Class AbstractFloatScalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>

java.lang.Object
java.lang.Number
org.djunits.value.AbstractScalar<U,​S>
org.djunits.value.vfloat.scalar.base.AbstractFloatScalar<U,​S>
Type Parameters:
U - the unit
S - the type
All Implemented Interfaces:
Serializable, Cloneable, Comparable<S>, Scalar<U,​S>, ValueFunctions<U,​S>, Value<U,​S>, FloatScalarInterface<U,​S>
Direct Known Subclasses:
AbstractFloatScalarAbs, AbstractFloatScalarRel

public abstract class AbstractFloatScalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
extends AbstractScalar<U,​S>
implements FloatScalarInterface<U,​S>
The most basic abstract class for the FloatScalar.

Copyright (c) 2013-2019 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
See Also:
Serialized Form
  • Field Details

    • si

      public final float si
      The value, stored in the standard SI unit.
  • Constructor Details

    • AbstractFloatScalar

      AbstractFloatScalar​(U unit, float si)
      Construct a new AbstractFloatScalar.
      Parameters:
      unit - U; the unit
      si - float; the si value to store
  • Method Details

    • getSI

      public final float getSI()
      Retrieve the value in the underlying SI unit.
      Specified by:
      getSI in interface FloatScalarInterface<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      float
    • getInUnit

      public final float getInUnit()
      Retrieve the value in the original unit.
      Specified by:
      getInUnit in interface FloatScalarInterface<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      float
    • getInUnit

      public final float getInUnit​(U targetUnit)
      Retrieve the value converted into some specified unit.
      Specified by:
      getInUnit in interface FloatScalarInterface<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      targetUnit - U; the unit to convert the value into
      Returns:
      float
    • lt

      public final boolean lt​(S o)
      Test if this DoubleScalar is less than another DoubleScalar.
      Specified by:
      lt in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is less than other; false if this is not less than other
    • le

      public final boolean le​(S o)
      Test if this DoubleScalar is less than or equal to another DoubleScalar.
      Specified by:
      le in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean
    • gt

      public final boolean gt​(S o)
      Test if this DoubleScalar is greater than or equal to a DoubleScalar.
      Specified by:
      gt in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is greater than or equal to other; false if this is not greater than or equal to other
    • ge

      public final boolean ge​(S o)
      Test if this DoubleScalar is greater than a DoubleScalar.
      Specified by:
      ge in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is greater than other; false if this is not greater than other
    • eq

      public final boolean eq​(S o)
      Test if this DoubleScalar is equal to a DoubleScalar.
      Specified by:
      eq in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is equal to other; false if this is not equal to other
    • ne

      public final boolean ne​(S o)
      Test if this DoubleScalar is not equal to a DoubleScalar.
      Specified by:
      ne in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is not equal to other; false if this is equal to other
    • lt0

      public final boolean lt0()
      Test if this DoubleScalar is less than 0.0.
      Specified by:
      lt0 in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      boolean; true if this is less than 0.0; false if this is not less than 0.0
    • le0

      public final boolean le0()
      Test if this DoubleScalar is less than or equal to 0.0.
      Specified by:
      le0 in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      boolean; true if this is less than or equal to 0.0; false if this is not less than or equal to 0.0
    • gt0

      public final boolean gt0()
      Test if this DoubleScalar is greater than or equal to 0.0.
      Specified by:
      gt0 in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      boolean; true if this is greater than or equal to 0.0; false if this is not greater than or equal to 0.0
    • ge0

      public final boolean ge0()
      Test if this DoubleScalar is greater than 0.0.
      Specified by:
      ge0 in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      boolean; true if this is greater than 0.0; false if this is not greater than 0.0
    • eq0

      public final boolean eq0()
      Test if this DoubleScalar is equal to 0.0.
      Specified by:
      eq0 in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      boolean; true if this is equal to 0.0; false if this is not equal to 0.0
    • ne0

      public final boolean ne0()
      Test if this DoubleScalar is not equal to 0.0.
      Specified by:
      ne0 in interface Scalar<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Returns:
      boolean; true if this is not equal to 0.0; false if this is equal to 0.0
    • compareTo

      public final int compareTo​(S o)
      Specified by:
      compareTo in interface Comparable<U extends Unit<U>>
    • intValue

      public int intValue()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • toString

      public final String toString()
      Concise description of this value.
      Specified by:
      toString in interface Value<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Overrides:
      toString in class Object
      Returns:
      a String with the value, non-verbose, with the unit attached.
    • toString

      public final String toString​(U displayUnit)
      Somewhat verbose description of this value with the values expressed in the specified unit.
      Specified by:
      toString in interface Value<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      displayUnit - U; the unit into which the values are converted for display
      Returns:
      String; printable string with the value contents expressed in the specified unit
    • toString

      public final String toString​(boolean verbose, boolean withUnit)
      Somewhat verbose description of this value with optional type and unit information.
      Specified by:
      toString in interface Value<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      verbose - boolean; if true; include type info; if false; exclude type info
      withUnit - boolean; if true; include the unit; of false; exclude the unit
      Returns:
      String; printable string with the value contents
    • toString

      public final String toString​(U displayUnit, boolean verbose, boolean withUnit)
      Somewhat verbose description of this value with the values expressed in the specified unit.
      Specified by:
      toString in interface Value<U extends Unit<U>,​S extends AbstractFloatScalar<U,​S>>
      Parameters:
      displayUnit - U; the unit into which the values are converted for display
      verbose - boolean; if true; include type info; if false; exclude type info
      withUnit - boolean; if true; include the unit; of false; exclude the unit
      Returns:
      String; printable string with the value contents
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object