Class UnitsRelationsDefault
java.lang.Object
org.checkerframework.checker.units.UnitsRelationsDefault
- All Implemented Interfaces:
UnitsRelations
Default relations between SI units.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Elements
The Element Utilities from the Units Checker's processing environment.protected AnnotationMirror
SI base units.protected AnnotationMirror
Non-SI unitsprotected AnnotationMirror
SI base units.protected AnnotationMirror
SI base units.protected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Non-SI unitsprotected AnnotationMirror
Derived SI units with special namesprotected AnnotationMirror
SI base units.protected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
SI base units.protected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Derived SI units without special namesprotected AnnotationMirror
Derived SI units with special namesprotected AnnotationMirror
SI base units.protected AnnotationMirror
Non-SI units -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
bothHaveSpecificPrefix
(Prefix lhtPrefix, Prefix rhtPrefix, Prefix specificPrefix) Checks to see if both lhtPrefix and rhtPrefix have the same prefix as specificPrefix.division
(AnnotatedTypeMirror lht, AnnotatedTypeMirror rht) Provides rules for resolving the result Unit of the division of checker-framework provided Units.protected boolean
havePairOfUnits
(AnnotatedTypeMirror lht, AnnotationMirror ul, AnnotatedTypeMirror rht, AnnotationMirror ur) Checks to see if lht has the unit ul and if rht has the unit ur all at the same time.protected boolean
havePairOfUnitsIgnoringOrder
(AnnotatedTypeMirror lht, AnnotationMirror u1, AnnotatedTypeMirror rht, AnnotationMirror u2) Checks to see if lht and rht have the pair of units u1 and u2 regardless of order.Constructs various AnnotationMirrors representing specific checker-framework provided Units involved in the rules resolved in this UnitsRelations implementation.Provides rules for resolving the result Unit of the multiplication of checker-framework provided Units.
-
Field Details
-
m
SI base units. -
km
SI base units. -
mm
SI base units. -
s
SI base units. -
g
SI base units. -
kg
SI base units. -
m2
Derived SI units without special names -
km2
Derived SI units without special names -
mm2
Derived SI units without special names -
m3
Derived SI units without special names -
km3
Derived SI units without special names -
mm3
Derived SI units without special names -
mPERs
Derived SI units without special names -
mPERs2
Derived SI units without special names -
N
Derived SI units with special names -
kN
Derived SI units with special names -
h
Non-SI units -
kmPERh
Non-SI units -
t
Non-SI units -
elements
The Element Utilities from the Units Checker's processing environment.
-
-
Constructor Details
-
UnitsRelationsDefault
public UnitsRelationsDefault()
-
-
Method Details
-
init
Constructs various AnnotationMirrors representing specific checker-framework provided Units involved in the rules resolved in this UnitsRelations implementation.- Specified by:
init
in interfaceUnitsRelations
- Parameters:
env
- the ProcessingEnvironment to use- Returns:
- a reference to "this"
-
multiplication
Provides rules for resolving the result Unit of the multiplication of checker-framework provided Units.- Specified by:
multiplication
in interfaceUnitsRelations
- Parameters:
lht
- left hand side in multiplicationrht
- right hand side in multiplication- Returns:
- the annotation to use for the result of the multiplication or null if no special relation is known
-
division
Provides rules for resolving the result Unit of the division of checker-framework provided Units.- Specified by:
division
in interfaceUnitsRelations
- Parameters:
lht
- left hand side in divisionrht
- right hand side in division- Returns:
- the annotation to use for the result of the division or null if no special relation is known
-
bothHaveSpecificPrefix
Checks to see if both lhtPrefix and rhtPrefix have the same prefix as specificPrefix.- Parameters:
lhtPrefix
- left hand side prefixrhtPrefix
- right hand side prefixspecificPrefix
- specific desired prefix to match- Returns:
- true if all 3 Prefix are the same, false otherwise
-
havePairOfUnits
protected boolean havePairOfUnits(AnnotatedTypeMirror lht, AnnotationMirror ul, AnnotatedTypeMirror rht, AnnotationMirror ur) Checks to see if lht has the unit ul and if rht has the unit ur all at the same time.- Parameters:
lht
- left hand annotated typeul
- left hand unitrht
- right hand annotated typeur
- right hand unit- Returns:
- true if lht has lu and rht has ru, false otherwise
-
havePairOfUnitsIgnoringOrder
protected boolean havePairOfUnitsIgnoringOrder(AnnotatedTypeMirror lht, AnnotationMirror u1, AnnotatedTypeMirror rht, AnnotationMirror u2) Checks to see if lht and rht have the pair of units u1 and u2 regardless of order.- Parameters:
lht
- left hand annotated typeu1
- unit 1rht
- right hand annotated typeu2
- unit 2- Returns:
- true if lht and rht have the pair of units u1 and u2 regardless of order, false otherwise
-