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.0
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 
14 public class Domain {
15  private transient long swigCPtr;
16  protected transient boolean swigCMemOwn;
17 
18  protected Domain(long cPtr, boolean cMemoryOwn) {
19  swigCMemOwn = cMemoryOwn;
20  swigCPtr = cPtr;
21  }
22 
23  protected static long getCPtr(Domain obj) {
24  return (obj == null) ? 0 : obj.swigCPtr;
25  }
26 
27  @SuppressWarnings("deprecation")
28  protected void finalize() {
29  delete();
30  }
31 
32  public synchronized void delete() {
33  if (swigCPtr != 0) {
34  if (swigCMemOwn) {
35  swigCMemOwn = false;
36  mainJNI.delete_Domain(swigCPtr);
37  }
38  swigCPtr = 0;
39  }
40  }
41 
45  public Domain() {
46  this(mainJNI.new_Domain__SWIG_0(), true);
47  }
48 
52  public Domain(long value) {
53  this(mainJNI.new_Domain__SWIG_1(value), true);
54  }
55 
59  public Domain(long left, long right) {
60  this(mainJNI.new_Domain__SWIG_2(left, right), true);
61  }
62 
66  public static Domain allValues() {
67  return new Domain(mainJNI.Domain_allValues(), true);
68  }
69 
73  public static Domain fromValues(long[] values) {
74  return new Domain(mainJNI.Domain_fromValues(values), true);
75  }
76 
80  public static Domain fromIntervals(long[][] intervals) {
81  return new Domain(mainJNI.Domain_fromIntervals(intervals), true);
82  }
83 
87  public static Domain fromFlatIntervals(long[] flat_intervals) {
88  return new Domain(mainJNI.Domain_fromFlatIntervals(flat_intervals), true);
89  }
90 
94  public long[] flattenedIntervals() {
95  return mainJNI.Domain_flattenedIntervals(swigCPtr, this);
96 }
97 
101  public boolean isEmpty() {
102  return mainJNI.Domain_isEmpty(swigCPtr, this);
103  }
104 
108  public long size() {
109  return mainJNI.Domain_size(swigCPtr, this);
110  }
111 
115  public long min() {
116  return mainJNI.Domain_min(swigCPtr, this);
117  }
118 
122  public long max() {
123  return mainJNI.Domain_max(swigCPtr, this);
124  }
125 
129  public boolean contains(long value) {
130  return mainJNI.Domain_contains(swigCPtr, this, value);
131  }
132 
136  public Domain complement() {
137  return new Domain(mainJNI.Domain_complement(swigCPtr, this), true);
138  }
139 
143  public Domain negation() {
144  return new Domain(mainJNI.Domain_negation(swigCPtr, this), true);
145  }
146 
150  public Domain intersectionWith(Domain domain) {
151  return new Domain(mainJNI.Domain_intersectionWith(swigCPtr, this, Domain.getCPtr(domain), domain), true);
152  }
153 
157  public Domain unionWith(Domain domain) {
158  return new Domain(mainJNI.Domain_unionWith(swigCPtr, this, Domain.getCPtr(domain), domain), true);
159  }
160 
164  public Domain additionWith(Domain domain) {
165  return new Domain(mainJNI.Domain_additionWith(swigCPtr, this, Domain.getCPtr(domain), domain), true);
166  }
167 
171  public String toString() {
172  return mainJNI.Domain_toString(swigCPtr, this);
173  }
174 
175 }
Domain negation()
Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.
Definition: Domain.java:143
Domain(long value)
Constructor for the common case of a singleton domain.
Definition: Domain.java:52
boolean contains(long value)
Returns true iff value is in Domain.
Definition: Domain.java:129
long min()
Returns the domain min value.
Definition: Domain.java:115
Domain intersectionWith(Domain domain)
Returns the set D ∩ domain.
Definition: Domain.java:150
long [] flattenedIntervals()
This method returns the flattened list of interval bounds of the domain.
Definition: Domain.java:94
Domain()
By default, Domain will be empty.
Definition: Domain.java:45
Domain unionWith(Domain domain)
Returns the set D ∪ domain.
Definition: Domain.java:157
String toString()
Returns a compact std::string of a vector of intervals like "[1,4][6][10,20]".
Definition: Domain.java:171
Domain complement()
Returns the set Int64 ∖ D.
Definition: Domain.java:136
long size()
Returns the number of elements in the domain.
Definition: Domain.java:108
long max()
Returns the domain max value.
Definition: Domain.java:122
Domain(long cPtr, boolean cMemoryOwn)
Definition: Domain.java:18
static Domain fromFlatIntervals(long[] flat_intervals)
This method is available in Python, Java and .NET.
Definition: Domain.java:87
Domain additionWith(Domain domain)
Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.
Definition: Domain.java:164
static Domain fromValues(long[] values)
Creates a domain from the union of an unsorted list of integer values.
Definition: Domain.java:73
Domain(long left, long right)
Constructor for the common case of a single interval [left, right].
Definition: Domain.java:59
static Domain allValues()
Returns the full domain Int64.
Definition: Domain.java:66
We call "domain" any subset of Int64 = [kint64min, kint64max].
Definition: Domain.java:14
static Domain fromIntervals(long[][] intervals)
This method is available in Python, Java and .NET.
Definition: Domain.java:80
boolean isEmpty()
Returns true if this is the empty set.
Definition: Domain.java:101