PathOperator.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.0
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 
11 // Used to wrap start_empty_path_class see:
12 // https://docs.oracle.com/javase/8/docs/api/java/util/function/LongToIntFunction.html
13 import java.util.function.LongToIntFunction;
14 
19  private transient long swigCPtr;
20 
21  protected PathOperator(long cPtr, boolean cMemoryOwn) {
22  super(mainJNI.PathOperator_SWIGUpcast(cPtr), cMemoryOwn);
23  swigCPtr = cPtr;
24  }
25 
26  protected static long getCPtr(PathOperator obj) {
27  return (obj == null) ? 0 : obj.swigCPtr;
28  }
29 
30  @SuppressWarnings("deprecation")
31  protected void finalize() {
32  delete();
33  }
34 
35  public synchronized void delete() {
36  if (swigCPtr != 0) {
37  if (swigCMemOwn) {
38  swigCMemOwn = false;
39  mainJNI.delete_PathOperator(swigCPtr);
40  }
41  swigCPtr = 0;
42  }
43  super.delete();
44  }
45 
46  protected void swigDirectorDisconnect() {
47  swigCMemOwn = false;
48  delete();
49  }
50 
51  public void swigReleaseOwnership() {
52  swigCMemOwn = false;
53  mainJNI.PathOperator_change_ownership(this, swigCPtr, false);
54  }
55 
56  public void swigTakeOwnership() {
57  swigCMemOwn = true;
58  mainJNI.PathOperator_change_ownership(this, swigCPtr, true);
59  }
60 
64  public PathOperator(IntVar[] next_vars, IntVar[] path_vars, int number_of_base_nodes, boolean skip_locally_optimal_paths, LongToIntFunction start_empty_path_class) {
65  this(mainJNI.new_PathOperator(next_vars, path_vars, number_of_base_nodes, skip_locally_optimal_paths, start_empty_path_class), true);
66  mainJNI.PathOperator_director_connect(this, swigCPtr, true, true);
67  }
68 
69  public boolean neighbor() {
70  return mainJNI.PathOperator_neighbor(swigCPtr, this);
71  }
72 
73  public void reset() {
74  if (getClass() == PathOperator.class) mainJNI.PathOperator_reset(swigCPtr, this); else mainJNI.PathOperator_resetSwigExplicitPathOperator(swigCPtr, this);
75  }
76 
80  protected boolean oneNeighbor() {
81  return (getClass() == PathOperator.class) ? mainJNI.PathOperator_oneNeighbor(swigCPtr, this) : mainJNI.PathOperator_oneNeighborSwigExplicitPathOperator(swigCPtr, this);
82  }
83 
87  protected boolean restartAtPathStartOnSynchronize() {
88  return (getClass() == PathOperator.class) ? mainJNI.PathOperator_restartAtPathStartOnSynchronize(swigCPtr, this) : mainJNI.PathOperator_restartAtPathStartOnSynchronizeSwigExplicitPathOperator(swigCPtr, this);
89  }
90 
94  protected boolean onSamePathAsPreviousBase(long base_index) {
95  return (getClass() == PathOperator.class) ? mainJNI.PathOperator_onSamePathAsPreviousBase(swigCPtr, this, base_index) : mainJNI.PathOperator_onSamePathAsPreviousBaseSwigExplicitPathOperator(swigCPtr, this, base_index);
96  }
97 
101  protected long getBaseNodeRestartPosition(int base_index) {
102  return (getClass() == PathOperator.class) ? mainJNI.PathOperator_getBaseNodeRestartPosition(swigCPtr, this, base_index) : mainJNI.PathOperator_getBaseNodeRestartPositionSwigExplicitPathOperator(swigCPtr, this, base_index);
103  }
104 
108  protected void setNextBaseToIncrement(long base_index) {
109  if (getClass() == PathOperator.class) mainJNI.PathOperator_setNextBaseToIncrement(swigCPtr, this, base_index); else mainJNI.PathOperator_setNextBaseToIncrementSwigExplicitPathOperator(swigCPtr, this, base_index);
110  }
111 
115  protected boolean initPosition() {
116  return (getClass() == PathOperator.class) ? mainJNI.PathOperator_initPosition(swigCPtr, this) : mainJNI.PathOperator_initPositionSwigExplicitPathOperator(swigCPtr, this);
117  }
118 
119 }
boolean initPosition()
Returns true if operator needs to restart its initial position at each call to Start()
boolean onSamePathAsPreviousBase(long base_index)
Returns true if a base node has to be on the same path as the "previous" base node (base node of inde...
long getBaseNodeRestartPosition(int base_index)
Returns the index of the node to which the base node of index base_index must be set to when it reach...
void setNextBaseToIncrement(long base_index)
Set the next base to increment on next iteration.
PathOperator(IntVar[] next_vars, IntVar[] path_vars, int number_of_base_nodes, boolean skip_locally_optimal_paths, LongToIntFunction start_empty_path_class)
Builds an instance of PathOperator from next and path variables.
Base class of the local search operators dedicated to path modifications (a path is a set of nodes li...
PathOperator(long cPtr, boolean cMemoryOwn)
boolean oneNeighbor()
This method should not be overridden.
boolean restartAtPathStartOnSynchronize()
When the operator is being synchronized with a new solution (when Start() is called),...