wt.part
Class Quantity

java.lang.Object
  extended by wt.part.Quantity
All Implemented Interfaces:
Externalizable, Serializable, NetFactor, ObjectMappable

public final class Quantity
extends Object
implements ObjectMappable, Externalizable

This structured attribute class represents the concept of quantity as an 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:
Serialized Form

Field Summary
static String AMOUNT
          Label for the attribute; The amount attributes represents the amount portion of the Quantity.
static String UNIT
          Label for the attribute.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the amount and QuantityUnit are equivalent.
 double getAmount()
          Gets the value of the attribute: AMOUNT.
 QuantityUnit getUnit()
          Gets the object for the association that plays role: UNIT.
protected  void initialize()
          Supports initialization, following construction of an instance.
protected  void initialize(double an_Amount, QuantityUnit a_Unit)
          Supports initialization, following construction of an instance.
static Quantity newQuantity()
          Default factory for Quantity.
static Quantity newQuantity(double an_Amount, QuantityUnit a_Unit)
          Quantity factory, allowing construction with a specified amount and unit.
 void setAmount(double a_Amount)
          Sets the value of the attribute: AMOUNT.
 void setUnit(QuantityUnit a_Unit)
          Sets the object for the association that plays role: UNIT.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AMOUNT

public static final String AMOUNT
Label for the attribute; The amount attributes represents the amount portion of the Quantity.

Supported API: true

See Also:
Constant Field Values

UNIT

public static final String UNIT
Label for the attribute.

Supported API: true

See Also:
Constant Field Values
Method Detail

getAmount

public double getAmount()
Gets the value of the attribute: AMOUNT. The amount attributes represents the amount portion of the Quantity.

Supported API: true

Returns:
double

setAmount

public void setAmount(double a_Amount)
Sets the value of the attribute: AMOUNT. The amount attributes represents the amount portion of the Quantity.

Supported API: true

Parameters:
a_Amount -

getUnit

public QuantityUnit getUnit()
Gets the object for the association that plays role: UNIT.

Supported API: true

Returns:
QuantityUnit

setUnit

public void setUnit(QuantityUnit a_Unit)
Sets the object for the association that plays role: UNIT.

Supported API: true

Parameters:
a_Unit -

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