4 #include "constraint.h"
9 Element::Element(ASTNodeType _type) :
14 ElementSet::ElementSet(Set *s) :
19 ElementSet::ElementSet(ASTNodeType _type, Set *s) :
24 ElementFunction::ElementFunction(Function *_function, Element **array, uint numArrays, BooleanEdge _overflowstatus) :
25 Element(ELEMFUNCRETURN),
27 inputs(array, numArrays),
28 overflowstatus(_overflowstatus),
29 functionencoding(this) {
32 ElementConst::ElementConst(uint64_t _value, Set *_set) :
33 ElementSet(ELEMCONST, _set),
37 Element *ElementConst::clone(CSolver *solver, CloneMap *map) {
38 return solver->getElementConst(type, value);
41 Element *ElementSet::clone(CSolver *solver, CloneMap *map) {
42 Element *e = (Element *) map->get(this);
45 e = solver->getElementVar(set->clone(solver, map));
50 Element *ElementFunction::clone(CSolver *solver, CloneMap *map) {
51 Element *array[inputs.getSize()];
52 for (uint i = 0; i < inputs.getSize(); i++) {
53 array[i] = inputs.get(i)->clone(solver, map);
55 Element *e = solver->applyFunction(function->clone(solver, map), array, inputs.getSize(), overflowstatus->clone(solver, map));
59 void ElementFunction::updateParents() {
60 for(uint i=0;i < inputs.getSize(); i++) inputs.get(i)->parents.push(this);
63 Set * ElementFunction::getRange() {
64 return function->getRange();