|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.common.Root
scale.clef.Node
scale.clef.stmt.Statement
public abstract class Statement
This class is the abstract (base) class for all language imperative statements.
$Id: Statement.java,v 1.44 2007-08-09 17:29:22 burrill Exp $
Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
| Constructor Summary | |
|---|---|
Statement()
|
|
| Method Summary | |
|---|---|
boolean |
containsLoopStmt()
Return true if this statement is a loop statement or contains a loop statement. |
void |
dump(java.lang.String indents,
java.io.PrintStream out)
|
DColor |
getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display. |
java.lang.String |
getDisplayLabel()
Return a String suitable for labeling this node in a graphical display. |
DShape |
getDisplayShapeHint()
Return a String specifying a shape to use when drawing this node in a graphical display. |
PragmaStk.Pragma |
getPragma()
|
int |
getSourceLineNumber()
Return the source line number associated with this node or -1 if not known. |
boolean |
hasReturnStmt()
Return true if this statement is, or contains, a return statement or a call to exit(). |
int |
numTotalStmts()
Return the number of statements represented by this statement. |
void |
setPragma(PragmaStk.Pragma pragma)
|
void |
setSourceLineNumber(int lineNumber)
Set the source line number associated with this node or -1 if not known. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
| Methods inherited from class scale.clef.Node |
|---|
getChild, getCoreType, getDecl, getType, numChildren, setAnnotationLevel, setReportLevel, toString, toString, toStringChildren, toStringSpecial |
| Methods inherited from class scale.common.Root |
|---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, trace, trace, trace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Statement()
| Method Detail |
|---|
public final void setPragma(PragmaStk.Pragma pragma)
public final PragmaStk.Pragma getPragma()
public java.lang.String getDisplayLabel()
getDisplayLabel in interface DisplayNodegetDisplayLabel in class Rootpublic DColor getDisplayColorHint()
getDisplayColorHint in interface DisplayNodegetDisplayColorHint in class RootDColorpublic DShape getDisplayShapeHint()
getDisplayShapeHint in interface DisplayNodegetDisplayShapeHint in class RootDShapepublic void visit(Predicate p)
Node
Each class has a visit(Predicate p) method. For
example, in class ABC:
public void visit(Predicate p)
{
p.visitABC(this);
}
and the class that implements Predicate has a method
public void visitABC(Node n)
{
ABC a = (ABC) n;
...
}
Thus, the class that implements Predicate can call
n.visit(this);where
n is a Node sub-class without
determining which specific sub-class n is.
The visit pattern basically avoids implementing a large
switch statement or defining different methods
in each class for some purpose.
visit in class NodePredicatepublic final int getSourceLineNumber()
getSourceLineNumber in class Nodepublic void setSourceLineNumber(int lineNumber)
setSourceLineNumber in class Nodepublic boolean hasReturnStmt()
exit().
public int numTotalStmts()
public boolean containsLoopStmt()
public void dump(java.lang.String indents,
java.io.PrintStream out)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||