public class IntLiteral extends AbstractIntegerLiteral
Modifier and Type | Field and Description |
---|---|
private static long |
MAX_UINT
A constant holding the maximum valid value as if an int was interpreted unsigned:
232-1
|
private int |
value
The actual value of the literal.
|
private java.lang.String |
valueStr
Textual representation of the value as a decimal number.
|
Constructor and Description |
---|
IntLiteral(ExtList children,
java.lang.String valStr)
Constructor for Recoder2KeY transformation.
|
IntLiteral(int value)
Creates a new IntLiteral representing the given int.
|
IntLiteral(java.lang.String valStr)
Creates a new IntLiteral from the given String.
|
Modifier and Type | Method and Description |
---|---|
KeYJavaType |
getKeYJavaType(Services javaServ)
retrieves the literal's type
|
long |
getValue() |
java.lang.String |
getValueString() |
protected int |
parseFromString(java.lang.String sourceStr)
Parses the String and extracts the actual value of the literal.
|
void |
prettyPrint(PrettyPrinter p)
Pretty printing the source element.
|
void |
visit(Visitor v)
calls the corresponding method of a visitor in order to
perform some action/transformation on this element
|
computeHashCode, equals, equalsModRenaming, getLDTName, representsDecLiteral, toString
getKeYJavaType, match
getComments, hashCode, prettyPrintMain, reuseSignature
getEndPosition, getFirstElement, getFirstElementIncludingBlocks, getLastElement, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComments
getEndPosition, getFirstElement, getFirstElementIncludingBlocks, getLastElement, getPositionInfo, getRelativePosition, getStartPosition
private static final long MAX_UINT
private final java.lang.String valueStr
private final int value
public IntLiteral(int value)
value
- the int value represented by the literalpublic IntLiteral(java.lang.String valStr)
valStr
- the String that contains the literaljava.lang.NumberFormatException
- if the given String does not represent a syntactically valid
literal or represents a value out of int rangepublic IntLiteral(ExtList children, java.lang.String valStr)
children
- the children of this AST element as KeY classes, may contain: CommentsvalStr
- the value of the literaljava.lang.NumberFormatException
- if the given String does not represent a syntactically valid
literal or represents a value out of int rangepublic void visit(Visitor v)
SourceElement
v
- the Visitorpublic void prettyPrint(PrettyPrinter p) throws java.io.IOException
JavaSourceElement
prettyPrint
in interface SourceElement
prettyPrint
in class JavaProgramElement
p
- a pretty printer.java.io.IOException
- occasionally thrown.public KeYJavaType getKeYJavaType(Services javaServ)
Literal
getKeYJavaType
in class Literal
javaServ
- the Services offering access to the Java modelpublic long getValue()
getValue
in class AbstractIntegerLiteral
public java.lang.String getValueString()
getValueString
in class AbstractIntegerLiteral
protected int parseFromString(java.lang.String sourceStr) throws java.lang.NumberFormatException
sourceStr
- the String containing the valuejava.lang.NumberFormatException
- if the given String does not represent a syntactically valid
literal or represents a value out of int range