Java Reference

Java Reference

IntExpr.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.2
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 
20 public class IntExpr extends PropagationBaseObject {
21  private transient long swigCPtr;
22 
23  protected IntExpr(long cPtr, boolean cMemoryOwn) {
24  super(mainJNI.IntExpr_SWIGUpcast(cPtr), cMemoryOwn);
25  swigCPtr = cPtr;
26  }
27 
28  protected static long getCPtr(IntExpr obj) {
29  return (obj == null) ? 0 : obj.swigCPtr;
30  }
31 
32  @SuppressWarnings("deprecation")
33  protected void finalize() {
34  delete();
35  }
36 
37  public synchronized void delete() {
38  if (swigCPtr != 0) {
39  if (swigCMemOwn) {
40  swigCMemOwn = false;
41  mainJNI.delete_IntExpr(swigCPtr);
42  }
43  swigCPtr = 0;
44  }
45  super.delete();
46  }
47 
48  public long min() {
49  return mainJNI.IntExpr_min(swigCPtr, this);
50  }
51 
52  public void setMin(long m) {
53  mainJNI.IntExpr_setMin(swigCPtr, this, m);
54  }
55 
56  public long max() {
57  return mainJNI.IntExpr_max(swigCPtr, this);
58  }
59 
60  public void setMax(long m) {
61  mainJNI.IntExpr_setMax(swigCPtr, this, m);
62  }
63 
68  public void range(int[] l, int[] u) {
69  mainJNI.IntExpr_range(swigCPtr, this, l, u);
70  }
71 
75  public void setRange(long l, long u) {
76  mainJNI.IntExpr_setRange(swigCPtr, this, l, u);
77  }
78 
82  public void setValue(long v) {
83  mainJNI.IntExpr_setValue(swigCPtr, this, v);
84  }
85 
89  public boolean bound() {
90  return mainJNI.IntExpr_bound(swigCPtr, this);
91  }
92 
96  public boolean isVar() {
97  return mainJNI.IntExpr_isVar(swigCPtr, this);
98  }
99 
103  public IntVar var() {
104  long cPtr = mainJNI.IntExpr_var(swigCPtr, this);
105  return (cPtr == 0) ? null : new IntVar(cPtr, false);
106  }
107 
114  public IntVar varWithName(String name) {
115  long cPtr = mainJNI.IntExpr_varWithName(swigCPtr, this, name);
116  return (cPtr == 0) ? null : new IntVar(cPtr, false);
117  }
118 
122  public void whenRange(Demon d) {
123  mainJNI.IntExpr_whenRange__SWIG_0(swigCPtr, this, Demon.getCPtr(d), d);
124  }
125 
129  public void whenRange(Runnable closure) {
130  mainJNI.IntExpr_whenRange__SWIG_1(swigCPtr, this, closure);
131  }
132 
136  public void accept(ModelVisitor visitor) {
137  mainJNI.IntExpr_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
138  }
139 
140 }
boolean bound()
Returns true if the min and the max of the expression are equal.
Definition: IntExpr.java:89
Model visitor.
The class IntExpr is the base of all integer expressions in constraint programming.
Definition: IntExpr.java:20
void whenRange(Runnable closure)
Attach a demon that will watch the min or the max of the expression.
Definition: IntExpr.java:129
IntExpr(long cPtr, boolean cMemoryOwn)
Definition: IntExpr.java:23
The class IntVar is a subset of IntExpr.
void accept(ModelVisitor visitor)
Accepts the given visitor.
Definition: IntExpr.java:136
long max()
Definition: IntExpr.java:56
void setMax(long m)
Definition: IntExpr.java:60
void setRange(long l, long u)
This method sets both the min and the max of the expression.
Definition: IntExpr.java:75
A Demon is the base element of a propagation queue.
Definition: Demon.java:22
void whenRange(Demon d)
Attach a demon that will watch the min or the max of the expression.
Definition: IntExpr.java:122
NOLINT The PropagationBaseObject is a subclass of BaseObject that is also friend to the Solver clas...
long min()
Definition: IntExpr.java:48
String name()
Object naming.
void setMin(long m)
Definition: IntExpr.java:52
IntVar varWithName(String name)
Creates a variable from the expression and set the name of the resulting var.
Definition: IntExpr.java:114
void setValue(long v)
This method sets the value of the expression.
Definition: IntExpr.java:82
void range(int[] l, int[] u)
By default calls Min() and Max(), but can be redefined when Min and Max code can be factorized.
Definition: IntExpr.java:68
IntVar var()
Creates a variable from the expression.
Definition: IntExpr.java:103
boolean isVar()
Returns true if the expression is indeed a variable.
Definition: IntExpr.java:96