|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.common.Root
scale.score.Note
scale.score.chords.Chord
scale.score.chords.SequentialChord
scale.score.chords.LoopExitChord
public class LoopExitChord
This class is used to mark the exit point of loops.
$Id: LoopExitChord.java,v 1.32 2006-02-28 16:37:08 burrill Exp $
Copyright 2005 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This class represents a non-action.
No code is generated for this node.
int sumfor2(int n)
{
int sum, i;
sum = 0;
for (i = 0; i < n; i++) {
sum += i;
if (sum > 100)
return -1;
}
return sum;
}
LoopHeaderChord,
LoopPreHeaderChord,
LoopHeaderChord,
LoopTailChord,
LoopInitChord| Field Summary |
|---|
| Fields inherited from class scale.score.chords.Chord |
|---|
lineNumber |
| Constructor Summary | |
|---|---|
LoopExitChord(LoopHeaderChord header)
|
|
LoopExitChord(LoopHeaderChord header,
Chord next)
|
|
| Method Summary | |
|---|---|
Chord |
copy()
Make a copy of this CFG node with the same out-going CFG edges. |
LoopExitChord |
findLoopExit(LoopHeaderChord header)
Return the LoopExitChord, for the specified loop, that is reachable from this Chord. |
DColor |
getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display. |
LoopHeaderChord |
getLoopHeader()
Return the LoopHeaderChord associated with this loop exit. |
boolean |
isLoopExit()
Return true if this chord is a LoopExitChord. |
boolean |
isSpecial()
Return true if this is chord was added for the convenience of the compiler and does not correspond to actual source code in the user program. |
void |
setLoopHeader(LoopHeaderChord header)
Specify the loop header of this loop. |
java.lang.String |
toStringSpecial()
Return a String containing additional information about this Chord. |
void |
unlinkChord()
Break any un-needed links from a Chord that is being deleted. |
void |
validate()
Check this node for validity. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
| Methods inherited from class scale.score.Note |
|---|
getChord, getEssentialUse, setAnnotationLevel, setReportLevel, toString |
| 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 LoopExitChord(LoopHeaderChord header,
Chord next)
public LoopExitChord(LoopHeaderChord header)
| Method Detail |
|---|
public LoopHeaderChord getLoopHeader()
getLoopHeader in class Chordpublic void setLoopHeader(LoopHeaderChord header)
header - is the loop header of this looppublic Chord copy()
Chord
copy in class Chordpublic void unlinkChord()
unlinkChord in class Chordpublic boolean isSpecial()
isSpecial in class Chordpublic final boolean isLoopExit()
isLoopExit in class Chordpublic void visit(Predicate p)
Note
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(Note n)
{
ABC a = (ABC) n;
...
}
Thus, the class that implements Predicate can call
n.visit(this);where
n is a Note 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 NotePredicatepublic java.lang.String toStringSpecial()
toStringSpecial in class Chordpublic final LoopExitChord findLoopExit(LoopHeaderChord header)
findLoopExit in class Chordpublic DColor getDisplayColorHint()
getDisplayColorHint in interface DisplayNodegetDisplayColorHint in class ChordDColorpublic void validate()
validate in class Note
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||