if (tags.containsKey(tag)){
//Code could try to remove flag that doesn't exist
- HashSet newset2=(HashSet)flagstate.clone();
- Hashtable<TagDescriptor,Integer> newtags2=(Hashtable<TagDescriptor,Integer>)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)};
}
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){
newset.remove(fd);
}
- return new FlagState(newset, cd,newtags);
+ return new FlagState(newset, cd, newtags);
}
/** Tests for equality of two flagstate objects.
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;
for(Iterator it_cflags=superdesc.getFlags();it_cflags.hasNext();) {
FlagDescriptor fd = (FlagDescriptor)it_cflags.next();
- System.out.println(fd.toString());
vFlags.add(fd);
}
}
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<FlagState,FlagState>());
cdtorootnodes.put(cd,new Vector());
}
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);
}
}
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.
*/
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();
throw new Error("PRE FlagActions not supported");
} else if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) {
- //***
- System.out.println("TASKEXIT");
- //***
-
Vector<FlagState> 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;
FlagState fsworking=(FlagState)en.nextElement();
if (!ffan.getTagChange(ttp)){
processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag())));
- }
+ } else processed.add(fsworking);
}
}
}
FlagState fsworking=(FlagState)en.nextElement();
if (ffan.getTagChange(ttp)){
processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag())));
- }
+ } else processed.add(fsworking);
}
}
}
return processed;
-
}
*/
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. */