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.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 IntExpr extends PropagationBaseObject {
15  private transient long swigCPtr;
16 
17  protected IntExpr(long cPtr, boolean cMemoryOwn) {
18  super(mainJNI.IntExpr_SWIGUpcast(cPtr), cMemoryOwn);
19  swigCPtr = cPtr;
20  }
21 
22  protected static long getCPtr(IntExpr 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_IntExpr(swigCPtr);
36  }
37  swigCPtr = 0;
38  }
39  super.delete();
40  }
41 
42  public long min() {
43  return mainJNI.IntExpr_min(swigCPtr, this);
44  }
45 
46  public void setMin(long m) {
47  mainJNI.IntExpr_setMin(swigCPtr, this, m);
48  }
49 
50  public long max() {
51  return mainJNI.IntExpr_max(swigCPtr, this);
52  }
53 
54  public void setMax(long m) {
55  mainJNI.IntExpr_setMax(swigCPtr, this, m);
56  }
57 
61  public void range(int[] l, int[] u) {
62  mainJNI.IntExpr_range(swigCPtr, this, l, u);
63  }
64 
68  public void setRange(long l, long u) {
69  mainJNI.IntExpr_setRange(swigCPtr, this, l, u);
70  }
71 
75  public void setValue(long v) {
76  mainJNI.IntExpr_setValue(swigCPtr, this, v);
77  }
78 
82  public boolean bound() {
83  return mainJNI.IntExpr_bound(swigCPtr, this);
84  }
85 
89  public boolean isVar() {
90  return mainJNI.IntExpr_isVar(swigCPtr, this);
91  }
92 
96  public IntVar var() {
97  long cPtr = mainJNI.IntExpr_var(swigCPtr, this);
98  return (cPtr == 0) ? null : new IntVar(cPtr, false);
99  }
100 
104  public IntVar varWithName(String name) {
105  long cPtr = mainJNI.IntExpr_varWithName(swigCPtr, this, name);
106  return (cPtr == 0) ? null : new IntVar(cPtr, false);
107  }
108 
112  public void whenRange(Demon d) {
113  mainJNI.IntExpr_whenRange__SWIG_0(swigCPtr, this, Demon.getCPtr(d), d);
114  }
115 
119  public void whenRange(Runnable closure) {
120  mainJNI.IntExpr_whenRange__SWIG_1(swigCPtr, this, closure);
121  }
122 
126  public void accept(ModelVisitor visitor) {
127  mainJNI.IntExpr_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
128  }
129 
130 }
boolean bound()
Returns true if the min and the max of the expression are equal.
Definition: IntExpr.java:82
Model visitor.
The class IntExpr is the base of all integer expressions in constraint programming.
Definition: IntExpr.java:14
void whenRange(Runnable closure)
Attach a demon that will watch the min or the max of the expression.
Definition: IntExpr.java:119
IntExpr(long cPtr, boolean cMemoryOwn)
Definition: IntExpr.java:17
The class IntVar is a subset of IntExpr.
void accept(ModelVisitor visitor)
Accepts the given visitor.
Definition: IntExpr.java:126
long max()
Definition: IntExpr.java:50
void setMax(long m)
Definition: IntExpr.java:54
void setRange(long l, long u)
This method sets both the min and the max of the expression.
Definition: IntExpr.java:68
A Demon is the base element of a propagation queue.
Definition: Demon.java:14
void whenRange(Demon d)
Attach a demon that will watch the min or the max of the expression.
Definition: IntExpr.java:112
NOLINT The PropagationBaseObject is a subclass of BaseObject that is also friend to the Solver class.
long min()
Definition: IntExpr.java:42
String name()
Object naming.
void setMin(long m)
Definition: IntExpr.java:46
IntVar varWithName(String name)
Creates a variable from the expression and set the name of the resulting var.
Definition: IntExpr.java:104
void setValue(long v)
This method sets the value of the expression.
Definition: IntExpr.java:75
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:61
IntVar var()
Creates a variable from the expression.
Definition: IntExpr.java:96
boolean isVar()
Returns true if the expression is indeed a variable.
Definition: IntExpr.java:89