IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.projector
Interface Tuple


public interface Tuple

A Tuple is a data structure that holds primitive attributes and associations (relationships) to other tuples. The metadata for the Tuple is contained in the associated TupleMetadata.

Tuple instances are created using the TupleMetadata.createTuple() method.

The Tuple interface should not be directly implemented.

Since:
WAS XD 6.1

Method Summary
 void addAssociationKey(int position, Tuple key)
          Add a single association key for an association.
 void addAssociationKeys(int position, Tuple[] keys)
          Add multiple association keys for an association.
 boolean equals(Object object)
          Indicates whether a Tuple is "equal to" this one.
 Tuple getAssociation(int position, int index)
          Retrieve the association Tuple key from the specified position and index.
 Tuple[] getAssociations(int position)
          Retrieve all association Tuple keys from the specified position.
 int getAssociationSize(int position)
          Retrieve the number of association keys for an association.
 Object getAttribute(int position)
          Retreive an attribute value from the specified position.
 TupleMetadata getMetadata()
          This returns the metadata for this tuple.
 int hashCode()
          Returns the hash code value for this Tuple.
 Object setAttribute(int position, Object value)
          Set the attribute value at the specified position.
 void setAttributes(Object[] values)
          Set the attribute values at the specified positions.
 

Method Detail

getMetadata

TupleMetadata getMetadata()
This returns the metadata for this tuple.

Returns:
the metadata for this tuple.

getAttribute

Object getAttribute(int position)
Retreive an attribute value from the specified position.

Parameters:
position - the position of the attribute within this tuple.
Returns:
the value of the attribute.
Throws:
IndexOutOfBoundsException - if the position is greater than TupleMetadata.getNumAttributes()-1 or less than 0.

setAttribute

Object setAttribute(int position,
                    Object value)
Set the attribute value at the specified position.

Parameters:
position - the position of the attribute within this tuple.
value - the value to set the attribute to.
Returns:
the value previously at the specified position.
Throws:
IndexOutOfBoundsException - if the position is greater than TupleMetadata.getNumAttributes()-1 or less than 0.

setAttributes

void setAttributes(Object[] values)
Set the attribute values at the specified positions.

Parameters:
values - the values to set each attribute to.
Throws:
IndexOutOfBoundsException - if the input array size is greater than TupleMetadata.getNumAttributes().

getAssociation

Tuple getAssociation(int position,
                     int index)
Retrieve the association Tuple key from the specified position and index.

Parameters:
position - the position of the association key(s) within this tuple.
index - the index of an association key for a given association.
Returns:
the Tuple key for the specified association index.
Throws:
IndexOutOfBoundsException - if the position is greater than TupleMetadata.getNumAssociations()()-1 or less than 0 or if the index is greater than getAssociationSize(int) or less than 0;

getAssociations

Tuple[] getAssociations(int position)
Retrieve all association Tuple keys from the specified position.

Parameters:
position - the position of the association key(s) within this tuple.
Returns:
the Tuple keys for the specified association.
Throws:
IndexOutOfBoundsException - if the position is greater than TupleMetadata.getNumAssociations()()-1 or less than 0.

addAssociationKey

void addAssociationKey(int position,
                       Tuple key)
Add a single association key for an association.

Parameters:
position - the position of the association key(s) within this tuple.
key - the Tuple key to add to the current association.
Throws:
IndexOutOfBoundsException - if the position is greater than TupleMetadata.getNumAssociations()()-1 or less than 0.

addAssociationKeys

void addAssociationKeys(int position,
                        Tuple[] keys)
Add multiple association keys for an association.

Parameters:
position - the position of the association key(s) within this tuple.
keys - the Tuple keys to add to the current association.
Throws:
IndexOutOfBoundsException - if the position is greater than TupleMetadata.getNumAssociations()()-1 or less than 0.

getAssociationSize

int getAssociationSize(int position)
Retrieve the number of association keys for an association.

Parameters:
position - the position of the association key(s) within this tuple.
Returns:
the number of keys that the association has.

equals

boolean equals(Object object)
Indicates whether a Tuple is "equal to" this one.

Tuples are equal if the attributes and associations are equal.

Attribute equality is determined by using the equals method on each attribute. Array attributes return true if they are "deeply equal". Each element in the array is checked for equality as a normal attribute. Nested arrays are therefore checked for equality.

Association equality is determined by using the equals method on each association key Tuple. If the association is a OneToMany or ManyToMany relationship, the keys are compared using the order in which the keys were added to the association.

Overrides:
equals in class Object
Parameters:
object - the reference Tuple with which to compare.
Returns:
true if this object is the same as the object argument; false otherwise.
See Also:
hashCode(), Hashtable

hashCode

int hashCode()
Returns the hash code value for this Tuple. The hash code complies with the fundamental contract of Object.hashCode() and is calculated based on the attributes and association keys within this tuple as described in the equals method.

Overrides:
hashCode in class Object
Returns:
a hash code value for this Tuple.
See Also:
Object.equals(java.lang.Object), Hashtable

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.