xxl.util
Class Tupel

java.lang.Object
  |
  +--xxl.util.Tupel

public class Tupel
extends java.lang.Object

This class implements a Tupel of objects. A tupel is compared and hashed in terms of its objects.


Field Summary
protected  java.lang.Object[] objects
           
 
Constructor Summary
Tupel(java.lang.Object[] objects)
          Creates an tupel using the given array.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares two tupels in terms of their objects.
 java.lang.Object get(int index)
          Gets the object stored at the given index.
 int hashCode()
          Computes a hash code for this tupel based on the objects stored in it.
 int length()
          Returns the length of the underlying array.
 java.lang.Object set(int index, java.lang.Object object)
          Updates this tupel at the given index with the given object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objects

protected java.lang.Object[] objects
Constructor Detail

Tupel

public Tupel(java.lang.Object[] objects)
Creates an tupel using the given array.
Parameters:
objects - The array that backs the tupel.
Method Detail

length

public int length()
Returns the length of the underlying array.
Returns:
The length of the underlying array.

equals

public boolean equals(java.lang.Object o)
Compares two tupels in terms of their objects.
Parameters:
The - tupel to be compared with.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Computes a hash code for this tupel based on the objects stored in it. Starting with 0, the hashCodes of the objects are superimposed with xor (^). The hashCode of null is 0 by definition.
Overrides:
hashCode in class java.lang.Object

set

public java.lang.Object set(int index,
                            java.lang.Object object)
                     throws java.lang.IndexOutOfBoundsException
Updates this tupel at the given index with the given object.
Parameters:
index - Updates this tupel at index.
object - Updates this tupel at the given index with object.
Throws:
java.lang.IndexOutOfBoundsException - Throw an IndexOutOfBoundsException if the index is negative or greater than or equal to length().

get

public java.lang.Object get(int index)
                     throws java.lang.IndexOutOfBoundsException
Gets the object stored at the given index.
Parameters:
index - Gets the object stored at the given index.
Throws:
java.lang.IndexOutOfBoundsException - Throw an IndexOutOfBoundsException if the index is negative or greater than or equal to length().