4 #include "constraint.h"
9 Element::Element(ASTNodeType _type) :
14 ElementSet::ElementSet(Set *s) :
19 ElementFunction::ElementFunction(Function *_function, Element **array, uint numArrays, BooleanEdge _overflowstatus) :
20 Element(ELEMFUNCRETURN),
22 inputs(array, numArrays),
23 overflowstatus(_overflowstatus),
24 functionencoding(this) {
27 ElementConst::ElementConst(uint64_t _value, VarType _type, Set *_set) :
33 Set *getElementSet(Element *This) {
36 return ((ElementSet *)This)->set;
38 return ((ElementConst *)This)->set;
39 case ELEMFUNCRETURN: {
40 Function *func = ((ElementFunction *)This)->function;
43 return ((FunctionTable *)func)->table->range;
45 return ((FunctionOperator *)func)->range;
57 Element *ElementConst::clone(CSolver *solver, CloneMap *map) {
58 return solver->getElementConst(type, value);
61 Element *ElementSet::clone(CSolver *solver, CloneMap *map) {
62 Element *e = (Element *) map->get(this);
65 e = solver->getElementVar(set->clone(solver, map));
70 Element *ElementFunction::clone(CSolver *solver, CloneMap *map) {
71 Element *array[inputs.getSize()];
72 for (uint i = 0; i < inputs.getSize(); i++) {
73 array[i] = inputs.get(i)->clone(solver, map);
75 Element *e = solver->applyFunction(function->clone(solver, map), array, inputs.getSize(), overflowstatus->clone(solver, map));
79 void ElementFunction::updateParents() {
80 for(uint i=0;i < inputs.getSize(); i++) inputs.get(i)->parents.push(this);