OR-Tools  9.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 */
20template<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);
29public:
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
36template <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 */
184typedef enum {
196
197typedef struct {
199 const char *java_exception;
201
202
203static 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
240
241
242#include <stdint.h> // Use the C99 official header
243
244
245#include <string>
246
247
248#include <vector>
250
251
252#include <vector>
255
256
257#ifdef __cplusplus
258extern "C" {
259#endif
260
262 jlong jresult = 0 ;
263 operations_research::Domain *result = 0 ;
264
265 (void)jenv;
266 (void)jcls;
268 *(operations_research::Domain **)&jresult = result;
269 return jresult;
270}
271
272
273SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) {
274 jlong jresult = 0 ;
275 int64_t arg1 ;
276 operations_research::Domain *result = 0 ;
277
278 (void)jenv;
279 (void)jcls;
280 arg1 = (int64_t)jarg1;
282 *(operations_research::Domain **)&jresult = result;
283 return jresult;
284}
285
286
287SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1Domain_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
288 jlong jresult = 0 ;
289 int64_t arg1 ;
290 int64_t arg2 ;
291 operations_research::Domain *result = 0 ;
292
293 (void)jenv;
294 (void)jcls;
295 arg1 = (int64_t)jarg1;
296 arg2 = (int64_t)jarg2;
298 *(operations_research::Domain **)&jresult = result;
299 return jresult;
300}
301
302
304 jlong jresult = 0 ;
306
307 (void)jenv;
308 (void)jcls;
311 return jresult;
312}
313
314
315SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromValues(JNIEnv *jenv, jclass jcls, jlongArray jarg1) {
316 jlong jresult = 0 ;
317 std::vector< int64_t > arg1 ;
319
320 (void)jenv;
321 (void)jcls;
322
323 if(jarg1) {
324 const int size = jenv->GetArrayLength(jarg1);
325 (&arg1)->clear();
326 (&arg1)->reserve(size);
327 jlong *values = jenv->GetLongArrayElements((jlongArray)jarg1, NULL);
328 for (int i = 0; i < size; ++i) {
329 (&arg1)->emplace_back(values[i]);
330 }
331 jenv->ReleaseLongArrayElements((jlongArray)jarg1, values, JNI_ABORT);
332 }
333 else {
335 return 0;
336 }
337
340 return jresult;
341}
342
343
344SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromIntervals(JNIEnv *jenv, jclass jcls, jobjectArray jarg1) {
345 jlong jresult = 0 ;
346 std::vector< std::vector< int64_t > > *arg1 = 0 ;
347 std::vector< std::vector< int64_t > > result1 ;
349
350 (void)jenv;
351 (void)jcls;
352
353 if(jarg1) {
354 const int size = jenv->GetArrayLength(jarg1);
355 result1.clear();
356 result1.resize(size);
357 for (int index1 = 0; index1 < size; ++index1) {
358 jlongArray inner_array =
359 (jlongArray)jenv->GetObjectArrayElement(jarg1, index1);
360 const int inner_size = jenv->GetArrayLength(inner_array);
361 result1[index1].reserve(inner_size);
362 jlong * const values =
363 jenv->GetLongArrayElements((jlongArray)inner_array, NULL);
364 for (int index2 = 0; index2 < inner_size; ++index2) {
365 result1[index1].emplace_back(values[index2]);
366 }
367 jenv->ReleaseLongArrayElements((jlongArray)inner_array, values, JNI_ABORT);
368 jenv->DeleteLocalRef(inner_array);
369 }
370 arg1 = &result1;
371 }
372 else {
374 return 0;
375 }
376
377 result = operations_research::Domain::FromVectorIntervals((std::vector< std::vector< long long > > const &)*arg1);
379 return jresult;
380}
381
382
383SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1fromFlatIntervals(JNIEnv *jenv, jclass jcls, jlongArray jarg1) {
384 jlong jresult = 0 ;
385 std::vector< int64_t > *arg1 = 0 ;
387
388 (void)jenv;
389 (void)jcls;
390
391 if(jarg1) {
392 arg1 = new std::vector<int64_t>;
393 const int size = jenv->GetArrayLength(jarg1);
394 arg1->reserve(size);
395 jlong *values = jenv->GetLongArrayElements((jlongArray)jarg1, NULL);
396 for (int i = 0; i < size; ++i) {
397 arg1->emplace_back(values[i]);
398 }
399 jenv->ReleaseLongArrayElements((jlongArray)jarg1, values, JNI_ABORT);
400 }
401 else {
403 return 0;
404 }
405
406 result = operations_research::Domain::FromFlatIntervals((std::vector< long long > const &)*arg1);
408 {
409 delete arg1;
410 }
411 return jresult;
412}
413
414
415SWIGEXPORT jlongArray JNICALL Java_com_google_ortools_util_mainJNI_Domain_1flattenedIntervals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
416 jlongArray jresult = 0 ;
418 std::vector< int64_t > result;
419
420 (void)jenv;
421 (void)jcls;
422 (void)jarg1_;
423 arg1 = *(operations_research::Domain **)&jarg1;
424 result = ((operations_research::Domain const *)arg1)->FlattenedIntervals();
425
426 const std::vector<int64_t>& vec = result;
427 jresult = jenv->NewLongArray(vec.size());
428 jenv->SetLongArrayRegion(jresult, 0, vec.size(), reinterpret_cast<const jlong*>(vec.data()));
429
430 return jresult;
431}
432
433
434SWIGEXPORT jboolean JNICALL Java_com_google_ortools_util_mainJNI_Domain_1isEmpty(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
435 jboolean jresult = 0 ;
437 bool result;
438
439 (void)jenv;
440 (void)jcls;
441 (void)jarg1_;
442 arg1 = *(operations_research::Domain **)&jarg1;
443 result = (bool)((operations_research::Domain const *)arg1)->IsEmpty();
444 jresult = (jboolean)result;
445 return jresult;
446}
447
448
449SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1size(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
450 jlong jresult = 0 ;
452 int64_t result;
453
454 (void)jenv;
455 (void)jcls;
456 (void)jarg1_;
457 arg1 = *(operations_research::Domain **)&jarg1;
458 result = (int64_t)((operations_research::Domain const *)arg1)->Size();
459 jresult = (jlong)result;
460 return jresult;
461}
462
463
464SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1min(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
465 jlong jresult = 0 ;
467 int64_t result;
468
469 (void)jenv;
470 (void)jcls;
471 (void)jarg1_;
472 arg1 = *(operations_research::Domain **)&jarg1;
473 result = (int64_t)((operations_research::Domain const *)arg1)->Min();
474 jresult = (jlong)result;
475 return jresult;
476}
477
478
479SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1max(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
480 jlong jresult = 0 ;
482 int64_t result;
483
484 (void)jenv;
485 (void)jcls;
486 (void)jarg1_;
487 arg1 = *(operations_research::Domain **)&jarg1;
488 result = (int64_t)((operations_research::Domain const *)arg1)->Max();
489 jresult = (jlong)result;
490 return jresult;
491}
492
493
494SWIGEXPORT jboolean JNICALL Java_com_google_ortools_util_mainJNI_Domain_1contains(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
495 jboolean jresult = 0 ;
497 int64_t arg2 ;
498 bool result;
499
500 (void)jenv;
501 (void)jcls;
502 (void)jarg1_;
503 arg1 = *(operations_research::Domain **)&jarg1;
504 arg2 = (int64_t)jarg2;
505 result = (bool)((operations_research::Domain const *)arg1)->Contains(arg2);
506 jresult = (jboolean)result;
507 return jresult;
508}
509
510
511SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1complement(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
512 jlong jresult = 0 ;
515
516 (void)jenv;
517 (void)jcls;
518 (void)jarg1_;
519 arg1 = *(operations_research::Domain **)&jarg1;
520 result = ((operations_research::Domain const *)arg1)->Complement();
522 return jresult;
523}
524
525
526SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1negation(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
527 jlong jresult = 0 ;
530
531 (void)jenv;
532 (void)jcls;
533 (void)jarg1_;
534 arg1 = *(operations_research::Domain **)&jarg1;
535 result = ((operations_research::Domain const *)arg1)->Negation();
537 return jresult;
538}
539
540
541SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1intersectionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
542 jlong jresult = 0 ;
546
547 (void)jenv;
548 (void)jcls;
549 (void)jarg1_;
550 (void)jarg2_;
551 arg1 = *(operations_research::Domain **)&jarg1;
552 arg2 = *(operations_research::Domain **)&jarg2;
553 if (!arg2) {
554 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "operations_research::Domain const & reference is null");
555 return 0;
556 }
557 result = ((operations_research::Domain const *)arg1)->IntersectionWith((operations_research::Domain const &)*arg2);
559 return jresult;
560}
561
562
563SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1unionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
564 jlong jresult = 0 ;
568
569 (void)jenv;
570 (void)jcls;
571 (void)jarg1_;
572 (void)jarg2_;
573 arg1 = *(operations_research::Domain **)&jarg1;
574 arg2 = *(operations_research::Domain **)&jarg2;
575 if (!arg2) {
576 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "operations_research::Domain const & reference is null");
577 return 0;
578 }
579 result = ((operations_research::Domain const *)arg1)->UnionWith((operations_research::Domain const &)*arg2);
581 return jresult;
582}
583
584
585SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_Domain_1additionWith(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
586 jlong jresult = 0 ;
590
591 (void)jenv;
592 (void)jcls;
593 (void)jarg1_;
594 (void)jarg2_;
595 arg1 = *(operations_research::Domain **)&jarg1;
596 arg2 = *(operations_research::Domain **)&jarg2;
597 if (!arg2) {
598 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "operations_research::Domain const & reference is null");
599 return 0;
600 }
601 result = ((operations_research::Domain const *)arg1)->AdditionWith((operations_research::Domain const &)*arg2);
603 return jresult;
604}
605
606
607SWIGEXPORT jstring JNICALL Java_com_google_ortools_util_mainJNI_Domain_1toString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
608 jstring jresult = 0 ;
610 std::string result;
611
612 (void)jenv;
613 (void)jcls;
614 (void)jarg1_;
615 arg1 = *(operations_research::Domain **)&jarg1;
616 result = ((operations_research::Domain const *)arg1)->ToString();
617 jresult = jenv->NewStringUTF((&result)->c_str());
618 return jresult;
619}
620
621
622SWIGEXPORT void JNICALL Java_com_google_ortools_util_mainJNI_delete_1Domain(JNIEnv *jenv, jclass jcls, jlong jarg1) {
624
625 (void)jenv;
626 (void)jcls;
627 arg1 = *(operations_research::Domain **)&jarg1;
628 delete arg1;
629}
630
631
633 jlong jresult = 0 ;
635
636 (void)jenv;
637 (void)jcls;
640 return jresult;
641}
642
643
644SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlongArray jarg1, jlongArray jarg2) {
645 jlong jresult = 0 ;
646 std::vector< int64_t > *arg1 = 0 ;
647 std::vector< int64_t > *arg2 = 0 ;
649
650 (void)jenv;
651 (void)jcls;
652
653 if(jarg1) {
654 arg1 = new std::vector<int64_t>;
655 const int size = jenv->GetArrayLength(jarg1);
656 arg1->reserve(size);
657 jlong *values = jenv->GetLongArrayElements((jlongArray)jarg1, NULL);
658 for (int i = 0; i < size; ++i) {
659 arg1->emplace_back(values[i]);
660 }
661 jenv->ReleaseLongArrayElements((jlongArray)jarg1, values, JNI_ABORT);
662 }
663 else {
665 return 0;
666 }
667
668
669 if(jarg2) {
670 arg2 = new std::vector<int64_t>;
671 const int size = jenv->GetArrayLength(jarg2);
672 arg2->reserve(size);
673 jlong *values = jenv->GetLongArrayElements((jlongArray)jarg2, NULL);
674 for (int i = 0; i < size; ++i) {
675 arg2->emplace_back(values[i]);
676 }
677 jenv->ReleaseLongArrayElements((jlongArray)jarg2, values, JNI_ABORT);
678 }
679 else {
681 return 0;
682 }
683
684 result = (operations_research::SortedDisjointIntervalList *)new operations_research::SortedDisjointIntervalList((std::vector< int64_t > const &)*arg1,(std::vector< int64_t > const &)*arg2);
686 {
687 delete arg1;
688 }
689 {
690 delete arg2;
691 }
692 return jresult;
693}
694
695
696SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_new_1SortedDisjointIntervalList_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jintArray jarg1, jintArray jarg2) {
697 jlong jresult = 0 ;
698 std::vector< int > *arg1 = 0 ;
699 std::vector< int > *arg2 = 0 ;
701
702 (void)jenv;
703 (void)jcls;
704
705 if(jarg1) {
706 arg1 = new std::vector<int>;
707 const int size = jenv->GetArrayLength(jarg1);
708 arg1->reserve(size);
709 jint *values = jenv->GetIntArrayElements((jintArray)jarg1, NULL);
710 for (int i = 0; i < size; ++i) {
711 arg1->emplace_back(values[i]);
712 }
713 jenv->ReleaseIntArrayElements((jintArray)jarg1, values, JNI_ABORT);
714 }
715 else {
717 return 0;
718 }
719
720
721 if(jarg2) {
722 arg2 = new std::vector<int>;
723 const int size = jenv->GetArrayLength(jarg2);
724 arg2->reserve(size);
725 jint *values = jenv->GetIntArrayElements((jintArray)jarg2, NULL);
726 for (int i = 0; i < size; ++i) {
727 arg2->emplace_back(values[i]);
728 }
729 jenv->ReleaseIntArrayElements((jintArray)jarg2, values, JNI_ABORT);
730 }
731 else {
733 return 0;
734 }
735
736 result = (operations_research::SortedDisjointIntervalList *)new operations_research::SortedDisjointIntervalList((std::vector< int > const &)*arg1,(std::vector< int > const &)*arg2);
738 {
739 delete arg1;
740 }
741 {
742 delete arg2;
743 }
744 return jresult;
745}
746
747
748SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1buildComplementOnInterval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
749 jlong jresult = 0 ;
751 int64_t arg2 ;
752 int64_t arg3 ;
754
755 (void)jenv;
756 (void)jcls;
757 (void)jarg1_;
759 arg2 = (int64_t)jarg2;
760 arg3 = (int64_t)jarg3;
761 result = (arg1)->BuildComplementOnInterval(arg2,arg3);
763 return jresult;
764}
765
766
767SWIGEXPORT jlong JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1insertInterval(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
768 jlong jresult = 0 ;
770 int64_t arg2 ;
771 int64_t arg3 ;
772 SwigValueWrapper< std::set< operations_research::ClosedInterval,operations_research::SortedDisjointIntervalList::IntervalComparator >::iterator > result;
773
774 (void)jenv;
775 (void)jcls;
776 (void)jarg1_;
778 arg2 = (int64_t)jarg2;
779 arg3 = (int64_t)jarg3;
780 result = (arg1)->InsertInterval(arg2,arg3);
782 return jresult;
783}
784
785
786SWIGEXPORT 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) {
788 std::vector< int64_t > *arg2 = 0 ;
789 std::vector< int64_t > *arg3 = 0 ;
790
791 (void)jenv;
792 (void)jcls;
793 (void)jarg1_;
795
796 if(jarg2) {
797 arg2 = new std::vector<int64_t>;
798 const int size = jenv->GetArrayLength(jarg2);
799 arg2->reserve(size);
800 jlong *values = jenv->GetLongArrayElements((jlongArray)jarg2, NULL);
801 for (int i = 0; i < size; ++i) {
802 arg2->emplace_back(values[i]);
803 }
804 jenv->ReleaseLongArrayElements((jlongArray)jarg2, values, JNI_ABORT);
805 }
806 else {
808 return ;
809 }
810
811
812 if(jarg3) {
813 arg3 = new std::vector<int64_t>;
814 const int size = jenv->GetArrayLength(jarg3);
815 arg3->reserve(size);
816 jlong *values = jenv->GetLongArrayElements((jlongArray)jarg3, NULL);
817 for (int i = 0; i < size; ++i) {
818 arg3->emplace_back(values[i]);
819 }
820 jenv->ReleaseLongArrayElements((jlongArray)jarg3, values, JNI_ABORT);
821 }
822 else {
824 return ;
825 }
826
827 (arg1)->InsertIntervals((std::vector< int64_t > const &)*arg2,(std::vector< int64_t > const &)*arg3);
828 {
829 delete arg2;
830 }
831 {
832 delete arg3;
833 }
834}
835
836
837SWIGEXPORT 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) {
839 std::vector< int > *arg2 = 0 ;
840 std::vector< int > *arg3 = 0 ;
841
842 (void)jenv;
843 (void)jcls;
844 (void)jarg1_;
846
847 if(jarg2) {
848 arg2 = new std::vector<int>;
849 const int size = jenv->GetArrayLength(jarg2);
850 arg2->reserve(size);
851 jint *values = jenv->GetIntArrayElements((jintArray)jarg2, NULL);
852 for (int i = 0; i < size; ++i) {
853 arg2->emplace_back(values[i]);
854 }
855 jenv->ReleaseIntArrayElements((jintArray)jarg2, values, JNI_ABORT);
856 }
857 else {
859 return ;
860 }
861
862
863 if(jarg3) {
864 arg3 = new std::vector<int>;
865 const int size = jenv->GetArrayLength(jarg3);
866 arg3->reserve(size);
867 jint *values = jenv->GetIntArrayElements((jintArray)jarg3, NULL);
868 for (int i = 0; i < size; ++i) {
869 arg3->emplace_back(values[i]);
870 }
871 jenv->ReleaseIntArrayElements((jintArray)jarg3, values, JNI_ABORT);
872 }
873 else {
875 return ;
876 }
877
878 (arg1)->InsertIntervals((std::vector< int > const &)*arg2,(std::vector< int > const &)*arg3);
879 {
880 delete arg2;
881 }
882 {
883 delete arg3;
884 }
885}
886
887
888SWIGEXPORT jint JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1numIntervals(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
889 jint jresult = 0 ;
891 int result;
892
893 (void)jenv;
894 (void)jcls;
895 (void)jarg1_;
897 result = (int)((operations_research::SortedDisjointIntervalList const *)arg1)->NumIntervals();
898 jresult = (jint)result;
899 return jresult;
900}
901
902
903SWIGEXPORT jstring JNICALL Java_com_google_ortools_util_mainJNI_SortedDisjointIntervalList_1toString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
904 jstring jresult = 0 ;
906 std::string result;
907
908 (void)jenv;
909 (void)jcls;
910 (void)jarg1_;
913 jresult = jenv->NewStringUTF((&result)->c_str());
914 return jresult;
915}
916
917
920
921 (void)jenv;
922 (void)jcls;
924 delete arg1;
925}
926
927
928#ifdef __cplusplus
929}
930#endif
931
We call domain any subset of Int64 = [kint64min, kint64max].
static Domain AllValues()
Returns the full domain Int64.
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.
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.
static Domain FromFlatIntervals(const std::vector< int64_t > &flat_intervals)
This method is available in Python, Java and .NET.
std::vector< int64_t > FlattenedIntervals() const
This method returns the flattened list of interval bounds of the domain.
Domain IntersectionWith(const Domain &domain) const
Returns the intersection of D and domain.
static Domain FromVectorIntervals(const std::vector< std::vector< int64_t > > &intervals)
This method is available in Python, Java and .NET.
static Domain FromValues(std::vector< int64_t > values)
Creates a domain from the union of an unsorted list of integer values.
This class represents a sorted list of disjoint, closed intervals.
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)