All Packages Class Hierarchy This Package Previous Next Index
Class structure.ComparableInt
java.lang.Object

+structure.ComparableInt
 public class ComparableInt
 extends Object
 implements Comparable
A java.lang.Integerlike class that can be ordered.

ComparableInt(int)
 Construct a integer wrapper that can be compared.

equals(Object)
 Determine if two ComparableInts are equal.

hashCode()
 Generate hashcode associated with ComparableInt.

lessThan(Comparable)
 Determine the order of two ComparableInts.

toString()
 Construct a string representation of the comparable integer.

value()
 Fetch the value of the ComparableInt.
ComparableInt
public ComparableInt(int x)
 Construct a integer wrapper that can be compared.
 Postcondition:
 construct an integer object that may be compared.
 Parameters:
 x  The integer.
lessThan
public boolean lessThan(Comparable other)
 Determine the order of two ComparableInts.
 Precondition:
 other is a nonnull ComparableInt
 Postcondition:
 returns true iff the value of other is less than this
 Parameters:
 other  The other ComparableInt
 Returns:
 True if this is less than the other ComparableInt.
equals
public boolean equals(Object other)
 Determine if two ComparableInts are equal.
 Precondition:
 other is a ComparableInt
 Postcondition:
 returns true iff other is logically equal
 Parameters:
 other  The other ComparableInt
 Returns:
 True if both integers are equal.
 Overrides:
 equals in class Object
hashCode
public int hashCode()
 Generate hashcode associated with ComparableInt.
 Postcondition:
 return hashcode associated with underlying Integer.
 Returns:
 The hashcode associated with the contained integer.
 Overrides:
 hashCode in class Object
toString
public String toString()
 Construct a string representation of the comparable integer.
 Postcondition:
 return string representation of the contained integer.
 Returns:
 The string representing the ComparableInt.
 Overrides:
 toString in class Object
value
public int value()
 Fetch the value of the ComparableInt.
 Postcondition:
 returns the value associated with this object
 Returns:
 The integer contained within the ComparableInt
All Packages Class Hierarchy This Package Previous Next Index