Package adams.core
Class UniqueIDs
- java.lang.Object
-
- adams.core.UniqueIDs
-
public class UniqueIDs extends Object
Class for creating unique IDs.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected static longm_Counterthe counter.protected static NamedCounterm_NamedCounterthe named counter.
-
Constructor Summary
Constructors Constructor Description UniqueIDs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringnext()Creates a new unique ID, using current nanotime, virtual machine PID, counter (within JVM session).static intnextInt(String name)Returns the next ID for the given name.static longnextLong()Returns the next ID from the counter.
-
-
-
Field Detail
-
m_Counter
protected static long m_Counter
the counter.
-
m_NamedCounter
protected static NamedCounter m_NamedCounter
the named counter.
-
-
Method Detail
-
next
public static String next()
Creates a new unique ID, using current nanotime, virtual machine PID, counter (within JVM session).- Returns:
- the generated ID
-
nextLong
public static long nextLong()
Returns the next ID from the counter.- Returns:
- the next ID
-
nextInt
public static int nextInt(String name)
Returns the next ID for the given name.- Parameters:
name- the named ID counter- Returns:
- the next ID
-
-