MaxFlow.java
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 3.0.12
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.graph;
10 
11 public class MaxFlow {
12  private transient long swigCPtr;
13  protected transient boolean swigCMemOwn;
14 
15  protected MaxFlow(long cPtr, boolean cMemoryOwn) {
16  swigCMemOwn = cMemoryOwn;
17  swigCPtr = cPtr;
18  }
19 
20  protected static long getCPtr(MaxFlow obj) {
21  return (obj == null) ? 0 : obj.swigCPtr;
22  }
23 
24  protected void finalize() {
25  delete();
26  }
27 
28  public synchronized void delete() {
29  if (swigCPtr != 0) {
30  if (swigCMemOwn) {
31  swigCMemOwn = false;
32  mainJNI.delete_MaxFlow(swigCPtr);
33  }
34  swigCPtr = 0;
35  }
36  }
37 
38  public MaxFlow() {
39  this(mainJNI.new_MaxFlow(), true);
40  }
41 
42  public int addArcWithCapacity(int tail, int head, long capacity) {
43  return mainJNI.MaxFlow_addArcWithCapacity(swigCPtr, this, tail, head, capacity);
44  }
45 
46  public int getNumNodes() {
47  return mainJNI.MaxFlow_getNumNodes(swigCPtr, this);
48  }
49 
50  public int getNumArcs() {
51  return mainJNI.MaxFlow_getNumArcs(swigCPtr, this);
52  }
53 
54  public int getTail(int arc) {
55  return mainJNI.MaxFlow_getTail(swigCPtr, this, arc);
56  }
57 
58  public int getHead(int arc) {
59  return mainJNI.MaxFlow_getHead(swigCPtr, this, arc);
60  }
61 
62  public long getCapacity(int arc) {
63  return mainJNI.MaxFlow_getCapacity(swigCPtr, this, arc);
64  }
65 
66  public MaxFlow.Status solve(int source, int sink) {
67  return MaxFlow.Status.swigToEnum(mainJNI.MaxFlow_solve(swigCPtr, this, source, sink));
68  }
69 
70  public long getOptimalFlow() {
71  return mainJNI.MaxFlow_getOptimalFlow(swigCPtr, this);
72  }
73 
74  public long getFlow(int arc) {
75  return mainJNI.MaxFlow_getFlow(swigCPtr, this, arc);
76  }
77 
78  public void setArcCapacity(int arc, long capacity) {
79  mainJNI.MaxFlow_setArcCapacity(swigCPtr, this, arc, capacity);
80  }
81 
82  public enum Status {
87 
88  public final int swigValue() {
89  return swigValue;
90  }
91 
92  public static Status swigToEnum(int swigValue) {
93  Status[] swigValues = Status.class.getEnumConstants();
94  if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
95  return swigValues[swigValue];
96  for (Status swigEnum : swigValues)
97  if (swigEnum.swigValue == swigValue)
98  return swigEnum;
99  throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
100  }
101 
102  @SuppressWarnings("unused")
103  private Status() {
104  this.swigValue = SwigNext.next++;
105  }
106 
107  @SuppressWarnings("unused")
108  private Status(int swigValue) {
109  this.swigValue = swigValue;
110  SwigNext.next = swigValue+1;
111  }
112 
113  @SuppressWarnings("unused")
114  private Status(Status swigEnum) {
115  this.swigValue = swigEnum.swigValue;
116  SwigNext.next = this.swigValue+1;
117  }
118 
119  private final int swigValue;
120 
121  private static class SwigNext {
122  private static int next = 0;
123  }
124  }
125 
126 }
void setArcCapacity(int arc, long capacity)
Definition: MaxFlow.java:78
transient boolean swigCMemOwn
Definition: MaxFlow.java:13
int addArcWithCapacity(int tail, int head, long capacity)
Definition: MaxFlow.java:42
static long getCPtr(MaxFlow obj)
Definition: MaxFlow.java:20
MaxFlow.Status solve(int source, int sink)
Definition: MaxFlow.java:66
static Status swigToEnum(int swigValue)
Definition: MaxFlow.java:92
MaxFlow(long cPtr, boolean cMemoryOwn)
Definition: MaxFlow.java:15