From 2c146c894972e2c6ab701b3c66dcf242d7be656f Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Tue, 24 Dec 2019 16:16:13 -0500 Subject: Added Javadoc to the project. --- doc/org/unitConverter/unit/LinearUnit.html | 800 +++++++++++++++++++++++++++++ 1 file changed, 800 insertions(+) create mode 100644 doc/org/unitConverter/unit/LinearUnit.html (limited to 'doc/org/unitConverter/unit/LinearUnit.html') diff --git a/doc/org/unitConverter/unit/LinearUnit.html b/doc/org/unitConverter/unit/LinearUnit.html new file mode 100644 index 0000000..1e1fce2 --- /dev/null +++ b/doc/org/unitConverter/unit/LinearUnit.html @@ -0,0 +1,800 @@ + + + + + +LinearUnit + + + + + + + + +
+ + + + + + + +
+ + + +
+
org.unitConverter.unit
+

Class LinearUnit

+
+
+ +
+
    +
  • +
    +
    +
    public final class LinearUnit
    +extends Unit
    +
    A unit that can be expressed as a product of its base and a number. For example, kilometres, inches and pounds.
    +
    +
    Since:
    +
    2019-10-16
    +
    Author:
    +
    Adrien Hopkins
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        fromUnitValue

        +
        public static LinearUnit fromUnitValue(Unit unit,
        +                                       double value)
        +
        Gets a LinearUnit from a unit and a value. For example, converts '59 °F' to a linear unit with the value + of '288.15 K'
        +
        +
        Parameters:
        +
        unit - unit to convert
        +
        value - value to convert
        +
        Returns:
        +
        value expressed as a LinearUnit
        +
        Throws:
        +
        java.lang.NullPointerException - if unit is null
        +
        Since:
        +
        2019-10-16
        +
        +
      • +
      + + + +
        +
      • +

        fromUnitValue

        +
        public static LinearUnit fromUnitValue(Unit unit,
        +                                       double value,
        +                                       NameSymbol ns)
        +
        Gets a LinearUnit from a unit and a value. For example, converts '59 °F' to a linear unit with the value + of '288.15 K'
        +
        +
        Parameters:
        +
        unit - unit to convert
        +
        value - value to convert
        +
        ns - name(s) and symbol of unit
        +
        Returns:
        +
        value expressed as a LinearUnit
        +
        Throws:
        +
        java.lang.NullPointerException - if unit or ns is null
        +
        Since:
        +
        2019-10-21
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static LinearUnit valueOf(ObjectProduct<BaseUnit> unitBase,
        +                                 double conversionFactor)
        +
        Gets a LinearUnit from a unit base and a conversion factor. In other words, gets the product of + unitBase and conversionFactor, expressed as a LinearUnit.
        +
        +
        Parameters:
        +
        unitBase - unit base to multiply by
        +
        conversionFactor - number to multiply base by
        +
        Returns:
        +
        product of base and conversion factor
        +
        Throws:
        +
        java.lang.NullPointerException - if unitBase is null
        +
        Since:
        +
        2019-10-16
        +
        +
      • +
      + + + +
        +
      • +

        valueOf

        +
        public static LinearUnit valueOf(ObjectProduct<BaseUnit> unitBase,
        +                                 double conversionFactor,
        +                                 NameSymbol ns)
        +
        Gets a LinearUnit from a unit base and a conversion factor. In other words, gets the product of + unitBase and conversionFactor, expressed as a LinearUnit.
        +
        +
        Parameters:
        +
        unitBase - unit base to multiply by
        +
        conversionFactor - number to multiply base by
        +
        ns - name(s) and symbol of unit
        +
        Returns:
        +
        product of base and conversion factor
        +
        Throws:
        +
        java.lang.NullPointerException - if unitBase is null
        +
        Since:
        +
        2019-10-21
        +
        +
      • +
      + + + +
        +
      • +

        convertFromBase

        +
        protected double convertFromBase(double value)
        +
        Converts from a value expressed in this unit's base unit to a value expressed in this unit. +

        + This must be the inverse of convertToBase, so convertFromBase(convertToBase(value)) must be equal + to value for any value, ignoring precision loss by roundoff error. +

        +

        + If this unit is a base unit, this method should return value. +

        + + Converts by dividing by conversionFactor
        +
        +
        Specified by:
        +
        convertFromBase in class Unit
        +
        Parameters:
        +
        value - value expressed in base unit
        +
        Returns:
        +
        value expressed in this unit
        +
        +
      • +
      + + + +
        +
      • +

        convertToBase

        +
        protected double convertToBase(double value)
        +
        Converts from a value expressed in this unit to a value expressed in this unit's base unit. +

        + This must be the inverse of convertFromBase, so convertToBase(convertFromBase(value)) must be + equal to value for any value, ignoring precision loss by roundoff error. +

        +

        + If this unit is a base unit, this method should return value. +

        + + Converts by multiplying by conversionFactor
        +
        +
        Specified by:
        +
        convertToBase in class Unit
        +
        Parameters:
        +
        value - value expressed in this unit
        +
        Returns:
        +
        value expressed in base unit
        +
        +
      • +
      + + + +
        +
      • +

        dividedBy

        +
        public LinearUnit dividedBy(double divisor)
        +
        Divides this unit by a scalar.
        +
        +
        Parameters:
        +
        divisor - scalar to divide by
        +
        Returns:
        +
        quotient
        +
        Since:
        +
        2018-12-23, v0.1.0
        +
        +
      • +
      + + + +
        +
      • +

        dividedBy

        +
        public LinearUnit dividedBy(LinearUnit divisor)
        +
        Returns the quotient of this unit and another.
        +
        +
        Parameters:
        +
        divisor - unit to divide by
        +
        Returns:
        +
        quotient of two units
        +
        Throws:
        +
        java.lang.NullPointerException - if divisor is null
        +
        Since:
        +
        2018-12-22, v0.1.0
        +
        +
      • +
      + + + +
        +
      • +

        equals

        +
        public boolean equals(java.lang.Object obj)
        +
        + + Uses the base and conversion factor of units to test for equality.
        +
        +
        Overrides:
        +
        equals in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        getConversionFactor

        +
        public double getConversionFactor()
        +
        +
        Returns:
        +
        conversion factor
        +
        Since:
        +
        2019-10-16
        +
        +
      • +
      + + + +
        +
      • +

        hashCode

        +
        public int hashCode()
        +
        + + Uses the base and conversion factor to compute a hash code.
        +
        +
        Overrides:
        +
        hashCode in class java.lang.Object
        +
        +
      • +
      + + + +
        +
      • +

        isBase

        +
        public boolean isBase()
        +
        +
        Returns:
        +
        whether this unit is equivalent to a BaseUnit (i.e. there is a BaseUnit b where + b.asLinearUnit().equals(this) returns true.)
        +
        Since:
        +
        2019-10-16
        +
        +
      • +
      + + + +
        +
      • +

        isCoherent

        +
        public boolean isCoherent()
        +
        +
        Returns:
        +
        whether this unit is coherent (i.e. has conversion factor 1)
        +
        Since:
        +
        2019-10-16
        +
        +
      • +
      + + + +
        +
      • +

        minus

        +
        public LinearUnit minus(LinearUnit subtrahendend)
        +
        Returns the difference of this unit and another. +

        + Two units can be subtracted if they have the same base. Note that Unit.canConvertTo(org.unitConverter.unit.Unit) can be used to determine + this. If subtrahend does not meet this condition, an IllegalArgumentException will be thrown. +

        +
        +
        Parameters:
        +
        subtrahend - unit to subtract
        +
        Returns:
        +
        difference of units
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if subtrahend is not compatible for subtraction as described above
        +
        java.lang.NullPointerException - if subtrahend is null
        +
        Since:
        +
        2019-03-17, v0.2.0
        +
        +
      • +
      + + + +
        +
      • +

        plus

        +
        public LinearUnit plus(LinearUnit addend)
        +
        Returns the sum of this unit and another. +

        + Two units can be added if they have the same base. Note that Unit.canConvertTo(org.unitConverter.unit.Unit) can be used to determine this. + If addend does not meet this condition, an IllegalArgumentException will be thrown. +

        +
        +
        Parameters:
        +
        addend - unit to add
        +
        Returns:
        +
        sum of units
        +
        Throws:
        +
        java.lang.IllegalArgumentException - if addend is not compatible for addition as described above
        +
        java.lang.NullPointerException - if addend is null
        +
        Since:
        +
        2019-03-17, v0.2.0
        +
        +
      • +
      + + + +
        +
      • +

        times

        +
        public LinearUnit times(double multiplier)
        +
        Multiplies this unit by a scalar.
        +
        +
        Parameters:
        +
        multiplier - scalar to multiply by
        +
        Returns:
        +
        product
        +
        Since:
        +
        2018-12-23, v0.1.0
        +
        +
      • +
      + + + +
        +
      • +

        times

        +
        public LinearUnit times(LinearUnit multiplier)
        +
        Returns the product of this unit and another.
        +
        +
        Parameters:
        +
        multiplier - unit to multiply by
        +
        Returns:
        +
        product of two units
        +
        Throws:
        +
        java.lang.NullPointerException - if multiplier is null
        +
        Since:
        +
        2018-12-22, v0.1.0
        +
        +
      • +
      + + + +
        +
      • +

        toExponent

        +
        public LinearUnit toExponent(int exponent)
        +
        Returns this unit but to an exponent.
        +
        +
        Parameters:
        +
        exponent - exponent to exponentiate unit to
        +
        Returns:
        +
        exponentiated unit
        +
        Since:
        +
        2019-01-15, v0.1.0
        +
        +
      • +
      + + + +
        +
      • +

        toString

        +
        public java.lang.String toString()
        +
        +
        Overrides:
        +
        toString in class Unit
        +
        Returns:
        +
        a string providing a definition of this unit
        +
        Since:
        +
        2019-10-21
        +
        +
      • +
      + + + +
        +
      • +

        withName

        +
        public LinearUnit withName(NameSymbol ns)
        +
        +
        Overrides:
        +
        withName in class Unit
        +
        Parameters:
        +
        ns - name(s) and symbol to use
        +
        Returns:
        +
        a copy of this unit with provided name(s) and symbol
        +
        +
      • +
      + + + +
        +
      • +

        withPrefix

        +
        public LinearUnit withPrefix(UnitPrefix prefix)
        +
        Returns the result of applying prefix to this unit. +

        + If this unit and the provided prefix have a primary name, the returned unit will have a primary name (prefix's + name + unit's name).
        + If this unit and the provided prefix have a symbol, the returned unit will have a symbol.
        + This method ignores alternate names of both this unit and the provided prefix.

        +
        +
        Parameters:
        +
        prefix - prefix to apply
        +
        Returns:
        +
        unit with prefix
        +
        Throws:
        +
        java.lang.NullPointerException - if prefix is null
        +
        Since:
        +
        2019-03-18, v0.2.0
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + -- cgit v1.2.3