From b2b9e59192f0c04e77ad0702a5c425fb146b5b13 Mon Sep 17 00:00:00 2001 From: sivaji Date: Sat, 9 Jun 2007 20:48:28 +0000 Subject: [PATCH] *Fixed the big graph *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. --- .../Analysis/TaskStateAnalysis/FlagState.java | 8 ++++--- .../Analysis/TaskStateAnalysis/TaskGraph.java | 23 ++++++++++++++++--- Robust/src/Interface/WebInterface.java | 15 +++++++++++- Robust/src/Main/Main.java | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java index bd211e8c..7a83da44 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java +++ b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java @@ -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(){ diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java b/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java index 013bfab8..6daabf57 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java @@ -16,7 +16,7 @@ public class TaskGraph { Hashtable 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); } } diff --git a/Robust/src/Interface/WebInterface.java b/Robust/src/Interface/WebInterface.java index 759a669b..d7135100 100644 --- a/Robust/src/Interface/WebInterface.java +++ b/Robust/src/Interface/WebInterface.java @@ -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("

Task:   "+td.toString()+"


"); printTask(td,pw); + + //printing out the classes that are instantiated by this task + pw.println("

Instantiated Classes:

"); + Set newstates=taganalysis.getFlagStates(td); + for(Iterator fsit=newstates.iterator();fsit.hasNext();) { + FlagState fsnew=(FlagState) fsit.next(); + ClassDescriptor cd=fsnew.getClassDescriptor(); + pw.println("  "+cd.getSymbol()+"
"); + pw.println("    "+fsnew.getTextLabel()+"
"); + } + pw.flush(); } catch (Exception e) {e.printStackTrace();System.exit(-1);} return null; diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 775891c6..552586c6 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -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(); } -- 2.34.1