Interface Measurable<V extends Number,E extends Measurable<V,E,T>,T extends BaseUnit<T>>

All Superinterfaces:
Comparable<E>, Serializable
All Known Subinterfaces:
AbstractMeasure
All Known Implementing Classes:
MetricDimension, Piece, Weight

public interface Measurable<V extends Number,E extends Measurable<V,E,T>,T extends BaseUnit<T>> extends Comparable<E>, Serializable
A Measurable.
Author:
Heiko Scherrer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Measurable<V,E,T> other)
    Add an other Measurable to this one.
    default String
    Return a combination of amount and unit, e.g. 24 PC
    convertTo(T unit)
    Convert this Measurable into another Measurable .
    Get the magnitude of this Measurable.
    Returns the type of Measurable.
    boolean
    Check whether the magnitude is of negative value.
    boolean
    Check whether the magnitude is 0.
    Subtract an other Measurable instance from this one.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Field Details

  • Method Details

    • getUnitType

      T getUnitType()
      Returns the type of Measurable.
      Returns:
      The Measurable's type
    • getMagnitude

      V getMagnitude()
      Get the magnitude of this Measurable.
      Returns:
      the magnitude
    • isZero

      boolean isZero()
      Check whether the magnitude is 0.
      Returns:
      true is magnitude is 0, otherwise false
    • isNegative

      boolean isNegative()
      Check whether the magnitude is of negative value.
      Returns:
      true if the magnitude is of negative value, otherwise false
    • convertTo

      E convertTo(T unit)
      Convert this Measurable into another Measurable .
      Parameters:
      unit - The BaseUnit to convert to
      Returns:
      The converted unit
    • asString

      default String asString()
      Return a combination of amount and unit, e.g. 24 PC
    • add

      Measurable<V,E,T> add(Measurable<V,E,T> other)
      Add an other Measurable to this one.
      Parameters:
      other - The one to add
      Returns:
      A new instance
    • subtract

      Measurable<V,E,T> subtract(Measurable<V,E,T> other)
      Subtract an other Measurable instance from this one.
      Parameters:
      other - The one to subtract
      Returns:
      A new instance