Java Reference

Java Reference

Decision.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 Decision extends BaseObject {
15  private transient long swigCPtr;
16 
17  protected Decision(long cPtr, boolean cMemoryOwn) {
18  super(mainJNI.Decision_SWIGUpcast(cPtr), cMemoryOwn);
19  swigCPtr = cPtr;
20  }
21 
22  protected static long getCPtr(Decision 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_Decision(swigCPtr);
36  }
37  swigCPtr = 0;
38  }
39  super.delete();
40  }
41 
42  protected void swigDirectorDisconnect() {
43  swigCMemOwn = false;
44  delete();
45  }
46 
47  public void swigReleaseOwnership() {
48  swigCMemOwn = false;
49  mainJNI.Decision_change_ownership(this, swigCPtr, false);
50  }
51 
52  public void swigTakeOwnership() {
53  swigCMemOwn = true;
54  mainJNI.Decision_change_ownership(this, swigCPtr, true);
55  }
56 
57  public Decision() {
58  this(mainJNI.new_Decision(), true);
59  mainJNI.Decision_director_connect(this, swigCPtr, true, true);
60  }
61 
65  public void apply(Solver s) {
66  mainJNI.Decision_apply(swigCPtr, this, Solver.getCPtr(s), s);
67  }
68 
72  public void refute(Solver s) {
73  mainJNI.Decision_refute(swigCPtr, this, Solver.getCPtr(s), s);
74  }
75 
76  public String toString() {
77  return (getClass() == Decision.class) ? mainJNI.Decision_toString(swigCPtr, this) : mainJNI.Decision_toStringSwigExplicitDecision(swigCPtr, this);
78  }
79 
83  public void accept(DecisionVisitor visitor) {
84  if (getClass() == Decision.class) mainJNI.Decision_accept(swigCPtr, this, DecisionVisitor.getCPtr(visitor), visitor); else mainJNI.Decision_acceptSwigExplicitDecision(swigCPtr, this, DecisionVisitor.getCPtr(visitor), visitor);
85  }
86 
87 }
A DecisionVisitor is used to inspect a decision.
void swigTakeOwnership()
Definition: Decision.java:52
String toString()
Definition: Decision.java:76
void swigDirectorDisconnect()
Definition: Decision.java:42
Decision(long cPtr, boolean cMemoryOwn)
Definition: Decision.java:17
A Decision represents a choice point in the search tree.
Definition: Decision.java:14
void swigReleaseOwnership()
Definition: Decision.java:47
A BaseObject is the root of all reversibly allocated objects.
Definition: BaseObject.java:14
void accept(DecisionVisitor visitor)
Accepts the given visitor.
Definition: Decision.java:83
void refute(Solver s)
Refute will be called after a backtrack.
Definition: Decision.java:72
Decision()
Definition: Decision.java:57
void apply(Solver s)
Apply will be called first when the decision is executed.
Definition: Decision.java:65
Solver Class A solver represents the main computation engine.
Definition: Solver.java:57