Class DoubleScalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
java.lang.Object
java.lang.Number
org.djunits.value.base.Scalar<U,S>
org.djunits.value.vdouble.scalar.base.DoubleScalar<U,S>
- Type Parameters:
U- the unitS- the type
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<S>,Value<U,S>
- Direct Known Subclasses:
DoubleScalarAbs,DoubleScalarRel
public abstract class DoubleScalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
extends Scalar<U,S>
The most basic abstract class for the DoubleScalar.
Copyright (c) 2013-2025 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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDoubleScalar(double value, U unit) Construct a new DoubleScalar.DoubleScalar(S value) Construct a new DoubleScalar. -
Method Summary
Modifier and TypeMethodDescriptionfinal intdoublefinal booleanTest if this DoubleScalar is equal to another DoubleScalar.final booleaneq0()Test if this DoubleScalar is equal to 0.0.booleanfloatfinal booleanTest if this DoubleScalar is greater than or equal to another DoubleScalar.final booleange0()Test if this DoubleScalar is greater than or equal to 0.0.final doubleRetrieve the value in the original unit.final doubleRetrieve the value converted into some specified unit.final doublegetSI()Retrieve the value in the underlying SI unit.final booleanTest if this DoubleScalar is greater than another DoubleScalar.final booleangt0()Test if this DoubleScalar is greater than 0.0.inthashCode()intintValue()final booleanTest if this DoubleScalar is less than or equal to another DoubleScalar.final booleanle0()Test if this DoubleScalar is less than or equal to 0.0.longfinal booleanTest if this DoubleScalar is less than another DoubleScalar.final booleanlt0()Test if this DoubleScalar is less than 0.0.final booleanTest if this DoubleScalar is not equal to another DoubleScalar.final booleanne0()Test if this DoubleScalar is not equal to 0.0.Concise display description of this value, without the engineering formatting, so without trailing zeroes.toDisplayString(U displayUnit) Concise display description of this value, without the engineering formatting, so without trailing zeroes.toString()Concise description of this value.toString(boolean verbose, boolean withUnit) Somewhat verbose description of this value with optional type and unit information.Somewhat verbose description of this value with the values expressed in the specified unit.Somewhat verbose description of this value with the values expressed in the specified unit.Format this DoubleScalar in SI unit using prefixes when possible.toStringSIPrefixed(int smallestPower, int biggestPower) Format this DoubleScalar in SI unit using prefixes when possible and within the specified size range.Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.toTextualString(U displayUnit) Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.Methods inherited from class org.djunits.value.base.Scalar
format, format, getDisplayUnit, setDisplayUnitMethods inherited from class java.lang.Number
byteValue, shortValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.value.Value
abs, ceil, floor, isAbsolute, isRelative, neg, rint
-
Field Details
-
si
public final double siThe value, stored in the standard SI unit.
-
-
Constructor Details
-
DoubleScalar
Construct a new DoubleScalar.- Parameters:
value- the value to store, expressed in the given unitunit- the unit
-
DoubleScalar
Construct a new DoubleScalar.- Parameters:
value- the value to duplicate
-
-
Method Details
-
getSI
public final double getSI()Retrieve the value in the underlying SI unit.- Returns:
- double
-
getInUnit
public final double getInUnit()Retrieve the value in the original unit.- Returns:
- double
-
getInUnit
Retrieve the value converted into some specified unit.- Parameters:
targetUnit- the unit to convert the value into- Returns:
- double
-
lt
Description copied from class:ScalarTest if this DoubleScalar is less than another DoubleScalar. -
le
Description copied from class:ScalarTest if this DoubleScalar is less than or equal to another DoubleScalar. -
gt
Description copied from class:ScalarTest if this DoubleScalar is greater than another DoubleScalar. -
ge
Description copied from class:ScalarTest if this DoubleScalar is greater than or equal to another DoubleScalar. -
eq
Description copied from class:ScalarTest if this DoubleScalar is equal to another DoubleScalar. -
ne
Description copied from class:ScalarTest if this DoubleScalar is not equal to another DoubleScalar. -
lt0
public final boolean lt0()Description copied from class:ScalarTest if this DoubleScalar is less than 0.0. -
le0
public final boolean le0()Description copied from class:ScalarTest if this DoubleScalar is less than or equal to 0.0. -
gt0
public final boolean gt0()Description copied from class:ScalarTest if this DoubleScalar is greater than 0.0. -
ge0
public final boolean ge0()Description copied from class:ScalarTest if this DoubleScalar is greater than or equal to 0.0. -
eq0
public final boolean eq0()Description copied from class:ScalarTest if this DoubleScalar is equal to 0.0. -
ne0
public final boolean ne0()Description copied from class:ScalarTest if this DoubleScalar is not equal to 0.0. -
compareTo
-
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
Description copied from interface:ValueConcise description of this value. -
toString
Description copied from interface:ValueSomewhat verbose description of this value with the values expressed in the specified unit.- Parameters:
displayUnit- the unit into which the values are converted for display- Returns:
- printable string with the value contents expressed in the specified unit
-
toString
Description copied from interface:ValueSomewhat verbose description of this value with optional type and unit information.- Parameters:
verbose- if true; include type info; if false; exclude type infowithUnit- if true; include the unit; of false; exclude the unit- Returns:
- printable string with the value contents
-
toString
Description copied from interface:ValueSomewhat verbose description of this value with the values expressed in the specified unit.- Parameters:
displayUnit- the unit into which the values are converted for displayverbose- if true; include type info; if false; exclude type infowithUnit- if true; include the unit; of false; exclude the unit- Returns:
- printable string with the value contents
-
toStringSIPrefixed
Format this DoubleScalar in SI unit using prefixes when possible. If the value is too small or too large, e-notation and the plain SI unit are used.- Returns:
- formatted value of this DoubleScalar
-
toStringSIPrefixed
Format this DoubleScalar in SI unit using prefixes when possible and within the specified size range. If the value is too small or too large, e-notation and the plain SI unit are used.- Parameters:
smallestPower- the smallest exponent value that will be written using an SI prefixbiggestPower- the largest exponent value that will be written using an SI prefix- Returns:
- formatted value of this DoubleScalar
-
toTextualString
Description copied from class:ScalarConcise 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 classScalar<U extends Unit<U>,S extends DoubleScalar<U, S>> - Returns:
- a String with the value with the default textual representation of the unit attached.
-
toTextualString
Description copied from class:ScalarConcise 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 classScalar<U extends Unit<U>,S extends DoubleScalar<U, S>> - Parameters:
displayUnit- the display unit for the value- Returns:
- a String with the value with the default textual representation of the provided unit attached.
-
toDisplayString
Description copied from class:ScalarConcise 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 classScalar<U extends Unit<U>,S extends DoubleScalar<U, S>> - Returns:
- a String with the value with the default display representation of the unit attached.
-
toDisplayString
Description copied from class:ScalarConcise 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 classScalar<U extends Unit<U>,S extends DoubleScalar<U, S>> - Parameters:
displayUnit- 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
-