Go to the documentation of this file.
9 package com.google.ortools.util;
22 private transient long swigCPtr;
23 protected transient boolean swigCMemOwn;
25 public Domain(
long cPtr,
boolean cMemoryOwn) {
26 swigCMemOwn = cMemoryOwn;
30 protected static long getCPtr(
Domain obj) {
31 return (obj ==
null) ? 0 : obj.swigCPtr;
34 @SuppressWarnings(
"deprecation")
35 protected
void finalize() {
39 public synchronized void delete() {
43 mainJNI.delete_Domain(swigCPtr);
53 this(mainJNI.new_Domain__SWIG_0(),
true);
60 this(mainJNI.new_Domain__SWIG_1(value),
true);
67 public Domain(
long left,
long right) {
68 this(mainJNI.new_Domain__SWIG_2(left, right),
true);
75 return new Domain(mainJNI.Domain_allValues(),
true);
83 return new Domain(mainJNI.Domain_fromValues(values),
true);
92 return new Domain(mainJNI.Domain_fromIntervals(intervals),
true);
101 return new Domain(mainJNI.Domain_fromFlatIntervals(flat_intervals),
true);
112 return mainJNI.Domain_flattenedIntervals(swigCPtr,
this);
119 return mainJNI.Domain_isEmpty(swigCPtr,
this);
126 return mainJNI.Domain_size(swigCPtr,
this);
134 return mainJNI.Domain_min(swigCPtr,
this);
142 return mainJNI.Domain_max(swigCPtr,
this);
149 return mainJNI.Domain_contains(swigCPtr,
this, value);
156 return new Domain(mainJNI.Domain_complement(swigCPtr,
this),
true);
166 return new Domain(mainJNI.Domain_negation(swigCPtr,
this),
true);
173 return new Domain(mainJNI.Domain_intersectionWith(swigCPtr,
this,
Domain.getCPtr(domain), domain),
true);
180 return new Domain(mainJNI.Domain_unionWith(swigCPtr,
this,
Domain.getCPtr(domain), domain),
true);
187 return new Domain(mainJNI.Domain_additionWith(swigCPtr,
this,
Domain.getCPtr(domain), domain),
true);
194 return mainJNI.Domain_toString(swigCPtr,
this);
Domain intersectionWith(Domain domain)
Returns the intersection of D and domain.
boolean contains(long value)
Returns true iff value is in Domain.
Domain complement()
Returns the set Int64 ∖ D.
Domain(long cPtr, boolean cMemoryOwn)
Domain additionWith(Domain domain)
Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.
long[] flattenedIntervals()
This method returns the flattened list of interval bounds of the domain.
Domain(long value)
Constructor for the common case of a singleton domain.
boolean isEmpty()
Returns true if this is the empty set.
Domain(long left, long right)
Constructor for the common case of a single interval [left, right].
Domain unionWith(Domain domain)
Returns the union of D and domain.
We call domain any subset of Int64 = [kint64min, kint64max].
static Domain fromIntervals(long[][] intervals)
This method is available in Python, Java and .NET.
long size()
Returns the number of elements in the domain.
Domain()
By default, Domain will be empty.
long max()
Returns the max value of the domain.
long min()
Returns the min value of the domain.
static Domain fromValues(long[] values)
Creates a domain from the union of an unsorted list of integer values.
static Domain fromFlatIntervals(long[] flat_intervals)
This method is available in Python, Java and .NET.
String toString()
Returns a compact string of a vector of intervals like "[1,4][6][10,20]".
static Domain allValues()
Returns the full domain Int64.
Domain negation()
Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.