Bug fixes for Java API + Exactly one constraints + Adding support for getting the...
[satune.git] / src / ccsolver.cc
index 05f66a3efb3337d6b8e5621c54ae47e4bac377f2..fa2e3426211b50e34f786e506e865307d3aa2d04 100644 (file)
@@ -54,11 +54,11 @@ void *getBooleanVar(void *solver,unsigned int type) {
        return CCSOLVER(solver)->getBooleanVar((VarType) type).getRaw();
 }
 
-void *getBooleanTrue(void *solver){
+void *getBooleanTrue(void *solver) {
        return CCSOLVER(solver)->getBooleanTrue().getRaw();
 }
 
-void *getBooleanFalse(void *solver){
+void *getBooleanFalse(void *solver) {
        return CCSOLVER(solver)->getBooleanFalse().getRaw();
 }
 
@@ -102,8 +102,20 @@ void *applyPredicate(void *solver,void *predicate, void **inputs, unsigned int n
        return CCSOLVER(solver)->applyPredicate((Predicate *)predicate, (Element **)inputs, (uint) numInputs).getRaw();
 }
 
-void *applyLogicalOperation(void *solver,unsigned int op, void *array, unsigned int asize) {
-       return CCSOLVER(solver)->applyLogicalOperation((LogicOp) op, (BooleanEdge *)array, (uint) asize).getRaw();
+void *applyLogicalOperation(void *solver,unsigned int op, void **array, unsigned int asize) {
+       BooleanEdge constr [asize];
+       for(uint i=0; i< asize; i++){
+               constr[i] = BooleanEdge((Boolean*)array[i]);
+       }
+       return CCSOLVER(solver)->applyLogicalOperation((LogicOp) op, constr, (uint) asize).getRaw();
+}
+
+void *applyExactlyOneConstraint(void *solver, void **array, unsigned int asize) {
+       BooleanEdge constr [asize];
+       for(uint i=0; i< asize; i++){
+               constr[i] = BooleanEdge((Boolean*)array[i]);
+       }
+       return CCSOLVER(solver)->applyExactlyOneConstraint( constr, (uint) asize).getRaw();
 }
 
 void *applyLogicalOperationTwo(void *solver,unsigned int op, void *arg1, void *arg2) {
@@ -160,7 +172,7 @@ void mustHaveValue(void *solver, void *element) {
        CCSOLVER(solver)->mustHaveValue( (Element *) element);
 }
 
-void setInterpreter(void *solver, unsigned int type){
+void setInterpreter(void *solver, unsigned int type) {
        CCSOLVER(solver)->setInterpreter((InterpreterType)type);
 }