asgaard.lang
Class Unit

java.lang.Object
  |
  +--asgaard.skid.LightBean
        |
        +--asgaard.lang.Def
              |
              +--asgaard.lang.Word
                    |
                    +--asgaard.lang.Unit
Direct Known Subclasses:
Item

public class Unit
extends Word

This class implements the Mechanism to use different units at a given measure. These Units are stored as instances within Skid and relate on a choosen Base - Unit, e.g. [meter] for Distances (which may also be displayed as [mile] by a unit - instance.

The conversation mechanism itselfe is implemented by the classes in the asgaard.utils.unit package using the Convert interface.

Remark: To inherit this kind of SkidBean modifications within the code of the BeanBroker are nessecary (look for the BEANTYPE pattern).

See Also:
Convert, Serialized Form

Fields inherited from class asgaard.lang.Def
longName, shortName
 
Fields inherited from class asgaard.skid.LightBean
broker, cKey, debug, history_policy, key, tsCreated, tsModified, update_policy
 
Constructor Summary
Unit()
          Instanciates a new unit Do not use manually.
Unit(java.lang.String sName, java.lang.String lName, asgaard.utils.unit.Convert unit)
          Generates a new Unit with the Default-Values
 
Method Summary
 asgaard.utils.unit.Convert convert()
          Returns the conversion object
 void init(java.lang.String name, java.lang.Object content, long tsC, long tsM)
          Inits a new Unit with a given Collection Do not use manually.
 void setConvert(asgaard.utils.unit.Convert unit)
          Sets the conversation Object.
 
Methods inherited from class asgaard.lang.Word
getArgs, getLongName, getName, getObject, setName, setName, setName
 
Methods inherited from class asgaard.lang.Def
getLongname, getName, init, setLongname, setName
 
Methods inherited from class asgaard.skid.LightBean
addEvent, cloneBean, flush, getAge, getBeanType, getBroker, getChangeHistory, getClassKey, getCreated, getEvent, getFilter, getIdentifier, getKey, getLink, getMethods, getModified, getUpdatePolicy, init, invoke, isChanged, isNew, isReadOnly, modify, putLink, setAge, setObject, suscribeEvent, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Unit

public Unit()
Instanciates a new unit Do not use manually.

Unit

public Unit(java.lang.String sName,
            java.lang.String lName,
            asgaard.utils.unit.Convert unit)
     throws asgaard.skid.SkidException
Generates a new Unit with the Default-Values
Parameters:
sName - the identifying (common) Name of the Word
multiplier - the factor
Throws:
asgaard.skid.SkidException -  
Method Detail

init

public void init(java.lang.String name,
                 java.lang.Object content,
                 long tsC,
                 long tsM)
          throws asgaard.skid.SkidException
Inits a new Unit with a given Collection Do not use manually. Only use by the BeanBroker.
Parameters:
content - collection of Words indized by other Def's
tsC - created - timestamp
tsM - modified - timestamp
Throws:
asgaard.skid.SkidException - if the given Object is no valid Hashtable
Overrides:
init in class Word

convert

public asgaard.utils.unit.Convert convert()
Returns the conversion object
See Also:
asggard.utils.unit.Convert

setConvert

public void setConvert(asgaard.utils.unit.Convert unit)
Sets the conversation Object.
Parameters:
factor - a multiplier