From 2353220dc04368be57a09229fc002f8e7d34f6d3 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 18 Jul 2007 22:15:40 +0000 Subject: [PATCH] changes --- .../Analysis/TaskStateAnalysis/FlagState.java | 24 ++++------- .../TaskStateAnalysis/TaskAnalysis.java | 42 +++---------------- 2 files changed, 14 insertions(+), 52 deletions(-) diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java index 78233e15..c18f9d90 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java +++ b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java @@ -122,20 +122,15 @@ public class FlagState extends GraphNode { if (tags.containsKey(tag)){ //Code could try to remove flag that doesn't exist - HashSet newset2=(HashSet)flagstate.clone(); - Hashtable newtags2=(Hashtable)tags.clone(); switch (tags.get(tag).intValue()){ case ONETAG: newtags1.put(tag,new Integer(MULTITAGS)); - break; + return new FlagState[] {this, new FlagState(newset1, cd, newtags1)}; case MULTITAGS: - newtags1.put(tag,new Integer(MULTITAGS)); - break; + return new FlagState[] {this}; default: throw new Error(); } - return new FlagState[] {new FlagState(newset1,cd,newtags1), - new FlagState(newset2,cd,newtags2)}; } else { newtags1.put(tag,new Integer(ONETAG)); return new FlagState[] {new FlagState(newset1,cd,newtags1)}; @@ -143,13 +138,12 @@ public class FlagState extends GraphNode { } public int getTagCount(String tagtype){ - for (Enumeration en=getTags();en.hasMoreElements();){ - TagDescriptor td=(TagDescriptor)en.nextElement(); - if (tagtype.equals(td.getSymbol())) - return tags.get(td).intValue(); //returns either ONETAG or MULTITAG - } - return NOTAGS; - + for (Enumeration en=getTags();en.hasMoreElements();){ + TagDescriptor td=(TagDescriptor)en.nextElement(); + if (tagtype.equals(td.getSymbol())) + return tags.get(td).intValue(); //returns either ONETAG or MULTITAG + } + return NOTAGS; } public FlagState[] clearTag(TagDescriptor tag){ @@ -223,7 +217,7 @@ public class FlagState extends GraphNode { newset.remove(fd); } - return new FlagState(newset, cd,newtags); + return new FlagState(newset, cd, newtags); } /** Tests for equality of two flagstate objects. diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java index baf38bcc..6da94379 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java @@ -47,7 +47,6 @@ public class TaskAnalysis { for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { ClassDescriptor cd = (ClassDescriptor)it_classes.next(); - System.out.println(cd.getSymbol()); Vector vFlags=new Vector(); FlagDescriptor flag[]; int ctr=0; @@ -59,7 +58,6 @@ public class TaskAnalysis { for(Iterator it_cflags=superdesc.getFlags();it_cflags.hasNext();) { FlagDescriptor fd = (FlagDescriptor)it_cflags.next(); - System.out.println(fd.toString()); vFlags.add(fd); } } @@ -106,13 +104,6 @@ public class TaskAnalysis { ClassDescriptor cd=(ClassDescriptor)it_classes.next(); externs=((Integer)extern_flags.get(cd)).intValue(); FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); - - //Debug block - System.out.println("Inside taskAnalysis;\n Class:"+ cd.getSymbol()); - System.out.println("No of externs " + externs); - System.out.println("No of flags: "+fd.length); - //Debug block - flagstates.put(cd,new Hashtable()); cdtorootnodes.put(cd,new Vector()); } @@ -147,11 +138,7 @@ public class TaskAnalysis { Enumeration e=flagstates.keys(); while (e.hasMoreElements()) { - System.out.println("creating dot file"); ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); - System.out.println((cdtemp.getSymbol())); - - createDOTfile(cdtemp); } } @@ -172,12 +159,6 @@ private void analyseTasks(FlagState fs) { TaskDescriptor td = (TaskDescriptor)it_tasks.next(); String taskname=td.getSymbol(); - //**Debug***/ - System.out.println(); - System.out.println(cd.getSymbol()+" : "+fs.getTextLabel()); - System.out.println("Task: "+taskname); - //*********** - /** counter to keep track of the number of parameters (of the task being analyzed) that * are satisfied by the flagstate. */ @@ -206,10 +187,6 @@ private void analyseTasks(FlagState fs) { throw new Error("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task."); - //** debug - System.out.println("Task:" + taskname +" is triggered"); - - Set newstates=taganalysis.getFlagStates(td); for(Iterator fsit=newstates.iterator();fsit.hasNext();) { FlagState fsnew=(FlagState) fsit.next(); @@ -244,22 +221,15 @@ private void analyseTasks(FlagState fs) { throw new Error("PRE FlagActions not supported"); } else if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { - //*** - System.out.println("TASKEXIT"); - //*** - Vector fsv_taskexit=evalTaskExitNode(ffan,cd,fs,temp); - for(Enumeration en=fsv_taskexit.elements();en.hasMoreElements();){ FlagState fs_taskexit=(FlagState)en.nextElement(); if (!sourcenodes.containsKey(fs_taskexit)) { toprocess.add(fs_taskexit); - } //seen this node already fs_taskexit=canonicalizeFlagState(sourcenodes,fs_taskexit); FEdge newedge=new FEdge(fs_taskexit,taskname); - //FEdge newedge=new FEdge(fs_taskexit,td); fs.addEdge(newedge); } continue; @@ -360,7 +330,7 @@ private boolean isTaskTrigger_tag(TagExpressionList tel, FlagState fs){ FlagState fsworking=(FlagState)en.nextElement(); if (!ffan.getTagChange(ttp)){ processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag()))); - } + } else processed.add(fsworking); } } } @@ -376,12 +346,11 @@ private boolean isTaskTrigger_tag(TagExpressionList tel, FlagState fs){ FlagState fsworking=(FlagState)en.nextElement(); if (ffan.getTagChange(ttp)){ processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); - } + } else processed.add(fsworking); } } } return processed; - } @@ -401,10 +370,9 @@ private boolean isTaskTrigger_tag(TagExpressionList tel, FlagState fs){ */ public void createDOTfile(ClassDescriptor cd) throws java.io.IOException { - File dotfile_flagstates= new File("graph"+cd.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,true); - FlagState.DOTVisitor.visit(dotstream,((Hashtable)flagstates.get(cd)).values()); - + File dotfile_flagstates= new File("graph"+cd.getSymbol()+".dot"); + FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,true); + FlagState.DOTVisitor.visit(dotstream,((Hashtable)flagstates.get(cd)).values()); } /** Returns the flag states for the class descriptor. */ -- 2.34.1