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;
41 return func->getRange();
50 Element *ElementConst::clone(CSolver *solver, CloneMap *map) {
51 return solver->getElementConst(type, value);
54 Element *ElementSet::clone(CSolver *solver, CloneMap *map) {
55 Element *e = (Element *) map->get(this);
58 e = solver->getElementVar(set->clone(solver, map));
63 Element *ElementFunction::clone(CSolver *solver, CloneMap *map) {
64 Element *array[inputs.getSize()];
65 for (uint i = 0; i < inputs.getSize(); i++) {
66 array[i] = inputs.get(i)->clone(solver, map);
68 Element *e = solver->applyFunction(function->clone(solver, map), array, inputs.getSize(), overflowstatus->clone(solver, map));
72 void ElementFunction::updateParents() {
73 for(uint i=0;i < inputs.getSize(); i++) inputs.get(i)->parents.push(this);