Java Reference

Java Reference

gen/java/com/google/ortools/constraintsolver/IntVar.java
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.1
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.constraintsolver;
10 
14 public class IntVar extends IntExpr {
15  private transient long swigCPtr;
16 
17  protected IntVar(long cPtr, boolean cMemoryOwn) {
18  super(mainJNI.IntVar_SWIGUpcast(cPtr), cMemoryOwn);
19  swigCPtr = cPtr;
20  }
21 
22  protected static long getCPtr(IntVar obj) {
23  return (obj == null) ? 0 : obj.swigCPtr;
24  }
25 
26  @SuppressWarnings("deprecation")
27  protected void finalize() {
28  delete();
29  }
30 
31  public synchronized void delete() {
32  if (swigCPtr != 0) {
33  if (swigCMemOwn) {
34  swigCMemOwn = false;
35  mainJNI.delete_IntVar(swigCPtr);
36  }
37  swigCPtr = 0;
38  }
39  super.delete();
40  }
41 
42  public boolean isVar() {
43  return mainJNI.IntVar_isVar(swigCPtr, this);
44  }
45 
46  public IntVar var() {
47  long cPtr = mainJNI.IntVar_var(swigCPtr, this);
48  return (cPtr == 0) ? null : new IntVar(cPtr, false);
49  }
50 
54  public long value() {
55  return mainJNI.IntVar_value(swigCPtr, this);
56  }
57 
61  public void removeValue(long v) {
62  mainJNI.IntVar_removeValue(swigCPtr, this, v);
63  }
64 
68  public void removeInterval(long l, long u) {
69  mainJNI.IntVar_removeInterval(swigCPtr, this, l, u);
70  }
71 
75  public void removeValues(long[] values) {
76  mainJNI.IntVar_removeValues(swigCPtr, this, values);
77  }
78 
82  public void setValue(long[] values) {
83  mainJNI.IntVar_setValue(swigCPtr, this, values);
84  }
85 
89  public void whenBound(Demon d) {
90  mainJNI.IntVar_whenBound__SWIG_0(swigCPtr, this, Demon.getCPtr(d), d);
91  }
92 
96  public void whenBound(Runnable closure) {
97  mainJNI.IntVar_whenBound__SWIG_1(swigCPtr, this, closure);
98  }
99 
103  public void whenDomain(Demon d) {
104  mainJNI.IntVar_whenDomain__SWIG_0(swigCPtr, this, Demon.getCPtr(d), d);
105  }
106 
110  public void whenDomain(Runnable closure) {
111  mainJNI.IntVar_whenDomain__SWIG_1(swigCPtr, this, closure);
112  }
113 
117  public long size() {
118  return mainJNI.IntVar_size(swigCPtr, this);
119  }
120 
124  public boolean contains(long v) {
125  return mainJNI.IntVar_contains(swigCPtr, this, v);
126  }
127 
131  public IntVarIterator makeHoleIterator(boolean reversible) {
132  long cPtr = mainJNI.IntVar_makeHoleIterator(swigCPtr, this, reversible);
133  return (cPtr == 0) ? null : new IntVarIterator(cPtr, false);
134  }
135 
139  public IntVarIterator makeDomainIterator(boolean reversible) {
140  long cPtr = mainJNI.IntVar_makeDomainIterator(swigCPtr, this, reversible);
141  return (cPtr == 0) ? null : new IntVarIterator(cPtr, false);
142  }
143 
147  public long oldMin() {
148  return mainJNI.IntVar_oldMin(swigCPtr, this);
149  }
150 
154  public long oldMax() {
155  return mainJNI.IntVar_oldMax(swigCPtr, this);
156  }
157 
158  public int varType() {
159  return mainJNI.IntVar_varType(swigCPtr, this);
160  }
161 
165  public void accept(ModelVisitor visitor) {
166  mainJNI.IntVar_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
167  }
168 
172  public IntVar isEqual(long constant) {
173  long cPtr = mainJNI.IntVar_isEqual(swigCPtr, this, constant);
174  return (cPtr == 0) ? null : new IntVar(cPtr, false);
175  }
176 
177  public IntVar isDifferent(long constant) {
178  long cPtr = mainJNI.IntVar_isDifferent(swigCPtr, this, constant);
179  return (cPtr == 0) ? null : new IntVar(cPtr, false);
180  }
181 
182  public IntVar isGreaterOrEqual(long constant) {
183  long cPtr = mainJNI.IntVar_isGreaterOrEqual(swigCPtr, this, constant);
184  return (cPtr == 0) ? null : new IntVar(cPtr, false);
185  }
186 
187  public IntVar isLessOrEqual(long constant) {
188  long cPtr = mainJNI.IntVar_isLessOrEqual(swigCPtr, this, constant);
189  return (cPtr == 0) ? null : new IntVar(cPtr, false);
190  }
191 
195  public int index() {
196  return mainJNI.IntVar_index(swigCPtr, this);
197  }
198 
199 }
IntVarIterator makeHoleIterator(boolean reversible)
Creates a hole iterator.
long oldMax()
Returns the previous max.
Model visitor.
The class IntExpr is the base of all integer expressions in constraint programming.
Definition: IntExpr.java:14
void accept(ModelVisitor visitor)
Accepts the given visitor.
void removeValue(long v)
This method removes the value 'v' from the domain of the variable.
IntVar isEqual(long constant)
IsEqual.
The class IntVar is a subset of IntExpr.
IntVar isDifferent(long constant)
boolean contains(long v)
This method returns whether the value 'v' is in the domain of the variable.
void removeInterval(long l, long u)
This method removes the interval 'l' .
long size()
This method returns the number of values in the domain of the variable.
IntVarIterator makeDomainIterator(boolean reversible)
Creates a domain iterator.
void whenDomain(Runnable closure)
This method attaches a closure that will watch any domain modification of the domain of the variable.
void removeValues(long[] values)
This method remove the values from the domain of the variable.
IntVar var()
Creates a variable from the expression.
int varType()
The class Iterator has two direct subclasses.
A Demon is the base element of a propagation queue.
Definition: Demon.java:14
IntVar isGreaterOrEqual(long constant)
void whenBound(Runnable closure)
This method attaches a closure that will be awakened when the variable is bound.
IntVar(long cPtr, boolean cMemoryOwn)
int index()
Returns the index of the variable.
IntVar isLessOrEqual(long constant)
void whenBound(Demon d)
This method attaches a demon that will be awakened when the variable is bound.
void setValue(long[] values)
This method intersects the current domain with the values in the array.
long oldMin()
Returns the previous min.
long value()
This method returns the value of the variable.
void whenDomain(Demon d)
This method attaches a demon that will watch any domain modification of the domain of the variable.
boolean isVar()
Returns true if the expression is indeed a variable.