Top Description Constructors Methods
tech.units.indriya.format

pack-priv Class EBNFHelper

extends Object
Class Inheritance
Imports
javax.measure.Unit, .UnitConverter, tech.units.indriya.AbstractUnit, tech.units.indriya.unit.AnnotatedUnit, .BaseUnit, .ProductUnit, .TransformedUnit, java.io.IOException, java.util.Map

Helper class that handles internals of formatting in EBNFUnitFormat
Authors
otaviojava, keilw
Version
1.4

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
formatExponent(Unit<?>
Unit the unit to be formatted
unit
,
int
int the numerator of the fractional power
pow
,
int
int the denominator of the fractional power
root
,
boolean
boolean true if the converter expression should begin with an operator, otherwise false. This will always be true unless the unit being modified is equal to Unit.ONE.
continued
,
Appendable
StringBuffer the buffer to append to. No assumptions should be made about its content.
buffer
,
SymbolMap symbolMap)

Format the given unit raised to the given fractional power to the given StringBuffer.

pack-priv static int

Returns:

the operator precedence of the outermost operator in the unit expression that was output
formatInternal
(Unit<?>
the unit to be formatted
unit
,
Appendable
the StringBuffer to be written to
buffer
,
SymbolMap symbolMap)

Format the given unit to the given Appendable, then return the operator precedence of the outermost operator in the unit expression that was formatted.

private static int
private static int
productPrecedenceInternal(Unit<?> unit, Appendable buffer, SymbolMap symbolMap)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EBNFHelperback to summary
pack-priv EBNFHelper()

Method Detail

formatExponentback to summary
private static void formatExponent(Unit<?> unit, int pow, int root, boolean continued, Appendable buffer, SymbolMap symbolMap) throws IOException

Format the given unit raised to the given fractional power to the given StringBuffer.

Parameters
unit:Unit<?>

Unit the unit to be formatted

pow:int

int the numerator of the fractional power

root:int

int the denominator of the fractional power

continued:boolean

boolean true if the converter expression should begin with an operator, otherwise false. This will always be true unless the unit being modified is equal to Unit.ONE.

buffer:Appendable

StringBuffer the buffer to append to. No assumptions should be made about its content.

formatInternalback to summary
pack-priv static int formatInternal(Unit<?> unit, Appendable buffer, SymbolMap symbolMap) throws IOException

Format the given unit to the given Appendable, then return the operator precedence of the outermost operator in the unit expression that was formatted. See ConverterFormatter for the constants that define the various precedence values.

Parameters
unit:Unit<?>

the unit to be formatted

buffer:Appendable

the StringBuffer to be written to

Returns:int

the operator precedence of the outermost operator in the unit expression that was output

Annotations
@SuppressWarnings:rawtypes, unchecked
noopPrecedenceInternalback to summary
private static int noopPrecedenceInternal(Appendable buffer, String symbol) throws IOException
productPrecedenceInternalback to summary
private static int productPrecedenceInternal(Unit<?> unit, Appendable buffer, SymbolMap symbolMap) throws IOException
Annotations
@SuppressWarnings:unchecked