Class AbstractDoubleScalarAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractDoubleScalarRelWithAbs<AU,A,RU,R>>
java.lang.Object
java.lang.Number
org.djunits.value.AbstractScalar<U,S>
org.djunits.value.vdouble.scalar.base.AbstractDoubleScalar<AU,A>
org.djunits.value.vdouble.scalar.base.AbstractDoubleScalarAbs<AU,A,RU,R>
- Type Parameters:
AU
- the absolute unitA
- the Absolute class for reference purposesRU
- the relative unitR
- the Relative class for reference purposes
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<A>
,Absolute
,Scalar<AU,A>
,Scalar.Abs<AU,A,RU,R>
,ValueFunctions<AU,A>
,Value<AU,A>
,DoubleScalarInterface<AU,A>
,DoubleScalarInterface.Abs<AU,A,RU,R>
- Direct Known Subclasses:
AbsoluteTemperature
,Direction
,Position
,Time
public abstract class AbstractDoubleScalarAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractDoubleScalarRelWithAbs<AU,A,RU,R>> extends AbstractDoubleScalar<AU,A> implements DoubleScalarInterface.Abs<AU,A,RU,R>
The typed, abstract DoubleScalarAbs class that forms the basis of all DoubleScalar definitions and extensions.
Note: A relative scalar class can implement the toAbs() method if it has an absolute equivalent.
Note: A relative scalar class can implement the toAbs() method if it has an absolute equivalent.
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, Wouter Schakel
- 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
-
Constructor Summary
Constructors Constructor Description AbstractDoubleScalarAbs(double value, AU unit)
Construct a new Absolute Immutable DoubleScalar.AbstractDoubleScalarAbs(A value)
Construct a new Absolute Immutable DoubleScalar from an existing Absolute Immutable DoubleScalar. -
Method Summary
Modifier and Type Method Description A
abs()
Return a new Scalar/Vector/Matrix with absolute value(s).A
ceil()
Return a new Scalar/Vector/Matrix with the nearest integer value(s) above the current value(s).A
floor()
Return a new Scalar/Vector/Matrix with the nearest integer value(s) below the current value(s).R
minus(A decrement)
Subtract an Absolute value from this Absolute value, resulting in a Relative value.A
minus(R decrement)
Subtract a Relative value from this Absolute value.A
neg()
Return a new Scalar/Vector/Matrix with negated value(s).A
plus(R increment)
Add a Relative value to this Absolute value.A
rint()
Return a new Scalar/Vector/Matrix with the nearest integer value(s).Methods inherited from class org.djunits.value.vdouble.scalar.base.AbstractDoubleScalar
compareTo, doubleValue, eq, eq0, equals, floatValue, ge, ge0, getInUnit, getInUnit, getSI, gt, gt0, hashCode, intValue, le, le0, longValue, lt, lt0, ne, ne0, toDisplayString, toDisplayString, toString, toString, toString, toString, toTextualString, toTextualString
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.vdouble.scalar.base.DoubleScalarInterface
getInUnit, getInUnit, getSI
Methods inherited from interface org.djunits.value.vdouble.scalar.base.DoubleScalarInterface.Abs
instantiateAbs, instantiateRel
Methods inherited from interface org.djunits.value.base.Scalar
eq, eq0, ge, ge0, gt, gt0, le, le0, lt, lt0, ne, ne0, toDisplayString, toDisplayString, toTextualString, toTextualString
Methods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit, toString, toString, toString, toString
-
Constructor Details
-
AbstractDoubleScalarAbs
Construct a new Absolute Immutable DoubleScalar.- Parameters:
value
- double; the value of the new Absolute Immutable DoubleScalarunit
- AU; the unit of the new Absolute Immutable DoubleScalar
-
AbstractDoubleScalarAbs
Construct a new Absolute Immutable DoubleScalar from an existing Absolute Immutable DoubleScalar.- Parameters:
value
- A, an absolute typed DoubleScalar; the reference
-
-
Method Details
-
plus
Add a Relative value to this Absolute value. A new value is returned due to immutability.- Specified by:
plus
in interfaceScalar.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractDoubleScalarRelWithAbs<AU,A,RU,R>>
- Parameters:
increment
- R; R the right operand- Returns:
- A; the sum of this value and the operand
-
minus
Subtract a Relative value from this Absolute value. A new value is returned due to immutability.- Specified by:
minus
in interfaceScalar.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractDoubleScalarRelWithAbs<AU,A,RU,R>>
- Parameters:
decrement
- R; R the right operand- Returns:
- A; the subtraction of this value and the operand
-
minus
Subtract an Absolute value from this Absolute value, resulting in a Relative value. A new value is returned due to immutability.- Specified by:
minus
in interfaceScalar.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractDoubleScalarRelWithAbs<AU,A,RU,R>>
- Parameters:
decrement
- A; A the right operand- Returns:
- R; the subtraction of this value and the operand
-
abs
Return a new Scalar/Vector/Matrix with absolute value(s).- Specified by:
abs
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
ceil
Return a new Scalar/Vector/Matrix with the nearest integer value(s) above the current value(s).- Specified by:
ceil
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
floor
Return a new Scalar/Vector/Matrix with the nearest integer value(s) below the current value(s).- Specified by:
floor
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
neg
Return a new Scalar/Vector/Matrix with negated value(s).- Specified by:
neg
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with negated value(s)
-
rint
Return a new Scalar/Vector/Matrix with the nearest integer value(s). When the value is exactly in the middle between two integer values, the even one is returned.- Specified by:
rint
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractDoubleScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-