OR-Tools  8.2
util_java_wrap.cc
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  * This file is not intended to be easily readable and contains a number of
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG
8  * interface file instead.
9  * ----------------------------------------------------------------------------- */
10 
11 
12 #ifndef SWIGJAVA
13 #define SWIGJAVA
14 #endif
15 
16 
17 
18 #ifdef __cplusplus
19 /* SwigValueWrapper is described in swig.swg */
20 template<typename T> class SwigValueWrapper {
21  struct SwigMovePointer {
22  T *ptr;
23  SwigMovePointer(T *p) : ptr(p) { }
24  ~SwigMovePointer() { delete ptr; }
25  SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
26  } pointer;
27  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
28  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
29 public:
30  SwigValueWrapper() : pointer(0) { }
31  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
32  operator T&() const { return *pointer.ptr; }
33  T *operator&() { return pointer.ptr; }
34 };
35 
36 template <typename T> T SwigValueInit() {
37  return T();
38 }
39 #endif
40 
41 /* -----------------------------------------------------------------------------
42  * This section contains generic SWIG labels for method/variable
43  * declarations/attributes, and other compiler dependent labels.
44  * ----------------------------------------------------------------------------- */
45 
46 /* template workaround for compilers that cannot correctly implement the C++ standard */
47 #ifndef SWIGTEMPLATEDISAMBIGUATOR
48 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
49 # define SWIGTEMPLATEDISAMBIGUATOR template
50 # elif defined(__HP_aCC)
51 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
52 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
53 # define SWIGTEMPLATEDISAMBIGUATOR template
54 # else
55 # define SWIGTEMPLATEDISAMBIGUATOR
56 # endif
57 #endif
58 
59 /* inline attribute */
60 #ifndef SWIGINLINE
61 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
62 # define SWIGINLINE inline
63 # else
64 # define SWIGINLINE
65 # endif
66 #endif
67 
68 /* attribute recognised by some compilers to avoid 'unused' warnings */
69 #ifndef SWIGUNUSED
70 # if defined(__GNUC__)
71 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
72 # define SWIGUNUSED __attribute__ ((__unused__))
73 # else
74 # define SWIGUNUSED
75 # endif
76 # elif defined(__ICC)
77 # define SWIGUNUSED __attribute__ ((__unused__))
78 # else
79 # define SWIGUNUSED
80 # endif
81 #endif
82 
83 #ifndef SWIG_MSC_UNSUPPRESS_4505
84 # if defined(_MSC_VER)
85 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
86 # endif
87 #endif
88 
89 #ifndef SWIGUNUSEDPARM
90 # ifdef __cplusplus
91 # define SWIGUNUSEDPARM(p)
92 # else
93 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
94 # endif
95 #endif
96 
97 /* internal SWIG method */
98 #ifndef SWIGINTERN
99 # define SWIGINTERN static SWIGUNUSED
100 #endif
101 
102 /* internal inline SWIG method */
103 #ifndef SWIGINTERNINLINE
104 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
105 #endif
106 
107 /* exporting methods */
108 #if defined(__GNUC__)
109 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
110 # ifndef GCC_HASCLASSVISIBILITY
111 # define GCC_HASCLASSVISIBILITY
112 # endif
113 # endif
114 #endif
115 
116 #ifndef SWIGEXPORT
117 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
118 # if defined(STATIC_LINKED)
119 # define SWIGEXPORT
120 # else
121 # define SWIGEXPORT __declspec(dllexport)
122 # endif
123 # else
124 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
125 # define SWIGEXPORT __attribute__ ((visibility("default")))
126 # else
127 # define SWIGEXPORT
128 # endif
129 # endif
130 #endif
131 
132 /* calling conventions for Windows */
133 #ifndef SWIGSTDCALL
134 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
135 # define SWIGSTDCALL __stdcall
136 # else
137 # define SWIGSTDCALL
138 # endif
139 #endif
140 
141 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
142 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
143 # define _CRT_SECURE_NO_DEPRECATE
144 #endif
145 
146 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
147 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
148 # define _SCL_SECURE_NO_DEPRECATE
149 #endif
150 
151 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
152 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
153 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
154 #endif
155 
156 /* Intel's compiler complains if a variable which was never initialised is
157  * cast to void, which is a common idiom which we use to indicate that we
158  * are aware a variable isn't used. So we just silence that warning.
159  * See: https://github.com/swig/swig/issues/192 for more discussion.
160  */
161 #ifdef __INTEL_COMPILER
162 # pragma warning disable 592
163 #endif
164 
165 
166 /* Fix for jlong on some versions of gcc on Windows */
167 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
168  typedef long long __int64;
169 #endif
170 
171 /* Fix for jlong on 64-bit x86 Solaris */
172 #if defined(__x86_64)
173 # ifdef _LP64
174 # undef _LP64
175 # endif
176 #endif
177 
178 #include <jni.h>
179 #include <stdlib.h>
180 #include <string.h>
181 
182 
183 /* Support for throwing Java exceptions */
184 typedef enum {
196 
197 typedef struct {
199  const char *java_exception;
201 
202 
203 static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
204  jclass excep;
205  static const SWIG_JavaExceptions_t java_exceptions[] = {
206  { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
207  { SWIG_JavaIOException, "java/io/IOException" },
208  { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
209  { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
210  { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
211  { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
212  { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
213  { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
214  { SWIG_JavaUnknownError, "java/lang/UnknownError" },
215  { SWIG_JavaIllegalStateException, "java/lang/IllegalStateException" },
216  { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" }
217  };
218  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
219 
220  while (except_ptr->code != code && except_ptr->code)
221  except_ptr++;
222 
223  jenv->ExceptionClear();
224  excep = jenv->FindClass(except_ptr->java_exception);
225  if (excep)
226  jenv->ThrowNew(excep, msg);
227 }
228 
229 
230 /* Contract support */
231 
232 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
233 
234 
235 #include <cstdint>
236 #include <string>
237 #include <vector>
238 
239 #include "ortools/base/basictypes.h"
240 
241 
242 #include <stdint.h> // Use the C99 official header
243 
244 
245 #define SWIGWORDSIZE64
246 #ifndef LONG_MAX
247 #include <limits.h>
248 #endif
249 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
250 # error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
251 #endif
252 
253 
254 #include <string>
255 
256 
257 #include <vector>
259 
260 
261 #include <vector>
264 
265 
266 #ifdef __cplusplus
267 extern "C" {
268 #endif
269 
271  jlong jresult = 0 ;
272  operations_research::Domain *result = 0 ;
273 
274  (void)jenv;
275  (void)jcls;
277  *(operations_research::Domain **)&jresult = result;
278  return jresult;
279 }
280 
281 
282 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) {
283  jlong jresult = 0 ;
284  int64 arg1 ;
285  operations_research::Domain *result = 0 ;
286 
287  (void)jenv;
288  (void)jcls;
289  arg1 = (int64)jarg1;
291  *(operations_research::Domain **)&jresult = result;
292  return jresult;
293 }
294 
295 
296 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
297  jlong jresult = 0 ;
298  int64 arg1 ;
299  int64 arg2 ;
300  operations_research::Domain *result = 0 ;
301 
302  (void)jenv;
303  (void)jcls;
304  arg1 = (int64)jarg1;
305  arg2 = (int64)jarg2;
306  result = (operations_research::Domain *)new operations_research::Domain(arg1,arg2);
307  *(operations_research::Domain **)&jresult = result;
308  return jresult;
309 }
310 
311 
312 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1allValues(JNIEnv *jenv, jclass jcls) {
313  jlong jresult = 0 ;
315 
316  (void)jenv;
317  (void)jcls;
320  return jresult;
321 }
322 
323 
324 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromValues(JNIEnv *jenv, jclass jcls, jlongArray jarg1) {
325  jlong jresult = 0 ;
326  std::vector< int64 > arg1 ;
328 
329  (void)jenv;
330  (void)jcls;
331 
332  if(jarg1) {
333  const int size = jenv->GetArrayLength(jarg1);
334  (&arg1)->clear();
335  (&arg1)->reserve(size);
336  jlong *values = jenv->GetLongArrayElements((jlongArray)jarg1, NULL);
337  for (int i = 0; i < size; ++i) {
338  (&arg1)->emplace_back(values[i]);
339  }
340  jenv->ReleaseLongArrayElements((jlongArray)jarg1, values, JNI_ABORT);
341  }
342  else {
344  return 0;
345  }
346 
349  return jresult;
350 }
351 
352 
353 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromIntervals(JNIEnv *jenv, jclass jcls, jobjectArray jarg1) {
354  jlong jresult = 0 ;
355  std::vector< std::vector< int64 > > *arg1 = 0 ;
356  std::vector< std::vector< int64 > > result1 ;
358 
359  (void)jenv;
360  (void)jcls;
361 
362  if(jarg1) {
363  const int size = jenv->GetArrayLength(jarg1);
364  result1.clear();
365  result1.resize(size);
366  for (int index1 = 0; index1 < size; ++index1) {
367  jlongArray inner_array =
368  (jlongArray)jenv->GetObjectArrayElement(jarg1, index1);
369  const int inner_size = jenv->GetArrayLength(inner_array);
370  result1[index1].reserve(inner_size);
371  jlong * const values =
372  jenv->GetLongArrayElements((jlongArray)inner_array, NULL);
373  for (int index2 = 0; index2 < inner_size; ++index2) {
374  result1[index1].emplace_back(values[index2]);
375  }
376  jenv->ReleaseLongArrayElements((jlongArray)inner_array, values, JNI_ABORT);
377  jenv->DeleteLocalRef(inner_array);
378  }
379  arg1 = &result1;
380  }
381  else {
383  return 0;
384  }
385 
386  result = operations_research::Domain::FromVectorIntervals((std::vector< std::vector< long > > const &)*arg1);
388  return jresult;
389 }
390 
391 
392 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromFlatIntervals(JNIEnv *jenv, jclass jcls, jlongArray jarg1) {
393  jlong jresult = 0 ;
394  std::vector< int64 > *arg1 = 0 ;
396 
397  (void)jenv;
398  (void)jcls;
399 
400  if(jarg1) {
401  arg1 = new std::vector<int64>;
402  const int size = jenv->GetArrayLength(jarg1);
403  arg1->reserve(size);
404  jlong *values = jenv->GetLongArrayElements((jlongArray)jarg1, NULL);
405  for (int i = 0; i < size; ++i) {
406  arg1->emplace_back(values[i]);
407  }
408  jenv->ReleaseLongArrayElements((jlongArray)jarg1, values, JNI_ABORT);
409  }
410  else {
412  return 0;
413  }
414 
415  result = operations_research::Domain::FromFlatIntervals((std::vector< long > const &)*arg1);
417  {
418  delete arg1;
419  }
420  return jresult;
421 }
422 
423 
424 SWIGEXPORT jlongArray JNICALL Java_com_google_ortools_util_mainJNI_Domain_1flattenedIntervals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
425  jlongArray jresult = 0 ;
427  std::vector< int64 > result;
428 
429  (void)jenv;
430  (void)jcls;
431  (void)jarg1_;
432  arg1 = *(operations_research::Domain **)&jarg1;
433  result = ((operations_research::Domain const *)arg1)->FlattenedIntervals();
434 
435  const std::vector<int64>& vec = result;
436  jresult = jenv->NewLongArray(vec.size());
437  jenv->SetLongArrayRegion(jresult, 0, vec.size(), reinterpret_cast<const jlong*>(vec.data()));
438 
439  return jresult;
440 }
441 
442 
443 SWIGEXPORT jboolean JNICALL Java_com_google_ortools_util_mainJNI_Domain_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
444  jboolean jresult = 0 ;
446  bool result;
447 
448  (void)jenv;
449  (void)jcls;
450  (void)jarg1_;
451  arg1 = *(operations_research::Domain **)&jarg1;
452  result = (bool)((operations_research::Domain const *)arg1)->IsEmpty();
453  jresult = (jboolean)result;
454  return jresult;
455 }
456 
457 
458 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
459  jlong jresult = 0 ;
461  int64 result;
462 
463  (void)jenv;
464  (void)jcls;
465  (void)jarg1_;
466  arg1 = *(operations_research::Domain **)&jarg1;
467  result = (int64)((operations_research::Domain const *)arg1)->Size();
468  jresult = (jlong)result;
469  return jresult;
470 }
471 
472 
473 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1min(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
474  jlong jresult = 0 ;
476  int64 result;
477 
478  (void)jenv;
479  (void)jcls;
480  (void)jarg1_;
481  arg1 = *(operations_research::Domain **)&jarg1;
482  result = (int64)((operations_research::Domain const *)arg1)->Min();
483  jresult = (jlong)result;
484  return jresult;
485 }
486 
487 
488 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1max(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
489  jlong jresult = 0 ;
491  int64 result;
492 
493  (void)jenv;
494  (void)jcls;
495  (void)jarg1_;
496  arg1 = *(operations_research::Domain **)&jarg1;
497  result = (int64)((operations_research::Domain const *)arg1)->Max();
498  jresult = (jlong)result;
499  return jresult;
500 }
501 
502 
503 SWIGEXPORT jboolean JNICALL Java_com_google_ortools_util_mainJNI_Domain_1contains(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
504  jboolean jresult = 0 ;
506  int64 arg2 ;
507  bool result;
508 
509  (void)jenv;
510  (void)jcls;
511  (void)jarg1_;
512  arg1 = *(operations_research::Domain **)&jarg1;
513  arg2 = (int64)jarg2;
514  result = (bool)((operations_research::Domain const *)arg1)->Contains(arg2);
515  jresult = (jboolean)result;
516  return jresult;
517 }
518 
519 
520 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1complement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
521  jlong jresult = 0 ;
524 
525  (void)jenv;
526  (void)jcls;
527  (void)jarg1_;
528  arg1 = *(operations_research::Domain **)&jarg1;
529  result = ((operations_research::Domain const *)arg1)->Complement();
531  return jresult;
532 }
533 
534 
535 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1negation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
536  jlong jresult = 0 ;
539 
540  (void)jenv;
541  (void)jcls;
542  (void)jarg1_;
543  arg1 = *(operations_research::Domain **)&jarg1;
544  result = ((operations_research::Domain const *)arg1)->Negation();
546  return jresult;
547 }
548 
549 
550 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1intersectionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
551  jlong jresult = 0 ;
553  operations_research::Domain *arg2 = 0 ;
555 
556  (void)jenv;
557  (void)jcls;
558  (void)jarg1_;
559  (void)jarg2_;
560  arg1 = *(operations_research::Domain **)&jarg1;
561  arg2 = *(operations_research::Domain **)&jarg2;
562  if (!arg2) {
563  SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "operations_research::Domain const & reference is null");
564  return 0;
565  }
566  result = ((operations_research::Domain const *)arg1)->IntersectionWith((operations_research::Domain const &)*arg2);
568  return jresult;
569 }
570 
571 
572 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1unionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
573  jlong jresult = 0 ;
575  operations_research::Domain *arg2 = 0 ;
577 
578  (void)jenv;
579  (void)jcls;
580  (void)jarg1_;
581  (void)jarg2_;
582  arg1 = *(operations_research::Domain **)&jarg1;
583  arg2 = *(operations_research::Domain **)&jarg2;
584  if (!arg2) {
585  SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "operations_research::Domain const & reference is null");
586  return 0;
587  }
588  result = ((operations_research::Domain const *)arg1)->UnionWith((operations_research::Domain const &)*arg2);
590  return jresult;
591 }
592 
593 
594 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1additionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
595  jlong jresult = 0 ;
597  operations_research::Domain *arg2 = 0 ;
599 
600  (void)jenv;
601  (void)jcls;
602  (void)jarg1_;
603  (void)jarg2_;
604  arg1 = *(operations_research::Domain **)&jarg1;
605  arg2 = *(operations_research::Domain **)&jarg2;
606  if (!arg2) {
607  SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "operations_research::Domain const & reference is null");
608  return 0;
609  }
610  result = ((operations_research::Domain const *)arg1)->AdditionWith((operations_research::Domain const &)*arg2);
612  return jresult;
613 }
614 
615 
616 SWIGEXPORT jstring JNICALL Java_com_google_ortools_util_mainJNI_Domain_1toString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
617  jstring jresult = 0 ;
619  std::string result;
620 
621  (void)jenv;
622  (void)jcls;
623  (void)jarg1_;
624  arg1 = *(operations_research::Domain **)&jarg1;
625  result = ((operations_research::Domain const *)arg1)->ToString();
626  jresult = jenv->NewStringUTF((&result)->c_str());
627  return jresult;
628 }
629 
630 
631 SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_delete_1Domain(JNIEnv *jenv, jclass jcls, jlong jarg1) {
633 
634  (void)jenv;
635  (void)jcls;
636  arg1 = *(operations_research::Domain **)&jarg1;
637  delete arg1;
638 }
639 
640 
642  jlong jresult = 0 ;
644 
645  (void)jenv;
646  (void)jcls;
648  *(operations_research::SortedDisjointIntervalList **)&jresult = result;
649  return jresult;
650 }
651 
652 
653 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlongArray jarg1, jlongArray jarg2) {
654  jlong jresult = 0 ;
655  std::vector< int64 > *arg1 = 0 ;
656  std::vector< int64 > *arg2 = 0 ;
658 
659  (void)jenv;
660  (void)jcls;
661 
662  if(jarg1) {
663  arg1 = new std::vector<int64>;
664  const int size = jenv->GetArrayLength(jarg1);
665  arg1->reserve(size);
666  jlong *values = jenv->GetLongArrayElements((jlongArray)jarg1, NULL);
667  for (int i = 0; i < size; ++i) {
668  arg1->emplace_back(values[i]);
669  }
670  jenv->ReleaseLongArrayElements((jlongArray)jarg1, values, JNI_ABORT);
671  }
672  else {
674  return 0;
675  }
676 
677 
678  if(jarg2) {
679  arg2 = new std::vector<int64>;
680  const int size = jenv->GetArrayLength(jarg2);
681  arg2->reserve(size);
682  jlong *values = jenv->GetLongArrayElements((jlongArray)jarg2, NULL);
683  for (int i = 0; i < size; ++i) {
684  arg2->emplace_back(values[i]);
685  }
686  jenv->ReleaseLongArrayElements((jlongArray)jarg2, values, JNI_ABORT);
687  }
688  else {
690  return 0;
691  }
692 
693  result = (operations_research::SortedDisjointIntervalList *)new operations_research::SortedDisjointIntervalList((std::vector< int64 > const &)*arg1,(std::vector< int64 > const &)*arg2);
694  *(operations_research::SortedDisjointIntervalList **)&jresult = result;
695  {
696  delete arg1;
697  }
698  {
699  delete arg2;
700  }
701  return jresult;
702 }
703 
704 
705 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jintArray jarg1, jintArray jarg2) {
706  jlong jresult = 0 ;
707  std::vector< int > *arg1 = 0 ;
708  std::vector< int > *arg2 = 0 ;
710 
711  (void)jenv;
712  (void)jcls;
713 
714  if(jarg1) {
715  arg1 = new std::vector<int>;
716  const int size = jenv->GetArrayLength(jarg1);
717  arg1->reserve(size);
718  jint *values = jenv->GetIntArrayElements((jintArray)jarg1, NULL);
719  for (int i = 0; i < size; ++i) {
720  arg1->emplace_back(values[i]);
721  }
722  jenv->ReleaseIntArrayElements((jintArray)jarg1, values, JNI_ABORT);
723  }
724  else {
726  return 0;
727  }
728 
729 
730  if(jarg2) {
731  arg2 = new std::vector<int>;
732  const int size = jenv->GetArrayLength(jarg2);
733  arg2->reserve(size);
734  jint *values = jenv->GetIntArrayElements((jintArray)jarg2, NULL);
735  for (int i = 0; i < size; ++i) {
736  arg2->emplace_back(values[i]);
737  }
738  jenv->ReleaseIntArrayElements((jintArray)jarg2, values, JNI_ABORT);
739  }
740  else {
742  return 0;
743  }
744 
745  result = (operations_research::SortedDisjointIntervalList *)new operations_research::SortedDisjointIntervalList((std::vector< int > const &)*arg1,(std::vector< int > const &)*arg2);
746  *(operations_research::SortedDisjointIntervalList **)&jresult = result;
747  {
748  delete arg1;
749  }
750  {
751  delete arg2;
752  }
753  return jresult;
754 }
755 
756 
757 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1buildComplementOnInterval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
758  jlong jresult = 0 ;
760  int64 arg2 ;
761  int64 arg3 ;
763 
764  (void)jenv;
765  (void)jcls;
766  (void)jarg1_;
768  arg2 = (int64)jarg2;
769  arg3 = (int64)jarg3;
770  result = (arg1)->BuildComplementOnInterval(arg2,arg3);
772  return jresult;
773 }
774 
775 
776 SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertInterval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
777  jlong jresult = 0 ;
779  int64 arg2 ;
780  int64 arg3 ;
781  SwigValueWrapper< std::set< operations_research::ClosedInterval,operations_research::SortedDisjointIntervalList::IntervalComparator >::iterator > result;
782 
783  (void)jenv;
784  (void)jcls;
785  (void)jarg1_;
787  arg2 = (int64)jarg2;
788  arg3 = (int64)jarg3;
789  result = (arg1)->InsertInterval(arg2,arg3);
791  return jresult;
792 }
793 
794 
795 SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertIntervals_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlongArray jarg2, jlongArray jarg3) {
797  std::vector< int64 > *arg2 = 0 ;
798  std::vector< int64 > *arg3 = 0 ;
799 
800  (void)jenv;
801  (void)jcls;
802  (void)jarg1_;
804 
805  if(jarg2) {
806  arg2 = new std::vector<int64>;
807  const int size = jenv->GetArrayLength(jarg2);
808  arg2->reserve(size);
809  jlong *values = jenv->GetLongArrayElements((jlongArray)jarg2, NULL);
810  for (int i = 0; i < size; ++i) {
811  arg2->emplace_back(values[i]);
812  }
813  jenv->ReleaseLongArrayElements((jlongArray)jarg2, values, JNI_ABORT);
814  }
815  else {
817  return ;
818  }
819 
820 
821  if(jarg3) {
822  arg3 = new std::vector<int64>;
823  const int size = jenv->GetArrayLength(jarg3);
824  arg3->reserve(size);
825  jlong *values = jenv->GetLongArrayElements((jlongArray)jarg3, NULL);
826  for (int i = 0; i < size; ++i) {
827  arg3->emplace_back(values[i]);
828  }
829  jenv->ReleaseLongArrayElements((jlongArray)jarg3, values, JNI_ABORT);
830  }
831  else {
833  return ;
834  }
835 
836  (arg1)->InsertIntervals((std::vector< int64 > const &)*arg2,(std::vector< int64 > const &)*arg3);
837  {
838  delete arg2;
839  }
840  {
841  delete arg3;
842  }
843 }
844 
845 
846 SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertIntervals_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jintArray jarg2, jintArray jarg3) {
848  std::vector< int > *arg2 = 0 ;
849  std::vector< int > *arg3 = 0 ;
850 
851  (void)jenv;
852  (void)jcls;
853  (void)jarg1_;
855 
856  if(jarg2) {
857  arg2 = new std::vector<int>;
858  const int size = jenv->GetArrayLength(jarg2);
859  arg2->reserve(size);
860  jint *values = jenv->GetIntArrayElements((jintArray)jarg2, NULL);
861  for (int i = 0; i < size; ++i) {
862  arg2->emplace_back(values[i]);
863  }
864  jenv->ReleaseIntArrayElements((jintArray)jarg2, values, JNI_ABORT);
865  }
866  else {
868  return ;
869  }
870 
871 
872  if(jarg3) {
873  arg3 = new std::vector<int>;
874  const int size = jenv->GetArrayLength(jarg3);
875  arg3->reserve(size);
876  jint *values = jenv->GetIntArrayElements((jintArray)jarg3, NULL);
877  for (int i = 0; i < size; ++i) {
878  arg3->emplace_back(values[i]);
879  }
880  jenv->ReleaseIntArrayElements((jintArray)jarg3, values, JNI_ABORT);
881  }
882  else {
884  return ;
885  }
886 
887  (arg1)->InsertIntervals((std::vector< int > const &)*arg2,(std::vector< int > const &)*arg3);
888  {
889  delete arg2;
890  }
891  {
892  delete arg3;
893  }
894 }
895 
896 
897 SWIGEXPORT jint JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1numIntervals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
898  jint jresult = 0 ;
900  int result;
901 
902  (void)jenv;
903  (void)jcls;
904  (void)jarg1_;
906  result = (int)((operations_research::SortedDisjointIntervalList const *)arg1)->NumIntervals();
907  jresult = (jint)result;
908  return jresult;
909 }
910 
911 
912 SWIGEXPORT jstring JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1toString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
913  jstring jresult = 0 ;
915  std::string result;
916 
917  (void)jenv;
918  (void)jcls;
919  (void)jarg1_;
922  jresult = jenv->NewStringUTF((&result)->c_str());
923  return jresult;
924 }
925 
926 
927 SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_delete_1SortedDisjointIntervalList(JNIEnv *jenv, jclass jcls, jlong jarg1) {
929 
930  (void)jenv;
931  (void)jcls;
933  delete arg1;
934 }
935 
936 
937 #ifdef __cplusplus
938 }
939 #endif
940 
We call domain any subset of Int64 = [kint64min, kint64max].
static Domain AllValues()
Returns the full domain Int64.
static Domain FromFlatIntervals(const std::vector< int64 > &flat_intervals)
This method is available in Python, Java and .NET.
std::string ToString() const
Returns a compact string of a vector of intervals like "[1,4][6][10,20]".
Domain Negation() const
Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.
Domain Complement() const
Returns the set Int64 ∖ D.
static Domain FromValues(std::vector< int64 > values)
Creates a domain from the union of an unsorted list of integer values.
static Domain FromVectorIntervals(const std::vector< std::vector< int64 > > &intervals)
This method is available in Python, Java and .NET.
Domain AdditionWith(const Domain &domain) const
Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.
Domain UnionWith(const Domain &domain) const
Returns the union of D and domain.
Domain IntersectionWith(const Domain &domain) const
Returns the intersection of D and domain.
std::vector< int64 > FlattenedIntervals() const
This method returns the flattened list of interval bounds of the domain.
This class represents a sorted list of disjoint, closed intervals.
int64_t int64
SWIG_JavaExceptionCodes code
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlongArray jarg1, jlongArray jarg2)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jintArray jarg1, jintArray jarg2)
SWIGEXPORT jlongArray JNICALL Java_com_google_ortools_util_mainJNI_Domain_1flattenedIntervals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertInterval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3)
SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_delete_1SortedDisjointIntervalList(JNIEnv *jenv, jclass jcls, jlong jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1negation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromValues(JNIEnv *jenv, jclass jcls, jlongArray jarg1)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_util_mainJNI_Domain_1toString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1unionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1min(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jint JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1numIntervals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromIntervals(JNIEnv *jenv, jclass jcls, jobjectArray jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromFlatIntervals(JNIEnv *jenv, jclass jcls, jlongArray jarg1)
SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_delete_1Domain(JNIEnv *jenv, jclass jcls, jlong jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1intersectionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1additionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_)
#define SWIGUNUSED
SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertIntervals_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlongArray jarg2, jlongArray jarg3)
SWIGEXPORT jboolean JNICALL Java_com_google_ortools_util_mainJNI_Domain_1contains(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2)
static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg)
SWIG_JavaExceptionCodes
@ SWIG_JavaIOException
@ SWIG_JavaArithmeticException
@ SWIG_JavaUnknownError
@ SWIG_JavaRuntimeException
@ SWIG_JavaNullPointerException
@ SWIG_JavaDirectorPureVirtual
@ SWIG_JavaOutOfMemoryError
@ SWIG_JavaIllegalStateException
@ SWIG_JavaIllegalArgumentException
@ SWIG_JavaIndexOutOfBoundsException
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_10(JNIEnv *jenv, jclass jcls)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1complement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_10(JNIEnv *jenv, jclass jcls)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1toString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1max(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1allValues(JNIEnv *jenv, jclass jcls)
SWIGEXPORT jboolean JNICALL Java_com_google_ortools_util_mainJNI_Domain_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertIntervals_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jintArray jarg2, jintArray jarg3)
#define SWIGEXPORT
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1buildComplementOnInterval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2)