Unit
public class PrefixedUnit extends java.lang.Object implements Unit
SimpleUnit
,
Prefix
Constructor | Description |
---|---|
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
|
Modifier and Type | Method | Description |
---|---|---|
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() |
|
boolean |
prefixAllowed() |
Indicates if the unit is appropriate for use with a prefix.
|
void |
setPrefix(Prefix pre) |
Changes prefix to given instance if prefixAllowed flag is true.
|
java.lang.String |
symbol() |
Returns the symbol of unit, such as "g" for grams.
|
double |
toSim(double x) |
Takes the given value in class units (considering prefix) and converts it to simulation units.
|
java.lang.String |
toString() |
|
Unit |
unit() |
public PrefixedUnit(Unit base)
public Dimension dimension()
public final void setPrefix(Prefix pre)
pre
- the new prefix for the unitpublic Prefix getPrefix()
public Prefix prefix()
public Unit unit()
public final double toSim(double x)
public final double fromSim(double x)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String symbol()
Unit
public boolean prefixAllowed()
Unit
prefixAllowed
in interface Unit
Unit.prefixAllowed()