org.openwms.common.domain.values
Class Weight

java.lang.Object
  extended by org.openwms.common.domain.values.Weight
All Implemented Interfaces:
Serializable, Comparable<Weight>, Unit<WeightUnit>

public class Weight
extends Object
implements Comparable<Weight>, Unit<WeightUnit>, Serializable

A Weight represents a real world weight, that comes with an Unit and a value.

Since:
0.1
Version:
$Revision: 1594 $
Author:
Heiko Scherrer
See Also:
Serialized Form

Constructor Summary
Weight(BigDecimal value, WeightUnit unit)
          Create a new Weight.
Weight(double value, WeightUnit unit)
          Create a new Weight.
Weight(int value, WeightUnit unit)
          Create a new Weight.
 
Method Summary
 int compareTo(Weight o)
          
 void convertTo(WeightUnit unt)
          Convert this unit into another Unit.
 WeightUnit getUnit()
          Returns the unit of the Weight.
 BigDecimal getValue()
          Returns the value of the Weight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Weight

public Weight(BigDecimal value,
              WeightUnit unit)
Create a new Weight.

Parameters:
value - The value of the Weight
unit - The unit of measure

Weight

public Weight(int value,
              WeightUnit unit)
Create a new Weight.

Parameters:
value - The value of the Weight as int
unit - The unit of measure

Weight

public Weight(double value,
              WeightUnit unit)
Create a new Weight.

Parameters:
value - The value of the Weight as double
unit - The unit of measure
Method Detail

getUnit

public WeightUnit getUnit()
Returns the unit of the Weight.

Returns:
The unit.

getValue

public BigDecimal getValue()
Returns the value of the Weight.

Returns:
The value.

convertTo

public void convertTo(WeightUnit unt)
Convert this unit into another Unit.

Specified by:
convertTo in interface Unit<WeightUnit>
Parameters:
unt - The unit to convert to

compareTo

public int compareTo(Weight o)

Specified by:
compareTo in interface Comparable<Weight>


Copyright © 2005-2011 openwms.org. All Rights Reserved.