Class UnitsRelationsDefault

java.lang.Object
org.checkerframework.checker.units.UnitsRelationsDefault
All Implemented Interfaces:
UnitsRelations

public class UnitsRelationsDefault extends Object implements UnitsRelations
Default relations between SI units.
  • Field Details Link icon

  • Constructor Details Link icon

    • UnitsRelationsDefault Link icon

      public UnitsRelationsDefault()
  • Method Details Link icon

    • init Link icon

      Constructs various AnnotationMirrors representing specific checker-framework provided Units involved in the rules resolved in this UnitsRelations implementation.
      Specified by:
      init in interface UnitsRelations
      Parameters:
      env - the ProcessingEnvironment to use
      Returns:
      a reference to "this"
    • multiplication Link icon

      Provides rules for resolving the result Unit of the multiplication of checker-framework provided Units.
      Specified by:
      multiplication in interface UnitsRelations
      Parameters:
      lht - left hand side in multiplication
      rht - 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 Link icon

      Provides rules for resolving the result Unit of the division of checker-framework provided Units.
      Specified by:
      division in interface UnitsRelations
      Parameters:
      lht - left hand side in division
      rht - 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 Link icon

      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 prefix
      rhtPrefix - right hand side prefix
      specificPrefix - specific desired prefix to match
      Returns:
      true if all 3 Prefix are the same, false otherwise
    • havePairOfUnits Link icon

      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 type
      ul - left hand unit
      rht - right hand annotated type
      ur - right hand unit
      Returns:
      true if lht has lu and rht has ru, false otherwise
    • havePairOfUnitsIgnoringOrder Link icon

      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 type
      u1 - unit 1
      rht - right hand annotated type
      u2 - unit 2
      Returns:
      true if lht and rht have the pair of units u1 and u2 regardless of order, false otherwise