public class ArrayTupleImpl extends Object implements Tuple
Modifier and Type | Field and Description |
---|---|
private Object[] |
arrayContents |
private static Comparator<Object> |
COMPARE_TO |
private int |
hash |
private static long |
serialVersionUID |
private String |
string |
Modifier | Constructor and Description |
---|---|
|
ArrayTupleImpl(Object... base) |
private |
ArrayTupleImpl(Object[] base,
boolean copy) |
|
ArrayTupleImpl(Object value,
int length)
Create an ArrayTupleImpl with all elements initialized to a given value.
|
Modifier and Type | Method and Description |
---|---|
Tuple |
append(Object element)
Add an element to the end of a tuple.
|
private static int |
compareLexicographically(Object a,
Object b) |
int |
compareTo(Tuple o) |
boolean |
contains(Object element)
Tests whether the tuple has an element equal to its argument.
|
boolean |
equals(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(Predicate<Object> fun)
Given a tuple and a
Predicate , returns a new tuple containing
only the elements that match the predicate. |
Object |
get(double i)
Compatibility method to speed up calls made using doubles.
|
Object |
get(Double i)
Compatibility method to speed up calls made using doubles.
|
Object |
get(int i)
Retrieve the object at one of a tuple's indices.
|
int |
hashCode() |
int |
indexof(Object element)
Searches for an element in a tuple, returning its index if found.
|
Tuple |
insert(int i,
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() |
Iterator<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(Function<Object,Object> fun)
Maps a tuple to another same-length tuple by applying a function to each
element.
|
Object |
max(Object def) |
Tuple |
mergeAfter(Tuple tuple)
Append elements of another tuple to the end of this tuple.
|
Object |
min(Object def) |
Tuple |
prepend(Object element)
Add an element to the start of a tuple.
|
Object |
reduce(ExecutionContext ctx,
Object defVal,
FunctionDefinition fun)
Performs a reduction operation, that maps a tuple to a single value.
|
Object |
reduce(Object defVal,
BinaryOperator<Object> fun)
Performs a reduction operation, that maps a tuple to a single value.
|
Tuple |
set(int i,
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.
|
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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
private static final long serialVersionUID
private final Object[] arrayContents
private int hash
private String string
private static final Comparator<Object> COMPARE_TO
public ArrayTupleImpl(Object... base)
base
- the elementsprivate ArrayTupleImpl(Object[] base, boolean copy)
public ArrayTupleImpl(Object value, int length)
value
- The value to initialize tolength
- The length of the tuplepublic Object get(int i)
Tuple
public Object get(double i)
i
- the element position (will be floored to int)public Object get(Double i)
i
- the element position (will be floored to int)public int size()
public ArrayTupleImpl subTupleEnd(int i)
Tuple
subTupleEnd
in interface Tuple
i
- First element to take for new tuplepublic ArrayTupleImpl subTupleStart(int i)
Tuple
subTupleStart
in interface Tuple
i
- Number of elements to takepublic int compareTo(Tuple o)
compareTo
in interface Comparable<Tuple>
public Tuple append(Object element)
Tuple
public Tuple insert(int i, Object element)
Tuple
public Tuple set(int i, Object element)
Tuple
public ArrayTupleImpl subTuple(int i, int j)
Tuple
public Tuple mergeAfter(Tuple tuple)
Tuple
mergeAfter
in interface Tuple
tuple
- tuple to be addedpublic boolean isEmpty()
public boolean contains(Object element)
Tuple
public int indexof(Object element)
Tuple
public Tuple unwrap(int i)
Tuple
public ArrayTupleImpl union(Tuple t)
Tuple
public Tuple intersection(Tuple t)
Tuple
intersection
in interface Tuple
t
- tuple to take intersection withpublic Tuple subtract(Tuple t)
Tuple
public Object reduce(ExecutionContext ctx, Object defVal, FunctionDefinition fun)
Tuple
reduce
in interface Tuple
ctx
- the current execution contextdefVal
- the value that will be returned if the tuple is emptyfun
- the BinaryOperator
that will be applied to each couple
of valuespublic Object reduce(Object defVal, BinaryOperator<Object> fun)
Tuple
reduce
in interface Tuple
defVal
- the value that will be returned if the tuple is emptyfun
- the BinaryOperator
that will be applied to each couple
of valuespublic Tuple map(ExecutionContext ctx, FunctionDefinition fun)
Tuple
public Tuple map(Function<Object,Object> fun)
Tuple
public Tuple filter(ExecutionContext ctx, FunctionDefinition fun)
Tuple
public Tuple filter(Predicate<Object> fun)
Tuple
Predicate
, returns a new tuple containing
only the elements that match the predicate.public Tuple prepend(Object element)
Tuple
public Tuple sort()