Class DataAlias

java.lang.Object
ucar.unidata.data.DataAlias
All Implemented Interfaces:
Comparable

public class DataAlias extends Object implements Comparable
This class manages a set of data aliases - a mapping between canonical names and a list of aliases for the canonical name. This class is not instantiated - rather it provides a set of static methods. It is initialized by the IDV with an XmlResourceCollection that holds a set of aliases.xml files. The xml looks like:
 <aliases>
 <alias name="TEMP"     label="Temperature"   aliases="T,t,Temperature,tdry" />
 ...
 </aliases>
 </pre>
 Each alias tag holds a name (the canonical name), a label and a comma
 separated list of aliases for the name.
Version:
$Revision: 1.39 $
Author:
IDV development team
  • Field Details

  • Constructor Details

    • DataAlias

      public DataAlias(String name, String label)
      Construct a new DataAlias with the given name and label.
      Parameters:
      name - name of this DataAlias
      label - label of this DataAlias. Used for displaying a "nice" string for this DataAlias.
  • Method Details

    • addAlias

      protected void addAlias(String alias)
      Add an alias for this object.
      Parameters:
      alias - alias to add.
    • addAliases

      protected void addAliases(List l)
      Add alist of aliases to this DataAlias
      Parameters:
      l - List of names (String-s)
    • hashCode

      public int hashCode()
      Override of hashCode method.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode
    • equals

      public boolean equals(Object o)
      See if o is equal to this.
      Overrides:
      equals in class Object
      Parameters:
      o - object in question
      Returns:
      true if o is a DataAlias and they have the same name.
    • setName

      public void setName(String value)
      Set the name of this DataAlias
      Parameters:
      value - new name.
    • getName

      public String getName()
      Get the name of this DataAlias
      Returns:
      name of this.
    • setLabel

      public void setLabel(String value)
      Set the label of this DataAlias
      Parameters:
      value - new label.
    • getLabel

      public String getLabel()
      Get the label of this DataAlias
      Returns:
      label.
    • getAliases

      public List getAliases()
      Get aliases for the name of this DataAlias
      Returns:
      List of names.
    • createDataAliases

      public static List createDataAliases(Element root)
      Process the given xml and return a list of DataAlias objects defined within the xml.
      Parameters:
      root - root element of the XML
      Returns:
      A list of DataAlias objects
    • compareTo

      public int compareTo(Object o)
      _more_
      Specified by:
      compareTo in interface Comparable
      Parameters:
      o - _more_
      Returns:
      _more_
    • reInit

      public static void reInit(XmlResourceCollection resources)
      Reinitialize the data structures and reprocess the xml. This is called by the AliasEditor when aliases have been changed.
      Parameters:
      resources - collection of XML resources
    • init

      public static void init(XmlResourceCollection resources)
      Initialize the DataAlias-es with the given collection of xml resources, XmlResourceCollection
      Parameters:
      resources - collection of XML resources
    • getDataAliasList

      public static List getDataAliasList()
      Return the list of canonical names (String-s)
      Returns:
      List of names
    • getLabelIdList

      public static List getLabelIdList()
      Return the list of name/label pairs (TwoFacedObject-s)
      Returns:
      List of names
    • aliasToCanonical

      public static String aliasToCanonical(String paramName)
      Return the canonical name for the given alias.
      Parameters:
      paramName - alias to look for
      Returns:
      name of DataAlias corresponding to name or null if no match is found.
    • getAliasesOf

      public static List getAliasesOf(String paramName)
      Return the list of aliases (Strings) for the given canonical.
      Parameters:
      paramName - canonical name (name) to look for
      Returns:
      List of aliases for the canonical name.
    • findAlias

      public static DataAlias findAlias(String paramName)
      Return the DataAlias object the given canonical name.
      Parameters:
      paramName - alias to look for
      Returns:
      The DataAlias corresponding to name or null if no match is found.
    • toString

      public String toString()
      Returns a string representation of this DataAlias.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the DataAlias.