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