java.lang.Object
org.checkerframework.dataflow.constantpropagation.Constant
All Implemented Interfaces:
AbstractValue<Constant>

public class Constant extends Object implements AbstractValue<Constant>
  • Field Details

    • type

      protected final Constant.Type type
      What kind of abstract value is this?
    • value

      protected @Nullable Integer value
      The value of this abstract value (or null).
  • Constructor Details

    • Constant

      public Constant(Constant.Type type)
      Create a constant for type.
    • Constant

      public Constant(Integer value)
      Create a constant for value.
  • Method Details

    • isTop

      public boolean isTop()
      Returns whether or not the constant is TOP.
      Returns:
      whether or not the constant is TOP
    • isBottom

      public boolean isBottom()
      Returns whether or not the constant is BOTTOM.
      Returns:
      whether or not the constant is BOTTOM
    • isConstant

      @EnsuresNonNullIf(result=true, expression="value") public boolean isConstant()
      Returns whether or not the constant is CONSTANT.
      Returns:
      whether or not the constant is CONSTANT
    • getValue

      public Integer getValue()
      Returns the value.
      Returns:
      the value
    • copy

      public Constant copy()
    • leastUpperBound

      public Constant leastUpperBound(Constant other)
      Description copied from interface: AbstractValue
      Compute the least upper bound of two values.

      Important: This method must fulfill the following contract:

      • Does not change this.
      • Does not change other.
      • Returns a fresh object which is not aliased yet.
      • Returns an object of the same (dynamic) type as this, even if the signature is more permissive.
      • Is commutative.
      Specified by:
      leastUpperBound in interface AbstractValue<Constant>
      Parameters:
      other - the other value
      Returns:
      the least upper bound of the two values
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object