Class SIScalar

All Implemented Interfaces:
Serializable, Cloneable, Comparable<SIScalar>, Relative<SIUnit,SIScalar>, Value<SIUnit,SIScalar>

@Generated(value="org.djunits.generator.GenerateDJUNIT", date="2023-07-23T14:06:38.224104100Z") public class SIScalar extends DoubleScalarRel<SIUnit,SIScalar>
Easy access methods for the generic Relative SI DoubleScalar.

Copyright (c) 2013-2024 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:
  • Constructor Details

    • SIScalar

      public SIScalar(double value, SIUnit unit)
      Construct SI scalar.
      Parameters:
      value - double; the double value
      unit - SIUnit; unit for the double value
    • SIScalar

      public SIScalar(SIScalar value)
      Construct SI scalar.
      Parameters:
      value - SIScalar; Scalar from which to construct this instance
  • Method Details

    • instantiateRel

      public final SIScalar instantiateRel(double value, SIUnit unit)
      Description copied from class: DoubleScalarRel
      Construct a new Relative Immutable DoubleScalar of the right type. Each extending class must implement this method.
      Specified by:
      instantiateRel in class DoubleScalarRel<SIUnit,SIScalar>
      Parameters:
      value - double; the double value
      unit - U; the unit
      Returns:
      R a new relative instance of the DoubleScalar of the right type
    • instantiateSI

      public static final SIScalar instantiateSI(double value, SIUnit unit)
      Construct SI scalar.
      Parameters:
      value - double; the double value in SI units
      unit - SIUnit; the unit to use for the SI scalar
      Returns:
      SIScalar; the new scalar with the SI value
    • interpolate

      public static SIScalar interpolate(SIScalar zero, SIScalar one, double ratio)
      Interpolate between two values.
      Parameters:
      zero - SIScalar; the low value
      one - SIScalar; the high value
      ratio - double; the ratio between 0 and 1, inclusive
      Returns:
      SIScalar; a Scalar at the ratio between
    • max

      public static SIScalar max(SIScalar r1, SIScalar r2)
      Return the maximum value of two relative scalars.
      Parameters:
      r1 - SIScalar; the first scalar
      r2 - SIScalar; the second scalar
      Returns:
      SIScalar; the maximum value of two relative scalars
    • max

      public static SIScalar max(SIScalar r1, SIScalar r2, SIScalar... rn)
      Return the maximum value of more than two relative scalars.
      Parameters:
      r1 - SIScalar; the first scalar
      r2 - SIScalar; the second scalar
      rn - SIScalar...; the other scalars
      Returns:
      SIScalar; the maximum value of more than two relative scalars
    • min

      public static SIScalar min(SIScalar r1, SIScalar r2)
      Return the minimum value of two relative scalars.
      Parameters:
      r1 - SIScalar; the first scalar
      r2 - SIScalar; the second scalar
      Returns:
      SIScalar; the minimum value of two relative scalars
    • min

      public static SIScalar min(SIScalar r1, SIScalar r2, SIScalar... rn)
      Return the minimum value of more than two relative scalars.
      Parameters:
      r1 - SIScalar; the first scalar
      r2 - SIScalar; the second scalar
      rn - SIScalar...; the other scalars
      Returns:
      SIScalar; the minimum value of more than two relative scalars
    • reciprocal

      public SIScalar reciprocal()
      Description copied from class: DoubleScalarRel
      Create the reciprocal of this scalar with the correct dimensions.
      Specified by:
      reciprocal in class DoubleScalarRel<SIUnit,SIScalar>
      Returns:
      DoubleScalar<?>; a new scalar instance with correct SI dimensions
    • valueOf

      public static SIScalar valueOf(String text)
      Returns an SIScalar representation of a textual representation of a value with a unit. The String representation that can be parsed is the double value in the unit, followed by the official abbreviation of the unit. Spaces are allowed, but not required, between the value and the unit.
      Parameters:
      text - String; the textual representation to parse into a SIScalar
      Returns:
      SIScalar; the Scalar representation of the value in its unit
      Throws:
      IllegalArgumentException - when the text cannot be parsed
      NullPointerException - when the text argument is null
    • of

      public static SIScalar of(double value, String unitString)
      Returns an SIScalar based on a value and the textual representation of the unit.
      Parameters:
      value - double; the value to use
      unitString - String; the textual representation of the unit
      Returns:
      SIScalar; the Scalar representation of the value in its unit
      Throws:
      IllegalArgumentException - when the unit cannot be parsed or is incorrect
      NullPointerException - when the unitString argument is null
    • toString

      public String toString(SIUnit displayUnit, boolean verbose, boolean withUnit)
      Description copied from interface: Value
      Somewhat verbose description of this value with the values expressed in the specified unit.
      Specified by:
      toString in interface Value<SIUnit,SIScalar>
      Overrides:
      toString in class DoubleScalar<SIUnit,SIScalar>
      Parameters:
      displayUnit - U; the unit into which the values are converted for display
      verbose - boolean; if true; include type info; if false; exclude type info
      withUnit - boolean; if true; include the unit; of false; exclude the unit
      Returns:
      String; printable string with the value contents
    • as

      public final <U extends Unit<U>, S extends DoubleScalarRel<U, S>> S as(U displayUnit)
      Return the current scalar transformed to a scalar in the given unit. Of course the SI dimensionality has to match, otherwise the scalar cannot be transformed. The compiler will check the alignment between the return value and the unit.
      Type Parameters:
      U - the unit type
      S - the scalar type
      Parameters:
      displayUnit - KU; the unit in which the scalar needs to be expressed
      Returns:
      S; the scalar that has been transformed into the right scalar type and unit
    • asAbsorbedDose

      public final AbsorbedDose asAbsorbedDose()
      Return the current scalar as a absorbeddose.
      Returns:
      AbsorbedDose; the current scalar as a absorbeddose
    • asAbsorbedDose

      public final AbsorbedDose asAbsorbedDose(AbsorbedDoseUnit displayUnit)
      Return the current scalar as a absorbeddose, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      AbsorbedDose; the current scalar as a absorbeddose
    • asAcceleration

      public final Acceleration asAcceleration()
      Return the current scalar as a acceleration.
      Returns:
      Acceleration; the current scalar as a acceleration
    • asAcceleration

      public final Acceleration asAcceleration(AccelerationUnit displayUnit)
      Return the current scalar as a acceleration, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Acceleration; the current scalar as a acceleration
    • asAmountOfSubstance

      public final AmountOfSubstance asAmountOfSubstance()
      Return the current scalar as a amountofsubstance.
      Returns:
      AmountOfSubstance; the current scalar as a amountofsubstance
    • asAmountOfSubstance

      public final AmountOfSubstance asAmountOfSubstance(AmountOfSubstanceUnit displayUnit)
      Return the current scalar as a amountofsubstance, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      AmountOfSubstance; the current scalar as a amountofsubstance
    • asAngularAcceleration

      public final AngularAcceleration asAngularAcceleration()
      Return the current scalar as a angularacceleration.
      Returns:
      AngularAcceleration; the current scalar as a angularacceleration
    • asAngularAcceleration

      public final AngularAcceleration asAngularAcceleration(AngularAccelerationUnit displayUnit)
      Return the current scalar as a angularacceleration, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      AngularAcceleration; the current scalar as a angularacceleration
    • asAngularVelocity

      public final AngularVelocity asAngularVelocity()
      Return the current scalar as a angularvelocity.
      Returns:
      AngularVelocity; the current scalar as a angularvelocity
    • asAngularVelocity

      public final AngularVelocity asAngularVelocity(AngularVelocityUnit displayUnit)
      Return the current scalar as a angularvelocity, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      AngularVelocity; the current scalar as a angularvelocity
    • asArea

      public final Area asArea()
      Return the current scalar as a area.
      Returns:
      Area; the current scalar as a area
    • asArea

      public final Area asArea(AreaUnit displayUnit)
      Return the current scalar as a area, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Area; the current scalar as a area
    • asCatalyticActivity

      public final CatalyticActivity asCatalyticActivity()
      Return the current scalar as a catalyticactivity.
      Returns:
      CatalyticActivity; the current scalar as a catalyticactivity
    • asCatalyticActivity

      public final CatalyticActivity asCatalyticActivity(CatalyticActivityUnit displayUnit)
      Return the current scalar as a catalyticactivity, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      CatalyticActivity; the current scalar as a catalyticactivity
    • asDensity

      public final Density asDensity()
      Return the current scalar as a density.
      Returns:
      Density; the current scalar as a density
    • asDensity

      public final Density asDensity(DensityUnit displayUnit)
      Return the current scalar as a density, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Density; the current scalar as a density
    • asDimensionless

      public final Dimensionless asDimensionless()
      Return the current scalar as a dimensionless.
      Returns:
      Dimensionless; the current scalar as a dimensionless
    • asDimensionless

      public final Dimensionless asDimensionless(DimensionlessUnit displayUnit)
      Return the current scalar as a dimensionless, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Dimensionless; the current scalar as a dimensionless
    • asElectricalCapacitance

      public final ElectricalCapacitance asElectricalCapacitance()
      Return the current scalar as a electricalcapacitance.
      Returns:
      ElectricalCapacitance; the current scalar as a electricalcapacitance
    • asElectricalCapacitance

      public final ElectricalCapacitance asElectricalCapacitance(ElectricalCapacitanceUnit displayUnit)
      Return the current scalar as a electricalcapacitance, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalCapacitance; the current scalar as a electricalcapacitance
    • asElectricalCharge

      public final ElectricalCharge asElectricalCharge()
      Return the current scalar as a electricalcharge.
      Returns:
      ElectricalCharge; the current scalar as a electricalcharge
    • asElectricalCharge

      public final ElectricalCharge asElectricalCharge(ElectricalChargeUnit displayUnit)
      Return the current scalar as a electricalcharge, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalCharge; the current scalar as a electricalcharge
    • asElectricalConductance

      public final ElectricalConductance asElectricalConductance()
      Return the current scalar as a electricalconductance.
      Returns:
      ElectricalConductance; the current scalar as a electricalconductance
    • asElectricalConductance

      public final ElectricalConductance asElectricalConductance(ElectricalConductanceUnit displayUnit)
      Return the current scalar as a electricalconductance, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalConductance; the current scalar as a electricalconductance
    • asElectricalCurrent

      public final ElectricalCurrent asElectricalCurrent()
      Return the current scalar as a electricalcurrent.
      Returns:
      ElectricalCurrent; the current scalar as a electricalcurrent
    • asElectricalCurrent

      public final ElectricalCurrent asElectricalCurrent(ElectricalCurrentUnit displayUnit)
      Return the current scalar as a electricalcurrent, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalCurrent; the current scalar as a electricalcurrent
    • asElectricalInductance

      public final ElectricalInductance asElectricalInductance()
      Return the current scalar as a electricalinductance.
      Returns:
      ElectricalInductance; the current scalar as a electricalinductance
    • asElectricalInductance

      public final ElectricalInductance asElectricalInductance(ElectricalInductanceUnit displayUnit)
      Return the current scalar as a electricalinductance, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalInductance; the current scalar as a electricalinductance
    • asElectricalPotential

      public final ElectricalPotential asElectricalPotential()
      Return the current scalar as a electricalpotential.
      Returns:
      ElectricalPotential; the current scalar as a electricalpotential
    • asElectricalPotential

      public final ElectricalPotential asElectricalPotential(ElectricalPotentialUnit displayUnit)
      Return the current scalar as a electricalpotential, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalPotential; the current scalar as a electricalpotential
    • asElectricalResistance

      public final ElectricalResistance asElectricalResistance()
      Return the current scalar as a electricalresistance.
      Returns:
      ElectricalResistance; the current scalar as a electricalresistance
    • asElectricalResistance

      public final ElectricalResistance asElectricalResistance(ElectricalResistanceUnit displayUnit)
      Return the current scalar as a electricalresistance, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      ElectricalResistance; the current scalar as a electricalresistance
    • asEnergy

      public final Energy asEnergy()
      Return the current scalar as a energy.
      Returns:
      Energy; the current scalar as a energy
    • asEnergy

      public final Energy asEnergy(EnergyUnit displayUnit)
      Return the current scalar as a energy, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Energy; the current scalar as a energy
    • asEquivalentDose

      public final EquivalentDose asEquivalentDose()
      Return the current scalar as a equivalentdose.
      Returns:
      EquivalentDose; the current scalar as a equivalentdose
    • asEquivalentDose

      public final EquivalentDose asEquivalentDose(EquivalentDoseUnit displayUnit)
      Return the current scalar as a equivalentdose, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      EquivalentDose; the current scalar as a equivalentdose
    • asFlowMass

      public final FlowMass asFlowMass()
      Return the current scalar as a flowmass.
      Returns:
      FlowMass; the current scalar as a flowmass
    • asFlowMass

      public final FlowMass asFlowMass(FlowMassUnit displayUnit)
      Return the current scalar as a flowmass, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      FlowMass; the current scalar as a flowmass
    • asFlowVolume

      public final FlowVolume asFlowVolume()
      Return the current scalar as a flowvolume.
      Returns:
      FlowVolume; the current scalar as a flowvolume
    • asFlowVolume

      public final FlowVolume asFlowVolume(FlowVolumeUnit displayUnit)
      Return the current scalar as a flowvolume, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      FlowVolume; the current scalar as a flowvolume
    • asForce

      public final Force asForce()
      Return the current scalar as a force.
      Returns:
      Force; the current scalar as a force
    • asForce

      public final Force asForce(ForceUnit displayUnit)
      Return the current scalar as a force, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Force; the current scalar as a force
    • asFrequency

      public final Frequency asFrequency()
      Return the current scalar as a frequency.
      Returns:
      Frequency; the current scalar as a frequency
    • asFrequency

      public final Frequency asFrequency(FrequencyUnit displayUnit)
      Return the current scalar as a frequency, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Frequency; the current scalar as a frequency
    • asIlluminance

      public final Illuminance asIlluminance()
      Return the current scalar as a illuminance.
      Returns:
      Illuminance; the current scalar as a illuminance
    • asIlluminance

      public final Illuminance asIlluminance(IlluminanceUnit displayUnit)
      Return the current scalar as a illuminance, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Illuminance; the current scalar as a illuminance
    • asLinearDensity

      public final LinearDensity asLinearDensity()
      Return the current scalar as a lineardensity.
      Returns:
      LinearDensity; the current scalar as a lineardensity
    • asLinearDensity

      public final LinearDensity asLinearDensity(LinearDensityUnit displayUnit)
      Return the current scalar as a lineardensity, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      LinearDensity; the current scalar as a lineardensity
    • asLuminousFlux

      public final LuminousFlux asLuminousFlux()
      Return the current scalar as a luminousflux.
      Returns:
      LuminousFlux; the current scalar as a luminousflux
    • asLuminousFlux

      public final LuminousFlux asLuminousFlux(LuminousFluxUnit displayUnit)
      Return the current scalar as a luminousflux, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      LuminousFlux; the current scalar as a luminousflux
    • asLuminousIntensity

      public final LuminousIntensity asLuminousIntensity()
      Return the current scalar as a luminousintensity.
      Returns:
      LuminousIntensity; the current scalar as a luminousintensity
    • asLuminousIntensity

      public final LuminousIntensity asLuminousIntensity(LuminousIntensityUnit displayUnit)
      Return the current scalar as a luminousintensity, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      LuminousIntensity; the current scalar as a luminousintensity
    • asMagneticFluxDensity

      public final MagneticFluxDensity asMagneticFluxDensity()
      Return the current scalar as a magneticfluxdensity.
      Returns:
      MagneticFluxDensity; the current scalar as a magneticfluxdensity
    • asMagneticFluxDensity

      public final MagneticFluxDensity asMagneticFluxDensity(MagneticFluxDensityUnit displayUnit)
      Return the current scalar as a magneticfluxdensity, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      MagneticFluxDensity; the current scalar as a magneticfluxdensity
    • asMagneticFlux

      public final MagneticFlux asMagneticFlux()
      Return the current scalar as a magneticflux.
      Returns:
      MagneticFlux; the current scalar as a magneticflux
    • asMagneticFlux

      public final MagneticFlux asMagneticFlux(MagneticFluxUnit displayUnit)
      Return the current scalar as a magneticflux, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      MagneticFlux; the current scalar as a magneticflux
    • asMass

      public final Mass asMass()
      Return the current scalar as a mass.
      Returns:
      Mass; the current scalar as a mass
    • asMass

      public final Mass asMass(MassUnit displayUnit)
      Return the current scalar as a mass, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Mass; the current scalar as a mass
    • asMomentum

      public final Momentum asMomentum()
      Return the current scalar as a momentum.
      Returns:
      Momentum; the current scalar as a momentum
    • asMomentum

      public final Momentum asMomentum(MomentumUnit displayUnit)
      Return the current scalar as a momentum, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Momentum; the current scalar as a momentum
    • asPower

      public final Power asPower()
      Return the current scalar as a power.
      Returns:
      Power; the current scalar as a power
    • asPower

      public final Power asPower(PowerUnit displayUnit)
      Return the current scalar as a power, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Power; the current scalar as a power
    • asPressure

      public final Pressure asPressure()
      Return the current scalar as a pressure.
      Returns:
      Pressure; the current scalar as a pressure
    • asPressure

      public final Pressure asPressure(PressureUnit displayUnit)
      Return the current scalar as a pressure, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Pressure; the current scalar as a pressure
    • asRadioActivity

      public final RadioActivity asRadioActivity()
      Return the current scalar as a radioactivity.
      Returns:
      RadioActivity; the current scalar as a radioactivity
    • asRadioActivity

      public final RadioActivity asRadioActivity(RadioActivityUnit displayUnit)
      Return the current scalar as a radioactivity, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      RadioActivity; the current scalar as a radioactivity
    • asSolidAngle

      public final SolidAngle asSolidAngle()
      Return the current scalar as a solidangle.
      Returns:
      SolidAngle; the current scalar as a solidangle
    • asSolidAngle

      public final SolidAngle asSolidAngle(SolidAngleUnit displayUnit)
      Return the current scalar as a solidangle, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      SolidAngle; the current scalar as a solidangle
    • asSpeed

      public final Speed asSpeed()
      Return the current scalar as a speed.
      Returns:
      Speed; the current scalar as a speed
    • asSpeed

      public final Speed asSpeed(SpeedUnit displayUnit)
      Return the current scalar as a speed, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Speed; the current scalar as a speed
    • asTorque

      public final Torque asTorque()
      Return the current scalar as a torque.
      Returns:
      Torque; the current scalar as a torque
    • asTorque

      public final Torque asTorque(TorqueUnit displayUnit)
      Return the current scalar as a torque, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Torque; the current scalar as a torque
    • asVolume

      public final Volume asVolume()
      Return the current scalar as a volume.
      Returns:
      Volume; the current scalar as a volume
    • asVolume

      public final Volume asVolume(VolumeUnit displayUnit)
      Return the current scalar as a volume, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Volume; the current scalar as a volume
    • asAngle

      public final Angle asAngle()
      Return the current scalar as a angle.
      Returns:
      Angle; the current scalar as a angle
    • asAngle

      public final Angle asAngle(AngleUnit displayUnit)
      Return the current scalar as a angle, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Angle; the current scalar as a angle
    • asLength

      public final Length asLength()
      Return the current scalar as a length.
      Returns:
      Length; the current scalar as a length
    • asLength

      public final Length asLength(LengthUnit displayUnit)
      Return the current scalar as a length, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Length; the current scalar as a length
    • asTemperature

      public final Temperature asTemperature()
      Return the current scalar as a temperature.
      Returns:
      Temperature; the current scalar as a temperature
    • asTemperature

      public final Temperature asTemperature(TemperatureUnit displayUnit)
      Return the current scalar as a temperature, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Temperature; the current scalar as a temperature
    • asDuration

      public final Duration asDuration()
      Return the current scalar as a duration.
      Returns:
      Duration; the current scalar as a duration
    • asDuration

      public final Duration asDuration(DurationUnit displayUnit)
      Return the current scalar as a duration, and provide a display unit.
      Parameters:
      displayUnit - the unit in which the value will be displayed
      Returns:
      Duration; the current scalar as a duration