Package ucar.units

Class PrefixDBImpl

    • Constructor Detail

      • PrefixDBImpl

        public PrefixDBImpl()
        Constructs from nothing.
    • Method Detail

      • addName

        public void addName​(String name,
                            double value)
                     throws PrefixExistsException
        Adds a prefix to the database by name.
        Specified by:
        addName in interface PrefixDB
        Parameters:
        name - The name of the prefix to be added.
        value - The value of the prefix.
        Throws:
        PrefixExistsException - Another prefix with the same name or value already exists in the database.
      • addSymbol

        public void addSymbol​(String symbol,
                              double value)
                       throws PrefixExistsException
        Adds a prefix symbol to the database.
        Specified by:
        addSymbol in interface PrefixDB
        Parameters:
        symbol - The symbol of the prefix to be added.
        value - The value of the prefix.
        Throws:
        PrefixExistsException - Another prefix with the same symbol or value already exists in the database.
      • getPrefixByName

        public Prefix getPrefixByName​(String string)
        Gets a prefix by name.
        Specified by:
        getPrefixByName in interface PrefixDB
        Parameters:
        string - The name to be matched.
        Returns:
        The prefix whose name matches or null.
      • getPrefixBySymbol

        public Prefix getPrefixBySymbol​(String string)
        Gets a prefix by symbol.
        Specified by:
        getPrefixBySymbol in interface PrefixDB
        Parameters:
        string - The symbol to be matched.
        Returns:
        The prefix whose symbol matches or null.
      • getPrefixByValue

        public Prefix getPrefixByValue​(double value)
        Gets a prefix by value.
        Specified by:
        getPrefixByValue in interface PrefixDB
        Parameters:
        value - The value to be matched.
        Returns:
        The prefix whose value matches or null.
      • toString

        public String toString()
        Returns a string representation of this database.
        Specified by:
        toString in interface PrefixDB
        Overrides:
        toString in class Object
        Returns:
        A string representation of this database.
      • iterator

        public Iterator<Prefix> iterator()
        Gets an iterator over the prefixes in the database.
        Specified by:
        iterator in interface PrefixDB
        Returns:
        An iterator over the entries in the database. The objects returned by the iterator will be of type Prefix.