Class Unit

    • Constructor Detail

      • Unit

        public Unit()
        Constructor
      • Unit

        public Unit​(UnitType type,
                    String name)
        Constructor
        Parameters:
        type - unit type
        name - name
      • Unit

        public Unit​(UnitType type,
                    String name,
                    double conversionFactor)
        Constructor
        Parameters:
        type - unit type
        name - name
        conversionFactor - conversion factor
      • Unit

        public Unit​(UnitType type,
                    String name,
                    String conversionFactor)
        Constructor
        Parameters:
        type - unit type
        name - name
        conversionFactor - conversion factor
        Since:
        1.1.0
    • Method Detail

      • getType

        public UnitType getType()
        Get the unit type
        Returns:
        unit type
      • setType

        public void setType​(UnitType type)
        Set the unit type
        Parameters:
        type - unit type
      • getName

        public String getName()
        Get the name
        Returns:
        name
      • setName

        public void setName​(String name)
        Set the name
        Parameters:
        name - name
      • getConversionFactor

        public Double getConversionFactor()
        Get the conversion factor
        Returns:
        conversion factor
      • getConversionFactorText

        public String getConversionFactorText()
        Get the conversion factor text
        Returns:
        conversion factor text
        Since:
        1.1.0
      • hasConversionFactor

        public boolean hasConversionFactor()
        Has a conversion factor
        Returns:
        true if has conversion factor
      • setConversionFactor

        public void setConversionFactor​(Double conversionFactor)
        Set the conversion factor
        Parameters:
        conversionFactor - conversion factor
      • setConversionFactor

        public void setConversionFactor​(String conversionFactor)
        Set the conversion factor
        Parameters:
        conversionFactor - conversion factor
        Since:
        1.1.0
      • hasIdentifiers

        public boolean hasIdentifiers()
        Has identifiers
        Specified by:
        hasIdentifiers in interface Identifiable
        Returns:
        true if has identifiers
      • numIdentifiers

        public int numIdentifiers()
        Number of identifiers
        Specified by:
        numIdentifiers in interface Identifiable
        Returns:
        identifiers count
      • getIdentifier

        public Identifier getIdentifier​(int index)
        Get the identifier at the index
        Specified by:
        getIdentifier in interface Identifiable
        Parameters:
        index - identifier index
        Returns:
        identifier
      • addIdentifier

        public void addIdentifier​(Identifier identifier)
        Add the identifier
        Specified by:
        addIdentifier in interface Identifiable
        Parameters:
        identifier - identifier
      • equalsName

        public boolean equalsName​(Unit unit)
        Determine if the unit names are equal, ignoring case
        Parameters:
        unit - unit
        Returns:
        true if equal names
        Since:
        1.1.0
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object