Package com.tailf.proto
Class ConfETuple
Object
com.tailf.proto.ConfEObject
com.tailf.proto.ConfETuple
- All Implemented Interfaces:
Serializable
,Cloneable
Provides a Java representation of E tuples. Tuples are created from one or
more arbitrary E terms.
The arity of the tuple is the number of elements it contains. Elements are indexed from 0 to (arity-1) and can be retrieved individually by using the appropriate index.
- See Also:
-
Constructor Summary
ConstructorDescriptionConfETuple
(ConfEObject elem) Create a unary tuple containing the given element.ConfETuple
(ConfEObject[] elems) Create a tuple from an array of terms.ConfETuple
(ConfEObject[] elems, int start, int count) Create a tuple from an array of terms.Create a tuple from a stream containing an tuple encoded in E external format. -
Method Summary
Modifier and TypeMethodDescriptionint
arity()
Get the arity of the tuple.clone()
elementAt
(int i) Get the specified element from the tuple.elements()
Get all the elements from the tuple as an array.void
encode
(ConfOutputStream buf) Convert this tuple to the equivalent E external representation.boolean
Determine if two tuples are equal.int
hashCode()
toString()
Get the string representation of the tuple.Methods inherited from class com.tailf.proto.ConfEObject
decode
-
Constructor Details
-
ConfETuple
Create a unary tuple containing the given element.- Parameters:
elem
- the element to create the tuple from.- Throws:
IllegalArgumentException
- if the array is empty (null).
-
ConfETuple
Create a tuple from an array of terms.- Parameters:
elems
- the array of terms to create the tuple from.- Throws:
IllegalArgumentException
- if the array is empty (null) or contains null elements.
-
ConfETuple
Create a tuple from an array of terms.- Parameters:
elems
- the array of terms to create the tuple from.start
- the offset of the first term to insert.count
- the number of terms to insert.- Throws:
IllegalArgumentException
- if the array is empty (null) or contains null elements.
-
ConfETuple
Create a tuple from a stream containing an tuple encoded in E external format.- Parameters:
buf
- the stream containing the encoded tuple.- Throws:
ConfEDecodeException
- if the buffer does not contain a valid external representation of an E tuple.
-
-
Method Details
-
arity
public int arity()Get the arity of the tuple.- Returns:
- the number of elements contained in the tuple.
-
elementAt
Get the specified element from the tuple.- Parameters:
i
- the index of the requested element. Tuple elements are numbered as array elements, starting at 0.- Returns:
- the requested element, of null if i is not a valid element index.
-
elements
Get all the elements from the tuple as an array.- Returns:
- an array containing all of the tuple's elements.
-
toString
Get the string representation of the tuple.- Specified by:
toString
in classConfEObject
- Returns:
- the string representation of the tuple.
-
encode
Convert this tuple to the equivalent E external representation.- Specified by:
encode
in classConfEObject
- Parameters:
buf
- an output stream to which the encoded tuple should be written.
-
equals
Determine if two tuples are equal. Tuples are equal if they have the same arity and all of the elements are equal.- Specified by:
equals
in classConfEObject
- Parameters:
o
- the tuple to compare to.- Returns:
- true if the tuples have the same arity and all the elements are equal.
-
hashCode
public int hashCode() -
clone
- Overrides:
clone
in classConfEObject
-