Package adams.data.id

Class AbstractIDGenerator<T>

    • Constructor Detail

      • AbstractIDGenerator

        public AbstractIDGenerator()
    • Method Detail

      • check

        protected void check​(Object o)
        For performing checks on the provided data. If data doesn't pass the check then just throw an IllegalStateException.

        Default implementation does nothing.
        Parameters:
        o - the object to check
      • assemble

        protected abstract String assemble​(Object o)
        Generates the actual ID.
        Parameters:
        o - the object to generate the ID for
        Returns:
        the generated ID
      • postProcess

        protected String postProcess​(String id)
        For post-processing the ID.

        The default implementation does nothing.
        Parameters:
        id - the ID to post-process
        Returns:
        the post-processed id
        See Also:
        #m_MakeFilename
      • generate

        public String generate​(Object o)
        Generates the ID.
        Parameters:
        o - the object to generate the ID for
        Returns:
        the generated ID
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

        Only compares the commandlines of the two objects.
        Specified by:
        compareTo in interface Comparable<T>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.

        Only compares the commandlines of the two objects.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one
      • shallowCopy

        public AbstractIDGenerator shallowCopy​(boolean expand)
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Specified by:
        shallowCopy in interface ShallowCopySupporter<T>
        Parameters:
        expand - whether to expand variables to their current values
        Returns:
        the shallow copy