Vector edges = new Vector();
Vector inedges = new Vector();
NodeStatus status = UNVISITED;
- String dotnodeparams = new String();
+ protected String dotnodeparams = new String();
boolean merge=false;
String nodeoption="";
public void setMerge() {
merge=true;
}
+
+ public FlagState(ClassDescriptor cd) {
+ this.flagstate=new HashSet();
+ this.cd=cd;
+ }
- public FlagState(HashSet flagstate, ClassDescriptor cd) {
+ private FlagState(HashSet flagstate, ClassDescriptor cd) {
this.flagstate=flagstate;
this.cd=cd;
}
-
+
public boolean get(FlagDescriptor fd) {
return flagstate.contains(fd);
}
public Iterator getFlags() {
return flagstate.iterator();
}
+
+ public String toString(FlagDescriptor[] flags)
+ {
+ StringBuffer sb = new StringBuffer(flagstate.size());
+ for(int i=0;i < flags.length; i++)
+ {
+ if (get(flags[i]))
+ sb.append(1);
+ else
+ sb.append(0);
+ }
+
+ return new String(sb);
+ }
+
+
+ public ClassDescriptor getClassDescriptor(){
+ return cd;
+ }
public FlagState setFlag(FlagDescriptor fd, boolean status) {
HashSet newset=(HashSet) flagstate.clone();
if (status)
newset.add(fd);
- else
+ else if (newset.contains(fd)){
newset.remove(fd);
+ }
return new FlagState(newset, cd);
}
public String getTextLabel() {
String label=null;
for(Iterator it=getFlags();it.hasNext();) {
- FlagState fs=(FlagState) it.next();
+ FlagDescriptor fd=(FlagDescriptor) it.next();
if (label==null)
- label=fs.toString();
+ label=fd.toString();
else
- label+=", "+fs.toString();
+ label+=", "+fd.toString();
}
return label;
}
output.println("\tremincross=true;");*/
output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];");
output.println("\tedge [fontsize=6];");
- traverse();
+ //traverse();
output.println("}\n");
}
- private void traverse() {
+ private void traverse() {
Set cycleset=FlagState.findcycles(nodes);
Iterator i = nodes.iterator();
if (nodes.contains(node)) {
for(Iterator nodeit=nonmerge(node).iterator();nodeit.hasNext();) {
FlagState node2=(FlagState)nodeit.next();
- String edgelabel = Compiler.DEBUGGRAPH ? "label=\"" + edge.getLabel() + "\"" : "label=\"\"";
+ String edgelabel = "label=\"" + edge.getLabel() + "\"";
output.println("\t" + gn.getLabel() + " -> " + node2.getLabel() + " [" + edgelabel + edge.dotnodeparams + "];");
}
}
}
}
}
+
Set nonmerge(FlagState gn) {
HashSet newset=new HashSet();