Package edu.umd.cs.findbugs.ba.constant
Class Constant
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.constant.Constant
-
public class Constant extends java.lang.ObjectAbstract dataflow value representing a value which may or may not be a constant.- Author:
- David Hovemeyer
- See Also:
ConstantAnalysis
-
-
Field Summary
Fields Modifier and Type Field Description static ConstantNOT_CONSTANTSingle instance representing all non-constant values.
-
Constructor Summary
Constructors Constructor Description Constant(java.lang.Object value)Constructor for a constant value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)intgetConstantInt()Get the constant int value of this value.java.lang.StringgetConstantString()Get the constant String value of this value.java.lang.ObjectgetConstantValue()inthashCode()booleanisConstant()Return whether or not this value is a constant.booleanisConstantInteger()Return whether or not this value is a constant int/Integer.booleanisConstantString()Return whether or not this value is a constant String.static Constantmerge(Constant a, Constant b)Merge two Constants.java.lang.StringtoString()
-
-
-
Field Detail
-
NOT_CONSTANT
public static final Constant NOT_CONSTANT
Single instance representing all non-constant values.
-
-
Method Detail
-
getConstantValue
public java.lang.Object getConstantValue()
-
isConstant
public boolean isConstant()
Return whether or not this value is a constant.- Returns:
- true if the value is a constant, false if not
-
isConstantString
public boolean isConstantString()
Return whether or not this value is a constant String.- Returns:
- true if the value is a constant String, false if not
-
getConstantString
public java.lang.String getConstantString()
Get the constant String value of this value.- Returns:
- the constant String value
-
isConstantInteger
public boolean isConstantInteger()
Return whether or not this value is a constant int/Integer.- Returns:
- true if the value is a constant int/Integer, false if not
-
getConstantInt
public int getConstantInt()
Get the constant int value of this value.- Returns:
- the constant int value
-
merge
public static Constant merge(Constant a, Constant b)
Merge two Constants.- Parameters:
a- a StaticConstantb- another StaticConstant- Returns:
- the merge (dataflow meet) of the two Constants
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-