Commit 632b07e9 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Statistics works, safe(?) version for demo 061212

parent e83e90c0
......@@ -233,32 +233,32 @@ aspect GenRewrites {
pStream.println(ind(3)+name()+" node = new "+name()+"();");
pStream.println(ind(3)+"node.setOwlIdentifier(getOwlIdentifier());");
pStream.println(ind(3)+"node.setAttributeList(getAttributeList());");
// pStream.println(ind(3)+"node.setElementList(getElementList());");
Restrictions restr = getRestrictions();
pStream.println(ind(3)+"List l, remain;");
pStream.println(ind(3)+"remain = new List();");
for (int i=0; i<restr.getNumOwlRestriction(); i++) {
OwlRestriction r = restr.getOwlRestriction(i);
pStream.println(ind(3)+"l = new List();");
pStream.println(ind(3)+"for (int i=0; i<getNumElement(); i++) {");
pStream.println(ind(4)+"ComplexElement e = (ComplexElement) getElement(i);");
pStream.println(ind(4)+"if (e.getNumElement() > 0 && e.getElement(0) instanceof "+r.name()+" ) {");
pStream.println(ind(5)+"l.add(e.getElement(0));");
pStream.println(ind(4)+"}");
pStream.println(ind(3)+"}");
if (r.allValuesFrom()) {
pStream.println(ind(3)+"node.set"+r.name()+"List(l);");
} else {
pStream.println(ind(3)+r.name()+" c"+ix+" = new "+r.name()+"();");
pStream.println(ind(3)+"node.set"+r.name()+"(c"+(ix++)+");");
}
}
pStream.println(ind(3)+"for (int i=0; i<getNumElement(); i++) {");
pStream.println(ind(4)+"if (getElement(i) instanceof ValueElement) {");
pStream.println(ind(5)+"remain.add(getElement(i));");
pStream.println(ind(4)+"}");
pStream.println(ind(3)+"}");
pStream.println(ind(3)+"node.setElementList(remain);");
pStream.println(ind(3)+"node.setElementList(getElementList());");
// Restrictions restr = getRestrictions();
// pStream.println(ind(3)+"List l, remain;");
// pStream.println(ind(3)+"remain = new List();");
// for (int i=0; i<restr.getNumOwlRestriction(); i++) {
// OwlRestriction r = restr.getOwlRestriction(i);
// pStream.println(ind(3)+"l = new List();");
// pStream.println(ind(3)+"for (int i=0; i<getNumElement(); i++) {");
// pStream.println(ind(4)+"ComplexElement e = (ComplexElement) getElement(i);");
// pStream.println(ind(4)+"if (e.getNumElement() > 0 && e.getElement(0) instanceof "+r.name()+" ) {");
// pStream.println(ind(5)+"l.add(e.getElement(0));");
// pStream.println(ind(4)+"}");
// pStream.println(ind(3)+"}");
// if (r.allValuesFrom()) {
// pStream.println(ind(3)+"node.set"+r.name()+"List(l);");
// } else {
// pStream.println(ind(3)+r.name()+" c"+ix+" = new "+r.name()+"();");
// pStream.println(ind(3)+"node.set"+r.name()+"(c"+(ix++)+");");
// }
// }
// pStream.println(ind(3)+"for (int i=0; i<getNumElement(); i++) {");
// pStream.println(ind(4)+"if (getElement(i) instanceof ValueElement) {");
// pStream.println(ind(5)+"remain.add(getElement(i));");
// pStream.println(ind(4)+"}");
// pStream.println(ind(3)+"}");
// pStream.println(ind(3)+"node.setElementList(remain);");
pStream.println(ind(3)+"return node;");
pStream.println(ind(2)+"}");
pStream.println(ind(1)+"}");
......
......@@ -10,12 +10,14 @@ import java.io.PrintStream;
aspect Statistics {
public void ASTNode.getManipulationDevices(PrintStream pStream) {
// for (int i=0; i<getNumChild(); i++) {
// getChild(i).getManipulationDevices(pStream);
// }
for (int i=0; i<getNumChild(); i++) {
getChild(i).getManipulationDevices(pStream);
}
}
public void Start.getManipulationDevices(PrintStream pStream) {
// System.out.println("Searching among: "+getElementList().getNumChild()+
// " Things");
for (int i=0; i<getNumElement(); i++) {
getElement(i).getManipulationDevices(pStream);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment