Class AbstractTuple
java.lang.Object
tools.refinery.interpreter.matchers.tuple.AbstractTuple
- All Implemented Interfaces:
ITuple
- Direct Known Subclasses:
Tuple
,VolatileTuple
Common implementation methods for immutable and volatile tuples. The class should not be used directly in client
code, except for the definition of new tuple implementations.
- Since:
- 1.7
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
<T> Set
<T> Object[]
As the tuple is supposed to be immutable, do not modify the returned array.protected boolean
internalEquals
(ITuple other) Compares the elements stored in this tuple to another tupleCalculates an inverted index of the elements of this pattern.Calculates an inverted index of the elements of this pattern.protected IndexOutOfBoundsException
raiseIndexingError
(int index) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface tools.refinery.interpreter.matchers.tuple.ITuple
get, getSize, toImmutable
-
Constructor Details
-
AbstractTuple
public AbstractTuple()
-
-
Method Details
-
getElements
As the tuple is supposed to be immutable, do not modify the returned array.- Specified by:
getElements
in interfaceITuple
- Returns:
- the array containing all elements of this Tuple
-
getDistinctElements
- Specified by:
getDistinctElements
in interfaceITuple
- Returns:
- the set containing all distinct elements of this Tuple, cast as type T
-
invertIndex
Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) occurrence is calculated.- Specified by:
invertIndex
in interfaceITuple
- Returns:
- the inverted index mapping each element of this pattern to its index in the array
-
invertIndexWithMupliplicity
Calculates an inverted index of the elements of this pattern. For each element, the index of all of its occurrences is calculated.- Specified by:
invertIndexWithMupliplicity
in interfaceITuple
- Returns:
- the inverted index mapping each element of this pattern to its index in the array
-
raiseIndexingError
- Since:
- 1.7
-
internalEquals
Compares the elements stored in this tuple to another tuple -
toString
-
doCalcHash
protected int doCalcHash()- Since:
- 1.7
-