|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectetomica.units.PrefixedUnit
public class PrefixedUnit
Implementation of the Unit interface formed from a base Unit (e. g., grams) and a Prefix (e. g., kilo). The base unit cannot be changed after construction. However, the prefix can be changed using the setPrefix method.
SimpleUnit,
Prefix,
Serialized Form| Constructor Summary | |
|---|---|
PrefixedUnit(Prefix prefix,
Unit base)
Constructs a PrefixedUnit using the given prefix and base |
|
PrefixedUnit(Unit base)
Constructs a PrefixedUnit using the given base and a Null prefix |
|
| Method Summary | |
|---|---|
Dimension |
dimension()
Returns the dimension of this baseUnit. |
double |
fromSim(double x)
Takes the given value in simulation units and converts it to class units (considering prefix). |
Prefix |
getPrefix()
|
Prefix |
prefix()
Returns the prefix of the baseUnit. |
boolean |
prefixAllowed()
Returns false to indicate that a prefix cannot be applied to an already prefixed baseUnit. |
void |
setPrefix(Prefix pre)
Changes prefix to given instance if prefixAllowed flag is true |
String |
symbol()
Accessor for symbol of baseUnit |
double |
toSim(double x)
Takes the given value in class units (considering prefix) and converts it to simulation units. |
String |
toString()
Accessor for common name of baseUnit |
Unit |
unit()
Returns the base baseUnit of the baseUnit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PrefixedUnit(Unit base)
public PrefixedUnit(Prefix prefix,
Unit base)
| Method Detail |
|---|
public Dimension dimension()
dimension in interface Unitpublic final void setPrefix(Prefix pre)
public Prefix getPrefix()
public Prefix prefix()
public Unit unit()
public final double toSim(double x)
toSim in interface Unitx - a value in units of this class
public final double fromSim(double x)
fromSim in interface Unitx - a value in simulation units
public String toString()
toString in class Objectpublic String symbol()
symbol in interface Unitpublic boolean prefixAllowed()
prefixAllowed in interface UnitUnit.prefixAllowed()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||