9 package com.google.ortools.util;
15 private transient long swigCPtr;
16 protected transient boolean swigCMemOwn;
18 protected Domain(
long cPtr,
boolean cMemoryOwn) {
19 swigCMemOwn = cMemoryOwn;
23 protected static long getCPtr(
Domain obj) {
24 return (obj ==
null) ? 0 : obj.swigCPtr;
27 @SuppressWarnings(
"deprecation")
28 protected
void finalize() {
32 public synchronized void delete() {
36 mainJNI.delete_Domain(swigCPtr);
46 this(mainJNI.new_Domain__SWIG_0(),
true);
53 this(mainJNI.new_Domain__SWIG_1(value),
true);
59 public Domain(
long left,
long right) {
60 this(mainJNI.new_Domain__SWIG_2(left, right),
true);
67 return new Domain(mainJNI.Domain_allValues(),
true);
74 return new Domain(mainJNI.Domain_fromValues(values),
true);
81 return new Domain(mainJNI.Domain_fromIntervals(intervals),
true);
88 return new Domain(mainJNI.Domain_fromFlatIntervals(flat_intervals),
true);
95 return mainJNI.Domain_flattenedIntervals(swigCPtr,
this);
102 return mainJNI.Domain_isEmpty(swigCPtr,
this);
109 return mainJNI.Domain_size(swigCPtr,
this);
116 return mainJNI.Domain_min(swigCPtr,
this);
123 return mainJNI.Domain_max(swigCPtr,
this);
130 return mainJNI.Domain_contains(swigCPtr,
this, value);
137 return new Domain(mainJNI.Domain_complement(swigCPtr,
this),
true);
144 return new Domain(mainJNI.Domain_negation(swigCPtr,
this),
true);
151 return new Domain(mainJNI.Domain_intersectionWith(swigCPtr,
this,
Domain.getCPtr(domain), domain),
true);
158 return new Domain(mainJNI.Domain_unionWith(swigCPtr,
this,
Domain.getCPtr(domain), domain),
true);
165 return new Domain(mainJNI.Domain_additionWith(swigCPtr,
this,
Domain.getCPtr(domain), domain),
true);
172 return mainJNI.Domain_toString(swigCPtr,
this);
Domain negation()
Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.
Domain(long value)
Constructor for the common case of a singleton domain.
boolean contains(long value)
Returns true iff value is in Domain.
long min()
Returns the domain min value.
Domain intersectionWith(Domain domain)
Returns the set D ∩ domain.
long [] flattenedIntervals()
This method returns the flattened list of interval bounds of the domain.
Domain()
By default, Domain will be empty.
Domain unionWith(Domain domain)
Returns the set D ∪ domain.
String toString()
Returns a compact std::string of a vector of intervals like "[1,4][6][10,20]".
Domain complement()
Returns the set Int64 ∖ D.
long size()
Returns the number of elements in the domain.
long max()
Returns the domain max value.
Domain(long cPtr, boolean cMemoryOwn)
static Domain fromFlatIntervals(long[] flat_intervals)
This method is available in Python, Java and .NET.
Domain additionWith(Domain domain)
Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.
static Domain fromValues(long[] values)
Creates a domain from the union of an unsorted list of integer values.
Domain(long left, long right)
Constructor for the common case of a single interval [left, right].
static Domain allValues()
Returns the full domain Int64.
We call "domain" any subset of Int64 = [kint64min, kint64max].
static Domain fromIntervals(long[][] intervals)
This method is available in Python, Java and .NET.
boolean isEmpty()
Returns true if this is the empty set.