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

Variable Index

 o MAX_VALUE
The largest value of type Int.
 o MIN_VALUE
The smallest value of type Int.
 o value
The underlying primitive data type.

Constructor Index

 o Int()
Constructs an Int object with a default value of 0.
 o Int(int)
Initializes the underlying int primitive data type.

Method Index

 o hash()
Returns the hash value of this Int object, which is simply the underlying integer value.
 o hash(int)
Returns the hash value of this Int object, based on the given hashtable size.
 o isEqualTo(Comparable)
Returns true if this Int object is equal to the given Comparable argument C, which must be of type Int.
 o isLessThan(Comparable)
Returns true if this Int object is less than the given Comparable argument C, which must be of type Int.
 o isPrime(Int)
The static isPrime() method is used to determine if a given Int object is a prime number.
 o isPrime(int)
The static isPrime() method is used to determine if a given int value is a prime number.
 o toString()
Displays this Int object in the form of a String object.

Variables

 o MIN_VALUE
 public static final int MIN_VALUE
The smallest value of type Int.

 o MAX_VALUE
 public static final int MAX_VALUE
The largest value of type Int.

 o value
 public int value
The underlying primitive data type.

Constructors

 o Int
 public Int(int v)
Initializes the underlying int primitive data type.

Parameters:
v - the initial integer value.
 o Int
 public Int()
Constructs an Int object with a default value of 0.

Methods

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