Class AbstractFloatScalarRel<U extends Unit<U>,R extends AbstractFloatScalarRel<U,R>>
java.lang.Object
java.lang.Number
org.djunits.value.AbstractScalar<U,S>
org.djunits.value.vfloat.scalar.base.AbstractFloatScalar<U,R>
org.djunits.value.vfloat.scalar.base.AbstractFloatScalarRel<U,R>
- Type Parameters:
U
- the unitR
- the Relative class for reference purposes
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<R>
,Scalar<U,R>
,Scalar.Rel<U,R>
,ValueFunctions<U,R>
,Relative<U,R>
,Value<U,R>
,FloatScalarInterface<U,R>
,FloatScalarInterface.Rel<U,R>
- Direct Known Subclasses:
AbstractFloatScalarRelWithAbs
,FloatAbsorbedDose
,FloatAcceleration
,FloatAmountOfSubstance
,FloatArea
,FloatCatalyticActivity
,FloatDensity
,FloatDimensionless
,FloatElectricalCapacitance
,FloatElectricalCharge
,FloatElectricalConductance
,FloatElectricalCurrent
,FloatElectricalInductance
,FloatElectricalPotential
,FloatElectricalResistance
,FloatEnergy
,FloatEquivalentDose
,FloatFlowMass
,FloatFlowVolume
,FloatForce
,FloatFrequency
,FloatIlluminance
,FloatLinearDensity
,FloatLuminousFlux
,FloatLuminousIntensity
,FloatMagneticFlux
,FloatMagneticFluxDensity
,FloatMass
,FloatPower
,FloatPressure
,FloatRadioActivity
,FloatSIScalar
,FloatSolidAngle
,FloatSpeed
,FloatTorque
,FloatVolume
public abstract class AbstractFloatScalarRel<U extends Unit<U>,R extends AbstractFloatScalarRel<U,R>> extends AbstractFloatScalar<U,R> implements FloatScalarInterface.Rel<U,R>
The typed, abstract FloatScalarRel 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.
Note: A relative scalar class can implement the toAbs() method if it has an absolute equivalent.
Copyright (c) 2013-2019 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.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
-
Constructor Summary
Constructors Constructor Description AbstractFloatScalarRel(float value, U unit)
Construct a new Relative Immutable FloatScalar.AbstractFloatScalarRel(R value)
Construct a new Relative Immutable FloatScalar from an existing Relative Immutable FloatScalar. -
Method Summary
Modifier and Type Method Description R
abs()
Return a new Scalar/Vector/Matrix with absolute value(s).R
ceil()
Return a new Scalar/Vector/Matrix with the nearest integer value(s) above the current value(s).R
divide(double constant)
Returns a new scalar/vector/matrix with value(s) divided by a factor.R
divide(float constant)
Returns a new scalar/vector/matrix with value(s) divided by a factor.FloatSIScalar
divide(AbstractFloatScalarRel<?,?> otherScalar)
Divide this scalar by another scalar and create a new scalar.R
floor()
Return a new Scalar/Vector/Matrix with the nearest integer value(s) below the current value(s).R
minus(R decrement)
Subtract a Relative value from this Relative value.R
neg()
Return a new Scalar/Vector/Matrix with negated value(s).R
plus(R increment)
Add a Relative value to this Relative value.FloatSIScalar
reciprocal()
Create the reciprocal of this scalar with the correct dimensions.R
rint()
Return a new Scalar/Vector/Matrix with the nearest integer value(s).R
times(double constant)
Returns a new scalar/vector/matrix with value(s) multiplied by a factor.R
times(float constant)
Returns a new scalar/vector/matrix with value(s) multiplied by a factor.FloatSIScalar
times(AbstractFloatScalarRel<?,?> otherScalar)
Multiply this scalar by another scalar and create a new scalar.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, 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.vfloat.scalar.base.FloatScalarInterface
getInUnit, getInUnit, getSI
Methods inherited from interface org.djunits.value.vfloat.scalar.base.FloatScalarInterface.Rel
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
-
AbstractFloatScalarRel
Construct a new Relative Immutable FloatScalar.- Parameters:
value
- float; the value of the new Relative Immutable FloatScalarunit
- U; the unit of the new Relative Immutable FloatScalar
-
AbstractFloatScalarRel
Construct a new Relative Immutable FloatScalar from an existing Relative Immutable FloatScalar.- Parameters:
value
- R, a relative typed FloatScalar; the reference
-
-
Method Details
-
plus
Add a Relative value to this Relative value. A new value is returned due to immutability.- Specified by:
plus
in interfaceScalar.Rel<U extends Unit<U>,R extends AbstractFloatScalarRel<U,R>>
- Parameters:
increment
- R; the value to add- Returns:
- R; the sum of this value and the operand as a new object
-
minus
Subtract a Relative value from this Relative value. A new value is returned due to immutability.- Specified by:
minus
in interfaceScalar.Rel<U extends Unit<U>,R extends AbstractFloatScalarRel<U,R>>
- Parameters:
decrement
- R; the value to subtract- Returns:
- R; the difference of this value and the operand
-
times
Multiply this scalar by another scalar and create a new scalar.- Parameters:
otherScalar
- AbstractFloatScalarRel<?, ?>; the value by which this scalar is multiplied- Returns:
- FloatScalar<?>; a new scalar instance with correct SI dimensions
-
reciprocal
Create the reciprocal of this scalar with the correct dimensions.- Returns:
- FloatScalar<?>; a new scalar instance with correct SI dimensions
-
divide
Divide this scalar by another scalar and create a new scalar.- Parameters:
otherScalar
- AbstractFloatScalarRel<?, ?>; the value by which this scalar is divided- Returns:
- FloatScalar<?>; a new scalar instance with correct SI dimensions
-
abs
Return a new Scalar/Vector/Matrix with absolute value(s).- Specified by:
abs
in interfaceValueFunctions<U extends Unit<U>,R extends AbstractFloatScalarRel<U,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<U extends Unit<U>,R extends AbstractFloatScalarRel<U,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<U extends Unit<U>,R extends AbstractFloatScalarRel<U,R>>
- Returns:
- R; a new R with absolute 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<U extends Unit<U>,R extends AbstractFloatScalarRel<U,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<U extends Unit<U>,R extends AbstractFloatScalarRel<U,R>>
- Returns:
- R; a new R with negated value(s)
-
times
Returns a new scalar/vector/matrix with value(s) multiplied by a factor. -
divide
Returns a new scalar/vector/matrix with value(s) divided by a factor. -
times
Returns a new scalar/vector/matrix with value(s) multiplied by a factor. -
divide
Returns a new scalar/vector/matrix with value(s) divided by a factor.
-