Package org.sim0mq.message.types
Class NumberTime
- java.lang.Object
-
- java.lang.Number
-
- org.sim0mq.message.types.NumberTime
-
- All Implemented Interfaces:
Serializable
public class NumberTime extends Number implements Serializable
Wrapper for a Number or float/double with Unit of type Time. Store it internally as a Number or as a DoubleScalar, or as a FloatScalar and have methods to retrieve it in different ways.Copyright (c) 2016-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Apr 24, 2017
BSD-style license. See Sim0MQ License.- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NumberTime(Number time)
Create a time from a Number.NumberTime(Time time)
Create a time from a DoubleScalar Time type.NumberTime(FloatTime time)
Create a time from a FloatScalar FloatTime type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
doubleValue()
float
floatValue()
FloatTime
getFloatTime()
Number
getNumber()
Object
getObject()
Return the NumberTime as an object, e.g., for serializing.Time
getTime()
static NumberTime
instantiate(Object value)
Instantiate a NumberTime based on a value.int
intValue()
long
longValue()
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Constructor Detail
-
NumberTime
public NumberTime(Number time)
Create a time from a Number.- Parameters:
time
- the time as a Number.
-
NumberTime
public NumberTime(Time time)
Create a time from a DoubleScalar Time type.- Parameters:
time
- the time as a DoubleScalar Time.
-
NumberTime
public NumberTime(FloatTime time)
Create a time from a FloatScalar FloatTime type.- Parameters:
time
- the time as a FloatScalar FloatTime.
-
-
Method Detail
-
instantiate
public static NumberTime instantiate(Object value) throws Sim0MQException
Instantiate a NumberTime based on a value.- Parameters:
value
- the value that can be Time, FloatTime, or Number- Returns:
- an instantiation of NumberTime
- Throws:
Sim0MQException
- if the value is neither Time, FloatTime, nor Number
-
floatValue
public float floatValue()
- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in classNumber
-
getObject
public Object getObject()
Return the NumberTime as an object, e.g., for serializing.- Returns:
- NumberTime as an object
-
getNumber
public Number getNumber()
- Returns:
- the time as a Number
-
getTime
public Time getTime()
- Returns:
- the time as a djunits Time type
-
getFloatTime
public FloatTime getFloatTime()
- Returns:
- the time as a djunits FloatTime type
-
-