Java Reference

Java Reference

Domain

Detailed Description

We call domain any subset of Int64 = [kint64min, kint64max].



This class can be used to represent such set efficiently as a sorted and
non-adjacent list of intervals. This is efficient as long as the size of such
list stays reasonable.

In the comments below, the domain of *this will always be written 'D'.
Note that all the functions are safe with respect to integer overflow.

Definition at line 21 of file Domain.java.

Public Member Functions

 Domain (long cPtr, boolean cMemoryOwn)
 
synchronized void delete ()
 
 Domain ()
 By default, Domain will be empty. More...
 
 Domain (long value)
 Constructor for the common case of a singleton domain. More...
 
 Domain (long left, long right)
 Constructor for the common case of a single interval [left, right]. More...
 
long[] flattenedIntervals ()
 This method returns the flattened list of interval bounds of the domain. More...
 
boolean isEmpty ()
 Returns true if this is the empty set. More...
 
long size ()
 Returns the number of elements in the domain. More...
 
long min ()
 Returns the min value of the domain. More...
 
long max ()
 Returns the max value of the domain. More...
 
boolean contains (long value)
 Returns true iff value is in Domain. More...
 
Domain complement ()
 Returns the set Int64 ∖ D. More...
 
Domain negation ()
 Returns {x ∈ Int64, ∃ e ∈ D, x = -e}. More...
 
Domain intersectionWith (Domain domain)
 Returns the intersection of D and domain. More...
 
Domain unionWith (Domain domain)
 Returns the union of D and domain. More...
 
Domain additionWith (Domain domain)
 Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}. More...
 
String toString ()
 Returns a compact string of a vector of intervals like "[1,4][6][10,20]". More...
 

Static Public Member Functions

static Domain allValues ()
 Returns the full domain Int64. More...
 
static Domain fromValues (long[] values)
 Creates a domain from the union of an unsorted list of integer values. More...
 
static Domain fromIntervals (long[][] intervals)
 This method is available in Python, Java and .NET. More...
 
static Domain fromFlatIntervals (long[] flat_intervals)
 This method is available in Python, Java and .NET. More...
 

Constructor & Destructor Documentation

◆ Domain() [1/4]

Domain ( long  cPtr,
boolean  cMemoryOwn 
)
inline

Definition at line 25 of file Domain.java.

◆ Domain() [2/4]

Domain ( )
inline

By default, Domain will be empty.

Definition at line 52 of file Domain.java.

◆ Domain() [3/4]

Domain ( long  value)
inline

Constructor for the common case of a singleton domain.

Definition at line 59 of file Domain.java.

◆ Domain() [4/4]

Domain ( long  left,
long  right 
)
inline

Constructor for the common case of a single interval [left, right].


If left > right, this will result in the empty domain.

Definition at line 67 of file Domain.java.

Member Function Documentation

◆ additionWith()

Domain additionWith ( Domain  domain)
inline

Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.

Definition at line 186 of file Domain.java.

◆ allValues()

static Domain allValues ( )
inlinestatic

Returns the full domain Int64.

Definition at line 74 of file Domain.java.

◆ complement()

Domain complement ( )
inline

Returns the set Int64 ∖ D.

Definition at line 155 of file Domain.java.

◆ contains()

boolean contains ( long  value)
inline

Returns true iff value is in Domain.

Definition at line 148 of file Domain.java.

◆ delete()

synchronized void delete ( )
inline

Definition at line 39 of file Domain.java.

◆ flattenedIntervals()

long [] flattenedIntervals ( )
inline

This method returns the flattened list of interval bounds of the domain.



Thus the domain {0, 1, 2, 5, 8, 9, 10} will return 0, 2, 5, 5, 8, 10.

Definition at line 111 of file Domain.java.

◆ fromFlatIntervals()

static Domain fromFlatIntervals ( long[]  flat_intervals)
inlinestatic

This method is available in Python, Java and .NET.

It allows
building a Domain object from a flattened list of intervals
(long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python).

Definition at line 100 of file Domain.java.

◆ fromIntervals()

static Domain fromIntervals ( long  intervals[][])
inlinestatic

This method is available in Python, Java and .NET.

It allows
building a Domain object from a list of intervals (long[][] in Java and
.NET, [[0, 2], [5, 5], [8, 10]] in python).

Definition at line 91 of file Domain.java.

◆ fromValues()

static Domain fromValues ( long[]  values)
inlinestatic

Creates a domain from the union of an unsorted list of integer values.


Input values may be repeated, with no consequence on the output

Definition at line 82 of file Domain.java.

◆ intersectionWith()

Domain intersectionWith ( Domain  domain)
inline

Returns the intersection of D and domain.

Definition at line 172 of file Domain.java.

◆ isEmpty()

boolean isEmpty ( )
inline

Returns true if this is the empty set.

Definition at line 118 of file Domain.java.

◆ max()

long max ( )
inline

Returns the max value of the domain.


The domain must not be empty.

Definition at line 141 of file Domain.java.

◆ min()

long min ( )
inline

Returns the min value of the domain.


The domain must not be empty.

Definition at line 133 of file Domain.java.

◆ negation()

Domain negation ( )
inline

Returns {x ∈ Int64, ∃ e ∈ D, x = -e}.



Note in particular that if the negation of Int64 is not Int64 but
Int64 \ {kint64min} !!

Definition at line 165 of file Domain.java.

◆ size()

long size ( )
inline

Returns the number of elements in the domain.

It is capped at kint64max

Definition at line 125 of file Domain.java.

◆ toString()

String toString ( )
inline

Returns a compact string of a vector of intervals like "[1,4][6][10,20]".

Definition at line 193 of file Domain.java.

◆ unionWith()

Domain unionWith ( Domain  domain)
inline

Returns the union of D and domain.

Definition at line 179 of file Domain.java.


The documentation for this class was generated from the following file: