Java Reference

Java Reference

Domain.java
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.1
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.google.ortools.util;
10 
21 public class Domain {
22  private transient long swigCPtr;
23  protected transient boolean swigCMemOwn;
24 
25  public Domain(long cPtr, boolean cMemoryOwn) {
26  swigCMemOwn = cMemoryOwn;
27  swigCPtr = cPtr;
28  }
29 
30  protected static long getCPtr(Domain obj) {
31  return (obj == null) ? 0 : obj.swigCPtr;
32  }
33 
34  @SuppressWarnings("deprecation")
35  protected void finalize() {
36  delete();
37  }
38 
39  public synchronized void delete() {
40  if (swigCPtr != 0) {
41  if (swigCMemOwn) {
42  swigCMemOwn = false;
43  mainJNI.delete_Domain(swigCPtr);
44  }
45  swigCPtr = 0;
46  }
47  }
48 
52  public Domain() {
53  this(mainJNI.new_Domain__SWIG_0(), true);
54  }
55 
59  public Domain(long value) {
60  this(mainJNI.new_Domain__SWIG_1(value), true);
61  }
62 
67  public Domain(long left, long right) {
68  this(mainJNI.new_Domain__SWIG_2(left, right), true);
69  }
70 
74  public static Domain allValues() {
75  return new Domain(mainJNI.Domain_allValues(), true);
76  }
77 
82  public static Domain fromValues(long[] values) {
83  return new Domain(mainJNI.Domain_fromValues(values), true);
84  }
85 
91  public static Domain fromIntervals(long[][] intervals) {
92  return new Domain(mainJNI.Domain_fromIntervals(intervals), true);
93  }
94 
100  public static Domain fromFlatIntervals(long[] flat_intervals) {
101  return new Domain(mainJNI.Domain_fromFlatIntervals(flat_intervals), true);
102  }
103 
111  public long[] flattenedIntervals() {
112  return mainJNI.Domain_flattenedIntervals(swigCPtr, this);
113 }
114 
118  public boolean isEmpty() {
119  return mainJNI.Domain_isEmpty(swigCPtr, this);
120  }
121 
125  public long size() {
126  return mainJNI.Domain_size(swigCPtr, this);
127  }
128 
133  public long min() {
134  return mainJNI.Domain_min(swigCPtr, this);
135  }
136 
141  public long max() {
142  return mainJNI.Domain_max(swigCPtr, this);
143  }
144 
148  public boolean contains(long value) {
149  return mainJNI.Domain_contains(swigCPtr, this, value);
150  }
151 
155  public Domain complement() {
156  return new Domain(mainJNI.Domain_complement(swigCPtr, this), true);
157  }
158 
165  public Domain negation() {
166  return new Domain(mainJNI.Domain_negation(swigCPtr, this), true);
167  }
168 
172  public Domain intersectionWith(Domain domain) {
173  return new Domain(mainJNI.Domain_intersectionWith(swigCPtr, this, Domain.getCPtr(domain), domain), true);
174  }
175 
179  public Domain unionWith(Domain domain) {
180  return new Domain(mainJNI.Domain_unionWith(swigCPtr, this, Domain.getCPtr(domain), domain), true);
181  }
182 
186  public Domain additionWith(Domain domain) {
187  return new Domain(mainJNI.Domain_additionWith(swigCPtr, this, Domain.getCPtr(domain), domain), true);
188  }
189 
193  public String toString() {
194  return mainJNI.Domain_toString(swigCPtr, this);
195  }
196 
197 }
Domain intersectionWith(Domain domain)
Returns the intersection of D and domain.
Definition: Domain.java:172
boolean contains(long value)
Returns true iff value is in Domain.
Definition: Domain.java:148
Domain complement()
Returns the set Int64 ∖ D.
Definition: Domain.java:155
Domain(long cPtr, boolean cMemoryOwn)
Definition: Domain.java:25
Domain additionWith(Domain domain)
Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.
Definition: Domain.java:186
long[] flattenedIntervals()
This method returns the flattened list of interval bounds of the domain.
Definition: Domain.java:111
Domain(long value)
Constructor for the common case of a singleton domain.
Definition: Domain.java:59
boolean isEmpty()
Returns true if this is the empty set.
Definition: Domain.java:118
Domain(long left, long right)
Constructor for the common case of a single interval [left, right].
Definition: Domain.java:67
Domain unionWith(Domain domain)
Returns the union of D and domain.
Definition: Domain.java:179
We call domain any subset of Int64 = [kint64min, kint64max].
Definition: Domain.java:21
static Domain fromIntervals(long[][] intervals)
This method is available in Python, Java and .NET.
Definition: Domain.java:91
long size()
Returns the number of elements in the domain.
Definition: Domain.java:125
Domain()
By default, Domain will be empty.
Definition: Domain.java:52
long max()
Returns the max value of the domain.
Definition: Domain.java:141
long min()
Returns the min value of the domain.
Definition: Domain.java:133
static Domain fromValues(long[] values)
Creates a domain from the union of an unsorted list of integer values.
Definition: Domain.java:82
static Domain fromFlatIntervals(long[] flat_intervals)
This method is available in Python, Java and .NET.
Definition: Domain.java:100
String toString()
Returns a compact string of a vector of intervals like "[1,4][6][10,20]".
Definition: Domain.java:193
static Domain allValues()
Returns the full domain Int64.
Definition: Domain.java:74
Domain negation()
Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.
Definition: Domain.java:165