4 #include "constraint.h"
9 Element::Element(ASTNodeType _type) :
15 ElementSet::ElementSet(Set *s) :
20 ElementFunction::ElementFunction(Function *_function, Element **array, uint numArrays, Boolean *_overflowstatus) :
21 Element(ELEMFUNCRETURN),
23 inputs(array, numArrays),
24 overflowstatus(_overflowstatus),
25 functionencoding(this) {
26 for (uint i = 0; i < numArrays; i++)
27 array[i]->parents.push(this);
30 ElementConst::ElementConst(uint64_t _value, VarType _type, Set *_set) :
36 Set *getElementSet(Element *This) {
39 return ((ElementSet *)This)->set;
41 return ((ElementConst *)This)->set;
42 case ELEMFUNCRETURN: {
43 Function *func = ((ElementFunction *)This)->function;
46 return ((FunctionTable *)func)->table->range;
48 return ((FunctionOperator *)func)->range;
60 Element *ElementConst::clone(CSolver *solver, CloneMap *map) {
61 return solver->getElementConst(type, value);
64 Element *ElementSet::clone(CSolver *solver, CloneMap *map) {
65 Element *e = (Element *) map->get(this);
68 e = solver->getElementVar(set->clone(solver, map));
73 Element *ElementFunction::clone(CSolver *solver, CloneMap *map) {
74 Element *array[inputs.getSize()];
75 for (uint i = 0; i < inputs.getSize(); i++) {
76 array[i] = inputs.get(i)->clone(solver, map);
78 Element *e = solver->applyFunction(function->clone(solver, map), array, inputs.getSize(), overflowstatus->clone(solver, map));