Package jadex.common
Class Tuple
java.lang.Object
jadex.common.Tuple
- All Implemented Interfaces:
Serializable
,Cloneable
A tuple is a list of entities.
The entities of a tuple may be null.
The equals and hashCode methods are overridden,
such that two tuples are equal and have the same hashcode,
if they contain the same entities.
Therefore tuples can be used for multipart keys in hashtables.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clone this tuple.boolean
Test two tuples for equality.get
(int n) Get an entity.Object[]
Get entitiesgetEntity
(int n) Get an entity.int
hashCode()
Compute the hashcode of the tuple.static void
int
size()
Get the size.toString()
Convert this tuple to a string representation.
-
Field Details
-
entities
The entities of the tuple.
-
-
Constructor Details
-
Tuple
Convenience constructor for binary tuples.- Parameters:
entity1
- The first object in the tuple.entity2
- The second object in the tuple.
-
Tuple
Convenience constructor for binary tuples.- Parameters:
entity1
- The first object in the tuple.entity2
- The second object in the tuple.entity3
- The third object in the tuple.
-
Tuple
Create a new tuple.- Parameters:
entities
- The objects in the tuple.
-
-
Method Details
-
getEntity
Get an entity.- Parameters:
n
- The entities position.- Returns:
- The entity.
-
getEntities
Get entities- Returns:
- The entities.
-
get
Get an entity.- Parameters:
n
- The entities position.- Returns:
- The entity.
-
size
public int size()Get the size.- Returns:
- The size.
-
hashCode
public int hashCode()Compute the hashcode of the tuple. -
equals
Test two tuples for equality. -
toString
Convert this tuple to a string representation. -
clone
Clone this tuple.- Overrides:
clone
in classObject
- Returns:
- A shallow copy of this tuple.
- Throws:
CloneNotSupportedException
-
main
- Throws:
Exception
-