public final class ArrayTupleImpl extends java.lang.Object implements Tuple
| Constructor and Description |
|---|
ArrayTupleImpl(java.lang.Object... base) |
ArrayTupleImpl(java.lang.Object value,
int length)
Create an ArrayTupleImpl with all elements initialized to a given value.
|
| Modifier and Type | Method and Description |
|---|---|
Tuple |
append(java.lang.Object element)
Add an element to the end of a tuple.
|
int |
compareTo(Tuple o) |
boolean |
contains(java.lang.Object element)
Tests whether the tuple has an element equal to its argument.
|
boolean |
containsAll(java.lang.Iterable<?> element)
Tests whether the tuple has an element equal to its argument.
|
boolean |
equals(java.lang.Object o) |
Tuple |
filter(ExecutionContext ctx,
FunctionDefinition fun)
Given a tuple and a predicate, returns a new tuple containing only the
elements that match the predicate.
|
Tuple |
filter(java.util.function.Predicate<java.lang.Object> fun)
Given a tuple and a
Predicate, returns a new tuple containing
only the elements that match the predicate. |
Tuple |
flatMap(java.util.function.Function<java.lang.Object,Tuple> fun)
Provided a function generating tuples from the tuple elements,
maps this tuple to a new tuple, and then flattens the result into a single tuple.
|
java.lang.Object |
fold(java.lang.Object initial,
java.util.function.BinaryOperator<java.lang.Object> fun)
Performs a reduction operation, that maps a tuple to a single value.
|
java.lang.Object |
get(double i)
Compatibility method to speed up calls made using doubles.
|
java.lang.Object |
get(java.lang.Double i)
Compatibility method to speed up calls made using doubles.
|
java.lang.Object |
get(int i)
Retrieve the object at one of a tuple's indices.
|
int |
hashCode() |
java.lang.Object |
head() |
int |
indexof(java.lang.Object element)
Searches for an element in a tuple, returning its index if found.
|
Tuple |
insert(int i,
java.lang.Object element)
Add an element to an arbitrary location within a tuple, moving all
elements after it down.
|
Tuple |
intersection(Tuple t)
Set arithmetic: compute intersection of set of tuple elements with set of
elements of another tuple.
|
boolean |
isEmpty() |
java.util.Iterator<java.lang.Object> |
iterator() |
Tuple |
map(ExecutionContext ctx,
FunctionDefinition fun)
Maps a tuple to another same-length tuple by applying a function to each
element.
|
Tuple |
map(java.util.function.Function<java.lang.Object,java.lang.Object> fun)
Maps a tuple to another same-length tuple by applying a function to each
element.
|
java.lang.Object |
max(java.lang.Object def) |
Tuple |
mergeAfter(Tuple tuple)
Append elements of another tuple to the end of this tuple.
|
java.lang.Object |
min(java.lang.Object def) |
Tuple |
prepend(java.lang.Object element)
Add an element to the start of a tuple.
|
java.lang.Object |
reduce(java.lang.Object defVal,
java.util.function.BinaryOperator<java.lang.Object> fun)
Performs a reduction operation, that maps a tuple to a single value.
|
Tuple |
set(int i,
java.lang.Object element)
Replace an element in a tuple.
|
int |
size() |
Tuple |
sort() |
Tuple |
subtract(Tuple t)
Set arithmetic: compute which elements in this tuple are not in another
tuple.
|
ArrayTupleImpl |
subTuple(int i,
int j)
Produces a new Tuple containing the elements between the start and end
indices.
|
ArrayTupleImpl |
subTupleEnd(int i)
Produces a new Tuple containing all elements from i onward.
|
ArrayTupleImpl |
subTupleStart(int i)
Produces a new Tuple containing the first i elements.
|
Tuple |
tail() |
java.lang.Object[] |
toArray() |
java.lang.String |
toString() |
ArrayTupleImpl |
union(Tuple t)
Set arithmetic: compute union of set of tuple elements with set of
elements of another tuple.
|
Tuple |
unwrap(int i)
For all elements that are tuples, substitute the ith sub-element.
|
Tuple |
zip(Tuple other)
Zips two tuples together, creating a Tuple of 2-ples.
|
public ArrayTupleImpl(java.lang.Object... base)
base - the elementspublic ArrayTupleImpl(java.lang.Object value,
int length)
value - The value to initialize tolength - The length of the tuplepublic Tuple append(java.lang.Object element)
Tuplepublic int compareTo(Tuple o)
compareTo in interface java.lang.Comparable<Tuple>public boolean contains(java.lang.Object element)
Tuplepublic boolean containsAll(java.lang.Iterable<?> element)
TuplecontainsAll in interface Tupleelement - Element to test whether it is equal to any element in the
tuplepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic Tuple filter(ExecutionContext ctx, FunctionDefinition fun)
Tuplepublic Tuple filter(java.util.function.Predicate<java.lang.Object> fun)
TuplePredicate, returns a new tuple containing
only the elements that match the predicate.public Tuple flatMap(java.util.function.Function<java.lang.Object,Tuple> fun)
Tuplepublic java.lang.Object fold(java.lang.Object initial,
java.util.function.BinaryOperator<java.lang.Object> fun)
Tuplepublic java.lang.Object get(double i)
i - the element position (will be floored to int)public java.lang.Object get(java.lang.Double i)
i - the element position (will be floored to int)public java.lang.Object get(int i)
Tuplepublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.Object head()
public int indexof(java.lang.Object element)
Tuplepublic Tuple insert(int i, java.lang.Object element)
Tuplepublic Tuple intersection(Tuple t)
Tupleintersection in interface Tuplet - tuple to take intersection withpublic boolean isEmpty()
@Nonnull public java.util.Iterator<java.lang.Object> iterator()
iterator in interface java.lang.Iterable<java.lang.Object>public Tuple map(ExecutionContext ctx, FunctionDefinition fun)
Tuplepublic Tuple map(java.util.function.Function<java.lang.Object,java.lang.Object> fun)
Tuplepublic java.lang.Object max(java.lang.Object def)
public Tuple mergeAfter(Tuple tuple)
TuplemergeAfter in interface Tupletuple - tuple to be addedpublic java.lang.Object min(java.lang.Object def)
public Tuple prepend(java.lang.Object element)
Tuplepublic java.lang.Object reduce(java.lang.Object defVal,
java.util.function.BinaryOperator<java.lang.Object> fun)
Tuplepublic Tuple set(int i, java.lang.Object element)
Tuplepublic int size()
public Tuple sort()
public Tuple subtract(Tuple t)
Tuplepublic ArrayTupleImpl subTuple(int i, int j)
Tuplepublic ArrayTupleImpl subTupleEnd(int i)
TuplesubTupleEnd in interface Tuplei - First element to take for new tuplepublic ArrayTupleImpl subTupleStart(int i)
TuplesubTupleStart in interface Tuplei - Number of elements to takepublic Tuple tail()
public java.lang.Object[] toArray()
public java.lang.String toString()
toString in class java.lang.Objectpublic ArrayTupleImpl union(Tuple t)
Tuplepublic Tuple unwrap(int i)
Tuplepublic Tuple zip(Tuple other)
Tuple