*Fixed the big graph
authorsivaji <sivaji>
Sat, 9 Jun 2007 20:48:28 +0000 (20:48 +0000)
committersivaji <sivaji>
Sat, 9 Jun 2007 20:48:28 +0000 (20:48 +0000)
*Added Flagstates to the task page

Mods required for the above fixes:
*added taganalysis as a parameter to WebInterface's constructor. Needed this
for fix 2.
*Fixed a bug in setAsSourceNode method in FlagState.java which led to issue 1 in the first place.

Robust/src/Analysis/TaskStateAnalysis/FlagState.java
Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java
Robust/src/Interface/WebInterface.java
Robust/src/Main/Main.java

index bd211e8ceadb34f2f67baf56e22c8654a531647f..7a83da44097ff3631d1e9e49e4e2ed5fbbd52d01 100644 (file)
@@ -71,12 +71,14 @@ public class FlagState extends GraphNode {
        /**  Sets the flagstate as a source node. 
      */
        public void setAsSourceNode(){
-               issourcenode=true;
-               this.tasks=new Vector();
+               if(!issourcenode){
+                       issourcenode=true;
+                       this.tasks=new Vector();
+               }
        }
        
        public void addAllocatingTask(TaskDescriptor task){
-               tasks.addElement(task);
+               tasks.add(task);
        }
 
        public Vector getAllocatingTasks(){
index 013bfab8d6a0a8ff18f986843710d421317b893d..6daabf5799bc51ba90b4c78347df67482aa0f1ee 100644 (file)
@@ -16,7 +16,7 @@ public class TaskGraph {
     Hashtable<TaskNode,TaskNode> alltasknodes;
     
     //Colors
-    String colors[]={"red","blue","green","brown","orange","pink","black","brown","grey","olivedrab"};
+    String colors[]={"red","blue","green","brown","orange","pink","black","grey","olivedrab","yellow"};
 
     public TaskGraph(State state, TaskAnalysis taskanalysis) {
        this.state=state;
@@ -116,18 +116,35 @@ public class TaskGraph {
                Set fsnodes;
                
                if (cd.hasFlags()&&((fsnodes=taskanalysis.getFlagStates(cd))!=null)){
-                       System.out.println(cd.getSymbol());
+                       //
+                       System.out.println("\nWorking on fses of Class: "+cd.getSymbol());
+                       //
                        for(Iterator it=fsnodes.iterator();it.hasNext();) {
                                FlagState fs=(FlagState)it.next();
+                               //
+                               System.out.println("Evaluating fs: "+fs.getTextLabel());
+                               //
                                        Iterator it_inedges=fs.inedges();       
                                    TaskNode tn,sn;
                                    
                                    
                                    if (fs.isSourceNode()){
+                                           //
+                                           System.out.println("A sourcenode");
+                                           //
                                            if(fs.edges().hasNext()){
                                                Vector allocatingtasks=fs.getAllocatingTasks();
+                                               //
+                                               if (allocatingtasks.iterator().hasNext())
+                                                       System.out.println("has been allocated by "+allocatingtasks.size()+" tasks");
+                                               //
                                                    for(Iterator it_at=allocatingtasks.iterator();it_at.hasNext();){
-                                                           tn=new TaskNode(((TaskDescriptor)it_at.next()).getSymbol());
+                                                           TaskDescriptor allocatingtd=(TaskDescriptor)it_at.next();
+                                                           //
+                                                           System.out.println(allocatingtd.getSymbol());
+                                                           //
+                                                           tn=new TaskNode(allocatingtd.getSymbol());
+                                                           
                                                            addEdges(fs,tn,alltasknodes,ColorID);
                                                    }
                                            }
index 759a669bd537142a74566ebfa50179925a4fec2e..d7135100ad409454145813d81303ca1224e6af0c 100644 (file)
@@ -8,6 +8,7 @@ import Util.Namer;
 public class WebInterface {
     TaskAnalysis taskanalysis;
     TaskGraph taskgraph;
+    TagAnalysis taganalysis;
     State state;
     Hashtable flagstatemap;
     Hashtable taskgraphmap;
@@ -15,11 +16,12 @@ public class WebInterface {
     Hashtable taskmap;  // to hold the filenames for each of the pages linked to tasks in the program.
     GarbageAnalysis garbageanalysis;
 
-    public WebInterface(State state, TaskAnalysis taskanalysis, TaskGraph taskgraph, GarbageAnalysis garbageanalysis) {
+    public WebInterface(State state, TaskAnalysis taskanalysis, TaskGraph taskgraph, GarbageAnalysis garbageanalysis, TagAnalysis taganalysis) {
        this.state=state;
        this.taskanalysis=taskanalysis;
        this.taskgraph=taskgraph;
        this.garbageanalysis=garbageanalysis;
+       this.taganalysis=taganalysis;
 
        flagstatemap=new Hashtable();
        taskgraphmap=new Hashtable();
@@ -89,6 +91,17 @@ public class WebInterface {
        PrintWriter pw=new PrintWriter(out);
        pw.println("<br><br><h3>Task:&nbsp;&nbsp;&nbsp;"+td.toString()+"</h3><br>");
        printTask(td,pw);
+       
+       //printing out the classes that are instantiated by this task
+       pw.println("<br><h3>Instantiated Classes:</h3>");
+       Set newstates=taganalysis.getFlagStates(td);
+       for(Iterator fsit=newstates.iterator();fsit.hasNext();) {
+               FlagState fsnew=(FlagState) fsit.next();
+           ClassDescriptor cd=fsnew.getClassDescriptor();
+           pw.println("&nbsp;&nbsp;<a href=\"/"+cd.getSymbol()+".html\">"+cd.getSymbol()+"</a><br>");
+           pw.println("&nbsp;&nbsp;&nbsp;&nbsp;"+fsnew.getTextLabel()+"<br>");
+       }       
+       
        pw.flush();
        } catch (Exception e) {e.printStackTrace();System.exit(-1);}
        return null;
index 775891c634d390133301faa57a4193a254bfddde..552586c6e178b1cf104aeb648e3784db1f5865d3 100644 (file)
@@ -122,7 +122,7 @@ public class Main {
          tg.createDOTfiles();
          if (state.WEBINTERFACE) {
              GarbageAnalysis ga=new GarbageAnalysis(state, ta);
-             WebInterface wi=new WebInterface(state, ta, tg, ga);
+             WebInterface wi=new WebInterface(state, ta, tg, ga, taganalysis);
              JhttpServer serve=new JhttpServer(8000,wi);
              serve.run();
          }