public class LongLiteral extends AbstractIntegerLiteral
Modifier and Type | Field and Description |
---|---|
private static java.math.BigInteger |
MAX_LONG
A constant holding the maximum valid value of a signed long: 263-1
|
private static java.math.BigInteger |
MAX_ULONG
A constant holding the maximum valid value as if a long was interpreted unsigned:
: 264-1
|
private static java.math.BigInteger |
MIN_LONG
A constant holding the minimum valid value of a signed long: -263
|
private long |
value
The actual value of the literal.
|
private java.lang.String |
valueStr
Textual representation of the value as a decimal number (always ends with 'L').
|
Constructor and Description |
---|
LongLiteral(ExtList children,
java.lang.String valStr)
Constructor for Recoder2KeY transformation.
|
LongLiteral(long value)
Creates a new LongLiteral representing the given long.
|
LongLiteral(java.lang.String valStr)
Creates a new LongLiteral 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 long |
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 java.math.BigInteger MAX_LONG
private static final java.math.BigInteger MIN_LONG
private static final java.math.BigInteger MAX_ULONG
private final java.lang.String valueStr
private final long value
public LongLiteral(long value)
value
- the long value represented by the literalpublic LongLiteral(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 long rangepublic LongLiteral(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 long 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 long parseFromString(java.lang.String sourceStr)
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 long range