NodeStatus status = UNVISITED;
String dotnodeparams = new String();
Object owner = null;
+ boolean merge=false;
+ String nodeoption="";
+
+ public void setOption(String option) {
+ this.nodeoption=option;
+ }
+
+ public void setMerge() {
+ merge=true;
+ }
public GraphNode(String label) {
this.nodelabel = label;
GraphNode gn = (GraphNode) i.next();
Iterator edges = gn.edges();
String label = gn.getTextLabel(); // + " [" + gn.discoverytime + "," + gn.finishingtime + "];";
- String option="";
- if (cycleset.contains(gn))
- option=",style=bold";
+ String option=gn.nodeoption;
if (special!=null&&special.contains(gn))
option+=",shape=box";
- output.println("\t" + gn.getLabel() + " [label=\"" + label + "\"" + gn.dotnodeparams + option+"];");
+ if (!gn.merge)
+ output.println("\t" + gn.getLabel() + " [label=\"" + label + "\"" + gn.dotnodeparams + option+"];");
+ if (!gn.merge)
while (edges.hasNext()) {
Edge edge = (Edge) edges.next();
GraphNode node = edge.getTarget();
if (nodes.contains(node)) {
- String edgelabel = useEdgeLabels ? "label=\"" + edge.getLabel() + "\"" : "label=\"\"";
- output.println("\t" + gn.getLabel() + " -> " + node.getLabel() + " [" + edgelabel + edge.dotnodeparams + "];");
+ for(Iterator nodeit=nonmerge(node).iterator();nodeit.hasNext();) {
+ GraphNode node2=(GraphNode)nodeit.next();
+ String edgelabel = useEdgeLabels ? "label=\"" + edge.getLabel() + "\"" : "label=\"\"";
+ output.println("\t" + gn.getLabel() + " -> " + node2.getLabel() + " [" + edgelabel + edge.dotnodeparams + "];");
+ }
}
}
}
}
+
+ Set nonmerge(GraphNode gn) {
+ HashSet newset=new HashSet();
+ HashSet toprocess=new HashSet();
+ toprocess.add(gn);
+ while(!toprocess.isEmpty()) {
+ GraphNode gn2=(GraphNode)toprocess.iterator().next();
+ toprocess.remove(gn2);
+ if (!gn2.merge)
+ newset.add(gn2);
+ else {
+ Iterator edges = gn2.edges();
+ while (edges.hasNext()) {
+ Edge edge = (Edge) edges.next();
+ GraphNode node = edge.getTarget();
+ if (!newset.contains(node)&&nodes.contains(node))
+ toprocess.add(node);
+ }
+ }
+ }
+ return newset;
+ }
+
}
/** This function returns the set of nodes involved in cycles.
ExactSize exactsize;
ArrayAnalysis arrayanalysis;
Sources sources;
+ static String conjoption="style=bold";
+ static String absrepoption="shape=box,color=blue,style=bold";
+ static String updateoption="shape=box,color=red,style=bold";
+ static String scopeoption="color=brown";
+ static String conseqoption="style=bold,color=green";
+ static String compoption="shape=box,color=purple,style=bold";
public Termination(State state) {
this.state=state;
debugmsg("Generating data structure nodes");
generatedatastructureupdatenodes();
debugmsg("Generating compensation nodes");
- generatecompensationnodes();
+ if (!Compiler.OMITCOMP)
+ generatecompensationnodes();
debugmsg("Generating abstract edges");
generateabstractedges();
debugmsg("Generating scope edges");
GraphNode gn=new GraphNode("Conj"+i+"A"+j,
"Conj ("+i+","+j+") "+dnf.get(j).name()
,tn);
+ gn.setOption(conjoption);
conjunctions.add(gn);
if (!conjunctionmap.containsKey(c))
conjunctionmap.put(c,new HashSet());
GraphNode gn=new GraphNode("Conj"+i+"AQ"+j,
"Conj ("+i+","+j+") "+dconst.get(0).name()
,tn);
+ gn.setOption(conjoption);
conjunctions.add(gn);
if (!conjunctionmap.containsKey(c))
conjunctionmap.put(c,new HashSet());
GraphNode gn=new GraphNode("Conj"+i+"AQ"+j,
"Conj ("+i+","+j+") "+dconst.get(0).name()
,tn);
+ gn.setOption(conjoption);
conjunctions.add(gn);
if (!conjunctionmap.containsKey(c))
conjunctionmap.put(c,new HashSet());
ScopeNode satisfy=new ScopeNode(r,true);
TermNode tnsatisfy=new TermNode(satisfy);
GraphNode gnsatisfy=new GraphNode("SatisfyRule"+i,tnsatisfy);
+ gnsatisfy.setOption(scopeoption);
+ gnsatisfy.setMerge();
ConsequenceNode cnsatisfy=new ConsequenceNode();
TermNode ctnsatisfy=new TermNode(cnsatisfy);
GraphNode cgnsatisfy=new GraphNode("ConseqSatisfyRule"+i,ctnsatisfy);
+ cgnsatisfy.setOption(conseqoption);
consequence.put(satisfy,cgnsatisfy);
GraphNode.Edge esat=new GraphNode.Edge("consequencesatisfy"+i,cgnsatisfy);
gnsatisfy.addEdge(esat);
ScopeNode falsify=new ScopeNode(r,false);
TermNode tnfalsify=new TermNode(falsify);
GraphNode gnfalsify=new GraphNode("FalsifyRule"+i,tnfalsify);
+ gnfalsify.setOption(scopeoption);
+ gnfalsify.setMerge();
ConsequenceNode cnfalsify=new ConsequenceNode();
TermNode ctnfalsify=new TermNode(cnfalsify);
GraphNode cgnfalsify=new GraphNode("ConseqFalsifyRule"+i,ctnfalsify);
+ cgnfalsify.setOption(conseqoption);
consequence.put(falsify,cgnfalsify);
GraphNode.Edge efals=new GraphNode.Edge("consequencefalsify"+i,cgnfalsify);
gnfalsify.addEdge(efals);
for(int j=0;j<array.length;j++) {
AbstractRepair ar=new AbstractRepair(dp,array[j],d,sources);
TermNode tn2=new TermNode(ar);
- GraphNode gn2=new GraphNode(gn.getLabel()+"A"+i+"B"+ar.type(),gn.getTextLabel()+" #"+i+" "+ar.type(),tn2);
+ // GraphNode gn2=new GraphNode(gn.getLabel()+"A"+i+"B"+ar.type(),gn.getTextLabel()+" #"+i+" "+ar.type(),tn2);
+ GraphNode gn2=new GraphNode(gn.getLabel()+"A"+i+"B"+ar.type(),dp.name()+" "+ar.type(),tn2);
+ gn2.setOption(absrepoption);
GraphNode.Edge e=new GraphNode.Edge("abstract",gn2);
gn.addEdge(e);
if (!predtoabstractmap.containsKey(dp))
AbstractRepair ar=new AbstractRepair(tp, AbstractRepair.ADDTOSET, sd,sources);
TermNode tn=new TermNode(ar);
GraphNode gn=new GraphNode("AbstractAddSetRule"+i,tn);
+ gn.setOption(absrepoption);
if (!predtoabstractmap.containsKey(tp))
predtoabstractmap.put(tp,new HashSet());
((Set)predtoabstractmap.get(tp)).add(gn);
AbstractRepair ar2=new AbstractRepair(tp2, AbstractRepair.REMOVEFROMSET, sd,sources);
TermNode tn2=new TermNode(ar2);
GraphNode gn2=new GraphNode("AbstractRemSetRule"+i,tn2);
+ gn2.setOption(absrepoption);
if (!predtoabstractmap.containsKey(tp2))
predtoabstractmap.put(tp2,new HashSet());
((Set)predtoabstractmap.get(tp2)).add(gn2);
AbstractRepair ar=new AbstractRepair(tp, AbstractRepair.ADDTORELATION, rd,sources);
TermNode tn=new TermNode(ar);
GraphNode gn=new GraphNode("AbstractAddRelRule"+i,tn);
+ gn.setOption(absrepoption);
if (!predtoabstractmap.containsKey(tp))
predtoabstractmap.put(tp,new HashSet());
((Set)predtoabstractmap.get(tp)).add(gn);
AbstractRepair ar2=new AbstractRepair(tp2, AbstractRepair.REMOVEFROMRELATION, rd,sources);
TermNode tn2=new TermNode(ar2);
GraphNode gn2=new GraphNode("AbstractRemRelRule"+i,tn2);
+ gn2.setOption(absrepoption);
if (!predtoabstractmap.containsKey(tp2))
predtoabstractmap.put(tp2,new HashSet());
((Set)predtoabstractmap.get(tp2)).add(gn2);
MultUpdateNode mun=new MultUpdateNode(sn);
TermNode tn2=new TermNode(mun);
GraphNode gn2=new GraphNode("CompRem"+compensationcount,tn2);
+ gn2.setOption(compoption);
UpdateNode un=new UpdateNode(r);
if (j<r.numQuantifiers()) {
MultUpdateNode mun=new MultUpdateNode(ar,MultUpdateNode.REMOVE);
TermNode tn=new TermNode(mun);
GraphNode gn2=new GraphNode("UpdateRem"+removefromcount,tn);
+ gn2.setOption(updateoption);
boolean goodflag=true;
for(int i=0;i<possiblerules.size();i++) {
MultUpdateNode mun=new MultUpdateNode(ar,MultUpdateNode.MODIFY);
TermNode tn=new TermNode(mun);
GraphNode gn2=new GraphNode("UpdateMod"+modifycount,tn);
+ gn2.setOption(updateoption);
boolean goodflag=true;
for(int i=0;i<possiblerules.size();i++) {
MultUpdateNode mun=new MultUpdateNode(ar,MultUpdateNode.ADD);
TermNode tn=new TermNode(mun);
GraphNode gn2=new GraphNode("UpdateAdd"+addtocount,tn);
+ gn2.setOption(updateoption);
if (debugmsg("Start processing quantifiers")&&
processquantifiers(gn2,un, r,setmapping)&&