RealSet (API documentation of hlt.language packages)
Date: 2013-01-30

hlt.language.design.backend

## Class RealSet

- java.lang.Object
- - hlt.language.design.backend.RuntimeSet
  - - hlt.language.design.backend.RealSet

- All Implemented Interfaces:
    Container, Indexable, IndexableContainer, Iteratable, Lockable, RuntimeObject

      public class RealSet
      extends RuntimeSet

  This is a runtime representation for sets of (unboxed) double.
  See Also:
    `RuntimeSet`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RealSet()` Constructs a new empty set.
    `RealSet(DoubleToIntMap map)` Constructs a new set with the elements of the specified map.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RuntimeSet` | `_exclusion(RuntimeSet set)` Returns this set modified to contain the symmetric difference of this and the specified set.
    `RuntimeSet` | `_intersection(RuntimeSet set)` Returns this set modified to contain the intersection of this and the specified set.
    `RuntimeSet` | `_minus(RuntimeSet set)` Returns this set modified to contain the set difference of this and the specified set.
    `void` | `_recomputeMax()` Recomputes the maximum element.
    `void` | `_recomputeMin()` Recomputes the minimum element.
    `double[]` | `array()` Returns the inverse relation of the index map as an array.
    `IntIterator` | `backwardIntIterator()` Returns an iterator of ints over the elements of this set cast as ints in the reverse order of its indices.
    `java.util.Iterator` | `backwardIterator()` Returns an iterator of boxed doubles for this set in the reverse order of its indices.
    `DoubleIterator` | `backwardRealIterator()` Returns an iterator of doubles over the elements of this set in the reverse order of its indices.
    `boolean` | `contains(double element)` Returns `true` iff the specified double belongs to this set.
    `boolean` | `contains(int element)` Returns `true` iff the specified int cast as a double belongs to this set.
    `boolean` | `contains(java.lang.Object element)` Returns `true` iff this set contains the value of the given boxed double.
    `boolean` | `contains(RuntimeSet set)` Returns `true` iff this set contains all the elements of the specified set.
    `RuntimeSet` | `copy()` Returns a copy of this set.
    `boolean` | `equals(java.lang.Object object)` Returns `true` when this set is equal (as a set) to the specified object.
    `boolean` | `equals(java.lang.Object object, int[] permutation)` Returns `true` when this set is equal (as a set) to the specified object, with a side-effect on the specified array of ints that will contain the index permutation when the sets are found to be equal.
    `int` | `firstInt()` Returns the first element of this set as an int.
    `java.lang.Object` | `firstObject()` Returns the first element of this set as an object.
    `double` | `firstReal()` Returns the first element of this set as a double.
    `int` | `getIndex(double element)` Returns the index of the specified double if it belongs to this set, otherwise `-1`.
    `int` | `getIndex(int element)` Returns the index of the specified int cast as a double if such a value belongs to this set, otherwise `-1`.
    `int` | `getIndex(java.lang.Object element)` Returns the index of the double value of specified boxed double if it belongs to this set, otherwise `-1`.
    `IntIterator` | `indexIterator()` Returns an iterator for the indices of the elements of this set.
    `IntIterator` | `intIterator()` Returns an iterator of ints over the elements of this set cast as ints.
    `IntIterator` | `intIterator(boolean ordered)` Returns an iterator of ints over the elements of this set cast as ints such that whenever the specified boolean is `true`, iteration will be respecting the index order of the elements; otherwise, order of iteration is unpredictable.
    `java.util.Iterator` | `iterator()` Returns an iterator of boxed reals for this set.
    `java.util.Iterator` | `iterator(boolean ordered)` Returns an iterator of boxed reals for this set such that whenever the specified boolean is `true`, iteration will be respecting the index order of the elements; otherwise, order of iteration is unpredictable.
    `int` | `lastInt()` Returns the last element of this set as an int.
    `java.lang.Object` | `lastObject()` Returns the last element of this set as an object.
    `double` | `lastReal()` Returns the last element of this set as a double.
    `double` | `max()` Returns the greatest element of this set.
    `double` | `min()` Returns the least element of this set.
    `double` | `next(double element)` Returns the element following the given one in this set, as a double.
    `int` | `next(int element)` Returns the element following the given one in this set, as an int.
    `java.lang.Object` | `next(java.lang.Object element)` Returns the element following the given one in this set, as an object.
    `double` | `nextc(double element)` Returns the element following the given one in this set, as a double, wrapping back to the beginning if necessary.
    `int` | `nextc(int element)` Returns the element following the given one in this set, as an int, wrapping back to the beginning if necessary.
    `java.lang.Object` | `nextc(java.lang.Object element)` Returns the element following the given one in this set, as an object, wrapping back to the beginning if necessary.
    `int` | `ord(double element)` Returns the position of given double if it is an element of this set.
    `int` | `ord(int element)` Returns the position of given int if it is an element of this set.
    `int` | `ord(java.lang.Object element)` Returns the position of given object if it is an element of this set.
    `DoubleIterator` | `orderedIterator()` Returns an iterator of doubles over the elements respecting the order of the elements indices.
    `double` | `prev(double element)` Returns the element preceding the given one in this set, as a double.
    `int` | `prev(int element)` Returns the element preceding the given one in this set, as an int.
    `java.lang.Object` | `prev(java.lang.Object element)` Returns the element preceding the given one in this set, as an object.
    `double` | `prevc(double element)` Returns the element preceding the given one in this set, as a double, wrapping to last element if necessary.
    `int` | `prevc(int element)` Returns the element preceding the given one in this set, as an int, wrapping to last element if necessary.
    `java.lang.Object` | `prevc(java.lang.Object element)` Returns the element preceding the given one in this set, as an object, wrapping to last element if necessary.
    `DoubleIterator` | `realIterator()` Returns an iterator of doubles over the elements of this set.
    `DoubleIterator` | `realIterator(boolean ordered)` Returns an iterator of doubles over the elements of this set such that whenever the specified boolean is `true`, iteration will be respecting the index order of the elements; otherwise, order of iteration is unpredictable.
    `RealRange` | `toRealRange()` Returns a real range whose lower (resp., upper) bound is this set's miminum (resp., maximum) element.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class hlt.language.design.backend.RuntimeSet

      `add, add, add, exclusion, exclusion, hashCode, intersection, intersection, isEmpty, isLocked, lock, minus, minus, remove, remove, remove, size, union, union, unlock`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RealSet

          public RealSet()

      Constructs a new empty set.

    - #### RealSet

          public RealSet(DoubleToIntMap map)

      Constructs a new set with the elements of the specified map.

  - ### Method Detail

    - #### array

          public final double[] array()

      Returns the inverse relation of the index map as an array.

    - #### firstInt

          public final int firstInt()
                             throws NoSuchElementException

      Returns the first element of this set as an int. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `firstInt` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### firstReal

          public final double firstReal()
                                 throws NoSuchElementException

      Returns the first element of this set as a double. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `firstReal` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### firstObject

          public final java.lang.Object firstObject()
                                             throws NoSuchElementException

      Returns the first element of this set as an object. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `firstObject` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### lastInt

          public final int lastInt()
                            throws NoSuchElementException

      Returns the last element of this set as an int. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `lastInt` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### lastReal

          public final double lastReal()
                                throws NoSuchElementException

      Returns the last element of this set as a double. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `lastReal` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### lastObject

          public final java.lang.Object lastObject()
                                            throws NoSuchElementException

      Returns the last element of this set as an object. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `lastObject` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### ord

          public final int ord(int element)
                        throws NoSuchElementException

      Returns the position of given int if it is an element of this set. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `ord` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### ord

          public final int ord(double element)
                        throws NoSuchElementException

      Returns the position of given double if it is an element of this set. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `ord` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### ord

          public final int ord(java.lang.Object element)
                        throws NoSuchElementException

      Returns the position of given object if it is an element of this set. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `ord` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### next

          public final int next(int element)
                         throws NoSuchElementException

      Returns the element following the given one in this set, as an int. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `next` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### next

          public final double next(double element)
                            throws NoSuchElementException

      Returns the element following the given one in this set, as a double. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `next` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### next

          public final java.lang.Object next(java.lang.Object element)
                                      throws NoSuchElementException

      Returns the element following the given one in this set, as an object. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `next` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### prev

          public final int prev(int element)
                         throws NoSuchElementException

      Returns the element preceding the given one in this set, as an int. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `prev` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### prev

          public final double prev(double element)
                            throws NoSuchElementException

      Returns the element preceding the given one in this set, as a double. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `prev` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### prev

          public final java.lang.Object prev(java.lang.Object element)
                                      throws NoSuchElementException

      Returns the element preceding the given one in this set, as an object. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `prev` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### nextc

          public final int nextc(int element)
                          throws NoSuchElementException

      Returns the element following the given one in this set, as an int, wrapping back to the beginning if necessary. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `nextc` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### nextc

          public final double nextc(double element)
                             throws NoSuchElementException

      Returns the element following the given one in this set, as a double, wrapping back to the beginning if necessary. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `nextc` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### nextc

          public final java.lang.Object nextc(java.lang.Object element)
                                       throws NoSuchElementException

      Returns the element following the given one in this set, as an object, wrapping back to the beginning if necessary. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `nextc` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### prevc

          public final int prevc(int element)
                          throws NoSuchElementException

      Returns the element preceding the given one in this set, as an int, wrapping to last element if necessary. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `prevc` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### prevc

          public final double prevc(double element)
                             throws NoSuchElementException

      Returns the element preceding the given one in this set, as a double, wrapping to last element if necessary. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `prevc` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### prevc

          public final java.lang.Object prevc(java.lang.Object element)
                                       throws NoSuchElementException

      Returns the element preceding the given one in this set, as an object, wrapping to last element if necessary. If there is no such element, throws a `NoSuchElementException`.
      Specified by:
        `prevc` in class `RuntimeSet`
      Throws:
        `NoSuchElementException`

    - #### copy

          public final RuntimeSet copy()

      Returns a copy of this set.
      Specified by:
        `copy` in class `RuntimeSet`

    - #### getIndex

          public final int getIndex(double element)

      Returns the index of the specified double if it belongs to this set, otherwise `-1`.

    - #### getIndex

          public final int getIndex(int element)

      Returns the index of the specified int cast as a double if such a value belongs to this set, otherwise `-1`.

    - #### getIndex

          public final int getIndex(java.lang.Object element)

      Returns the index of the double value of specified boxed double if it belongs to this set, otherwise `-1`.

    - #### min

          public final double min()

      Returns the least element of this set. If the set is empty, throws a `NoSuchElementException`.

    - #### max

          public final double max()

      Returns the greatest element of this set. If the set is empty, throws a `NoSuchElementException`.

    - #### contains

          public final boolean contains(double element)

      Returns `true` iff the specified double belongs to this set.

    - #### contains

          public final boolean contains(int element)

      Returns `true` iff the specified int cast as a double belongs to this set.

    - #### contains

          public final boolean contains(java.lang.Object element)

      Returns `true` iff this set contains the value of the given boxed double.

    - #### contains

          public final boolean contains(RuntimeSet set)

      Returns `true` iff this set contains all the elements of the specified set.
      Specified by:
        `contains` in class `RuntimeSet`

    - #### _intersection

          public final RuntimeSet _intersection(RuntimeSet set)

      Returns this set modified to contain the intersection of this and the specified set.

    - #### _minus

          public final RuntimeSet _minus(RuntimeSet set)

      Returns this set modified to contain the set difference of this and the specified set.

    - #### _exclusion

          public final RuntimeSet _exclusion(RuntimeSet set)

      Returns this set modified to contain the symmetric difference of this and the specified set.

    - #### _recomputeMin

          public final void _recomputeMin()

      Recomputes the minimum element.

    - #### _recomputeMax

          public final void _recomputeMax()

      Recomputes the maximum element.

    - #### toRealRange

          public final RealRange toRealRange()

      Returns a real range whose lower (resp., upper) bound is this set's miminum (resp., maximum) element.

    - #### realIterator

          public final DoubleIterator realIterator(boolean ordered)

      Returns an iterator of doubles over the elements of this set such that whenever the specified boolean is `true`, iteration will be respecting the index order of the elements; otherwise, order of iteration is unpredictable. The former is less efficient than the latter and should be used only when it is mandatory to do ordered iteration.

    - #### realIterator

          public final DoubleIterator realIterator()

      Returns an iterator of doubles over the elements of this set. This iterator is not guaranteed to be ordered, unless the set is locked.

    - #### iterator

          public final java.util.Iterator iterator(boolean ordered)

      Returns an iterator of boxed reals for this set such that whenever the specified boolean is `true`, iteration will be respecting the index order of the elements; otherwise, order of iteration is unpredictable. The former is less efficient than the latter and should be used only when it is mandatory to do ordered iteration.

    - #### iterator

          public final java.util.Iterator iterator()

      Returns an iterator of boxed reals for this set. This iterator is not guaranteed to be ordered, unless the set is locked.

    - #### intIterator

          public final IntIterator intIterator(boolean ordered)

      Returns an iterator of ints over the elements of this set cast as ints such that whenever the specified boolean is `true`, iteration will be respecting the index order of the elements; otherwise, order of iteration is unpredictable. The former is less efficient than the latter and should be used only when it is mandatory to do ordered iteration.

    - #### intIterator

          public final IntIterator intIterator()

      Returns an iterator of ints over the elements of this set cast as ints. This iterator is not guaranteed to be ordered, unless the set is locked.

    - #### orderedIterator

          public final DoubleIterator orderedIterator()

      Returns an iterator of doubles over the elements respecting the order of the elements indices.

    - #### backwardRealIterator

          public final DoubleIterator backwardRealIterator()

      Returns an iterator of doubles over the elements of this set in the reverse order of its indices.

    - #### backwardIntIterator

          public final IntIterator backwardIntIterator()

      Returns an iterator of ints over the elements of this set cast as ints in the reverse order of its indices.

    - #### backwardIterator

          public final java.util.Iterator backwardIterator()

      Returns an iterator of boxed doubles for this set in the reverse order of its indices.

    - #### indexIterator

          public final IntIterator indexIterator()

      Returns an iterator for the indices of the elements of this set.

    - #### equals

          public final boolean equals(java.lang.Object object)

      Returns `true` when this set is equal (as a set) to the specified object. Note that order on indices is not important.
      Overrides:
        `equals` in class `java.lang.Object`

    - #### equals

          public final boolean equals(java.lang.Object object,
                       int[] permutation)

      Returns `true` when this set is equal (as a set) to the specified object, with a side-effect on the specified array of ints that will contain the index permutation when the sets are found to be equal.
      Specified by:
        `equals` in interface `Indexable`
      Specified by:
        `equals` in class `RuntimeSet`

    - #### toString

          public final java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`