Package org.djunits.value
Class AbstractScalar<U extends Unit<U>,S extends Scalar<U,S>>
- java.lang.Object
-
- java.lang.Number
-
- org.djunits.value.AbstractScalar<U,S>
-
- Type Parameters:
U
- the Unit of the value(s) in this AbstractScalar. Used for setting, getting and displaying the value(s)S
- the scalar type for this unit
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<S>
,Scalar<U,S>
,ValueFunctions<U,S>
,Value<U,S>
- Direct Known Subclasses:
AbstractDoubleScalar
,AbstractFloatScalar
public abstract class AbstractScalar<U extends Unit<U>,S extends Scalar<U,S>> extends Number implements Scalar<U,S>, Serializable
AbstractScalar is a class to help construct Scalar classes. In contrast with AbstractScalar, it extends Number.Copyright (c) 2015-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.djunits.value.base.Scalar
Scalar.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends Scalar.Abs<AU,A,RU,R>,RU extends Unit<RU>,R extends Scalar.RelWithAbs<AU,A,RU,R>>, Scalar.Rel<U extends Unit<U>,R extends Scalar.Rel<U,R>>, Scalar.RelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends Scalar.Abs<AU,A,RU,R>,RU extends Unit<RU>,R extends Scalar.RelWithAbs<AU,A,RU,R>>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractScalar(U displayUnit)
Construct a new AbstractScalar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description U
getDisplayUnit()
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.-
Methods inherited from class java.lang.Number
byteValue, doubleValue, floatValue, intValue, longValue, shortValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.djunits.value.base.Scalar
eq, eq0, format, format, ge, ge0, gt, gt0, le, le0, lt, lt0, ne, ne0, toDisplayString, toDisplayString, toTextualString, toTextualString
-
-
-
-
Constructor Detail
-
AbstractScalar
protected AbstractScalar(U displayUnit)
Construct a new AbstractScalar.- Parameters:
displayUnit
- U; the unit of the new AbstractScalar
-
-
Method Detail
-
getDisplayUnit
public final U getDisplayUnit()
Retrieve the unit of this Value.
-
setDisplayUnit
public void setDisplayUnit(U newUnit)
Set a new display unit for the value. Internally, the value will stay stored in the default or SI unit.
-
isAbsolute
public final boolean isAbsolute()
Indicate whether this is an Absolute Value.
-
-