Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
MaxFlow.java
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (https://www.swig.org).
3 * Version 4.2.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
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 protected static long swigRelease(MaxFlow obj) {
25 long ptr = 0;
26 if (obj != null) {
27 if (!obj.swigCMemOwn)
28 throw new RuntimeException("Cannot release ownership as memory is not owned");
29 ptr = obj.swigCPtr;
30 obj.swigCMemOwn = false;
31 obj.delete();
32 }
33 return ptr;
34 }
35
36 @SuppressWarnings({"deprecation", "removal"})
37 protected void finalize() {
38 delete();
39 }
40
41 public synchronized void delete() {
42 if (swigCPtr != 0) {
43 if (swigCMemOwn) {
44 swigCMemOwn = false;
45 mainJNI.delete_MaxFlow(swigCPtr);
46 }
47 swigCPtr = 0;
48 }
49 }
50
51 public MaxFlow() {
52 this(mainJNI.new_MaxFlow(), true);
53 }
54
55 public int addArcWithCapacity(int tail, int head, long capacity) {
56 return mainJNI.MaxFlow_addArcWithCapacity(swigCPtr, this, tail, head, capacity);
57 }
58
59 public int getNumNodes() {
60 return mainJNI.MaxFlow_getNumNodes(swigCPtr, this);
61 }
62
63 public int getNumArcs() {
64 return mainJNI.MaxFlow_getNumArcs(swigCPtr, this);
65 }
66
67 public int getTail(int arc) {
68 return mainJNI.MaxFlow_getTail(swigCPtr, this, arc);
69 }
70
71 public int getHead(int arc) {
72 return mainJNI.MaxFlow_getHead(swigCPtr, this, arc);
73 }
74
75 public long getCapacity(int arc) {
76 return mainJNI.MaxFlow_getCapacity(swigCPtr, this, arc);
77 }
78
79 public MaxFlow.Status solve(int source, int sink) {
80 return MaxFlow.Status.swigToEnum(mainJNI.MaxFlow_solve(swigCPtr, this, source, sink));
81 }
82
83 public long getOptimalFlow() {
84 return mainJNI.MaxFlow_getOptimalFlow(swigCPtr, this);
85 }
86
87 public long getFlow(int arc) {
88 return mainJNI.MaxFlow_getFlow(swigCPtr, this, arc);
89 }
90
91 public void setArcCapacity(int arc, long capacity) {
92 mainJNI.MaxFlow_setArcCapacity(swigCPtr, this, arc, capacity);
93 }
94
95 public enum Status {
100
101 public final int swigValue() {
102 return swigValue;
103 }
104
105 public static Status swigToEnum(int swigValue) {
106 Status[] swigValues = Status.class.getEnumConstants();
107 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
108 return swigValues[swigValue];
109 for (Status swigEnum : swigValues)
110 if (swigEnum.swigValue == swigValue)
111 return swigEnum;
112 throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
113 }
114
115 @SuppressWarnings("unused")
116 private Status() {
117 this.swigValue = SwigNext.next++;
118 }
119
120 @SuppressWarnings("unused")
121 private Status(int swigValue) {
122 this.swigValue = swigValue;
123 SwigNext.next = swigValue+1;
124 }
125
126 @SuppressWarnings("unused")
127 private Status(Status swigEnum) {
128 this.swigValue = swigEnum.swigValue;
129 SwigNext.next = this.swigValue+1;
130 }
131
132 private final int swigValue;
133
134 private static class SwigNext {
135 private static int next = 0;
136 }
137 }
138
139}
MaxFlow.Status solve(int source, int sink)
Definition MaxFlow.java:79
static long getCPtr(MaxFlow obj)
Definition MaxFlow.java:20
static long swigRelease(MaxFlow obj)
Definition MaxFlow.java:24
transient boolean swigCMemOwn
Definition MaxFlow.java:13
int addArcWithCapacity(int tail, int head, long capacity)
Definition MaxFlow.java:55
synchronized void delete()
Definition MaxFlow.java:41
MaxFlow(long cPtr, boolean cMemoryOwn)
Definition MaxFlow.java:15
void setArcCapacity(int arc, long capacity)
Definition MaxFlow.java:91
static Status swigToEnum(int swigValue)
Definition MaxFlow.java:105