Parsing Engine

danbikel.util
Class Pair

java.lang.Object
  extended by danbikel.util.Pair
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SymbolPair

public class Pair
extends Object
implements Serializable

Provides a mechanism to group any two objects. Either or both objects may be null.

See Also:
Serialized Form

Field Summary
 Object first
          The first object in the pair.
 Object second
          The second object in the pair.
 
Constructor Summary
Pair()
          Constructs a new Pair object with both data members set to null.
Pair(Object first, Object second)
          Constructs a new Pair object with the specified two objects.
 
Method Summary
 boolean equals(Object obj)
          Returns true if and only if the specified object is an instance of Pair and if this.first and ((Pair)obj).first are either both null or are equal as determined by the equals method of this.first if this.second and ((Pair)obj).second are either both null or are equal as determined by the equals method of this.second
 int hashCode()
          Returns a hash code that is formed from the hash codes of the two objects of this pair.
 String toString()
          Returns a human-readable string representation of this pair of objects, of the form "Pair(" + first + ", " + second + ")"
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public Object first
The first object in the pair.


second

public Object second
The second object in the pair.

Constructor Detail

Pair

public Pair()
Constructs a new Pair object with both data members set to null.


Pair

public Pair(Object first,
            Object second)
Constructs a new Pair object with the specified two objects.

Method Detail

equals

public boolean equals(Object obj)
Returns true if and only if

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code that is formed from the hash codes of the two objects of this pair. If an object in this pair is null, then its effective hash code as calculated by this method is 0.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a human-readable string representation of this pair of objects, of the form
 "Pair(" + first + ", " + second + ")" 

Overrides:
toString in class Object

Parsing Engine

Author: Dan Bikel.