Package org.apache.sis.measure
Class UnitFormat.Operation
java.lang.Object
org.apache.sis.measure.UnitFormat.Operation
- Enclosing class:
- UnitFormat
Represents an operation to be applied between two terms parsed by
UnitFormat.parseTerm(CharSequence, int, int, Operation)
.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
(package private) static final int
Meaning of some characters parsed byUnitFormat.parse(CharSequence)
.(package private) static final int
Meaning of some characters parsed byUnitFormat.parse(CharSequence)
.(package private) boolean
true
if the parsed terms may be one or more words, possibly containing white spaces.(package private) static final int
Meaning of some characters parsed byUnitFormat.parse(CharSequence)
.(package private) static final int
Meaning of some characters parsed byUnitFormat.parse(CharSequence)
.(package private) static final int
Meaning of some characters parsed byUnitFormat.parse(CharSequence)
.private final CharSequence
The symbols being parsed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) javax.measure.Unit<?>
apply
(javax.measure.Unit<?> unit, javax.measure.Unit<?> term, int position) Applies a multiplication or division operation between the given units.(package private) boolean
invert()
If this operation is a multiplication, replaces by division.
-
Field Details
-
NOOP
static final int NOOPMeaning of some characters parsed byUnitFormat.parse(CharSequence)
. TheIMPLICIT
case is a multiplication without symbol, which can be overridden by an explicit × or / symbol.- See Also:
-
IMPLICIT
static final int IMPLICITMeaning of some characters parsed byUnitFormat.parse(CharSequence)
. TheIMPLICIT
case is a multiplication without symbol, which can be overridden by an explicit × or / symbol.- See Also:
-
MULTIPLY
static final int MULTIPLYMeaning of some characters parsed byUnitFormat.parse(CharSequence)
. TheIMPLICIT
case is a multiplication without symbol, which can be overridden by an explicit × or / symbol.- See Also:
-
DIVIDE
static final int DIVIDEMeaning of some characters parsed byUnitFormat.parse(CharSequence)
. TheIMPLICIT
case is a multiplication without symbol, which can be overridden by an explicit × or / symbol.- See Also:
-
EXPONENT
static final int EXPONENTMeaning of some characters parsed byUnitFormat.parse(CharSequence)
. TheIMPLICIT
case is a multiplication without symbol, which can be overridden by an explicit × or / symbol.- See Also:
-
code
int code -
symbols
The symbols being parsed. Used only for formatting error message if needed. -
finished
boolean finishedtrue
if the parsed terms may be one or more words, possibly containing white spaces. In such case, the parsing should not continue after those words.- See Also:
-
-
Constructor Details
-
Operation
Operation(CharSequence symbols) Creates an operation initialized toNOOP
.
-
-
Method Details
-
apply
javax.measure.Unit<?> apply(javax.measure.Unit<?> unit, javax.measure.Unit<?> term, int position) Applies a multiplication or division operation between the given units.- Parameters:
unit
- the left operand, which is the unit parsed so far.term
- the right operation, which is the newly parsed unit.position
- the parse position to report if parsing fail.
-
invert
boolean invert()If this operation is a multiplication, replaces by division. Otherwise do nothing (we do not replace division by multiplication). The intent is to replace units like "m⋅s-1" by "m/s".- Returns:
- whether the operation has been inverted.
-