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.Integer-like class that can be ordered.


Constructor Index

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

Method Index

 o equals(Object)
Determine if two ComparableInts are equal.
 o hashCode()
Generate hashcode associated with ComparableInt.
 o lessThan(Comparable)
Determine the order of two ComparableInts.
 o toString()
Construct a string representation of the comparable integer.
 o value()
Fetch the value of the ComparableInt.

Constructors

 o 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.

Methods

 o lessThan
 public boolean lessThan(Comparable other)
Determine the order of two ComparableInts.

Precondition:
other is a non-null 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.
 o 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
 o 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
 o 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
 o 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