|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.units.UnitFormatImpl
ucar.units.StandardUnitFormat
public final class StandardUnitFormat
Standard formatter/parser for unit specifications. Instances of this class are thread-compatible but not thread-safe.
Field Summary | |
---|---|
Token |
jj_nt
Next token. |
Token |
token
Current token. |
StandardUnitFormatTokenManager |
token_source
Generated Token Manager. |
Fields inherited from interface ucar.units.StandardUnitFormatConstants |
---|
COLON, DEFAULT, DIVIDE, EOF, LB, LETTER, LG, LN, LPAREN, MINUS, NAME, PERIOD, PLUS, RAISE, REAL_EXP, RPAREN, SHIFT, SIGN, SP, STAR, SYMBOL, T, tokenImage, UINT |
Constructor Summary | |
---|---|
StandardUnitFormat(InputStream stream)
Constructor with InputStream. |
|
StandardUnitFormat(InputStream stream,
String encoding)
Constructor with InputStream and supplied encoding |
|
StandardUnitFormat(Reader stream)
Constructor. |
|
StandardUnitFormat(StandardUnitFormatTokenManager tm)
Constructor with generated Token Manager. |
Method Summary | |
---|---|
Unit |
basicExpr(UnitDB unitDB)
|
Calendar |
clockExpr(Calendar calendar)
|
Calendar |
dateExpr()
|
void |
disable_tracing()
Disable tracing. |
void |
enable_tracing()
Enable tracing. |
StringBuffer |
format(Factor factor,
StringBuffer buf)
Formats a Factor. |
StringBuffer |
format(Unit unit,
StringBuffer buf)
Formats a unit. |
ParseException |
generateParseException()
Generate ParseException. |
Token |
getNextToken()
Get the next Token. |
Token |
getToken(int index)
Get the specific Token. |
static StandardUnitFormat |
instance()
Returns an instance of this class. |
int |
integer()
|
Unit |
logExpr(UnitDB unitDB)
|
StringBuffer |
longFormat(Unit unit,
StringBuffer buf)
Formats a unit in the underlying system of units. |
static void |
main(String[] args)
Test this class. |
double |
number()
|
Unit |
parse(String spec,
UnitDB unitDB)
Decodes a unit specification. |
Unit |
powerExpr(UnitDB unitDB)
|
Unit |
productExpr(UnitDB unitDB)
|
double |
real()
|
void |
ReInit(InputStream stream)
Reinitialise. |
void |
ReInit(InputStream stream,
String encoding)
Reinitialise. |
void |
ReInit(Reader stream)
Reinitialise. |
void |
ReInit(StandardUnitFormatTokenManager tm)
Reinitialise. |
Unit |
shiftExpr(UnitDB unitDB)
|
int |
sign()
|
double |
tenFactor()
|
Date |
timeOriginExpr()
|
Unit |
unitIdentifier(UnitDB unitDB)
|
Unit |
unitSpec(UnitDB unitDB)
|
double |
unsignedDecimal()
|
int |
unsignedInteger()
|
Calendar |
zoneExpr(Calendar calendar)
|
Methods inherited from class ucar.units.UnitFormatImpl |
---|
format, format, longFormat, parse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public StandardUnitFormatTokenManager token_source
public Token token
public Token jj_nt
Constructor Detail |
---|
public StandardUnitFormat(InputStream stream)
public StandardUnitFormat(InputStream stream, String encoding)
public StandardUnitFormat(Reader stream)
public StandardUnitFormat(StandardUnitFormatTokenManager tm)
Method Detail |
---|
public static StandardUnitFormat instance()
public Unit parse(String spec, UnitDB unitDB) throws UnitParseException, SpecificationException, UnitDBException, PrefixDBException, UnitSystemException
parse
in interface UnitFormat
spec
- The unit specification to be decoded.unitDB
- The unit database to use.
UnitParseException
- The unit specification syntax is
invalid.
SpecificationException
- Something's wrong with the
specification.
UnitDBException
- Something's wrong with the unit
database.
PrefixDBException
- Something's wrong with the unit prefix
database.
UnitSystemException
- Something's wrong with the underlying
system of units.public StringBuffer format(Factor factor, StringBuffer buf)
format
in interface UnitFormat
factor
- The factor to be formatted.buf
- The buffer to append to.
public StringBuffer format(Unit unit, StringBuffer buf) throws UnitClassException
format
in interface UnitFormat
unit
- The unit to be formatted.buf
- The buffer to append to.
UnitClassException
- The class of the unit is unknown.public StringBuffer longFormat(Unit unit, StringBuffer buf) throws UnitClassException
longFormat
in interface UnitFormat
unit
- The unit to be formatted.buf
- The buffer to append to.
UnitClassException
- The class of the unit is unknown.public static void main(String[] args) throws Exception
Exception
public final Unit unitSpec(UnitDB unitDB) throws ParseException, OperationException, UnitSystemException, PrefixDBException, UnitDBException
ParseException
OperationException
UnitSystemException
PrefixDBException
UnitDBException
public final Unit shiftExpr(UnitDB unitDB) throws ParseException, OperationException, UnitSystemException, PrefixDBException, UnitDBException
ParseException
OperationException
UnitSystemException
PrefixDBException
UnitDBException
public final Unit productExpr(UnitDB unitDB) throws ParseException, OperationException, UnitSystemException, PrefixDBException, UnitDBException
ParseException
OperationException
UnitSystemException
PrefixDBException
UnitDBException
public final Unit powerExpr(UnitDB unitDB) throws ParseException, OperationException, UnitSystemException, PrefixDBException, UnitDBException
ParseException
OperationException
UnitSystemException
PrefixDBException
UnitDBException
public final Unit basicExpr(UnitDB unitDB) throws ParseException, OperationException, UnitSystemException, PrefixDBException, UnitDBException
ParseException
OperationException
UnitSystemException
PrefixDBException
UnitDBException
public final Unit logExpr(UnitDB unitDB) throws ParseException, OperationException, UnitSystemException, PrefixDBException, UnitDBException
ParseException
OperationException
UnitSystemException
PrefixDBException
UnitDBException
public final double number() throws ParseException
ParseException
public final double real() throws ParseException
ParseException
public final int sign() throws ParseException
ParseException
public final double unsignedDecimal() throws ParseException
ParseException
public final double tenFactor() throws ParseException
ParseException
public final int integer() throws ParseException
ParseException
public final int unsignedInteger() throws ParseException
ParseException
public final Unit unitIdentifier(UnitDB unitDB) throws ParseException, UnitDBException, UnitSystemException, PrefixDBException, OperationException
ParseException
UnitDBException
UnitSystemException
PrefixDBException
OperationException
public final Date timeOriginExpr() throws ParseException
ParseException
public final Calendar dateExpr() throws ParseException
ParseException
public final Calendar clockExpr(Calendar calendar) throws ParseException
ParseException
public final Calendar zoneExpr(Calendar calendar) throws ParseException
ParseException
public void ReInit(InputStream stream)
public void ReInit(InputStream stream, String encoding)
public void ReInit(Reader stream)
public void ReInit(StandardUnitFormatTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |