Package adams.core

Class UniqueIDs


  • public class UniqueIDs
    extends Object
    Class for creating unique IDs.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • m_Counter

        protected static long m_Counter
        the counter.
      • m_NamedCounter

        protected static NamedCounter m_NamedCounter
        the named counter.
    • Constructor Detail

      • UniqueIDs

        public UniqueIDs()
    • 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