diff options
author | ajreynol <andrew.j.reynolds@gmail.com> | 2016-02-19 11:00:48 -0600 |
---|---|---|
committer | ajreynol <andrew.j.reynolds@gmail.com> | 2016-02-19 11:00:48 -0600 |
commit | 2150eb22aaff94f9d0d9f0ee0854ea44675fd854 (patch) | |
tree | 061ee4c79296a6625d7f42f0ccb2dd1f1bab4fe9 /src/expr | |
parent | f47f24528f5d19ac0affd572f3d34c090e97f9f9 (diff) |
Fixes and improvements for datatypes properties and splitting.
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/datatype.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/expr/datatype.cpp b/src/expr/datatype.cpp index 45a7447aa..b52ceb856 100644 --- a/src/expr/datatype.cpp +++ b/src/expr/datatype.cpp @@ -306,10 +306,11 @@ bool Datatype::isUFinite() const throw(IllegalArgumentException) { if(self.getAttribute(DatatypeUFiniteComputedAttr())) { return self.getAttribute(DatatypeUFiniteAttr()); } + //start by assuming it is not + self.setAttribute(DatatypeUFiniteComputedAttr(), true); + self.setAttribute(DatatypeUFiniteAttr(), false); for(const_iterator i = begin(), i_end = end(); i != i_end; ++i) { if(! (*i).isUFinite()) { - self.setAttribute(DatatypeUFiniteComputedAttr(), true); - self.setAttribute(DatatypeUFiniteAttr(), false); return false; } } @@ -838,7 +839,7 @@ bool DatatypeConstructor::isFinite() const throw(IllegalArgumentException) { return self.getAttribute(DatatypeFiniteAttr()); } for(const_iterator i = begin(), i_end = end(); i != i_end; ++i) { - if(! SelectorType((*i).getSelector().getType()).getRangeType().getCardinality().isFinite()) { + if(! (*i).getRangeType().getCardinality().isFinite()) { self.setAttribute(DatatypeFiniteComputedAttr(), true); self.setAttribute(DatatypeFiniteAttr(), false); return false; @@ -858,9 +859,18 @@ bool DatatypeConstructor::isUFinite() const throw(IllegalArgumentException) { if(self.getAttribute(DatatypeUFiniteComputedAttr())) { return self.getAttribute(DatatypeUFiniteAttr()); } + bool success = true; for(const_iterator i = begin(), i_end = end(); i != i_end; ++i) { - Type t = SelectorType((*i).getSelector().getType()).getRangeType(); - if(!t.isSort() && !t.getCardinality().isFinite()) { + Type t = (*i).getRangeType(); + if( t.isDatatype() ){ + const Datatype& dt = ((DatatypeType)t).getDatatype(); + if( !dt.isUFinite() ){ + success = false; + } + }else if(!t.isSort() && !t.getCardinality().isFinite()) { + success = false; + } + if(!success ){ self.setAttribute(DatatypeUFiniteComputedAttr(), true); self.setAttribute(DatatypeUFiniteAttr(), false); return false; |