com.google.ortools.graph.MaxFlow Maven / Gradle / Ivy
The newest version!
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.google.ortools.graph;
public class MaxFlow {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected MaxFlow(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(MaxFlow obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
mainJNI.delete_MaxFlow(swigCPtr);
}
swigCPtr = 0;
}
}
public MaxFlow() {
this(mainJNI.new_MaxFlow(), true);
}
public int addArcWithCapacity(int tail, int head, long capacity) {
return mainJNI.MaxFlow_addArcWithCapacity(swigCPtr, this, tail, head, capacity);
}
public int getNumNodes() {
return mainJNI.MaxFlow_getNumNodes(swigCPtr, this);
}
public int getNumArcs() {
return mainJNI.MaxFlow_getNumArcs(swigCPtr, this);
}
public int getTail(int arc) {
return mainJNI.MaxFlow_getTail(swigCPtr, this, arc);
}
public int getHead(int arc) {
return mainJNI.MaxFlow_getHead(swigCPtr, this, arc);
}
public long getCapacity(int arc) {
return mainJNI.MaxFlow_getCapacity(swigCPtr, this, arc);
}
public MaxFlow.Status solve(int source, int sink) {
return MaxFlow.Status.swigToEnum(mainJNI.MaxFlow_solve(swigCPtr, this, source, sink));
}
public long getOptimalFlow() {
return mainJNI.MaxFlow_getOptimalFlow(swigCPtr, this);
}
public long getFlow(int arc) {
return mainJNI.MaxFlow_getFlow(swigCPtr, this, arc);
}
public void setArcCapacity(int arc, long capacity) {
mainJNI.MaxFlow_setArcCapacity(swigCPtr, this, arc, capacity);
}
public enum Status {
OPTIMAL,
POSSIBLE_OVERFLOW,
BAD_INPUT,
BAD_RESULT;
public final int swigValue() {
return swigValue;
}
public static Status swigToEnum(int swigValue) {
Status[] swigValues = Status.class.getEnumConstants();
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (Status swigEnum : swigValues)
if (swigEnum.swigValue == swigValue)
return swigEnum;
throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
}
@SuppressWarnings("unused")
private Status() {
this.swigValue = SwigNext.next++;
}
@SuppressWarnings("unused")
private Status(int swigValue) {
this.swigValue = swigValue;
SwigNext.next = swigValue+1;
}
@SuppressWarnings("unused")
private Status(Status swigEnum) {
this.swigValue = swigEnum.swigValue;
SwigNext.next = this.swigValue+1;
}
private final int swigValue;
private static class SwigNext {
private static int next = 0;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy