Package wt.part

Class Quantity

All Implemented Interfaces:
Externalizable, Serializable, wt.fc._NetFactor, wt.fc._ObjectMappable, NetFactor, ObjectMappable

This structured attribute class represents the concept of quantity as an _Quantity.amount and a QuantityUnit (unit of measure).

Use the newQuantity static factory method(s), not the Quantity constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
  • Method Details

    • newQuantity

      public static Quantity newQuantity(double an_Amount, QuantityUnit a_Unit) throws WTException
      Quantity factory, allowing construction with a specified amount and unit.

      Supported API: true
      Parameters:
      an_Amount -
      a_Unit -
      Returns:
      Quantity
      Throws:
      WTException
    • initialize

      protected void initialize(double an_Amount, QuantityUnit a_Unit) throws WTException
      Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

      Supported API: true
      Parameters:
      an_Amount -
      a_Unit -
      Throws:
      WTException
    • newQuantity

      public static Quantity newQuantity() throws WTException
      Default factory for Quantity. Defaults the amount to 1 and the unit to "ea".

      Supported API: true
      Returns:
      Quantity
      Throws:
      WTException
    • initialize

      protected void initialize() throws WTException
      Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

      Supported API: true
      Throws:
      WTException
    • equals

      public boolean equals(Object obj)
      Returns true if the amount and QuantityUnit are equivalent. Does not convert from one unit to another.

      Supported API: true
      Overrides:
      equals in class Object
      Parameters:
      obj - The Quantity object to compare against.
      Returns:
      boolean