Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
Decision.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 Decision : BaseObject {
19 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
21 internal Decision(global::System.IntPtr cPtr, bool cMemoryOwn) : base(operations_research_constraint_solverPINVOKE.Decision_SWIGUpcast(cPtr), cMemoryOwn) {
22 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
23 }
24
25 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Decision 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(Decision 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 public Decision() : this(operations_research_constraint_solverPINVOKE.new_Decision(), true) {
56 SwigDirectorConnect();
57 }
58
59 public virtual void ApplyWrapper(Solver s) {
61 }
62
63 public virtual void RefuteWrapper(Solver s) {
65 }
66
67 public override string ToString() {
68 string ret = (SwigDerivedClassHasMethod("ToString", swigMethodTypes0) ? operations_research_constraint_solverPINVOKE.Decision_ToStringSwigExplicitDecision(swigCPtr) : operations_research_constraint_solverPINVOKE.Decision_ToString(swigCPtr));
69 return ret;
70 }
71
72 public virtual void Accept(DecisionVisitor visitor) {
73 if (SwigDerivedClassHasMethod("Accept", swigMethodTypes3)) operations_research_constraint_solverPINVOKE.Decision_AcceptSwigExplicitDecision(swigCPtr, DecisionVisitor.getCPtr(visitor)); else operations_research_constraint_solverPINVOKE.Decision_Accept(swigCPtr, DecisionVisitor.getCPtr(visitor));
74 }
75
76 private void SwigDirectorConnect() {
77 if (SwigDerivedClassHasMethod("ToString", swigMethodTypes0))
78 swigDelegate0 = new SwigDelegateDecision_0(SwigDirectorMethodToString);
79 if (SwigDerivedClassHasMethod("ApplyWrapper", swigMethodTypes1))
80 swigDelegate1 = new SwigDelegateDecision_1(SwigDirectorMethodApplyWrapper);
81 if (SwigDerivedClassHasMethod("RefuteWrapper", swigMethodTypes2))
82 swigDelegate2 = new SwigDelegateDecision_2(SwigDirectorMethodRefuteWrapper);
83 if (SwigDerivedClassHasMethod("Accept", swigMethodTypes3))
84 swigDelegate3 = new SwigDelegateDecision_3(SwigDirectorMethodAccept);
85 operations_research_constraint_solverPINVOKE.Decision_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
86 }
87
88 private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {
89 global::System.Reflection.MethodInfo[] methodInfos = this.GetType().GetMethods(
90 global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance);
91 foreach (global::System.Reflection.MethodInfo methodInfo in methodInfos) {
92 if (methodInfo.DeclaringType == null)
93 continue;
94
95 if (methodInfo.Name != methodName)
96 continue;
97
98 var parameters = methodInfo.GetParameters();
99 if (parameters.Length != methodTypes.Length)
100 continue;
101
102 bool parametersMatch = true;
103 for (var i = 0; i < parameters.Length; i++) {
104 if (parameters[i].ParameterType != methodTypes[i]) {
105 parametersMatch = false;
106 break;
107 }
108 }
109
110 if (!parametersMatch)
111 continue;
112
113 if (methodInfo.IsVirtual && (methodInfo.DeclaringType.IsSubclassOf(typeof(Decision))) &&
114 methodInfo.DeclaringType != methodInfo.GetBaseDefinition().DeclaringType) {
115 return true;
116 }
117 }
118
119 return false;
120 }
121
122 private string SwigDirectorMethodToString() {
123 return ToString();
124 }
125
126 private void SwigDirectorMethodApplyWrapper(global::System.IntPtr s) {
127 ApplyWrapper((s == global::System.IntPtr.Zero) ? null : new Solver(s, false));
128 }
129
130 private void SwigDirectorMethodRefuteWrapper(global::System.IntPtr s) {
131 RefuteWrapper((s == global::System.IntPtr.Zero) ? null : new Solver(s, false));
132 }
133
134 private void SwigDirectorMethodAccept(global::System.IntPtr visitor) {
135 Accept((visitor == global::System.IntPtr.Zero) ? null : new DecisionVisitor(visitor, false));
136 }
137
138 public delegate string SwigDelegateDecision_0();
139 public delegate void SwigDelegateDecision_1(global::System.IntPtr s);
140 public delegate void SwigDelegateDecision_2(global::System.IntPtr s);
141 public delegate void SwigDelegateDecision_3(global::System.IntPtr visitor);
143 private SwigDelegateDecision_0 swigDelegate0;
144 private SwigDelegateDecision_1 swigDelegate1;
145 private SwigDelegateDecision_2 swigDelegate2;
146 private SwigDelegateDecision_3 swigDelegate3;
147
148 private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { };
149 private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(Solver) };
150 private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] { typeof(Solver) };
151 private static global::System.Type[] swigMethodTypes3 = new global::System.Type[] { typeof(DecisionVisitor) };
152}
153
154}
virtual void RefuteWrapper(Solver s)
Definition Decision.cs:65
virtual void ApplyWrapper(Solver s)
Definition Decision.cs:61
delegate void SwigDelegateDecision_1(global::System.IntPtr s)
delegate void SwigDelegateDecision_2(global::System.IntPtr s)
virtual void Accept(DecisionVisitor visitor)
Definition Decision.cs:74
delegate void SwigDelegateDecision_3(global::System.IntPtr visitor)
static void Decision_RefuteWrapper(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void Decision_ApplyWrapper(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void Decision_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, Decision.SwigDelegateDecision_0 delegate0, Decision.SwigDelegateDecision_1 delegate1, Decision.SwigDelegateDecision_2 delegate2, Decision.SwigDelegateDecision_3 delegate3)
static void Decision_Accept(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static string Decision_ToString(global::System.Runtime.InteropServices.HandleRef jarg1)
static void delete_Decision(global::System.Runtime.InteropServices.HandleRef jarg1)
static string Decision_ToStringSwigExplicitDecision(global::System.Runtime.InteropServices.HandleRef jarg1)
static void Decision_AcceptSwigExplicitDecision(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)