de.jface.remind.core
Class UniqueNumber

java.lang.Object
  |
  +--de.jface.remind.core.UniqueNumber
All Implemented Interfaces:
java.lang.Comparable

public class UniqueNumber
extends java.lang.Object
implements java.lang.Comparable

Version:
$Revision: 1.1 $
Author:
Moritz Petersen

Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
static UniqueNumber getInstance(long uniqueNumber)
          Returns an existing instance of UniqueNumber or null if no instance with the given uniqueNumber exists.
 int hashCode()
           
 long longValue()
          Returns the value of the UniqueNumber as long.
static UniqueNumber newInstance()
          Creates a new UniqueNumber instance.
static UniqueNumber newInstance(long uniqueNumber)
          Returns a new instance with the given uniqueNumber.
static UniqueNumber newInstance(long uniqueNumber, boolean allowModify)
          Returns a new instance with the given uniqueNumber.
static void reset()
          Used to reset the internal counters and instance list.
 java.lang.String toString()
          Returns the String representation of the UniqueNumber.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

newInstance

public static UniqueNumber newInstance()
Creates a new UniqueNumber instance.
Throws:
java.lang.RuntimeException - if the creation of the new UniqueNumber fails.

newInstance

public static UniqueNumber newInstance(long uniqueNumber)
                                throws IllegalUniqueNumberException
Returns a new instance with the given uniqueNumber. If the uniqueNumber already exists, a new instance with a new uniqueNumber is created.

newInstance

public static UniqueNumber newInstance(long uniqueNumber,
                                       boolean allowModify)
                                throws IllegalUniqueNumberException
Returns a new instance with the given uniqueNumber. If the uniqueNumber already exists, the IllegalUniqueNumberException is thrown, depending on the allowModify flag. If the flag is true, the Exception is not thrown.

getInstance

public static UniqueNumber getInstance(long uniqueNumber)
Returns an existing instance of UniqueNumber or null if no instance with the given uniqueNumber exists.

longValue

public long longValue()
Returns the value of the UniqueNumber as long.

reset

public static void reset()
Used to reset the internal counters and instance list. After resetting it is possible to get duplicate instances.

toString

public java.lang.String toString()
Returns the String representation of the UniqueNumber.
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable


Copyright © 2002-2002 Moritz Petersen. All Rights Reserved.