Class UnitsRelationsDefault
- java.lang.Object
-
- org.checkerframework.checker.units.UnitsRelationsDefault
-
- All Implemented Interfaces:
UnitsRelations
public class UnitsRelationsDefault extends java.lang.Object implements UnitsRelations
Default relations between SI units.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.lang.model.util.Elements
elements
The Element Utilities from the Units Checker's processing environment.protected javax.lang.model.element.AnnotationMirror
g
SI base units.protected javax.lang.model.element.AnnotationMirror
h
Non-SI unitsprotected javax.lang.model.element.AnnotationMirror
kg
SI base units.protected javax.lang.model.element.AnnotationMirror
km
SI base units.protected javax.lang.model.element.AnnotationMirror
km2
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
km3
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
kmPERh
Non-SI unitsprotected javax.lang.model.element.AnnotationMirror
kN
Derived SI units with special namesprotected javax.lang.model.element.AnnotationMirror
m
SI base units.protected javax.lang.model.element.AnnotationMirror
m2
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
m3
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
mm
SI base units.protected javax.lang.model.element.AnnotationMirror
mm2
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
mm3
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
mPERs
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
mPERs2
Derived SI units without special namesprotected javax.lang.model.element.AnnotationMirror
N
Derived SI units with special namesprotected javax.lang.model.element.AnnotationMirror
s
SI base units.protected javax.lang.model.element.AnnotationMirror
t
Non-SI units
-
Constructor Summary
Constructors Constructor Description UnitsRelationsDefault()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
bothHaveSpecificPrefix(Prefix lhtPrefix, Prefix rhtPrefix, Prefix specificPrefix)
Checks to see if both lhtPrefix and rhtPrefix have the same prefix as specificPrefix.@Nullable javax.lang.model.element.AnnotationMirror
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, javax.lang.model.element.AnnotationMirror ul, AnnotatedTypeMirror rht, javax.lang.model.element.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, javax.lang.model.element.AnnotationMirror u1, AnnotatedTypeMirror rht, javax.lang.model.element.AnnotationMirror u2)
Checks to see if lht and rht have the pair of units u1 and u2 regardless of order.UnitsRelations
init(javax.annotation.processing.ProcessingEnvironment env)
Constructs various AnnotationMirrors representing specific checker-framework provided Units involved in the rules resolved in this UnitsRelations implementation.@Nullable javax.lang.model.element.AnnotationMirror
multiplication(AnnotatedTypeMirror lht, AnnotatedTypeMirror rht)
Provides rules for resolving the result Unit of the multiplication of checker-framework provided Units.
-
-
-
Field Detail
-
m
protected javax.lang.model.element.AnnotationMirror m
SI base units.
-
km
protected javax.lang.model.element.AnnotationMirror km
SI base units.
-
mm
protected javax.lang.model.element.AnnotationMirror mm
SI base units.
-
s
protected javax.lang.model.element.AnnotationMirror s
SI base units.
-
g
protected javax.lang.model.element.AnnotationMirror g
SI base units.
-
kg
protected javax.lang.model.element.AnnotationMirror kg
SI base units.
-
m2
protected javax.lang.model.element.AnnotationMirror m2
Derived SI units without special names
-
km2
protected javax.lang.model.element.AnnotationMirror km2
Derived SI units without special names
-
mm2
protected javax.lang.model.element.AnnotationMirror mm2
Derived SI units without special names
-
m3
protected javax.lang.model.element.AnnotationMirror m3
Derived SI units without special names
-
km3
protected javax.lang.model.element.AnnotationMirror km3
Derived SI units without special names
-
mm3
protected javax.lang.model.element.AnnotationMirror mm3
Derived SI units without special names
-
mPERs
protected javax.lang.model.element.AnnotationMirror mPERs
Derived SI units without special names
-
mPERs2
protected javax.lang.model.element.AnnotationMirror mPERs2
Derived SI units without special names
-
N
protected javax.lang.model.element.AnnotationMirror N
Derived SI units with special names
-
kN
protected javax.lang.model.element.AnnotationMirror kN
Derived SI units with special names
-
h
protected javax.lang.model.element.AnnotationMirror h
Non-SI units
-
kmPERh
protected javax.lang.model.element.AnnotationMirror kmPERh
Non-SI units
-
t
protected javax.lang.model.element.AnnotationMirror t
Non-SI units
-
elements
protected javax.lang.model.util.Elements elements
The Element Utilities from the Units Checker's processing environment.
-
-
Method Detail
-
init
public UnitsRelations init(javax.annotation.processing.ProcessingEnvironment env)
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
public @Nullable javax.lang.model.element.AnnotationMirror multiplication(AnnotatedTypeMirror lht, AnnotatedTypeMirror rht)
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
public @Nullable javax.lang.model.element.AnnotationMirror division(AnnotatedTypeMirror lht, AnnotatedTypeMirror rht)
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
protected boolean bothHaveSpecificPrefix(Prefix lhtPrefix, Prefix rhtPrefix, Prefix specificPrefix)
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, javax.lang.model.element.AnnotationMirror ul, AnnotatedTypeMirror rht, javax.lang.model.element.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, javax.lang.model.element.AnnotationMirror u1, AnnotatedTypeMirror rht, javax.lang.model.element.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
-
-