BoolVar.java
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 package org.gecode;
00010
00015 public class BoolVar extends IntVar {
00016 private long swigCPtr;
00017
00018 protected BoolVar(long cPtr, boolean cMemoryOwn) {
00019 super(GecodeJNI.SWIGBoolVarUpcast(cPtr), cMemoryOwn);
00020 swigCPtr = cPtr;
00021 }
00022
00023 protected static long getCPtr(BoolVar obj) {
00024 return (obj == null) ? 0 : obj.swigCPtr;
00025 }
00026
00027 protected void finalize() {
00028 delete();
00029 }
00030
00031 public void delete() {
00032 if(swigCPtr != 0 && swigCMemOwn) {
00033 swigCMemOwn = false;
00034 GecodeJNI.delete_BoolVar(swigCPtr);
00035 }
00036 swigCPtr = 0;
00037 super.delete();
00038 }
00039
00040 protected static long[] cArrayUnwrapBool(VarArray<? extends BoolVar> arrayWrapper) {
00041 long[] cArray = new long[arrayWrapper.size()];
00042 for (int i=0; i<arrayWrapper.size(); i++)
00043 cArray[i] = IntVar.getCPtr(arrayWrapper.get(i));
00044 return cArray;
00045 }
00046
00047 protected static VarArray<BoolVar> cArrayWrapBool(long[] cArray,
00048 boolean cMemoryOwn) {
00049 VarArray<BoolVar> arrayWrapper = new VarArray<BoolVar>(cArray.length);
00050 for (int i=0; i<cArray.length; i++)
00051 arrayWrapper.add(i, new BoolVar(cArray[i], cMemoryOwn));
00052 return arrayWrapper;
00053 }
00054 public synchronized BoolVar copy(JavaSpace newHome, boolean share) {
00057 return new BoolVar(GecodeJNI.IntVar_copy(swigCPtr, JavaSpace.getCPtr(newHome), share), true);
00058 }
00059
00060 public BoolVar(JavaSpace home) {
00063 this(GecodeJNI.new_BoolVar__SWIG_0(JavaSpace.getCPtr(home)), true);
00064 }
00065
00066 public BoolVar(JavaSpace home, boolean v) {
00069 this(GecodeJNI.new_BoolVar__SWIG_1(JavaSpace.getCPtr(home), v), true);
00070 }
00071
00072 public BoolVar(JavaSpace home, String n) {
00075 this(GecodeJNI.new_BoolVar__SWIG_2(JavaSpace.getCPtr(home), n), true);
00076 }
00077
00078 public BoolVar(JavaSpace home, String n, boolean v) {
00081 this(GecodeJNI.new_BoolVar__SWIG_3(JavaSpace.getCPtr(home), n, v), true);
00082 }
00083
00084 }