Interface Value<Q extends Quantity<Q>>

Type Parameters:
Q - the quantity
All Superinterfaces:
Serializable
All Known Subinterfaces:
AbsVector.Col<V,Q>, AbsVector.Row<V,Q>, Vector.Col<V,Q>, Vector.Row<V,Q>
All Known Implementing Classes:
AbsMatrix, AbsMatrix1x1, AbsMatrix2x2, AbsMatrix3x3, AbsMatrixNxM, AbsMatrixNxN, AbsorbedDose, AbsQuantity, AbsQuantityTable, AbsSquareMatrix, AbsTable, AbsVector, AbsVector1, AbsVector2, AbsVector2.Col, AbsVector2.Row, AbsVector3, AbsVector3.Col, AbsVector3.Row, AbsVectorMatrix, AbsVectorN, AbsVectorN.Col, AbsVectorN.Row, Acceleration, AmountOfSubstance, Angle, AngularAcceleration, AngularVelocity, Area, ArealObjectDensity, CatalyticActivity, ComparableAbsQuantity, Density, Dimensionless, Direction, 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, Position, Power, Pressure, Quantity, QuantityTable, RadioActivity, SIQuantity, SolidAngle, Speed, SquareDenseMatrix, SquareMatrix, Table, Temperature, TemperatureDifference, Time, Torque, Vector, Vector1, Vector2, Vector2.Col, Vector2.Row, Vector3, Vector3.Col, Vector3.Row, VectorMatrix, VectorN, VectorN.Col, VectorN.Row, Volume, VolumetricObjectDensity

public interface Value<Q extends Quantity<Q>> extends Serializable
Value is the generic interface for all Scalar, Vector and Matrix classes that forces implementation of a few unit- and value-related methods. The Value interface defines a limited number of functions of Math to be implemented for absolute values. Note: a lot of standard Math functions are not implemented, as they don't make sense with the units. E.g., a cubic root of a Volume should give a Length, and not another volume... Trigoniometric functions should not give back the same unit either. The abs() function is not included here, as abs() only makes sense for relative vales. What is the absolute value of 14 January 2016? Therefore the set of functions that the interface forces to implement is rather limited, and certainly not the entire range of java.lang.Math functions.

Copyright (c) 2015-2026 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
  • Method Summary

    Modifier and Type
    Method
    Description
    Return a description of this value, applying the default format for the value type.
    format(UnitInterface<Q> displayUnit)
    Return a description of this value with the values expressed in the specified unit.
    Retrieve the unit of this Value.
    default boolean
    Indicate whether this is an Absolute Value.
    boolean
    Indicate whether this is a Relative Value.
  • Method Details

    • getDisplayUnit

      UnitInterface<Q> getDisplayUnit()
      Retrieve the unit of this Value.
      Returns:
      the unit of this Value
    • isAbsolute

      default boolean isAbsolute()
      Indicate whether this is an Absolute Value.
      Returns:
      whether this is an Absolute Value
    • isRelative

      boolean isRelative()
      Indicate whether this is a Relative Value.
      Returns:
      whether this is a Relative Value
    • format

      String format()
      Return a description of this value, applying the default format for the value type.
      Returns:
      a String with the value contents, using the default format.
    • format

      String format(UnitInterface<Q> displayUnit)
      Return a description of this value with the values expressed in the specified unit.
      Parameters:
      displayUnit - the unit into which the values are converted for display
      Returns:
      a String with the value contents expressed in the specified unit