Parsing Engine

danbikel.util
Class IntPair

java.lang.Object
  extended by danbikel.util.IntPair
All Implemented Interfaces:
Externalizable, Serializable

public class IntPair
extends Object
implements Externalizable

A simple class to contain two integers.

See Also:
Serialized Form

Constructor Summary
IntPair()
          Constructs a new IntPair object with both integers equal to 0.
IntPair(int first, int second)
          Constructs a new IntPair containing the specified integers.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the specified object is an instance of an IntPair whose corresponding two integers are equal to this IntPair's two integers.
 int first()
          Returns the first integer in this integer pair.
 int hashCode()
          Returns the hash code for this integer pair, which is defined to be 31 * first + second where first and second are the two integers of this integer pair.
 void readExternal(ObjectInput in)
           
 int second()
          Returns the second integer in this integer pair.
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntPair

public IntPair()
Constructs a new IntPair object with both integers equal to 0.


IntPair

public IntPair(int first,
               int second)
Constructs a new IntPair containing the specified integers.

Method Detail

first

public int first()
Returns the first integer in this integer pair.


second

public int second()
Returns the second integer in this integer pair.


equals

public boolean equals(Object obj)
Returns true if the specified object is an instance of an IntPair whose corresponding two integers are equal to this IntPair's two integers.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns the hash code for this integer pair, which is defined to be
31 * first + second
where first and second are the two integers of this integer pair.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

Parsing Engine

Author: Dan Bikel.