4 #include "constraint.h"
9 Element::Element(ASTNodeType _type) :
14 ElementSet::ElementSet(Set *s) :
19 ElementFunction::ElementFunction(Function *_function, Element **array, uint numArrays, Boolean *_overflowstatus) :
20 Element(ELEMFUNCRETURN),
22 inputs(array, numArrays),
23 overflowstatus(_overflowstatus),
24 functionencoding(this) {
25 for (uint i = 0; i < numArrays; i++)
26 GETELEMENTPARENTS(array[i])->push(this);
29 ElementConst::ElementConst(uint64_t _value, VarType _type, Set * _set) :
35 Set *getElementSet(Element *This) {
36 switch (GETELEMENTTYPE(This)) {
38 return ((ElementSet *)This)->set;
40 return ((ElementConst *)This)->set;
41 case ELEMFUNCRETURN: {
42 Function *func = ((ElementFunction *)This)->function;
43 switch (GETFUNCTIONTYPE(func)) {
45 return ((FunctionTable *)func)->table->range;
47 return ((FunctionOperator *)func)->range;
59 Element * ElementConst::clone(CSolver *solver, CloneMap * map) {
60 return solver->getElementConst(type, value);
63 Element * ElementSet::clone(CSolver *solver, CloneMap * map) {
64 Element * e = map->element.get(this);
67 e = solver->getElementVar(set->clone(solver, map));
68 map->element.put(e, e);
72 Element * ElementFunction::clone(CSolver *solver, CloneMap * map) {
73 Element * array[inputs.getSize()];
74 for(uint i=0; i<inputs.getSize(); i++) {
75 array[i]=inputs.get(i)->clone(solver, map);
77 Element * e = solver->applyFunction(function->clone(solver, map), array, inputs.getSize(), overflowstatus->clone(solver, map));