Package gnu.math

Class DQuantity

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable

    public class DQuantity
    extends Quantity
    implements java.io.Externalizable
    A Quantity represented as the product of a plain double and a Unit.
    See Also:
    Serialized Form
    • Constructor Detail

      • DQuantity

        public DQuantity​(double factor,
                         Unit unit)
    • Method Detail

      • re

        public final RealNum re()
        Description copied from class: Quantity
        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.
        Overrides:
        re in class Quantity
      • doubleValue

        public final double doubleValue()
        Description copied from class: Quantity
        The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
        Overrides:
        doubleValue in class Quantity
      • isExact

        public boolean isExact()
        Specified by:
        isExact in class Numeric
      • isZero

        public boolean isZero()
        Specified by:
        isZero in class Numeric
      • add

        public Numeric add​(java.lang.Object y,
                           int k)
        Description copied from class: Numeric
        Return this + k * obj.
        Overrides:
        add in class Quantity
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException