javatools.datatypes
Class Pair<F,S>

java.lang.Object
  extended by javatools.datatypes.Pair<F,S>
All Implemented Interfaces:
java.lang.Comparable<Pair<F,S>>
Direct Known Subclasses:
Triple

public class Pair<F,S>
extends java.lang.Object
implements java.lang.Comparable<Pair<F,S>>

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class provides the simple datatype of a pair


Field Summary
 F first
          Holds the first component
 S second
          Holds the second component
 
Constructor Summary
Pair()
          Constructs an empty pair
Pair(F first, S second)
          Constructs a Pair
 
Method Summary
 int compareTo(Pair<F,S> o)
           
 boolean equals(java.lang.Object obj)
           
 F first()
          Returns the first
 int hashCode()
           
 S second()
          Returns the second
 void setFirst(F first)
          Sets the first
 void setSecond(S second)
          Sets the second
 java.lang.String toString()
          Returns "first/second"
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public F first
Holds the first component


second

public S second
Holds the second component

Constructor Detail

Pair

public Pair(F first,
            S second)
Constructs a Pair


Pair

public Pair()
Constructs an empty pair

Method Detail

first

public F first()
Returns the first


setFirst

public void setFirst(F first)
Sets the first


second

public S second()
Returns the second


setSecond

public void setSecond(S second)
Sets the second


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns "first/second"

Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(Pair<F,S> o)
Specified by:
compareTo in interface java.lang.Comparable<Pair<F,S>>