Skip to content

Commit abd363d

Browse files
committed
Delegation+AbsFact up to PWMap [may need debugging]
2 parents 924d1e8 + 184fd91 commit abd363d

6 files changed

Lines changed: 14 additions & 15 deletions

File tree

sbg/af_map.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
/** @file af_map.hpp
22
3+
<<<<<<< HEAD
34
@brief <b>Map Factory</b>
5+
=======
6+
@brief <b>Map Abstract Factory</b>
7+
8+
It was proposed to try implementing SBG maps with "atomic" domains (i.e.,
9+
the domain is a described with a mdi). For this reason, it was decided that
10+
delegation should be used to provide different implementations, and also an
11+
abstract factory was needed to create objects with the desired implementation.
12+
>>>>>>> 184fd91f83c3ebe8685db86370ecf5dee8410781
413
514
<hr>
615

sbg/interval.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
1818
******************************************************************************/
1919

20-
#include <iostream>
2120
#include "sbg/interval.hpp"
2221

2322
namespace SBG {

sbg/map.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
******************************************************************************/
1919

2020
#include "sbg/map.hpp"
21-
#include <iostream>
2221

2322
namespace SBG {
2423

@@ -96,7 +95,7 @@ Map::Map(const SetAF &fact, Set s, Exp exp)
9695

9796
bool Map::operator==(const Map &other) const
9897
{
99-
if (dom_ == other.dom_) {
98+
if (dom_ == other.dom()) {
10099
if (dom_.cardinal() == 1) {
101100
return image() == other.image();
102101
}
@@ -205,6 +204,9 @@ Set Map::preImage(const Set &subcodom) const
205204

206205
Map Map::composition(const Map &other) const
207206
{
207+
if (exp_.isId())
208+
return Map(fact_, std::move(dom_), exp_);
209+
208210
Set res_dom = dom_.intersection(other.image());
209211
res_dom = other.preImage(res_dom);
210212
Exp res_exp = exp_.composition(other.exp_);

sbg/map.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct Map {
9797
* example, arity([1:1:10]x[1:1:10]) = 2.
9898
*/
9999
std::size_t arity() const;
100+
100101
bool isEmpty() const;
101102

102103
/**

sbg/pw_map.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
1818
******************************************************************************/
1919

20-
#include <iostream>
2120
#include "sbg/pw_map.hpp"
2221

2322
namespace SBG {

sbg/set.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
1818
******************************************************************************/
1919

20-
#include <iostream>
2120
#include "sbg/set.hpp"
2221

2322
namespace SBG {
@@ -827,16 +826,6 @@ bool Set::operator==(const Set &other) const
827826

828827
bool Set::operator!=(const Set &other) const { return !(*this == other); }
829828

830-
/*
831-
Set &Set::operator=(const Set &other)
832-
{
833-
if (this != &other)
834-
delegate_ = other.delegate_ ? other.delegate_->clone() : nullptr;
835-
836-
return *this;
837-
}
838-
*/
839-
840829
Set &Set::operator=(Set &&other)
841830
{
842831
if (this != &other)

0 commit comments

Comments
 (0)