/** This method returns a set of the nodes in this flat representation */
- public Set getNodeSet() {
- HashSet tovisit=new HashSet();
- HashSet visited=new HashSet();
+ public Set<FlatNode> getNodeSet() {
+ HashSet<FlatNode> tovisit=new HashSet<FlatNode>();
+ HashSet<FlatNode> visited=new HashSet<FlatNode>();
tovisit.add(this);
while(!tovisit.isEmpty()) {
- FlatNode fn=(FlatNode)tovisit.iterator().next();
+ FlatNode fn=tovisit.iterator().next();
tovisit.remove(fn);
visited.add(fn);
for(int i=0;i<fn.numNext();i++) {
return visited;
}
+ public String printMethod() {
+ return printMethod(null);
+ }
+
/** This method returns a string that is a human readable
* representation of this method. */
- public String printMethod() {
+ public String printMethod(Hashtable map) {
String st=method+" {\n";
HashSet tovisit=new HashSet();
HashSet visited=new HashSet();
tovisit.remove(fn);
visited.add(fn);
-// System.out.println("Next : "+fn.numNext());
-
for(int i=0;i<fn.numNext();i++) {
FlatNode nn=fn.getNext(i);
if(i>0) {
if (nodetolabel.containsKey(current_node))
st+="L"+nodetolabel.get(current_node)+":\n";
if (current_node.numNext()==0) {
- st+=" "+current_node.toString()+"\n";
+ if (map==null)
+ st+=" "+current_node.toString()+"\n";
+ else
+ st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n";
current_node=null;
} else if(current_node.numNext()==1) {
- st+=" "+current_node.toString()+"\n";
+ if (map==null)
+ st+=" "+current_node.toString()+"\n";
+ else
+ st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n";
FlatNode nextnode=current_node.getNext(0);
if (visited.contains(nextnode)) {
st+="goto L"+nodetolabel.get(nextnode)+"\n";