Class Weight

java.lang.Object
org.ka2ddo.yaac.osm.Weight
All Implemented Interfaces:
QuantityUnitMeasure<WeightUnit>

public class Weight extends Object implements QuantityUnitMeasure<WeightUnit>
This class defines a compound object containing a weight value and the unit of weight.
Author:
Andrew Pavlin, KA2DDO
  • Constructor Summary

    Constructors
    Constructor
    Description
    Weight(float weight)
    Create a Weight in short tons.
    Weight(float weight, WeightUnit unit)
    Create a Weight of the specified magnitude and units.
    Weight(String value)
    Create a Weight from a String encoding, which may include a weight unit name.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Get the magnitude of this value in its unit.
    float
    Get this length in the specified units.
    float
    Get the magnitude of this value in the default unit for the value class, scaling it if stored in a different unit.
    Get the unit in which the magnitude is measured.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Weight

      public Weight(String value) throws IllegalArgumentException
      Create a Weight from a String encoding, which may include a weight unit name.
      Parameters:
      value - String value to decode
      Throws:
      IllegalArgumentException - if weight cannot be decoded
    • Weight

      public Weight(float weight, WeightUnit unit)
      Create a Weight of the specified magnitude and units.
      Parameters:
      weight - magnitude of weight
      unit - WeightUnit of the value
    • Weight

      public Weight(float weight)
      Create a Weight in short tons.
      Parameters:
      weight - quantity of tons in the weight
  • Method Details