Interface Scalable<T extends Scalable<T>>

Type Parameters:
T - the element type
All Known Implementing Classes:
AbsorbedDose, Acceleration, AmountOfSubstance, Angle, AngularAcceleration, AngularVelocity, Area, ArealObjectDensity, CatalyticActivity, Density, Dimensionless, Duration, ElectricalCapacitance, ElectricalConductance, ElectricalInductance, ElectricalResistance, ElectricCharge, ElectricCurrent, ElectricPotential, Energy, EquivalentDose, FlowMass, FlowVolume, Force, Frequency, Illuminance, Length, LinearDensity, LinearObjectDensity, LuminousFlux, LuminousIntensity, MagneticFlux, MagneticFluxDensity, Mass, Matrix, Matrix1x1, Matrix2x2, Matrix3x3, MatrixNxM, MatrixNxN, Momentum, Power, Pressure, Quantity, QuantityTable, RadioActivity, SIQuantity, SolidAngle, Speed, SquareDenseMatrix, SquareMatrix, TemperatureDifference, Torque, Vector, Vector1, Vector2, Vector2.Col, Vector2.Row, Vector3, Vector3.Col, Vector3.Row, VectorMatrix, VectorN, VectorN.Col, VectorN.Row, Volume, VolumetricObjectDensity

public interface Scalable<T extends Scalable<T>>
Scalable indicates that elements of this type can be scaled by a dimensionless factor, based on their SI-values. Note that not all unit-carrying elements are scalable. An example is an absolute scalar (e.g., a date) that cannot be multiplied by 2.

Warning: scaling operations on units with an Offset Scale might lead to unexpected answers. 2 * 10 °C = 293.15 °C and not 20 °C. Copyright (c) 2025-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.

Author:
Alexander Verbraeck
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    divideBy(double divisor)
    Divide the element's value by a dimensionless factor, based on the SI-values.
    scaleBy(double factor)
    Scale the element by a dimensionless factor, based on the SI-values.
  • Method Details

    • scaleBy

      T scaleBy(double factor)
      Scale the element by a dimensionless factor, based on the SI-values. Note that this can lead to unwanted effects for elements with Offset scales. 2 * 10 °C = 293.15 °C and not 20 °C.
      Parameters:
      factor - the dimensionless scale factor
      Returns:
      a new element with all of its SI-values scaled by the dimensionless factor
    • divideBy

      default T divideBy(double divisor)
      Divide the element's value by a dimensionless factor, based on the SI-values. Note that this can lead to unwanted effects for elements with Offset scales. 10 °C / 2.0 = -131.575 °C and not 5 °C.
      Parameters:
      divisor - the dimensionless divisor
      Returns:
      a new element with all of its SI-values divided by the dimensionless divisor