|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensolaris.os.dtrace.Tuple
public final class Tuple
Multi-element key to a value in an Aggregation
.
Tuple equality is based on the length of each tuple and the equality of each corresponding element. The natural ordering of tuples is based on a lenient comparison designed not to throw exceptions when corresponding elements are not mutually comparable or the number of tuple elements differs.
Immutable. Supports persistence using XMLEncoder
.
Field Summary | |
---|---|
static Tuple |
EMPTY
The empty tuple has zero elements and may be used to obtain the singleton AggregationRecord of a non-keyed Aggregation , such as the one derived from the D statement
@a = count() . |
Constructor Summary | |
---|---|
Tuple(java.util.List<ValueRecord> tupleElements)
Creates a tuple with the given element list in the given list order. |
|
Tuple(ValueRecord... tupleElements)
Creates a tuple with the given elements in the given order. |
Method Summary | |
---|---|
java.util.List<ValueRecord> |
asList()
Gets a read-only List view of this tuple. |
static int |
compare(Tuple t1,
Tuple t2,
int pos)
Compares corresponding tuple elements at the given zero-based index. |
int |
compareTo(Tuple t)
Defines the natural ordering of tuples. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this Tuple instance
for equality. |
ValueRecord |
get(int index)
Gets the element at the given tuple index (starting at zero). |
java.util.List<ValueRecord> |
getElements()
Gets a modifiable list of this tuple's elements in the same order as their corresponding variables in the original D program tuple. |
int |
hashCode()
Overridden to ensure that equals instances have equal hash codes. |
boolean |
isEmpty()
Returns true if this tuple has no elements. |
java.util.Iterator<ValueRecord> |
iterator()
Gets an iterator over the elements of this tuple. |
int |
size()
Gets the number of elements in this tuple. |
java.lang.String |
toString()
Gets a string representation of this tuple's elements in the same format as that returned by AbstractCollection.toString() . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Tuple EMPTY
AggregationRecord
of a non-keyed Aggregation
, such as the one derived from the D statement
@a = count()
. (In D, an aggregation without
square brackets aggregates a single value.)
Constructor Detail |
---|
public Tuple(ValueRecord... tupleElements)
tupleElements
- ordered series of tuple elements
java.lang.NullPointerException
- if the given array or any of its
elements is null
public Tuple(java.util.List<ValueRecord> tupleElements)
tupleElements
- ordered list of tuple elements
java.lang.NullPointerException
- if the given list or any of its
elements is null
Method Detail |
---|
public java.util.List<ValueRecord> getElements()
public java.util.List<ValueRecord> asList()
List
view of this tuple.
List
view of this tuplepublic int size()
public boolean isEmpty()
true
if this tuple has no elements.
true
if this tuple has no elements, false
otherwiseEMPTY
public ValueRecord get(int index)
public java.util.Iterator<ValueRecord> iterator()
iterator
in interface java.lang.Iterable<ValueRecord>
public boolean equals(java.lang.Object o)
Tuple
instance
for equality. Defines equality as having the same elements in
the same order.
equals
in class java.lang.Object
true
if and only if the specified object is of
type Tuple
and both instances have the same size and
equal elements at corresponding tuple indexespublic int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Tuple t)
compareTo
in interface java.lang.Comparable<Tuple>
compare(Tuple t1, Tuple t2, int pos)
public static int compare(Tuple t1, Tuple t2, int pos)
t1
- first tuplet2
- second tuplepos
- nth tuple element, starting at zero
java.lang.IndexOutOfBoundsException
- if the given tuple index pos
is out of range (pos < 0 || pos >= size())
for
either of the given tuplespublic java.lang.String toString()
AbstractCollection.toString()
.
The representation, although specified, is subject to change.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |