Java Reference

Java Reference

SolveWrapper.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.sat;
10 
11 public class SolveWrapper {
12  private transient long swigCPtr;
13  protected transient boolean swigCMemOwn;
14 
15  public SolveWrapper(long cPtr, boolean cMemoryOwn) {
16  swigCMemOwn = cMemoryOwn;
17  swigCPtr = cPtr;
18  }
19 
20  protected static long getCPtr(SolveWrapper obj) {
21  return (obj == null) ? 0 : obj.swigCPtr;
22  }
23 
24  @SuppressWarnings("deprecation")
25  protected void finalize() {
26  delete();
27  }
28 
29  public synchronized void delete() {
30  if (swigCPtr != 0) {
31  if (swigCMemOwn) {
32  swigCMemOwn = false;
33  mainJNI.delete_SolveWrapper(swigCPtr);
34  }
35  swigCPtr = 0;
36  }
37  }
38 
39  public void setParameters(com.google.ortools.sat.SatParameters parameters) {
40  mainJNI.SolveWrapper_setParameters(swigCPtr, this, parameters.toByteArray());
41  }
42 
43  public void addSolutionCallback(SolutionCallback callback) {
44  mainJNI.SolveWrapper_addSolutionCallback(swigCPtr, this, SolutionCallback.getCPtr(callback), callback);
45  }
46 
47  public void clearSolutionCallback(SolutionCallback callback) {
48  mainJNI.SolveWrapper_clearSolutionCallback(swigCPtr, this, SolutionCallback.getCPtr(callback), callback);
49  }
50 
51  public void addLogCallback(java.util.function.Consumer<String> log_callback) {
52  mainJNI.SolveWrapper_addLogCallback(swigCPtr, this, log_callback);
53  }
54 
56  byte[] buf = mainJNI.SolveWrapper_solve(swigCPtr, this, model_proto.toByteArray());
57  if (buf == null || buf.length == 0) {
58  return null;
59  }
60  try {
62  } catch (com.google.protobuf.InvalidProtocolBufferException e) {
63  throw new RuntimeException(
64  "Unable to parse com.google.ortools.sat.CpSolverResponse protocol message.");
65  }
66 }
67 
68  public void stopSearch() {
69  mainJNI.SolveWrapper_stopSearch(swigCPtr, this);
70  }
71 
72  public SolveWrapper() {
73  this(mainJNI.new_SolveWrapper(), true);
74  }
75 
76 }
void addLogCallback(java.util.function.Consumer< String > log_callback)
void clearSolutionCallback(SolutionCallback callback)
com.google.ortools.sat.CpSolverResponse solve(com.google.ortools.sat.CpModelProto model_proto)
void addSolutionCallback(SolutionCallback callback)
static com.google.ortools.sat.CpSolverResponse parseFrom(java.nio.ByteBuffer data)
SolveWrapper(long cPtr, boolean cMemoryOwn)
void setParameters(com.google.ortools.sat.SatParameters parameters)