Package jahuwaldt.js.datareader
Class ScalarParam<Q extends javax.measure.quantity.Quantity>
- java.lang.Object
-
- jahuwaldt.js.datareader.DataParam
-
- jahuwaldt.js.datareader.UnitParameter<Q,ScalarParam>
-
- jahuwaldt.js.datareader.ScalarParam<Q>
-
- 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
-
-
Field Summary
-
Fields inherited from interface jahuwaldt.js.datareader.DataElement
RESOURCES
-
-
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 parameterallocated
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'sunit
.double
getValueSI()
Return the value of this parameter in reference SI units.int
hashCode()
Returns the hash code for thisUnitParameter
.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 jahuwaldt.js.datareader.UnitParameter
getUnit
-
Methods inherited from class jahuwaldt.js.datareader.DataParam
compareTo, getName, getUserObject, setName, setUserObject
-
-
-
-
Method Detail
-
copy
public ScalarParam<Q> copy()
Returns a copy of this parameterallocated
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<Q> 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.- Specified by:
to
in classUnitParameter<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 classUnitParameter<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'sunit
.- 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 classUnitParameter<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 thisUnitParameter
.- Overrides:
hashCode
in classUnitParameter<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.
-
-