Class AbstractFloatScalarAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractFloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractFloatScalarRelWithAbs<AU,A,RU,R>>
- java.lang.Object
-
- java.lang.Number
-
- org.djunits.value.AbstractScalar<U,S>
-
- org.djunits.value.vfloat.scalar.base.AbstractFloatScalar<AU,A>
-
- org.djunits.value.vfloat.scalar.base.AbstractFloatScalarAbs<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>
,FloatScalarInterface<AU,A>
,FloatScalarInterface.Abs<AU,A,RU,R>
- Direct Known Subclasses:
FloatAbsoluteTemperature
,FloatDirection
,FloatPosition
,FloatTime
public abstract class AbstractFloatScalarAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractFloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractFloatScalarRelWithAbs<AU,A,RU,R>> extends AbstractFloatScalar<AU,A> implements FloatScalarInterface.Abs<AU,A,RU,R>
The typed, abstract FloatScalarAbs class that forms the basis of all FloatScalar definitions and extensions.
Note: A relative scalar class can implement the toAbs() method if it has an absolute equivalent.Copyright (c) 2013-2023 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 inherited from class org.djunits.value.vfloat.scalar.base.AbstractFloatScalar
si
-
-
Constructor Summary
Constructors Constructor Description AbstractFloatScalarAbs(float value, AU unit)
Construct a new Absolute Immutable FloatScalar.AbstractFloatScalarAbs(A value)
Construct a new Absolute Immutable FloatScalar from an existing Absolute Immutable FloatScalar.
-
Method Summary
All Methods Instance Methods Concrete Methods 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.vfloat.scalar.base.AbstractFloatScalar
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, toStringSIPrefixed, toStringSIPrefixed, toTextualString, toTextualString
-
Methods inherited from class org.djunits.value.AbstractScalar
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.djunits.value.vfloat.scalar.base.FloatScalarInterface
getInUnit, getInUnit, getSI
-
Methods inherited from interface org.djunits.value.vfloat.scalar.base.FloatScalarInterface.Abs
instantiateAbs, instantiateRel
-
Methods inherited from interface org.djunits.value.base.Scalar
eq, eq0, format, format, 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 Detail
-
AbstractFloatScalarAbs
public AbstractFloatScalarAbs(float value, AU unit)
Construct a new Absolute Immutable FloatScalar.- Parameters:
value
- float; the value of the new Absolute Immutable FloatScalarunit
- AU; the unit of the new Absolute Immutable FloatScalar
-
AbstractFloatScalarAbs
public AbstractFloatScalarAbs(A value)
Construct a new Absolute Immutable FloatScalar from an existing Absolute Immutable FloatScalar.- Parameters:
value
- A, an absolute typed FloatScalar; the reference
-
-
Method Detail
-
plus
public final A plus(R increment)
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 AbstractFloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractFloatScalarRelWithAbs<AU,A,RU,R>>
- Parameters:
increment
- R; R the right operand- Returns:
- A; the sum of this value and the operand
-
minus
public final A minus(R decrement)
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 AbstractFloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractFloatScalarRelWithAbs<AU,A,RU,R>>
- Parameters:
decrement
- R; R the right operand- Returns:
- A; the subtraction of this value and the operand
-
minus
public final R minus(A decrement)
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 AbstractFloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends AbstractFloatScalarRelWithAbs<AU,A,RU,R>>
- Parameters:
decrement
- A; A the right operand- Returns:
- R; the subtraction of this value and the operand
-
abs
public A abs()
Return a new Scalar/Vector/Matrix with absolute value(s).- Specified by:
abs
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractFloatScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
ceil
public A 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 AbstractFloatScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
floor
public A 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 AbstractFloatScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
neg
public A neg()
Return a new Scalar/Vector/Matrix with negated value(s).- Specified by:
neg
in interfaceValueFunctions<AU extends AbsoluteLinearUnit<AU,RU>,A extends AbstractFloatScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with negated value(s)
-
rint
public A 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 AbstractFloatScalarAbs<AU,A,RU,R>>
- Returns:
- R; a new R with absolute value(s)
-
-