4 #include "constraint.h"
8 Element::Element(ASTNodeType _type) : ASTNode(_type) {
9 initElementEncoding(&encoding, (Element *) this);
12 ElementSet::ElementSet(Set *s) : Element(ELEMSET), set(s) {
15 ElementFunction::ElementFunction(Function *_function, Element **array, uint numArrays, Boolean *_overflowstatus) : Element(ELEMFUNCRETURN), function(_function), inputs(array, numArrays), overflowstatus(_overflowstatus) {
16 for (uint i = 0; i < numArrays; i++)
17 GETELEMENTPARENTS(array[i])->push(this);
18 initFunctionEncoding(&functionencoding, this);
21 ElementConst::ElementConst(uint64_t _value, VarType _type) : Element(ELEMCONST), value(_value) {
22 uint64_t array[]={value};
23 set = new Set(_type, array, 1);
26 Set *getElementSet(Element *This) {
27 switch (GETELEMENTTYPE(This)) {
29 return ((ElementSet *)This)->set;
31 return ((ElementConst *)This)->set;
32 case ELEMFUNCRETURN: {
33 Function *func = ((ElementFunction *)This)->function;
34 switch (GETFUNCTIONTYPE(func)) {
36 return ((FunctionTable *)func)->table->range;
38 return ((FunctionOperator *)func)->range;
50 ElementFunction::~ElementFunction() {
51 deleteFunctionEncoding(&functionencoding);
54 ElementConst::~ElementConst() {
59 deleteElementEncoding(&encoding);