U
- the unit of the values in the constructor and for displaypublic abstract class Scalar<U extends Unit<U>> extends Number implements Value<U>, Serializable
This file was generated by the djunits value classes generator, 26 jun, 2015
Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
$LastChangedDate: 2019-03-03 00:53:50 +0100 (Sun, 03 Mar 2019) $, @version $Revision: 349 $, by $Author: averbraeck $,
initial version 26 jun, 2015
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
NUMBER_PATTERN
Number pattern regex to be used in valueOf() method.
|
Modifier and Type | Method and Description |
---|---|
double |
expressAsSIUnit(double value)
Convert a value to the standard SI unit.
|
protected double |
expressAsSpecifiedUnit(double value)
Convert a value from the standard SI unit into the unit of this Scalar.
|
U |
getUnit()
Retrieve the unit of this Value.
|
boolean |
isAbsolute()
Indicate whether this is an Absolute Value.
|
boolean |
isRelative()
Indicate whether this is a Relative Value.
|
void |
setDisplayUnit(U newUnit)
Set a new display unit for the value.
|
static <U extends Unit<U>> |
stringOf(Scalar<U> value)
Returns a String representation of the scalar value that can be parsed back into its scalar type.
|
static <U extends Unit<U>> |
stringOfDefaultLocale(Scalar<U> value)
Returns a String representation of the scalar value that can be parsed back into its scalar type.
|
static <U extends Unit<U>> |
textualStringOf(Scalar<U> value)
Returns a String representation of the scalar value that can be parsed back into its scalar type.
|
static <U extends Unit<U>> |
textualStringOfDefaultLocale(Scalar<U> value)
Returns a String representation of the scalar value that can be parsed back into its scalar type.
|
byteValue, doubleValue, floatValue, intValue, longValue, shortValue
protected static final Pattern NUMBER_PATTERN
public Scalar(U unit)
unit
- U; the unit of the new Scalarpublic final U getUnit()
public final double expressAsSIUnit(double value)
expressAsSIUnit
in interface Value<U extends Unit<U>>
value
- double; the value to convert to the standard SI unitprotected final double expressAsSpecifiedUnit(double value)
value
- double; the value to convertpublic void setDisplayUnit(U newUnit)
setDisplayUnit
in interface Value<U extends Unit<U>>
newUnit
- U; the new display unit of this Valuepublic final boolean isAbsolute()
isAbsolute
in interface Value<U extends Unit<U>>
public final boolean isRelative()
isRelative
in interface Value<U extends Unit<U>>
public static <U extends Unit<U>> String stringOf(Scalar<U> value)
U
- the unit type for the scalarvalue
- Scalar<U>; the value to parse into a Stringpublic static <U extends Unit<U>> String stringOfDefaultLocale(Scalar<U> value)
U
- the unit type for the scalarvalue
- Scalar<U>; the value to parse into a Stringpublic static <U extends Unit<U>> String textualStringOf(Scalar<U> value)
U
- the unit type for the scalarvalue
- Scalar<U>; the value to parse into a Stringpublic static <U extends Unit<U>> String textualStringOfDefaultLocale(Scalar<U> value)
U
- the unit type for the scalarvalue
- Scalar<U>; the value to parse into a StringCopyright © 2015–2019 Delft University of Technology. All rights reserved.