Package gnu.math

Class Quantity

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CQuantity, DateTime, DQuantity, Duration, Quaternion, Unit

public abstract class Quantity extends Numeric
A quantity with a unit. This generalizes the DSSSL quantity type (to more than lengths).
See Also:
  • Constructor Details

    • Quantity

      public Quantity()
  • Method Details

    • unit

      public Unit unit()
    • dimensions

      public Dimensions dimensions()
    • number

      public abstract Quaternion number()
    • re

      public RealNum re()
      The value of the real component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true real component.
    • im

      public RealNum im()
      The value of the imaginary component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true imaginary component.
    • jm

      public RealNum jm()
      The value of the "j" component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true "j" component.
    • km

      public RealNum km()
      The value of the "k" component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true "k" component.
    • reValue

      public final double reValue()
      The value of the real component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleValue.
    • imValue

      public final double imValue()
      The value of the imaginary component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleImagValue.
    • jmValue

      public final double jmValue()
      The value of the "j" component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleJmagValue.
    • kmValue

      public final double kmValue()
      The value of the "k" component, as a double. This is relative to the unit().dims - i.e. unit().doubleValue() is factored in. A final alias for the virtual doubleKmagValue.
    • doubleValue

      public double doubleValue()
      The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
      Specified by:
      doubleValue in class Number
    • doubleImagValue

      public double doubleImagValue()
      The value of the imaginary component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
    • doubleJmagValue

      public double doubleJmagValue()
      The value of the "j" component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
    • doubleKmagValue

      public double doubleKmagValue()
      The value of the "k" component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
    • make

      public static Quantity make(Quaternion x, Unit u)
    • make

      public static Quantity make(RealNum re, RealNum im, RealNum jm, RealNum km, Unit unit)
    • make

      public static Quantity make(double re, double im, double jm, double km, Unit unit)
    • neg

      public Numeric neg()
      Specified by:
      neg in class Numeric
    • abs

      public Numeric abs()
      Specified by:
      abs in class Numeric
    • compare

      public static int compare(Quantity x, Quantity y)
    • compare

      public int compare(Object obj)
      Description copied from class: Numeric
      Return an integer for which of this or obj is larger. Return 1 if this>obj; 0 if this==obj; -1 if this<obj; -2 if this!=obj otherwise (for example if either is NaN); -3 if not comparable (incompatible types).
      Overrides:
      compare in class Numeric
    • compareReversed

      public int compareReversed(Numeric x)
      Overrides:
      compareReversed in class Numeric
    • add

      public static Quantity add(Quantity x, Quantity y, int k)
    • add

      public Numeric add(Object y, int k)
      Description copied from class: Numeric
      Return this + k * obj.
      Specified by:
      add in class Numeric
    • addReversed

      public Numeric addReversed(Numeric x, int k)
      Description copied from class: Numeric
      Calculate x+k&this.
      Overrides:
      addReversed in class Numeric
    • times

      public static Quantity times(Quantity x, Quantity y)
    • mul

      public Numeric mul(Object y)
      Specified by:
      mul in class Numeric
    • mulReversed

      public Numeric mulReversed(Numeric x)
      Overrides:
      mulReversed in class Numeric
    • divide

      public static Quantity divide(Quantity x, Quantity y)
    • div

      public Numeric div(Object y)
      Specified by:
      div in class Numeric
    • divReversed

      public Numeric divReversed(Numeric x)
      Overrides:
      divReversed in class Numeric
    • toString

      public String toString(int radix)
      Specified by:
      toString in class Numeric