Package ucar.units

Class BaseQuantity

    • Constructor Detail

      • BaseQuantity

        public BaseQuantity​(String name,
                            String symbol)
                     throws NameException
        Constructs from a name and a symbol.
        Parameters:
        name - Name of the base quantity. Shall be neither null nor empty.
        symbol - Symbol for the base quantity. May be null but shall not be empty.
        Throws:
        NameException - name is null or empty.
      • BaseQuantity

        protected BaseQuantity​(String name,
                               String symbol,
                               boolean trusted)
        Constructs from a name and a symbol. This is the trusted form of the the constructor for use by subclasses only.
        Parameters:
        name - Name of the base quantity. Shall be neither null nor empty.
        symbol - Symbol for the base quantity. May be null but shall not be empty.
    • Method Detail

      • getName

        public String getName()
        Returns the name of the base quantity.
        Returns:
        The name of the base quantity. Shall not be null or empty.
      • getSymbol

        public String getSymbol()
        Returns the symbol of the base quantity.
        Returns:
        The symbol of the base quantity. May be null. If non-null, then shall not be empty.
      • getID

        public final String getID()
        Returns the identifier for the base quantity.
        Specified by:
        getID in interface Base
        Returns:
        The base quantity's identifier (i.e. symbol or name).
      • toString

        public final String toString()
        Returns the string representation of the base quantity.
        Overrides:
        toString in class Object
        Returns:
        The string representation of the base quantity.
      • equals

        public boolean equals​(Object object)
        Indicates if this base quantity is semantically identical to an object.
        Specified by:
        equals in interface Base
        Overrides:
        equals in class Object
        Parameters:
        object - The object to examine.
        Returns:
        true if an only if this base quantity is semantically identical to object.
      • hashCode

        public int hashCode()
        Returns the hash code of this instance.
        Overrides:
        hashCode in class Object
        Returns:
        The hash code of this instance.
      • compareTo

        public int compareTo​(BaseQuantity that)
        Compares this base quantity to another base quantity.
        Specified by:
        compareTo in interface Comparable<BaseQuantity>
        Parameters:
        that - The BaseQuantity to compare against.
        Returns:
        An integer that is negative, zero, or positive depending on whether this BaseQuantity is less than, equal to, or greater than that.
      • isDimensionless

        public abstract boolean isDimensionless()
        Indicates if this base quantity is dimensionless.
        Specified by:
        isDimensionless in interface Base
        Returns:
        true if an only if this BaseQuantity is dimensionless (e.g. BaseQuantity.SOLID_ANGLE).