All Packages Class Hierarchy This Package Previous Next Index
Class rpi.goldsd.container.Int
java.lang.Object
|
+----rpi.goldsd.container.Int
- public class Int
- extends Object
- implements Hashable
The Int class provides a wrapper-class for the primitive data
type int that may be used in various associative containers
by implementing the Hashable interface (note that the
Hashable interface is actually an extension of the
Comparable interface). The actual integer value
(the int instance variable) is a public instance variable.
- Version:
- 1.2, 4/16/98
- Author:
- David Goldschmidt
- See Also:
- Comparable, Hashable
-
MAX_VALUE
- The largest value of type Int.
-
MIN_VALUE
- The smallest value of type Int.
-
value
- The underlying primitive data type.
-
Int()
- Constructs an Int object with a default value of 0.
-
Int(int)
- Initializes the underlying int primitive data type.
-
hash()
- Returns the hash value of this Int object, which is simply
the underlying integer value.
-
hash(int)
- Returns the hash value of this Int object, based on the
given hashtable size.
-
isEqualTo(Comparable)
- Returns true if this Int object is equal to the
given Comparable argument C, which must be of
type Int.
-
isLessThan(Comparable)
- Returns true if this Int object is less than the
given Comparable argument C, which must be of type
Int.
-
isPrime(Int)
- The static isPrime() method is used to determine if
a given Int object is a prime number.
-
isPrime(int)
- The static isPrime() method is used to determine if
a given int value is a prime number.
-
toString()
- Displays this Int object in the form of a String
object.
MIN_VALUE
public static final int MIN_VALUE
- The smallest value of type Int.
MAX_VALUE
public static final int MAX_VALUE
- The largest value of type Int.
value
public int value
- The underlying primitive data type.
Int
public Int(int v)
- Initializes the underlying int primitive data type.
- Parameters:
- v - the initial integer value.
Int
public Int()
- Constructs an Int object with a default value of 0.
isEqualTo
public boolean isEqualTo(Comparable C) throws IllegalArgumentException
- Returns true if this Int object is equal to the
given Comparable argument C, which must be of
type Int.
- Parameters:
- C - the right-hand side of the comparison.
- Returns:
- true if this Int object is equal to the
given Int object C; false otherwise.
- Throws: IllegalArgumentException
- if the Comparable argument
is not of type Int.
isLessThan
public boolean isLessThan(Comparable C) throws IllegalArgumentException
- Returns true if this Int object is less than the
given Comparable argument C, which must be of type
Int.
- Parameters:
- C - the right-hand side of the comparison.
- Returns:
- true if this Int object is less than the
given Int object C; false otherwise.
- Throws: IllegalArgumentException
- if the Comparable argument
is not of type Int.
isPrime
public static final boolean isPrime(Int I)
- The static isPrime() method is used to determine if
a given Int object is a prime number.
- Parameters:
- I - the Int object to be tested.
- Returns:
- true if the given Int object is prime;
false otherwise.
isPrime
public static final boolean isPrime(int i)
- The static isPrime() method is used to determine if
a given int value is a prime number.
- Parameters:
- i - the int value to be tested.
- Returns:
- true if the given int value is prime;
false otherwise.
hash
public int hash()
- Returns the hash value of this Int object, which is simply
the underlying integer value. If a more complex hashing function is
required, this method may be overridden.
- Returns:
- the hash value of this Int object.
hash
public int hash(int tableSize)
- Returns the hash value of this Int object, based on the
given hashtable size.
- Parameters:
- tableSize - the size of the hashtable making use of
this Int object.
- Returns:
- the hash value of this Int object.
toString
public String toString()
- Displays this Int object in the form of a String
object. This method simply returns a String representation
of the underlying integer value.
- Returns:
- a String representing this Int object.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index