Java Reference

Java Reference

gen/java/com/google/ortools/constraintsolver/Constraint.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 Constraint extends PropagationBaseObject {
15  private transient long swigCPtr;
16 
17  protected Constraint(long cPtr, boolean cMemoryOwn) {
18  super(mainJNI.Constraint_SWIGUpcast(cPtr), cMemoryOwn);
19  swigCPtr = cPtr;
20  }
21 
22  protected static long getCPtr(Constraint 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_Constraint(swigCPtr);
36  }
37  swigCPtr = 0;
38  }
39  super.delete();
40  }
41 
45  public void post() {
46  mainJNI.Constraint_post(swigCPtr, this);
47  }
48 
52  public void initialPropagate() {
53  mainJNI.Constraint_initialPropagate(swigCPtr, this);
54  }
55 
56  public String toString() {
57  return mainJNI.Constraint_toString(swigCPtr, this);
58  }
59 
63  public void postAndPropagate() {
64  mainJNI.Constraint_postAndPropagate(swigCPtr, this);
65  }
66 
70  public void accept(ModelVisitor visitor) {
71  mainJNI.Constraint_accept(swigCPtr, this, ModelVisitor.getCPtr(visitor), visitor);
72  }
73 
77  public boolean isCastConstraint() {
78  return mainJNI.Constraint_isCastConstraint(swigCPtr, this);
79  }
80 
84  public IntVar var() {
85  long cPtr = mainJNI.Constraint_var(swigCPtr, this);
86  return (cPtr == 0) ? null : new IntVar(cPtr, false);
87  }
88 
89 }
A constraint is the main modeling object.
String toString()
void postAndPropagate()
Calls Post and then Propagate to initialize the constraints.
Model visitor.
void post()
This method is called when the constraint is processed by the solver.
IntVar var()
Creates a Boolean variable representing the status of the constraint (false = constraint is violated,...
The class IntVar is a subset of IntExpr.
void accept(ModelVisitor visitor)
Accepts the given visitor.
Constraint(long cPtr, boolean cMemoryOwn)
NOLINT The PropagationBaseObject is a subclass of BaseObject that is also friend to the Solver class.
void initialPropagate()
This method performs the initial propagation of the constraint.
boolean isCastConstraint()
Is the constraint created by a cast from expression to integer variable?