public class CharLiteral extends AbstractIntegerLiteral
Modifier and Type | Field and Description |
---|---|
private char |
charVal
The actual char this CharLiteral represents.
|
Constructor and Description |
---|
CharLiteral(char charVal)
Creates a new CharLiteral from the given char.
|
CharLiteral(ExtList children,
java.lang.String valueStr)
Creates a new CharLiteral from the given String.
|
CharLiteral(java.lang.String valueStr)
Creates a new CharLiteral from the given String.
|
Modifier and Type | Method and Description |
---|---|
KeYJavaType |
getKeYJavaType(Services javaServ)
retrieves the literal's type
|
long |
getValue()
Returns the decimal value of the char.
|
java.lang.String |
getValueString() |
protected char |
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.
|
java.lang.String |
toString()
toString
|
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
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
public CharLiteral(char charVal)
charVal
- a char value.public CharLiteral(ExtList children, java.lang.String valueStr)
children
- an ExtList with all children(comments). May contain: CommentsvalueStr
- a string.public CharLiteral(java.lang.String valueStr)
'c'
(with c being an arbitrary char).valueStr
- a string.public long getValue()
getValue
in class AbstractIntegerLiteral
public 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 java.lang.String toString()
JavaSourceElement
toString
in class AbstractIntegerLiteral
public java.lang.String getValueString()
getValueString
in class AbstractIntegerLiteral
protected char parseFromString(java.lang.String sourceStr)
sourceStr
- the String containing the literal surrounded by single-quotesjava.lang.NumberFormatException
- if the given String does not represent a syntactically valid
character literal or the literal is not surrounded by single-quotes