Switch array struct to class
[satune.git] / src / AST / rewriter.cc
index 5e240514930bd2904f2c2e362ee3923d821637eb..386eba038e995d4fc25f4122ad50affcc602ef6a 100644 (file)
@@ -42,12 +42,12 @@ void replaceBooleanWithBoolean(CSolver * This, Boolean *oldb, Boolean *newb) {
                Boolean *parent = getVectorBoolean(&oldb->parents, i);
                BooleanLogic *logicop = (BooleanLogic *) parent;
 
-               uint parentsize = getSizeArrayBoolean(&logicop->inputs);
+               uint parentsize = logicop->inputs.getSize();
 
                for (uint j = 0; j < parentsize; j++) {
-                       Boolean *b = getArrayBoolean(&logicop->inputs, i);
+                       Boolean *b = logicop->inputs.get(i);
                        if (b == oldb) {
-                               setArrayBoolean(&logicop->inputs, i, newb);
+                               logicop->inputs.set(i, newb);
                                pushVectorBoolean(&newb->parents, parent);
                        }
                }
@@ -55,26 +55,26 @@ void replaceBooleanWithBoolean(CSolver * This, Boolean *oldb, Boolean *newb) {
 }
 
 void handleXORTrue(BooleanLogic *bexpr, Boolean *child) {
-       uint size = getSizeArrayBoolean(&bexpr->inputs);
-       Boolean *b = getArrayBoolean(&bexpr->inputs, 0);
+       uint size = bexpr->inputs.getSize();
+       Boolean *b = bexpr->inputs.get(0);
        uint childindex = (b == child) ? 0 : 1;
-       removeElementArrayBoolean(&bexpr->inputs, childindex);
+       bexpr->inputs.remove(childindex);
        bexpr->op = L_NOT;
 }
 
 void handleXORFalse(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
-       uint size = getSizeArrayBoolean(&bexpr->inputs);
-       Boolean *b = getArrayBoolean(&bexpr->inputs, 0);
+       uint size = bexpr->inputs.getSize();
+       Boolean *b = bexpr->inputs.get(0);
        uint otherindex = (b == child) ? 1 : 0;
-       replaceBooleanWithBoolean(This, (Boolean *)bexpr, getArrayBoolean(&bexpr->inputs, otherindex));
+       replaceBooleanWithBoolean(This, (Boolean *)bexpr, bexpr->inputs.get(otherindex));
 }
 
 void handleIMPLIESTrue(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
-       uint size = getSizeArrayBoolean(&bexpr->inputs);
-       Boolean *b = getArrayBoolean(&bexpr->inputs, 0);
+       uint size = bexpr->inputs.getSize();
+       Boolean *b = bexpr->inputs.get(0);
        if (b == child) {
                //Replace with other term
-               replaceBooleanWithBoolean(This, (Boolean *)bexpr, getArrayBoolean(&bexpr->inputs, 1));
+               replaceBooleanWithBoolean(This, (Boolean *)bexpr, bexpr->inputs.get(1));
        } else {
                //Statement is true...
                replaceBooleanWithTrue(This, (Boolean *)bexpr);
@@ -82,20 +82,20 @@ void handleIMPLIESTrue(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
 }
 
 void handleIMPLIESFalse(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
-       uint size = getSizeArrayBoolean(&bexpr->inputs);
-       Boolean *b = getArrayBoolean(&bexpr->inputs, 0);
+       uint size = bexpr->inputs.getSize();
+       Boolean *b = bexpr->inputs.get(0);
        if (b == child) {
                //Statement is true...
                replaceBooleanWithTrue(This, (Boolean *)bexpr);
        } else {
                //Make into negation of first term
-               removeElementArrayBoolean(&bexpr->inputs, 1);
+               bexpr->inputs.get(1);
                bexpr->op = L_NOT;
        }
 }
 
 void handleANDTrue(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
-       uint size = getSizeArrayBoolean(&bexpr->inputs);
+       uint size = bexpr->inputs.getSize();
 
        if (size == 1) {
                replaceBooleanWithTrue(This, (Boolean *)bexpr);
@@ -103,33 +103,33 @@ void handleANDTrue(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
        }
 
        for (uint i = 0; i < size; i++) {
-               Boolean *b = getArrayBoolean(&bexpr->inputs, i);
+               Boolean *b = bexpr->inputs.get(i);
                if (b == child) {
-                       removeElementArrayBoolean(&bexpr->inputs, i);
+                       bexpr->inputs.remove(i);
                }
        }
 
        if (size == 2) {
-               replaceBooleanWithBoolean(This, (Boolean *)bexpr, getArrayBoolean(&bexpr->inputs, 0));
+               replaceBooleanWithBoolean(This, (Boolean *)bexpr, bexpr->inputs.get(0));
        }
 }
 
 void handleORFalse(CSolver * This, BooleanLogic *bexpr, Boolean *child) {
-       uint size = getSizeArrayBoolean(&bexpr->inputs);
+       uint size = bexpr->inputs.getSize();
 
        if (size == 1) {
                replaceBooleanWithFalse(This, (Boolean *) bexpr);
        }
 
        for (uint i = 0; i < size; i++) {
-               Boolean *b = getArrayBoolean(&bexpr->inputs, i);
+               Boolean *b = bexpr->inputs.get(i);
                if (b == child) {
-                       removeElementArrayBoolean(&bexpr->inputs, i);
+                       bexpr->inputs.remove(i);
                }
        }
 
        if (size == 2) {
-               replaceBooleanWithBoolean(This, (Boolean *)bexpr, getArrayBoolean(&bexpr->inputs, 0));
+               replaceBooleanWithBoolean(This, (Boolean *)bexpr, bexpr->inputs.get(0));
        }
 }