Java Reference

Java Reference

MaxFlow.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.2
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
9package com.google.ortools.graph;
10
11public 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 @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_MaxFlow(swigCPtr);
34 }
35 swigCPtr = 0;
36 }
37 }
38
39 public MaxFlow() {
40 this(mainJNI.new_MaxFlow(), true);
41 }
42
43 public int addArcWithCapacity(int tail, int head, long capacity) {
44 return mainJNI.MaxFlow_addArcWithCapacity(swigCPtr, this, tail, head, capacity);
45 }
46
47 public int getNumNodes() {
48 return mainJNI.MaxFlow_getNumNodes(swigCPtr, this);
49 }
50
51 public int getNumArcs() {
52 return mainJNI.MaxFlow_getNumArcs(swigCPtr, this);
53 }
54
55 public int getTail(int arc) {
56 return mainJNI.MaxFlow_getTail(swigCPtr, this, arc);
57 }
58
59 public int getHead(int arc) {
60 return mainJNI.MaxFlow_getHead(swigCPtr, this, arc);
61 }
62
63 public long getCapacity(int arc) {
64 return mainJNI.MaxFlow_getCapacity(swigCPtr, this, arc);
65 }
66
67 public MaxFlow.Status solve(int source, int sink) {
68 return MaxFlow.Status.swigToEnum(mainJNI.MaxFlow_solve(swigCPtr, this, source, sink));
69 }
70
71 public long getOptimalFlow() {
72 return mainJNI.MaxFlow_getOptimalFlow(swigCPtr, this);
73 }
74
75 public long getFlow(int arc) {
76 return mainJNI.MaxFlow_getFlow(swigCPtr, this, arc);
77 }
78
79 public void setArcCapacity(int arc, long capacity) {
80 mainJNI.MaxFlow_setArcCapacity(swigCPtr, this, arc, capacity);
81 }
82
83 public enum Status {
88
89 public final int swigValue() {
90 return swigValue;
91 }
92
93 public static Status swigToEnum(int swigValue) {
94 Status[] swigValues = Status.class.getEnumConstants();
95 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
96 return swigValues[swigValue];
97 for (Status swigEnum : swigValues)
98 if (swigEnum.swigValue == swigValue)
99 return swigEnum;
100 throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
101 }
102
103 @SuppressWarnings("unused")
104 private Status() {
105 this.swigValue = SwigNext.next++;
106 }
107
108 @SuppressWarnings("unused")
109 private Status(int swigValue) {
110 this.swigValue = swigValue;
111 SwigNext.next = swigValue+1;
112 }
113
114 @SuppressWarnings("unused")
115 private Status(Status swigEnum) {
116 this.swigValue = swigEnum.swigValue;
117 SwigNext.next = this.swigValue+1;
118 }
119
120 private final int swigValue;
121
122 private static class SwigNext {
123 private static int next = 0;
124 }
125 }
126
127}
MaxFlow(long cPtr, boolean cMemoryOwn)
Definition: MaxFlow.java:15
synchronized void delete()
Definition: MaxFlow.java:29
int addArcWithCapacity(int tail, int head, long capacity)
Definition: MaxFlow.java:43
MaxFlow.Status solve(int source, int sink)
Definition: MaxFlow.java:67
void setArcCapacity(int arc, long capacity)
Definition: MaxFlow.java:79
static Status swigToEnum(int swigValue)
Definition: MaxFlow.java:93