Class LetterPair

java.lang.Object
  extended by LetterPair

public class LetterPair
extends java.lang.Object

LetterPair is a special kind of string that contains just two alphabetic characters.

Version:
2007.10.28
Author:
J. Dalbey

Constructor Summary
LetterPair()
          Construct an empty LetterPair.
LetterPair(char first, char second)
          Construct a LetterPair from two characters.
LetterPair(java.lang.String letters)
          Construct a LetterPair from a string.
 
Method Summary
 int compareTo(LetterPair val)
          Compares this LetterPair with the provided LetterPair.
 boolean equals(java.lang.Object other)
          Compare two LetterPairs for equality.
 java.lang.String toString()
          Return a string representation of this LetterPair
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LetterPair

public LetterPair()
Construct an empty LetterPair.


LetterPair

public LetterPair(char first,
                  char second)
Construct a LetterPair from two characters.

Parameters:
first - the first character of the pair
second - the second character of the pair

LetterPair

public LetterPair(java.lang.String letters)
Construct a LetterPair from a string.

Parameters:
letters - a String to be assigned to this LetterPair
Method Detail

compareTo

public int compareTo(LetterPair val)
Compares this LetterPair with the provided LetterPair.

Parameters:
val - LetterPair to which this LetterPair is to be compared.
Returns:
-1, 0 or 1 as this LetterPair's count is alphabetically less than, equal to, or greater than val.

equals

public boolean equals(java.lang.Object other)
Compare two LetterPairs for equality. This method is provided to facilitate JUnit testing. Return true if other is equal to this LetterPair.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Return a string representation of this LetterPair

Overrides:
toString in class java.lang.Object