polyglot.ext.jl.ast
Class IntLit_c

java.lang.Object
  extended by polyglot.ext.jl.ast.Node_c
      extended by polyglot.ext.jl.ast.Term_c
          extended by polyglot.ext.jl.ast.Expr_c
              extended by polyglot.ext.jl.ast.Lit_c
                  extended by polyglot.ext.jl.ast.NumLit_c
                      extended by polyglot.ext.jl.ast.IntLit_c
All Implemented Interfaces:
java.lang.Cloneable, Expr, IntLit, JL, Lit, Node, NodeOps, NumLit, Prefix, Receiver, Term, Typed, Copy

public class IntLit_c
extends NumLit_c
implements IntLit

An IntLit represents a literal in Java of an integer type.


Nested Class Summary
 
Nested classes/interfaces inherited from interface polyglot.ast.IntLit
IntLit.Kind
 
Field Summary
protected  IntLit.Kind kind
          The kind of literal: INT or LONG.
 
Fields inherited from class polyglot.ext.jl.ast.NumLit_c
value
 
Fields inherited from class polyglot.ext.jl.ast.Expr_c
type
 
Fields inherited from class polyglot.ext.jl.ast.Term_c
exceptions, reachable
 
Fields inherited from class polyglot.ext.jl.ast.Node_c
del, ext, position
 
Fields inherited from interface polyglot.ast.IntLit
INT, LONG
 
Constructor Summary
IntLit_c(Position pos, IntLit.Kind kind, long value)
           
 
Method Summary
 boolean boundary()
          Is this a boundary case, i.e., max int or max long + 1?
 java.lang.Object constantValue()
          Returns the constant value of the expression, if any.
 IntLit.Kind kind()
          Get the kind of the expression.
 IntLit kind(IntLit.Kind kind)
          Set the kind of the expression.
 java.lang.String positiveToString()
          Print the string as a positive number.
 Precedence precedence()
          Get the precedence of the expression.
 void prettyPrint(CodeWriter w, PrettyPrinter tr)
          Pretty-print the AST using the given CodeWriter.
 java.lang.String toString()
           
 Node typeCheck(TypeChecker tc)
          Type check the expression.
 long value()
          Get the value of the expression.
 IntLit value(long value)
          Set the value of the expression.
 
Methods inherited from class polyglot.ext.jl.ast.NumLit_c
dump, longValue
 
Methods inherited from class polyglot.ext.jl.ast.Lit_c
acceptCFG, entry, isConstant
 
Methods inherited from class polyglot.ext.jl.ast.Expr_c
booleanValue, buildTypes, byteValue, charValue, doubleValue, floatValue, intValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type
 
Methods inherited from class polyglot.ext.jl.ast.Term_c
exceptionCheck, exceptions, exceptions, listEntry, reachable, reachable
 
Methods inherited from class polyglot.ext.jl.ast.Node_c
addDecls, addMembers, addMembersEnter, addMembersOverride, buildTypesEnter, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, enterScope, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, visitEdge, visitList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface polyglot.ast.NumLit
longValue
 
Methods inherited from interface polyglot.ast.Expr
isConstant, printSubExpr, printSubExpr, type
 
Methods inherited from interface polyglot.ast.Node
childExpectedType, del, del, dump, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList
 
Methods inherited from interface polyglot.ast.JL
init, node
 
Methods inherited from interface polyglot.ast.NodeOps
addDecls, addMembers, addMembersEnter, buildTypes, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, throwTypes, translate, typeCheckEnter, visitChildren
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.ast.Typed
type
 
Methods inherited from interface polyglot.ast.Term
acceptCFG, entry, exceptions, exceptions, reachable, reachable
 

Field Detail

kind

protected IntLit.Kind kind
The kind of literal: INT or LONG.

Constructor Detail

IntLit_c

public IntLit_c(Position pos,
                IntLit.Kind kind,
                long value)
Method Detail

boundary

public boolean boundary()
Description copied from interface: IntLit
Is this a boundary case, i.e., max int or max long + 1?

Specified by:
boundary in interface IntLit
Returns:
True if this is a boundary case: the literal can only appear as the operand of a unary minus.

value

public long value()
Get the value of the expression.

Specified by:
value in interface IntLit

value

public IntLit value(long value)
Set the value of the expression.

Specified by:
value in interface IntLit

kind

public IntLit.Kind kind()
Get the kind of the expression.

Specified by:
kind in interface IntLit

kind

public IntLit kind(IntLit.Kind kind)
Set the kind of the expression.

Specified by:
kind in interface IntLit

typeCheck

public Node typeCheck(TypeChecker tc)
               throws SemanticException
Type check the expression.

Specified by:
typeCheck in interface NodeOps
Overrides:
typeCheck in class Node_c
Parameters:
tc - The type checking visitor.
Throws:
SemanticException

positiveToString

public java.lang.String positiveToString()
Description copied from interface: IntLit
Print the string as a positive number.

Specified by:
positiveToString in interface IntLit

toString

public java.lang.String toString()
Overrides:
toString in class Node_c

prettyPrint

public void prettyPrint(CodeWriter w,
                        PrettyPrinter tr)
Description copied from class: Node_c
Pretty-print the AST using the given CodeWriter.

Specified by:
prettyPrint in interface NodeOps
Overrides:
prettyPrint in class Node_c
Parameters:
w - The code writer to which to write.
tr - The pretty printer. This is not a visitor.

constantValue

public java.lang.Object constantValue()
Description copied from interface: Expr
Returns the constant value of the expression, if any.

Specified by:
constantValue in interface Expr
Specified by:
constantValue in class Lit_c

precedence

public Precedence precedence()
Description copied from class: Lit_c
Get the precedence of the expression.

Specified by:
precedence in interface Expr
Overrides:
precedence in class Lit_c