Class Constant
- java.lang.Object
-
- org.checkerframework.dataflow.constantpropagation.Constant
-
- All Implemented Interfaces:
AbstractValue<Constant>
public class Constant extends java.lang.Object implements AbstractValue<Constant>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Constant.Type
-
Field Summary
Fields Modifier and Type Field Description protected Constant.Type
type
What kind of abstract value is this?protected @Nullable java.lang.Integer
value
The value of this abstract value (or null).
-
Constructor Summary
Constructors Constructor Description Constant(java.lang.Integer value)
Create a constant forvalue
.Constant(Constant.Type type)
Create a constant fortype
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Constant
copy()
boolean
equals(@Nullable java.lang.Object obj)
java.lang.Integer
getValue()
Returns the value.int
hashCode()
boolean
isBottom()
Returns whether or not the constant is BOTTOM.boolean
isConstant()
Returns whether or not the constant is CONSTANT.boolean
isTop()
Returns whether or not the constant is TOP.Constant
leastUpperBound(Constant other)
Compute the least upper bound of two values.java.lang.String
toString()
-
-
-
Field Detail
-
type
protected final Constant.Type type
What kind of abstract value is this?
-
value
protected @Nullable java.lang.Integer value
The value of this abstract value (or null).
-
-
Constructor Detail
-
Constant
public Constant(Constant.Type type)
Create a constant fortype
.
-
Constant
public Constant(java.lang.Integer value)
Create a constant forvalue
.
-
-
Method Detail
-
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 java.lang.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 interfaceAbstractValue<Constant>
- Does not change
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-