model
Class ID

java.lang.Object
  extended by model.ID
All Implemented Interfaces:
java.lang.Comparable<java.lang.Object>

public class ID
extends java.lang.Object
implements java.lang.Comparable<java.lang.Object>

Class for IDs used in Entry, Tournament and Discount objects.


Field Summary
private  long id_number
           
 
Constructor Summary
ID(long id_str)
          Overloaded constructor.
ID(java.lang.String id_str)
          Overloaded constructor
 
Method Summary
 int compareTo(java.lang.Object other)
          The compareTo method is overridden so that ID objects can be sorted based on their id numbers.
 boolean equals(java.lang.Object other)
          Checks whether one ID object is equal to another.
 long getIdNumber()
          Returns id number.
 int hashCode()
          Methods hashCode and equals are overridden in order to be able to use ID objects as keys in hashMap objects.
 java.lang.String toString()
          Method returns a string representation of the ID object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id_number

private final transient long id_number
Constructor Detail

ID

public ID(java.lang.String id_str)
Overloaded constructor

Parameters:
id_str - discount id

ID

public ID(long id_str)
Overloaded constructor.

Parameters:
id_str - discount id
Method Detail

getIdNumber

public long getIdNumber()
Returns id number.

Returns:
id number

equals

public boolean equals(java.lang.Object other)
Checks whether one ID object is equal to another.

Overrides:
equals in class java.lang.Object
Parameters:
other - ID instance to compare to
Returns:
true if both have the same id number, otherwise false.

hashCode

public int hashCode()
Methods hashCode and equals are overridden in order to be able to use ID objects as keys in hashMap objects.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Method returns a string representation of the ID object

Overrides:
toString in class java.lang.Object
Returns:
the id number of the ID object as a string

compareTo

public int compareTo(java.lang.Object other)
The compareTo method is overridden so that ID objects can be sorted based on their id numbers.

Specified by:
compareTo in interface java.lang.Comparable<java.lang.Object>