Class UnitParameter<Q extends javax.measure.quantity.Quantity,​E extends UnitParameter>

  • Type Parameters:
    Q - The unit Quantity type.
    E - The unit parameter sub-type.
    All Implemented Interfaces:
    DataElement, java.lang.Comparable<DataElement>, javolution.lang.Immutable, javolution.lang.ValueType
    Direct Known Subclasses:
    ArrayParam, ScalarParam

    public abstract class UnitParameter<Q extends javax.measure.quantity.Quantity,​E extends UnitParameter>
    extends DataParam
    implements javolution.lang.ValueType
    A class that represents a parameter in a case that has units associated with it.

    Modified by: Joseph A. Huwaldt

    Version:
    March 18, 2017
    Author:
    Joseph A. Huwaldt, Date: March 5, 2003
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract <R extends javax.measure.quantity.Quantity>
      E
      changeTo​(javax.measure.unit.Unit<R> unit)
      Returns the parameter that has the same values as this parameter but with the units changed (without converting the values).
      boolean equals​(java.lang.Object obj)
      Compares the specified object with this parameter for strict equality same value, same units, same name, same user data.
      javax.measure.unit.Unit<Q> getUnit()
      Returns the unit in which the value is stated.
      int hashCode()
      Returns the hash code for this UnitParameter.
      abstract E to​(javax.measure.unit.Unit<Q> unit)
      Returns the parameter equivalent to this parameter but stated in the specified unit.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface javolution.lang.ValueType

        copy
    • Method Detail

      • getUnit

        public javax.measure.unit.Unit<QgetUnit()
        Returns the unit in which the value is stated.
        Returns:
        the parameter unit.
      • to

        public abstract E to​(javax.measure.unit.Unit<Q> unit)
                      throws javax.measure.converter.ConversionException
        Returns the parameter equivalent to this parameter but stated in the specified unit.
        Parameters:
        unit - the unit of the parameter to be returned.
        Returns:
        a parameter equivalent to this parameter but stated in the specified unit.
        Throws:
        javax.measure.converter.ConversionException - if the current model does not allows for conversion to the specified unit.
      • changeTo

        public abstract <R extends javax.measure.quantity.Quantity> E changeTo​(javax.measure.unit.Unit<R> unit)
                                                                        throws javax.measure.converter.ConversionException
        Returns the parameter that has the same values as this parameter but with the units changed (without converting the values).
        Type Parameters:
        R - The unit of measure type (or Quantity) for the input units.
        Parameters:
        unit - the unit of the parameter to be returned.
        Returns:
        a parameter equivalent to this parameter but stated in the specified unit.
        Throws:
        javax.measure.converter.ConversionException - if the current model does not allows for conversion to the specified unit.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares the specified object with this parameter for strict equality same value, same units, same name, same user data.
        Overrides:
        equals in class DataParam
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this parameter is identical to that parameter; false otherwise.
      • hashCode

        public int hashCode()
        Returns the hash code for this UnitParameter.
        Overrides:
        hashCode in class DataParam
        Returns:
        the hash code value.