IntSet.java
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 package org.gecode;
00010
00018 public class IntSet {
00019 private long swigCPtr;
00020 protected boolean swigCMemOwn;
00021
00022 protected IntSet(long cPtr, boolean cMemoryOwn) {
00023 swigCMemOwn = cMemoryOwn;
00024 swigCPtr = cPtr;
00025 }
00026
00027 protected static long getCPtr(IntSet 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_IntSet(swigCPtr);
00039 }
00040 swigCPtr = 0;
00041 }
00042
00043 public static int[] convertRangeVector(Range[] ranges) {
00044 int[] cArray = new int[ranges.length*2];
00045 for (int i=0; i<ranges.length; i++) {
00046 cArray[i*2] = ranges[i].min;
00047 cArray[i*2+1] = ranges[i].max;
00048 }
00049 return cArray;
00050 }
00051
00052
00053 public IntSet(int min, int max) {
00056 this(GecodeJNI.new_IntSet__SWIG_0(min, max), true);
00057 }
00058
00059 public IntSet(int[] r) {
00062 this(GecodeJNI.new_IntSet__SWIG_1(r), true);
00063 }
00064
00065 public IntSet(Range[] r) {
00068 this(GecodeJNI.new_IntSet__SWIG_2(IntSet.convertRangeVector(r)), true);
00069 }
00070
00071 }