Class AbstractDoubleScalar<U extends Unit<U>,S extends AbstractDoubleScalar<U,S>>
java.lang.Object
java.lang.Number
org.djunits.value.AbstractScalar<U,S>
org.djunits.value.vdouble.scalar.base.AbstractDoubleScalar<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>,DoubleScalarInterface<U,S>
- Direct Known Subclasses:
AbstractDoubleScalarAbs,AbstractDoubleScalarRel
public abstract class AbstractDoubleScalar<U extends Unit<U>,S extends AbstractDoubleScalar<U,S>> extends AbstractScalar<U,S> implements DoubleScalarInterface<U,S>
The most basic abstract class for the DoubleScalar.
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.vdouble.scalar.base.DoubleScalarInterface
DoubleScalarInterface.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarInterface.Abs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarInterface.RelWithAbs<AU,A,RU,R>>, DoubleScalarInterface.Rel<U extends Unit<U>,R extends DoubleScalarInterface.Rel<U,R>>, DoubleScalarInterface.RelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarInterface.Abs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarInterface.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 doublesiThe value, stored in the standard SI unit. -
Constructor Summary
Constructors Constructor Description AbstractDoubleScalar(U unit, double si)Construct a new AbstractDoubleScalar. -
Method Summary
Modifier and Type Method Description intcompareTo(S o)doubledoubleValue()booleaneq(S o)Test if this DoubleScalar is equal to a DoubleScalar.booleaneq0()Test if this DoubleScalar is equal to 0.0.booleanequals(Object obj)floatfloatValue()booleange(S o)Test if this DoubleScalar is greater than a DoubleScalar.booleange0()Test if this DoubleScalar is greater than 0.0.doublegetInUnit()Retrieve the value in the original unit.doublegetInUnit(U targetUnit)Retrieve the value converted into some specified unit.doublegetSI()Retrieve the value in the underlying SI unit.booleangt(S o)Test if this DoubleScalar is greater than or equal to a DoubleScalar.booleangt0()Test if this DoubleScalar is greater than or equal to 0.0.inthashCode()intintValue()booleanle(S o)Test if this DoubleScalar is less than or equal to another DoubleScalar.booleanle0()Test if this DoubleScalar is less than or equal to 0.0.longlongValue()booleanlt(S o)Test if this DoubleScalar is less than another DoubleScalar.booleanlt0()Test if this DoubleScalar is less than 0.0.booleanne(S o)Test if this DoubleScalar is not equal to a DoubleScalar.booleanne0()Test if this DoubleScalar is not equal to 0.0.StringtoDisplayString()Concise display description of this value, without the engineering formatting, so without trailing zeroes.StringtoDisplayString(U displayUnit)Concise display description of this value, without the engineering formatting, so without trailing zeroes.StringtoString()Concise description of this value.StringtoString(boolean verbose, boolean withUnit)Somewhat verbose description of this value with optional type and unit information.StringtoString(U displayUnit)Somewhat verbose description of this value with the values expressed in the specified unit.StringtoString(U displayUnit, boolean verbose, boolean withUnit)Somewhat verbose description of this value with the values expressed in the specified unit.StringtoTextualString()Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.StringtoTextualString(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, setDisplayUnitMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit
-
Field Details
-
si
public final double siThe value, stored in the standard SI unit.
-
-
Constructor Details
-
AbstractDoubleScalar
AbstractDoubleScalar(U unit, double si)Construct a new AbstractDoubleScalar.- Parameters:
unit- U; the unitsi- double; the si value to store
-
-
Method Details
-
getSI
public final double getSI()Retrieve the value in the underlying SI unit.- Specified by:
getSIin interfaceDoubleScalarInterface<U extends Unit<U>,S extends AbstractDoubleScalar<U,S>>- Returns:
- double
-
getInUnit
public final double getInUnit()Retrieve the value in the original unit.- Specified by:
getInUnitin interfaceDoubleScalarInterface<U extends Unit<U>,S extends AbstractDoubleScalar<U,S>>- Returns:
- double
-
getInUnit
Retrieve the value converted into some specified unit.- Specified by:
getInUnitin interfaceDoubleScalarInterface<U extends Unit<U>,S extends AbstractDoubleScalar<U,S>>- Parameters:
targetUnit- U; the unit to convert the value into- Returns:
- double
-
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:
gtin interfaceScalar<U extends Unit<U>,S extends AbstractDoubleScalar<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:
compareToin interfaceComparable<U extends Unit<U>>
-
intValue
public int intValue() -
longValue
public long longValue() -
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein 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:
toStringin interfaceValue<U extends Unit<U>,S extends AbstractDoubleScalar<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:
toStringin interfaceValue<U extends Unit<U>,S extends AbstractDoubleScalar<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:
toTextualStringin interfaceScalar<U extends Unit<U>,S extends AbstractDoubleScalar<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:
toTextualStringin interfaceScalar<U extends Unit<U>,S extends AbstractDoubleScalar<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:
toDisplayStringin interfaceScalar<U extends Unit<U>,S extends AbstractDoubleScalar<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:
toDisplayStringin interfaceScalar<U extends Unit<U>,S extends AbstractDoubleScalar<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
-