Class ScalarParam<Q extends javax.measure.quantity.Quantity>

  • Type Parameters:
    Q - Unit quantity type.
    All Implemented Interfaces:
    DataElement, java.lang.Comparable<DataElement>, javolution.lang.Immutable, javolution.lang.ValueType

    public final class ScalarParam<Q extends javax.measure.quantity.Quantity>
    extends UnitParameter<Q,​ScalarParam>
    A class that represents a scalar data value in a case.

    Modified by: Joseph A. Huwaldt

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <R extends javax.measure.quantity.Quantity>
      ScalarParam<R>
      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).
      ScalarParam<Q> copy()
      Returns a copy of this parameter allocated by the calling thread (possibly on the stack).
      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.
      double getValue()
      Returns the value for this parameter stated in this parameter's unit.
      double getValueSI()
      Return the value of this parameter in reference SI units.
      int hashCode()
      Returns the hash code for this UnitParameter.
      static void recycle​(ScalarParam instance)
      Recycles a parameter instance immediately (on the stack when executing in a StackContext).
      ScalarParam<Q> to​(javax.measure.unit.Unit<Q> unit)
      Returns the parameter equivalent to this parameter but stated in the specified unit.
      java.lang.String toString()
      Create a String representation of this parameter which consists of the parameter's name + value + units.
      javolution.text.Text toText()
      Create a Text representation of this parameter which consists of the parameter's name, value and unit.
      static <Q extends javax.measure.quantity.Quantity>
      ScalarParam<Q>
      valueOf​(java.lang.CharSequence name, double value, javax.measure.unit.Unit<Q> unit)
      Returns a scalar with the specified name, value and units.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • copy

        public ScalarParam<Qcopy()
        Returns a copy of this parameter allocated by the calling thread (possibly on the stack).
        Returns:
        an identical and independent copy of this parameter.
      • recycle

        public static void recycle​(ScalarParam instance)
        Recycles a parameter instance immediately (on the stack when executing in a StackContext).
        Parameters:
        instance - The instance to be recycled immediately.
      • valueOf

        public static <Q extends javax.measure.quantity.Quantity> ScalarParam<Q> valueOf​(java.lang.CharSequence name,
                                                                                         double value,
                                                                                         javax.measure.unit.Unit<Q> unit)
        Returns a scalar with the specified name, value and units.
        Type Parameters:
        Q - The unit quantity type for this parameter.
        Parameters:
        name - The name of the parameter (may not be null).
        value - The value to assign to this scalar in the specified units.
        unit - The units for this scalar (may not be null).
        Returns:
        A new scalar with the specified value and units.
      • to

        public ScalarParam<Qto​(javax.measure.unit.Unit<Q> unit)
                          throws javax.measure.converter.ConversionException
        Returns the parameter equivalent to this parameter but stated in the specified unit.
        Specified by:
        to in class UnitParameter<Q extends javax.measure.quantity.Quantity,​ScalarParam>
        Parameters:
        unit - The unit of the parameter to be returned (may not be null).
        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 <R extends javax.measure.quantity.Quantity> ScalarParam<R> 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).
        Specified by:
        changeTo in class UnitParameter<Q extends javax.measure.quantity.Quantity,​ScalarParam>
        Type Parameters:
        R - The unit of measure type (or Quantity) for the input units.
        Parameters:
        unit - The unit of the parameter to be returned (may not be null).
        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.
      • getValueSI

        public double getValueSI()
        Return the value of this parameter in reference SI units.
        Returns:
        The value of this parameter in reference SI units.
      • getValue

        public double getValue()
        Returns the value for this parameter stated in this parameter's unit.
        Returns:
        the value of the parameter.
      • 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 UnitParameter<Q extends javax.measure.quantity.Quantity,​ScalarParam>
        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 UnitParameter<Q extends javax.measure.quantity.Quantity,​ScalarParam>
        Returns:
        the hash code value.
      • toText

        public javolution.text.Text toText()
        Create a Text representation of this parameter which consists of the parameter's name, value and unit.
        Overrides:
        toText in class DataParam
        Returns:
        The Text representation of this parameter.
      • toString

        public java.lang.String toString()
        Create a String representation of this parameter which consists of the parameter's name + value + units.
        Overrides:
        toString in class DataParam
        Returns:
        A String representation of this parameter.