|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rubecula.util.Item
com.rubecula.jquantity.BaseUnit
com.rubecula.jquantity.UnitsFoundation
com.rubecula.jquantity.Units
This class extends UnitsFoundation by adding instance fields: _A, _B, _PowerA, _PowerB, _Scale, _Offset and _System.
New version of Units introduced February 2002.
In this new version, we make use of an Interface Measurable which provides
both the scale and the dimensions of a unit.
There are three implementers of Measurable:
This class is not yet fully implemented.
Nested Class Summary |
Nested classes inherited from class com.rubecula.jquantity.UnitsFoundation |
UnitsFoundation.UnitsException |
Fields inherited from class com.rubecula.jquantity.UnitsFoundation |
_Name |
Fields inherited from class com.rubecula.util.Item |
JQUANTITY_TEST |
Constructor Summary | |
(package private) |
Units(Measurable base)
|
(package private) |
Units(String name,
Measurable base)
|
(package private) |
Units(String name,
Measurable base,
SystemFlag flag)
|
(package private) |
Units(UnitsName name,
SystemFlag system,
Rational scale,
Measurable A)
|
(package private) |
Units(UnitsName name,
SystemFlag system,
Rational scale,
Rational powerA,
Measurable A)
|
(package private) |
Units(UnitsName name,
SystemFlag system,
Rational scale,
Rational powerA,
Measurable A,
Rational powerB,
Measurable B)
|
(package private) |
Units(UnitsName name,
SystemFlag system,
Rational scale,
Rational powerA,
Measurable A,
Rational powerB,
Measurable B,
Rational offset)
|
Method Summary | |
(package private) void |
audit(int indent)
|
void |
audit(PrintStream out)
|
Object |
clone()
Creates and returns a copy of this Units. |
(package private) Units |
combine(Rational powerA,
Measurable B,
Rational powerB)
|
int |
compareTo(Measurable val)
Compares this Units with the specified Measurable. |
int |
compareTo(Object val)
Compares this Units with the specified Object. |
Measurable |
convertToSystem(int systemIndex)
|
(package private) Units |
difference(Measurable addend)
|
BaseUnit |
flatten()
Method to reduce a Units tree to a single flattened version. |
(package private) int |
getCommonSysIndex(Units that)
|
private String |
getDescription()
|
Dimensions |
getDimensions()
Method to return the dimensions of this Measurable. |
Rational |
getOffset()
Method to return the offset of this Measurable. |
Rational |
getScale()
Method to return the scale of this Measurable. |
SystemFlag |
getSystem()
|
(package private) Units |
halve()
|
int |
hashCode()
|
boolean |
identity()
|
boolean |
isAngular()
|
(package private) boolean |
isEqual(Measurable other)
Method to determine if this BaseUnit is equivalent to that Measurable. |
boolean |
isInSystem(int sysIndex)
Method to determine if this Measurable is in a certain system of units. |
boolean |
isMutable()
This method indicates whether this particular instance is mutable, i.e. it has not been designated a constant. |
static void |
main(String[] args)
|
com.rubecula.util.Presentable |
makePresentableInstance(com.rubecula.util.Presentation presentation)
Instance method to convert a Presentation into a Presentable. |
(package private) Units |
minus()
|
private void |
monitor(String method,
String arg0,
String arg1,
String arg2)
|
private static Rational |
nonZeroDivide(Rational num,
long denom)
|
com.rubecula.util.Presentation |
present(com.rubecula.util.AttrMap attributes)
Convert this Presentable object into a Presentation, according to the set of attributes provided. |
(package private) Units |
productScalar(Rational power)
|
(package private) Units |
rename(String name)
|
(package private) Units |
scale(int scale)
Scale this unit. |
(package private) Units |
scale(Rational scale)
Scale this unit. |
(package private) Units |
scale(UnitsName name,
int scale)
Scale this unit and assign a new name to the result. |
(package private) Units |
scale(UnitsName name,
int scale,
SystemFlag system)
Scale this unit and assign a new name and system to the result. |
Units |
scale(UnitsName name,
Rational scale)
Scale this unit and assign a new name to the result. |
(package private) Units |
scale(UnitsName name,
Rational scale,
SystemFlag system)
Scale this unit and assign a new name and system to the result. |
(package private) Rational |
scaleToUnits(Measurable base,
Rational value)
This method converts value which is expressed in this Units into a value expressed in base units. |
private static boolean |
stringComposite(String string)
|
(package private) Units |
sum(Measurable addend)
|
static Measurable |
Sum(Measurable x,
Measurable y)
|
(package private) Units |
sum(Measurable addend,
Rational power)
|
String |
toString()
|
String |
toString(int sysIndex)
|
Methods inherited from class com.rubecula.jquantity.UnitsFoundation |
audit, audit, audit, getIdentifier, isNumber, monitor, normalize, setIdentifier, setName, setName, setName, setName, setName, setName |
Methods inherited from class com.rubecula.jquantity.BaseUnit |
isParallel, isParallelInSystem |
Methods inherited from class com.rubecula.util.Item |
Debug, getClassNameShort, getType, IsDebug, present, SetDebug, test, test, Wrap |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.rubecula.jquantity.Measurable |
isNumber, isParallel |
Methods inherited from interface com.rubecula.util.Identifiable |
getIdentifier |
Methods inherited from interface com.rubecula.util.Auditable |
audit, audit, audit |
Field Detail |
private final SystemFlag _System
private final Rational _Scale
private final Rational _Offset
private final Rational _PowerA
private final Measurable _A
private final Rational _PowerB
private final Measurable _B
public static final String ABA
public static final String ANGD
public static final String ANGR
public static final String ANGX
public static final String ANGG
public static final String ANGAS
public static final String ANGAM
public static final String CUSD
public static final String DEGF
public static final String DEGC
public static final String DEGK
public static final String DEGR
public static final String DSTM
public static final String DSTDM
public static final String DSTHM
public static final String DSTKM
public static final String DSTCM
public static final String DSTMM
public static final String DSTA
public static final String DSTF
public static final String DSTI
public static final String DSTY
public static final String DSTMI
public static final String DSTAU
public static final String DSTLS
public static final String DSTLY
public static final String TIMS
public static final String TIMM
public static final String TIMH
public static final String TIMD
public static final String TIMY
public static final String TIMW
public static final String TIMF
public static final String MASK
public static final String MASG
public static final String MASP
public static final String MASO
public static final String MASS
public static final String MASL
public static final String MAST
public static final String AMP
public static final String CHRG
public static final String ERGJ
public static final String ERGK
public static final String ERGB
public static final String ERGC
public static final String ERGV
public static final String ERGE
public static final String ERGF
public static final String POWW
public static final String POWH
public static final String LIGHT
public static final String QTY
public static final String VOLT
public static final String FREQ
public static final String FRCN
public static final String FRCD
public static final String FRCP
public static final String FRCW
public static final String PRSP
public static final String PRST
public static final String PRSB
public static final String PRSA
public static final String PRSPSI
public static final String REST
public static final String ECAP
public static final String MFLX
public static final String INDCT
public static final String MFD
public static final String AA
public static final String AAC
public static Rational Ten
public static Rational Tenth
public static Rational Hundred
public static Rational Hundredth
public static Rational Thousand
public static Rational Thousandth
public static final Units None
public static final Units Meter
public static final Units Second
public static final Units Kilogram
public static final Units Radian
public static final Units Ampere
public static final Units Kelvin
public static final Units Candela
public static final Units Mole
public static final Units DollarUS
public static final Units Minute
public static final Units Hour
public static final Units Day
public static final Units Hertz
public static final Units Degree
public static final Units Rightangle
public static final Units Grad
public static final Units Coulomb
private static final Units MeterPerSecond
private static final Units MeterCubed
private static final Units SecondSquared
private static final Units MetrePerSecondSquared
private static final Units KilogramPerSecondSquared
public static final Units Newton
public static final Units Pascal
public static final Units GravConstUnits
public static final Units MeterPerSecondAllSquared
public static final Units Joule
public static final Units G
public static final Units Watt
public static final Units Volt
public static final Units Weber
public static final Units Henry
public static final Units Tesla
public static final Units Gram
public static final Units Centimeter
protected static final long $L_M_PER_LIGHTSEC
protected static final String $S_M_PER_FOOT
protected static final String $S_KG_PER_POUND
public static final Units LightSecond
public static final Units Pound
public static final Units Foot
private static final Units[][] BaseUnits
Constructor Detail |
Units(UnitsName name, SystemFlag system, Rational scale, Rational powerA, Measurable A, Rational powerB, Measurable B, Rational offset)
Units(UnitsName name, SystemFlag system, Rational scale, Rational powerA, Measurable A, Rational powerB, Measurable B)
Units(UnitsName name, SystemFlag system, Rational scale, Rational powerA, Measurable A)
Units(UnitsName name, SystemFlag system, Rational scale, Measurable A)
Units(String name, Measurable base, SystemFlag flag)
Units(String name, Measurable base)
Units(Measurable base)
Method Detail |
public final int hashCode()
public Object clone()
Exception
- : not Cloneable (should be impossible)Cloneable
public int compareTo(Measurable val)
val
- Units to which this Measurable is to be compared.
public int compareTo(Object val)
compareTo
in interface Comparable
val
- Object to which this Units is to be compared.
public Dimensions getDimensions()
Measurable
getDimensions
in interface Measurable
public Rational getScale()
Measurable
getScale
in interface Measurable
public Rational getOffset()
Measurable
getOffset
in interface Measurable
final Units scale(UnitsName name, Rational scale, SystemFlag system)
name
- Name of scaled unitscale
- The scale.
For example, when creating an inch from a millimetre the
value of scale would be 254/10.system
- The system of the new unit.
public final Units scale(UnitsName name, Rational scale)
name
- Name of scaled unitscale
- The scale.
For example, when creating an inch from a millimetre the
value of scale would be 254/10.
final Units scale(Rational scale)
scale
- The scale.
For example, when creating an inch from a millimetre the
value of scale would be 254/10.
final Units scale(UnitsName name, int scale, SystemFlag system)
name
- Name of scaled unitscale
- The scale.
For example, when creating a minute from a second the
value of scale would be 60.system
- The system of the new unit.
final Units scale(UnitsName name, int scale)
name
- Name of scaled unitscale
- The scale.
For example, when creating a minute from a second the
value of scale would be 60.
final Units scale(int scale)
scale
- The scale.
For example, when creating a minute from a second the
value of scale would be 60.
final Units combine(Rational powerA, Measurable B, Rational powerB)
final Units sum(Measurable addend, Rational power)
final Units sum(Measurable addend)
final Units difference(Measurable addend)
final Units productScalar(Rational power)
final Units minus()
final Units halve() throws JQuantityException
JQuantityException
final Units rename(String name)
public SystemFlag getSystem()
getSystem
in interface Measurable
public boolean isInSystem(int sysIndex)
BaseUnit
isInSystem
in class BaseUnit
sysIndex
- the index of the units system.
public BaseUnit flatten() throws JQuantityException
Measurable
flatten
in interface Measurable
JQuantityException
boolean isEqual(Measurable other)
BaseUnit
isEqual
in class BaseUnit
other
- the Measurable to compare.
final Rational scaleToUnits(Measurable base, Rational value) throws JQuantityException
base
- the units in which we want a value scaled.value
- the value to scale.
JQuantityException
public String toString(int sysIndex)
toString
in class UnitsFoundation
public String toString()
toString
in class UnitsFoundation
public void audit(PrintStream out)
public com.rubecula.util.Presentation present(com.rubecula.util.AttrMap attributes) throws com.rubecula.util.PresentationException
present
in interface com.rubecula.util.Presentable
attributes
- a map of the attributes desired for the construction
of the new presentation (may be empty).
com.rubecula.util.PresentationException
- in case of parsing error.public com.rubecula.util.Presentable makePresentableInstance(com.rubecula.util.Presentation presentation) throws com.rubecula.util.PresentationException
makePresentableInstance
in interface com.rubecula.util.Presentable
presentation
- of a number to be converted into a Presentable number.
com.rubecula.util.PresentationException
- in case of parsing error.private String getDescription()
private static boolean stringComposite(String string)
public final boolean identity() throws JQuantityException
JQuantityException
public final boolean isAngular() throws JQuantityException
JQuantityException
final int getCommonSysIndex(Units that)
final void audit(int indent)
private void monitor(String method, String arg0, String arg1, String arg2)
private static Rational nonZeroDivide(Rational num, long denom)
public final Measurable convertToSystem(int systemIndex)
systemIndex
- the system in which we want the returned value to be.
public static void main(String[] args)
public boolean isMutable()
Mutable
isMutable
in interface Mutable
public static Measurable Sum(Measurable x, Measurable y)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |