Class AbstractFloatScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
java.lang.Object
java.lang.Number
org.djunits.value.AbstractScalar<U,S>
org.djunits.value.vfloat.scalar.base.AbstractFloatScalar<U,S>
- Type Parameters:
U
- the unitS
- the type
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<S>
,Scalar<U,S>
,ValueFunctions<U,S>
,Value<U,S>
,FloatScalarInterface<U,S>
- Direct Known Subclasses:
AbstractFloatScalarAbs
,AbstractFloatScalarRel
public abstract class AbstractFloatScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>> extends AbstractScalar<U,S> implements FloatScalarInterface<U,S>
The most basic abstract class for the FloatScalar.
Copyright (c) 2013-2020 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.vfloat.scalar.base.FloatScalarInterface
FloatScalarInterface.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends FloatScalarInterface.Abs<AU,A,RU,R>,RU extends Unit<RU>,R extends FloatScalarInterface.RelWithAbs<AU,A,RU,R>>, FloatScalarInterface.Rel<U extends Unit<U>,R extends FloatScalarInterface.Rel<U,R>>, FloatScalarInterface.RelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends FloatScalarInterface.Abs<AU,A,RU,R>,RU extends Unit<RU>,R extends FloatScalarInterface.RelWithAbs<AU,A,RU,R>>
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>>
-
Field Summary
Fields Modifier and Type Field Description float
si
The value, stored in the standard SI unit. -
Constructor Summary
Constructors Constructor Description AbstractFloatScalar(U unit, float si)
Construct a new AbstractFloatScalar. -
Method Summary
Modifier and Type Method Description int
compareTo(S o)
double
doubleValue()
boolean
eq(S o)
Test if this DoubleScalar is equal to a DoubleScalar.boolean
eq0()
Test if this DoubleScalar is equal to 0.0.boolean
equals(Object obj)
float
floatValue()
boolean
ge(S o)
Test if this DoubleScalar is greater than a DoubleScalar.boolean
ge0()
Test if this DoubleScalar is greater than 0.0.float
getInUnit()
Retrieve the value in the original unit.float
getInUnit(U targetUnit)
Retrieve the value converted into some specified unit.float
getSI()
Retrieve the value in the underlying SI unit.boolean
gt(S o)
Test if this DoubleScalar is greater than or equal to a DoubleScalar.boolean
gt0()
Test if this DoubleScalar is greater than or equal to 0.0.int
hashCode()
int
intValue()
boolean
le(S o)
Test if this DoubleScalar is less than or equal to another DoubleScalar.boolean
le0()
Test if this DoubleScalar is less than or equal to 0.0.long
longValue()
boolean
lt(S o)
Test if this DoubleScalar is less than another DoubleScalar.boolean
lt0()
Test if this DoubleScalar is less than 0.0.boolean
ne(S o)
Test if this DoubleScalar is not equal to a DoubleScalar.boolean
ne0()
Test if this DoubleScalar is not equal to 0.0.String
toDisplayString()
Concise display description of this value, without the engineering formatting, so without trailing zeroes.String
toDisplayString(U displayUnit)
Concise display description of this value, without the engineering formatting, so without trailing zeroes.String
toString()
Concise description of this value.String
toString(boolean verbose, boolean withUnit)
Somewhat verbose description of this value with optional type and unit information.String
toString(U displayUnit)
Somewhat verbose description of this value with the values expressed in the specified unit.String
toString(U displayUnit, boolean verbose, boolean withUnit)
Somewhat verbose description of this value with the values expressed in the specified unit.String
toTextualString()
Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.String
toTextualString(U displayUnit)
Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.Methods inherited from class org.djunits.value.AbstractScalar
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit
-
Field Details
-
si
public final float siThe value, stored in the standard SI unit.
-
-
Constructor Details
-
AbstractFloatScalar
AbstractFloatScalar(U unit, float si)Construct a new AbstractFloatScalar.- Parameters:
unit
- U; the unitsi
- float; the si value to store
-
-
Method Details
-
getSI
public final float getSI()Retrieve the value in the underlying SI unit.- Specified by:
getSI
in interfaceFloatScalarInterface<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Returns:
- float
-
getInUnit
public final float getInUnit()Retrieve the value in the original unit.- Specified by:
getInUnit
in interfaceFloatScalarInterface<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Returns:
- float
-
getInUnit
Retrieve the value converted into some specified unit.- Specified by:
getInUnit
in interfaceFloatScalarInterface<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Parameters:
targetUnit
- U; the unit to convert the value into- Returns:
- float
-
lt
Test if this DoubleScalar is less than another DoubleScalar. -
le
Test if this DoubleScalar is less than or equal to another DoubleScalar. -
gt
Test if this DoubleScalar is greater than or equal to a DoubleScalar.- Specified by:
gt
in interfaceScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Parameters:
o
- T, a relative typed DoubleScalar; the right hand side operand of the comparison- Returns:
- boolean; true if this is greater than or equal to other; false if this is not greater than or equal to other
-
ge
Test if this DoubleScalar is greater than a DoubleScalar. -
eq
Test if this DoubleScalar is equal to a DoubleScalar. -
ne
Test if this DoubleScalar is not equal to a DoubleScalar. -
lt0
public final boolean lt0()Test if this DoubleScalar is less than 0.0. -
le0
public final boolean le0()Test if this DoubleScalar is less than or equal to 0.0. -
gt0
public final boolean gt0()Test if this DoubleScalar is greater than or equal to 0.0. -
ge0
public final boolean ge0()Test if this DoubleScalar is greater than 0.0. -
eq0
public final boolean eq0()Test if this DoubleScalar is equal to 0.0. -
ne0
public final boolean ne0()Test if this DoubleScalar is not equal to 0.0. -
compareTo
- Specified by:
compareTo
in interfaceComparable<U extends Unit<U>>
-
intValue
public int intValue() -
longValue
public long longValue() -
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in classNumber
-
toString
Concise description of this value. -
toString
Somewhat verbose description of this value with the values expressed in the specified unit. -
toString
Somewhat verbose description of this value with optional type and unit information.- Specified by:
toString
in interfaceValue<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Parameters:
verbose
- boolean; if true; include type info; if false; exclude type infowithUnit
- boolean; if true; include the unit; of false; exclude the unit- Returns:
- String; printable string with the value contents
-
toString
Somewhat verbose description of this value with the values expressed in the specified unit.- Specified by:
toString
in interfaceValue<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Parameters:
displayUnit
- U; the unit into which the values are converted for displayverbose
- boolean; if true; include type info; if false; exclude type infowithUnit
- boolean; if true; include the unit; of false; exclude the unit- Returns:
- String; printable string with the value contents
-
toTextualString
Concise textual representation of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.- Specified by:
toTextualString
in interfaceScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Returns:
- a String with the value with the default textual representation of the unit attached.
-
toTextualString
Concise textual representation of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.- Specified by:
toTextualString
in interfaceScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Parameters:
displayUnit
- U; the display unit for the value- Returns:
- a String with the value with the default textual representation of the provided unit attached.
-
toDisplayString
Concise display description of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.- Specified by:
toDisplayString
in interfaceScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Returns:
- a String with the value with the default display representation of the unit attached.
-
toDisplayString
Concise display description of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.- Specified by:
toDisplayString
in interfaceScalar<U extends Unit<U>,S extends AbstractFloatScalar<U,S>>
- Parameters:
displayUnit
- U; the display unit for the value- Returns:
- a String with the value with the default display representation of the provided unit attached.
-
hashCode
public int hashCode() -
equals
-