JavaSpace.java
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 package org.gecode;
00010
00018 public class JavaSpace {
00019 private long swigCPtr;
00020 protected boolean swigCMemOwn;
00021
00022 protected JavaSpace(long cPtr, boolean cMemoryOwn) {
00023 swigCMemOwn = cMemoryOwn;
00024 swigCPtr = cPtr;
00025 }
00026
00027 protected static long getCPtr(JavaSpace obj) {
00028 return (obj == null) ? 0 : obj.swigCPtr;
00029 }
00030
00031 protected void finalize() {
00032 delete();
00033 }
00034
00035 public void delete() {
00036 if(swigCPtr != 0 && swigCMemOwn) {
00037 swigCMemOwn = false;
00038 GecodeJNI.delete_JavaSpace(swigCPtr);
00039 }
00040 swigCPtr = 0;
00041 }
00042
00043 protected void swigDirectorDisconnect() {
00044 swigCMemOwn = false;
00045 delete();
00046 }
00047
00048 public void swigReleaseOwnership() {
00049 swigCMemOwn = false;
00050 GecodeJNI.JavaSpace_change_ownership(this, swigCPtr, false);
00051 }
00052
00053 public void swigTakeOwnership() {
00054 swigCMemOwn = true;
00055 GecodeJNI.JavaSpace_change_ownership(this, swigCPtr, true);
00056 }
00057
00058 public JavaSpace() {
00061 this(GecodeJNI.new_JavaSpace__SWIG_0(), true);
00062 GecodeJNI.JavaSpace_director_connect(this, swigCPtr, swigCMemOwn, true);
00063 }
00064
00065 public JavaSpace(boolean share, JavaSpace s) {
00075 this(GecodeJNI.new_JavaSpace__SWIG_1(share, JavaSpace.getCPtr(s)), true);
00076 GecodeJNI.JavaSpace_director_connect(this, swigCPtr, swigCMemOwn, true);
00077 }
00078
00079 public JavaSpace copy_internal(boolean share) {
00085 return GecodeJNI.JavaSpace_copy_internal(swigCPtr, share);
00086 }
00087
00088 public void constrain_internal(JavaSpace homeSpace) {
00091 GecodeJNI.JavaSpace_constrain_internal(swigCPtr, homeSpace);
00092 }
00093
00094 public boolean failed() {
00102 return GecodeJNI.JavaSpace_failed(swigCPtr);
00103 }
00104
00105 public JavaSpace cloneSpace() {
00120 return GecodeJNI.JavaSpace_cloneSpace(swigCPtr);
00121 }
00122
00123 public void commit(BranchingDesc bd, long alt) {
00132 GecodeJNI.JavaSpace_commit(swigCPtr, BranchingDesc.getCPtr(bd), alt);
00133 }
00134
00135 public SpaceStatus status(long[] OUTPUT) {
00147 return SpaceStatus.swigToEnum(GecodeJNI.JavaSpace_status__SWIG_0(swigCPtr, OUTPUT));
00148 }
00149
00150 public SpaceStatus status() {
00161 return SpaceStatus.swigToEnum(GecodeJNI.JavaSpace_status__SWIG_1(swigCPtr));
00162 }
00163
00164 public BranchingDesc description() {
00179 long cPtr = GecodeJNI.JavaSpace_description(swigCPtr);
00180 return (cPtr == 0) ? null : new BranchingDesc(cPtr, false);
00181 }
00182
00183 }