Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
IntVar.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (https://www.swig.org).
5// Version 4.2.1
6//
7// Do not make changes to this file unless you know what you are doing - modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
12
13using System;
14using System.Runtime.InteropServices;
15using System.Collections;
16using System.Collections.Generic;
17
18public partial class IntVar : IntExpr {
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
21 internal IntVar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(operations_research_constraint_solverPINVOKE.IntVar_SWIGUpcast(cPtr), cMemoryOwn) {
22 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
23 }
24
25 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(IntVar obj) {
26 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
27 }
28
29 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(IntVar obj) {
30 if (obj != null) {
31 if (!obj.swigCMemOwn)
32 throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
33 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
34 obj.swigCMemOwn = false;
35 obj.Dispose();
36 return ptr;
37 } else {
38 return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
39 }
40 }
41
42 protected override void Dispose(bool disposing) {
43 lock(this) {
44 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
45 if (swigCMemOwn) {
46 swigCMemOwn = false;
48 }
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
50 }
51 base.Dispose(disposing);
52 }
53 }
54
55 // Keep reference to delegate to avoid GC to collect them early
56 private List<VoidToVoid> closureCallbacks;
57 private VoidToVoid StoreVoidToVoid(VoidToVoid closure) {
58 if (closureCallbacks == null)
59 closureCallbacks = new List<VoidToVoid>();
60 closureCallbacks.Add(closure);
61 return closure;
62 }
63
64 public override bool IsVar() {
65 bool ret = operations_research_constraint_solverPINVOKE.IntVar_IsVar(swigCPtr);
66 return ret;
67 }
68
69 public override IntVar Var() {
70 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_Var(swigCPtr);
71 IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
72 return ret;
73 }
74
75 public virtual long Value() {
77 return ret;
78 }
79
80 public virtual void RemoveValue(long v) {
87 }
88
89 public virtual void RemoveValues( long[] values) {
95 operations_research_constraint_solverPINVOKE.IntVar_SetValues(swigCPtr, values.Length, values );
96 }
97
98 public virtual void WhenBound(Demon d) {
101
102 public void WhenBound( VoidToVoid closure) {
105
106 public virtual void WhenDomain(Demon d) {
109
110 public void WhenDomain( VoidToVoid closure) {
113
114 public virtual ulong Size() {
116 return ret;
117 }
118
119 public virtual bool Contains(long v) {
121 return ret;
122 }
123
124 public virtual long OldMin() {
126 return ret;
127 }
128
129 public virtual long OldMax() {
131 return ret;
132 }
133
134 public virtual int VarType() {
136 return ret;
137 }
138
139 public override void Accept(ModelVisitor visitor) {
142
143 public virtual new IntVar IsEqual(long constant) {
144 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_IsEqual(swigCPtr, constant);
145 IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
146 return ret;
147 }
148
149 public virtual new IntVar IsDifferent(long constant) {
150 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_IsDifferent(swigCPtr, constant);
151 IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
152 return ret;
153 }
154
155 public virtual new IntVar IsGreaterOrEqual(long constant) {
156 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_IsGreaterOrEqual(swigCPtr, constant);
157 IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
158 return ret;
159 }
160
161 public virtual new IntVar IsLessOrEqual(long constant) {
162 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_IsLessOrEqual(swigCPtr, constant);
163 IntVar ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVar(cPtr, false);
164 return ret;
165 }
166
167 public int Index() {
169 return ret;
170 }
171
172 public IntVarIterator GetDomain() {
173 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_GetDomain(swigCPtr);
174 IntVarIterator ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVarIterator(cPtr, false);
175 return ret;
176 }
177
178 public IntVarIterator GetHoles() {
179 global::System.IntPtr cPtr = operations_research_constraint_solverPINVOKE.IntVar_GetHoles(swigCPtr);
180 IntVarIterator ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntVarIterator(cPtr, false);
181 return ret;
182 }
183
184}
185
186}
virtual bool Contains(long v)
Definition IntVar.cs:121
virtual new IntVar IsLessOrEqual(long constant)
Definition IntVar.cs:163
virtual void SetValues(long[] values)
Definition IntVar.cs:96
virtual void RemoveInterval(long l, long u)
Definition IntVar.cs:87
virtual new IntVar IsEqual(long constant)
Definition IntVar.cs:145
virtual new IntVar IsGreaterOrEqual(long constant)
Definition IntVar.cs:157
override void Accept(ModelVisitor visitor)
Definition IntVar.cs:141
virtual void RemoveValues(long[] values)
Definition IntVar.cs:91
virtual void WhenDomain(Demon d)
Definition IntVar.cs:108
virtual void WhenBound(Demon d)
Definition IntVar.cs:100
virtual void RemoveValue(long v)
Definition IntVar.cs:82
virtual new IntVar IsDifferent(long constant)
Definition IntVar.cs:151
static void IntVar_RemoveValues(global::System.Runtime.InteropServices.HandleRef jarg1, int length2, long[] jarg2)
static void IntVar_WhenBound__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static long IntVar_OldMax(global::System.Runtime.InteropServices.HandleRef jarg1)
static ulong IntVar_Size(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr IntVar_Var(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr IntVar_IsEqual(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void IntVar_RemoveValue(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static int IntVar_VarType(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr IntVar_GetDomain(global::System.Runtime.InteropServices.HandleRef jarg1)
static void delete_IntVar(global::System.Runtime.InteropServices.HandleRef jarg1)
static int IntVar_Index(global::System.Runtime.InteropServices.HandleRef jarg1)
static long IntVar_Value(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr IntVar_GetHoles(global::System.Runtime.InteropServices.HandleRef jarg1)
static long IntVar_OldMin(global::System.Runtime.InteropServices.HandleRef jarg1)
static global::System.IntPtr IntVar_IsDifferent(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void IntVar_Accept(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void IntVar_WhenDomain__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, VoidToVoid jarg2)
static void IntVar_WhenBound__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, VoidToVoid jarg2)
static global::System.IntPtr IntVar_IsGreaterOrEqual(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static global::System.IntPtr IntVar_IsLessOrEqual(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
static void IntVar_SetValues(global::System.Runtime.InteropServices.HandleRef jarg1, int length2, long[] jarg2)
static void IntVar_WhenDomain__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void IntVar_RemoveInterval(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2, long jarg3)
static bool IntVar_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, long jarg2)
delegate void VoidToVoid()
Used to wrap Closure (std::function<void()>)