|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Root scale.clef.Node scale.clef.decl.Declaration scale.clef.decl.RoutineDecl scale.clef.decl.ProcedureDecl
public class ProcedureDecl
This class represents the declaration of a procedure.
$Id: ProcedureDecl.java,v 1.39 2007-10-04 19:58:04 burrill Exp $
Copyright 2007 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Field Summary |
---|
Fields inherited from class scale.clef.decl.RoutineDecl |
---|
NOTPURE, PURE, PUREARGS, PUREGV, PUREGVA, PURESE, PURESGV |
Constructor Summary | |
---|---|
ProcedureDecl(java.lang.String name,
ProcedureType type)
Create a new procedure declaration. |
|
ProcedureDecl(java.lang.String name,
ProcedureType type,
int level,
RoutineDecl parentRoutine)
Create a new procedure declaration. |
|
ProcedureDecl(java.lang.String name,
ProcedureType type,
int level,
RoutineDecl parentRoutine,
Statement body)
Create a new procedure declaration. |
|
ProcedureDecl(java.lang.String name,
ProcedureType type,
int level,
Statement body)
Create a new procedure declaration. |
Method Summary | |
---|---|
Declaration |
copy(java.lang.String name)
Return a copy of this Declaration but with a different name. |
Node |
getChild(int i)
Return the specified AST child of this node. |
int |
getLevel()
Return the nested depth of this routine. |
RoutineDecl |
getParentRoutine()
Return the enclosing routine of this routine. |
boolean |
isProcedureDecl()
Return true if ProcedureDecl instance. |
int |
numChildren()
Return the number of AST children of this node. |
ProcedureDecl |
returnProcedureDecl()
Return a ProcedureDecl instance or
null . |
void |
setLevel(int lev)
Set the nested depth of this routine. |
void |
setParentRoutine(RoutineDecl parentRoutine)
Set the enclosing routine of this routine. |
java.lang.String |
toStringSpecial()
This method allows sub-classes to provide class specific stuff to the string. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
Methods inherited from class scale.clef.Node |
---|
setAnnotationLevel, setReportLevel, toString, toString, toStringChildren |
Methods inherited from class scale.common.Root |
---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, 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 ProcedureDecl(java.lang.String name, ProcedureType type, int level, RoutineDecl parentRoutine, Statement body)
name
- is the procedure nametype
- is the procedure typelevel
- is the nesting level of this procedureparentRoutine
- is the parent (enclosing) routine or nullbody
- is the body of the procedurepublic ProcedureDecl(java.lang.String name, ProcedureType type, int level, RoutineDecl parentRoutine)
name
- is the procedure nametype
- is the procedure typelevel
- is the nesting level of this procedureparentRoutine
- is the parent (enclosing) routine or nullpublic ProcedureDecl(java.lang.String name, ProcedureType type)
name
- is the procedure nametype
- is the procedure typepublic ProcedureDecl(java.lang.String name, ProcedureType type, int level, Statement body)
name
- is the procedure nametype
- is the procedure typelevel
- is the nesting level of this procedurebody
- is the body of the procedureMethod Detail |
---|
public java.lang.String toStringSpecial()
Node
toStringSpecial
in class RoutineDecl
public 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 RoutineDecl
Predicate
public final int getLevel()
public final RoutineDecl getParentRoutine()
null
.
public final void setLevel(int lev)
public final void setParentRoutine(RoutineDecl parentRoutine)
null
.
public Node getChild(int i)
getChild
in class RoutineDecl
public int numChildren()
numChildren
in class RoutineDecl
public Declaration copy(java.lang.String name)
copy
in class Declaration
public final boolean isProcedureDecl()
Declaration
isProcedureDecl
in class Declaration
public final ProcedureDecl returnProcedureDecl()
Declaration
ProcedureDecl
instance or
null
.
returnProcedureDecl
in class Declaration
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |