Overview | Package | Class | Tree | Deprecated | Index | Help
| bea Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## theory.smart.axiom.units
Interface UnitConversion

public interface UnitConversion
extends ConfigurableEntity

The Unit Conversion provides the ability to convert from one unit of measurement to any other in the same classification. The category of a unit describes what type quality the unit is measuring (e.g. height, weight, product packaging sizes). For each quantity being converted "to" the count can be used to simplify the implementation of the most common conversions based on a simple ratio. It also provides support the use of individual instance methods so that more complex calculations can be implemented.

     Primary Key = theory.smart.axiom.units.UnitConversionPk

                      category
     [UnitConversion] <*>------> [String] (Primary Key)

                      atomic
     [UnitConversion] <*>------> [theory.smart.axiom.units.Unit]

                      to (Map)
     [UnitConversion] <*>------> [theory.smart.axiom.units.Quantity]
                         0..*

See Also:
  `UnitConversionPk`, `UnitConversionHome`, `UnitConversionImpl`, `UnitConversionValue`

Method Summary
`boolean` | `containsToKey(java.lang.String key)` Returns `true` if the to map contains a to for the specified key.
`boolean` | `containsToValue(Quantity to)` Returns `true` if the to map maps one or more keys to the specified to.
`Quantity` | `convert(ConversionFunction policy, Quantity qty, Unit unit)`
`Quantity` | `convert(Quantity qty, Unit unit)` Convert the specified quantity to the atomic unit and then into the specified units.
`Unit` | `getAtomic()` Get the value of atomic
`java.lang.String` | `getCategory()`
`ConversionFunction` | `getDefaultConversionPolicy()`
`int` | `getNumberOfTos()` Returns the number of key-value mappings in the to map.
`Quantity` | `getToByKey(java.lang.String key)` Returns the to to which the to map maps the specified key.
`com.sun.java.util.collections.TreeMap` | `getTos()` Returns a copy all of the tos from the specified map to the to map.
`UnitConversionValue` | `getUnitConversionByValue()` Get all of UnitConversion's attributes.
`boolean` | `isTosEmpty()` Returns `true` if the to map contains no key-value mappings.
`void` | `putTo(java.lang.String key, Quantity to)` Associates the specified to with the specified key in the to map.
`void` | `putTos(com.sun.java.util.collections.TreeMap tos)` Copies all of the tos from the specified to map to this to map.
`void` | `removeAllTos()` Removes all tos from this to map.
`Quantity` | `removeToByKey(java.lang.String key)` Removes the to for this key from this to map if present.
`void` | `setAtomic(Unit atomic)` Set the value of atomic
`void` | `setDefaultConversionPolicy(ConversionFunction cvt)`
`void` | `setUnitConversionByValue(UnitConversionValue value)` Set all of UnitConversion's attributes to the passed in value.

Methods inherited from interface theory.smart.foundation.ConfigurableEntity
`setSuccessorAtClassLevel, setSuccessorAtInstanceLevel`

Methods inherited from interface theory.smart.foundation.Configurable
`addProperty, getProperty, removeProperty`

Methods inherited from interface theory.smart.foundation.BusinessPolicyManager
`addBusinessPolicy, getBusinessPolicy, removeBusinessPolicy`

Methods inherited from interface javax.ejb.EJBObject
`getEJBHome, getHandle, getPrimaryKey, isIdentical, remove`

Method Detail

### getUnitConversionByValue

    public UnitConversionValue getUnitConversionByValue()
                                                 throws java.rmi.RemoteException

  Get all of UnitConversion's attributes.
  Returns:
    UnitConversionValue the UnitConversion value object

### setUnitConversionByValue

    public void setUnitConversionByValue(UnitConversionValue value)
                                  throws java.rmi.RemoteException

  Set all of UnitConversion's attributes to the passed in value. Note: Primary key attributes are not set.
  Parameters:
    `UnitConversionValue` - the UnitConversion value object

### getCategory

    public java.lang.String getCategory()
                                 throws java.rmi.RemoteException

### getAtomic

    public Unit getAtomic()
                   throws java.rmi.RemoteException

  Get the value of atomic
  Returns:
    atomic.

### setAtomic

    public void setAtomic(Unit atomic)
                   throws java.rmi.RemoteException

  Set the value of atomic
  Parameters:
    `atomics` - atomic to be added

### containsToKey

    public boolean containsToKey(java.lang.String key)
                          throws java.rmi.RemoteException

  Returns `true` if the to map contains a to for the specified key.
  Parameters:
    `key` - key whose presence in the to map is to be tested.
  Returns:
    `true` if the to map contains a to for the specified key.
  Throws:
    ClassCastException - if the key cannot be compared with the keys currently in the map.
    NullPointerException - key is `null` and the to map uses natural ordering, or its comparator does not tolerate `null` keys.

### containsToValue

    public boolean containsToValue(Quantity to)
                            throws java.rmi.RemoteException

  Returns `true` if the to map maps one or more keys to the specified to. This operation will probably require linear time.
  Parameters:
    `to` - value of to whose presence in the to map is to be tested.

### getToByKey

    public Quantity getToByKey(java.lang.String key)
                        throws java.rmi.RemoteException

  Returns the to to which the to map maps the specified key. Returns `null` if the map contains no to for this key. A return value of `null` does not necessarily indicate that the map contains no to for the key; it's also possible that the map explicitly maps the key to `null`. The `containsKey` operation may be used to distinguish these two cases.
  Parameters:
    `key` - key whose associated to is to be returned.
  Returns:
    the to to which the to map maps the specified key, or `null` if the map contains no to for the key.
  Throws:
    ClassCastException - key cannot be compared with the keys currently in the map.
    NullPointerException - key is `null` and the to map uses natural ordering, or its comparator does not tolerate `null` keys.
  See Also:
    `#containsKey(Object)`

### getTos

    public com.sun.java.util.collections.TreeMap getTos()
                                                 throws java.rmi.RemoteException

  Returns a copy all of the tos from the specified map to the to map. These tos replace any tos that the to map had for any of the keys currently in the specified map.
  Parameters:
    `tos` - a copy of the tos.
  Throws:
    ClassCastException - class of a key or to in the specified map prevents it from being stored in the to map.
    NullPointerException - the to map does not permit `null` keys and a specified key is `null`.

### getNumberOfTos

    public int getNumberOfTos()
                       throws java.rmi.RemoteException

  Returns the number of key-value mappings in the to map.
  Returns:
    the number of key-value mappings in the to map.

### isTosEmpty

    public boolean isTosEmpty()
                       throws java.rmi.RemoteException

  Returns `true` if the to map contains no key-value mappings.

  Returns:
    `true` if the to map contains no key-value mappings.

### putTo

    public void putTo(java.lang.String key,
                      Quantity to)
               throws java.rmi.RemoteException

  Associates the specified to with the specified key in the to map. If the map previously contained a to for this key, the old to is replaced.
  Parameters:
    `key` - key with which the specified to is to be associated.
    `to` - to to be associated with the specified key.
  Throws:
    ClassCastException - key cannot be compared with the keys currently in the map.
    NullPointerException - key is `null` and the to map uses natural order, or its comparator does not tolerate `null` keys.

### putTos

    public void putTos(com.sun.java.util.collections.TreeMap tos)
                throws java.rmi.RemoteException

  Copies all of the tos from the specified to map to this to map. These tos replace any tos that this to map had for any of the keys currently in the specified map.
  Parameters:
    `to` - Tos to be stored in the to map.
  Throws:
    ClassCastException - class of a key or to in the specified map prevents it from being stored in the to map.
    NullPointerException - the to map does not permit `null` keys and a specified key is `null`.

### removeAllTos

    public void removeAllTos()
                      throws java.rmi.RemoteException

  Removes all tos from this to map.

### removeToByKey

    public Quantity removeToByKey(java.lang.String key)
                           throws java.rmi.RemoteException

  Removes the to for this key from this to map if present.
  Parameters:
    `key` - key with which the specified to is associated.
  Returns:
    previous to associated with specified key, or `null` if there was no to for key. A `null` return can also indicate that the map previously associated `null` with the specified key.
  Throws:
    ClassCastException - key cannot be compared with the keys currently in the map.
    NullPointerException - key is `null` and the to map uses natural order, or its comparator does not tolerate `null` keys.

### convert

    public Quantity convert(Quantity qty,
                            Unit unit)
                     throws java.rmi.RemoteException,
                            UnitConversionException

  Convert the specified quantity to the atomic unit and then into the specified units. This method first check for the existence of individual instance methods

### convert

    public Quantity convert(ConversionFunction policy,
                            Quantity qty,
                            Unit unit)
                     throws java.rmi.RemoteException,
                            UnitConversionException

### setDefaultConversionPolicy

    public void setDefaultConversionPolicy(ConversionFunction cvt)
                                    throws java.rmi.RemoteException

### getDefaultConversionPolicy

    public ConversionFunction getDefaultConversionPolicy()
                                                  throws java.rmi.RemoteException

Overview | Package | Class | Tree | Deprecated | Index | Help
| bea Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© Copyright 2000 bea Systems, Inc. All rights reserved.