Class IDMap


  • public class IDMap
    extends java.lang.Object
    A utility class to allow lookups of parameter IDs by short flag or long flag. This class is used by DefaultSource in order to populate Defaults objects.
    Author:
    Marty Lamb
    See Also:
    Flagged, DefaultSource, Defaults
    • Constructor Summary

      Constructors 
      Constructor Description
      IDMap​(java.util.List ids, java.util.Map byShortFlag, java.util.Map byLongFlag)
      Creates a new IDMap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getIDByLongFlag​(java.lang.String s)
      Returns the unique ID of the parameter with the specified long flag, or null if the specified long flag is not defined in this IDMap.
      java.lang.String getIDByShortFlag​(char c)
      Returns the unique ID of the parameter with the specified short flag, or null if the specified short flag is not defined in this IDMap.
      java.lang.String getIDByShortFlag​(java.lang.Character c)
      Returns the unique ID of the parameter with the specified short flag, or null if the specified short flag is not defined in this IDMap.
      boolean idExists​(java.lang.String id)
      Returns true if the specified ID is stored in this IDMap, false if not.
      java.util.Iterator idIterator()
      Returns an Iterator over all parameter IDs stored in this IDMap.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IDMap

        public IDMap​(java.util.List ids,
                     java.util.Map byShortFlag,
                     java.util.Map byLongFlag)
        Creates a new IDMap.
        Parameters:
        ids - a List of the unique IDs of all the parameters to store in this IDMap.
        byShortFlag - a Map with keys equal to the short flags of the parameters (as Character objects), and values equal to the unique IDs of the parameters associated with those short flags.
        byLongFlag - a Map with keys equal to the long flags of the parameters (as Strings), and values equal to the unique IDs of the parameters associated with those short flags.
    • Method Detail

      • idIterator

        public java.util.Iterator idIterator()
        Returns an Iterator over all parameter IDs stored in this IDMap.
        Returns:
        an Iterator over all parameter IDs stored in this IDMap.
        See Also:
        Iterator
      • idExists

        public boolean idExists​(java.lang.String id)
        Returns true if the specified ID is stored in this IDMap, false if not.
        Parameters:
        id - the id to search for in this IDMap
        Returns:
        true if the specified ID is stored in this IDMap, false if not.
      • getIDByShortFlag

        public java.lang.String getIDByShortFlag​(java.lang.Character c)
        Returns the unique ID of the parameter with the specified short flag, or null if the specified short flag is not defined in this IDMap.
        Parameters:
        c - the short flag to search for in this IDMap.
        Returns:
        the unique ID of the parameter with the specified short flag, or null if the specified short flag is not defined in this IDMap.
      • getIDByShortFlag

        public java.lang.String getIDByShortFlag​(char c)
        Returns the unique ID of the parameter with the specified short flag, or null if the specified short flag is not defined in this IDMap.
        Parameters:
        c - the short flag to search for in this IDMap.
        Returns:
        the unique ID of the parameter with the specified short flag, or null if the specified short flag is not defined in this IDMap.
      • getIDByLongFlag

        public java.lang.String getIDByLongFlag​(java.lang.String s)
        Returns the unique ID of the parameter with the specified long flag, or null if the specified long flag is not defined in this IDMap.
        Parameters:
        s - the long flag to search for in this IDMap.
        Returns:
        the unique ID of the parameter with the specified long flag, or null if the specified long flag is not defined in this IDMap.