9 package com.google.ortools.algorithms;
64 private transient long swigCPtr;
65 protected transient boolean swigCMemOwn;
68 swigCMemOwn = cMemoryOwn;
73 return (obj ==
null) ? 0 : obj.swigCPtr;
76 @SuppressWarnings(
"deprecation")
77 protected
void finalize() {
81 public synchronized void delete() {
85 mainJNI.delete_KnapsackSolver(swigCPtr);
92 this(mainJNI.new_KnapsackSolver__SWIG_0(solver_name),
true);
96 this(mainJNI.new_KnapsackSolver__SWIG_1(solver_type.swigValue(), solver_name),
true);
102 public void init(
long[] profits,
long[][] weights,
long[] capacities) {
103 mainJNI.KnapsackSolver_init(swigCPtr,
this, profits, weights, capacities);
110 return mainJNI.KnapsackSolver_solve(swigCPtr,
this);
117 return mainJNI.KnapsackSolver_bestSolutionContains(swigCPtr,
this, item_id);
124 return mainJNI.KnapsackSolver_isSolutionOptimal(swigCPtr,
this);
128 return mainJNI.KnapsackSolver_getName(swigCPtr,
this);
132 return mainJNI.KnapsackSolver_useReduction(swigCPtr,
this);
136 mainJNI.KnapsackSolver_setUseReduction(swigCPtr,
this, use_reduction);
146 mainJNI.KnapsackSolver_setTimeLimit(swigCPtr,
this, time_limit_seconds);
202 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
203 return swigValues[swigValue];
205 if (swigEnum.swigValue == swigValue)
207 throw new IllegalArgumentException(
"No enum " +
SolverType.class +
" with value " + swigValue);
210 @SuppressWarnings(
"unused")
212 this.swigValue = SwigNext.next++;
215 @SuppressWarnings(
"unused")
216 private SolverType(
int swigValue) {
217 this.swigValue = swigValue;
218 SwigNext.next = swigValue+1;
221 @SuppressWarnings(
"unused")
222 private SolverType(SolverType swigEnum) {
223 this.swigValue = swigEnum.swigValue;
224 SwigNext.next = this.swigValue+1;
227 private final int swigValue;
229 private static class SwigNext {
230 private static int next = 0;