org.infai.emo.matcher.util
Class Tuple<F,S>

java.lang.Object
  extended by org.infai.emo.matcher.util.Tuple<F,S>
Type Parameters:
F - the classtype of which the first element has to be.
S - the classtype of which the second element has to be.

public class Tuple<F,S>
extends java.lang.Object

This class contains a pair of elements that have any kind of relation.

Version:
1.0.0
Author:
Stanley Hillner

Field Summary
(package private)  F firstElement
          The first element of the tuple.
(package private)  S secondElement
          The second element of the tuple.
 
Constructor Summary
Tuple(F firstElement, S secondElement)
          The constructor that creates a new tuple from two the given elements.
 
Method Summary
 boolean equals(Tuple<F,S> t)
          Method for comparing a tuple with another one by comparing their elements.
 F getFirstElement()
           
 S getSecondElement()
           
 Tuple invert()
          Method inverts the tuple by switching the position of its elements.
 void setFirstElement(F firstElement)
          Set a new element to the first position of the tuple.
 void setSecondElement(S secondElement)
          Set a new element to the second position of the tuple.
 void setValues(F firstElement, S secondElement)
          Replaces both elements of the tuple by the given ones.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

firstElement

F firstElement
The first element of the tuple.


secondElement

S secondElement
The second element of the tuple.

Constructor Detail

Tuple

public Tuple(F firstElement,
             S secondElement)
The constructor that creates a new tuple from two the given elements.

Parameters:
firstElement - the fist element of the tuple.
secondElement - the second element of the tuple.
Method Detail

invert

public Tuple invert()
Method inverts the tuple by switching the position of its elements.

Returns:
the inverted tuple.

equals

public boolean equals(Tuple<F,S> t)
Method for comparing a tuple with another one by comparing their elements.

Parameters:
t - the tuple to compare with.
Returns:
true, if the tuples are equal, thus theirs elements are equal.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getFirstElement

public F getFirstElement()
Returns:
the first element of the tuple.

setFirstElement

public void setFirstElement(F firstElement)
Set a new element to the first position of the tuple.

Parameters:
firstElement - the new first element.

getSecondElement

public S getSecondElement()
Returns:
the second element of the tuple.

setSecondElement

public void setSecondElement(S secondElement)
Set a new element to the second position of the tuple.

Parameters:
secondElement - the new second element.

setValues

public void setValues(F firstElement,
                      S secondElement)
Replaces both elements of the tuple by the given ones.

Parameters:
firstElement - the new first element.
secondElement - the new second element.