Main{{ public static void p(String s){ System.out.print(s); } public static void main(String args[]) throws Exception { Start start = Start.parse(System.in); // some sample functionality p(start.display() + "\n"); p(start.print() + "\n"); p(start.toStr() + "\n"); System.out.println(start.equals(start)); Map statistics = start.countWords(); p(statistics.toString() + "\n"); p(new Traversal(new Print()).traverse(statistics).toString() + "\n"); p(statistics.keys().toString() + "\n"); for (Word w : statistics.keys()) { p(w.toStr() + "\n"); } // p(statistics.display() + "\n"); } }} RawMaterial{{ static class RelationNrComp implements java.util.Comparator{ public int compare(RelationNr a, RelationNr b){ // return a.v.compareTo(b.v); return new Integer(a.v).compareTo(b.v); } } public Map countRelationNrs(){ Map in = TUCombiner.traverse(this,new TUCombiner>(){ Map empty = Map.create(new RelationNrComp()); public Map combine(){ return empty; } public Map fold(Map a, Map b){ return a.merge(b, new Map.Merge(){ public Weight merge(Weight i, Weight j) { return i.sum(j); } }); } Map combine(Constraint c, Weight w, RelationNr r){ return empty.put(r,w); } }, Control.bypass(Constraint.class)); return in; } public Option> get_nested(){ return nested;} }} Weight {{ Weight sum(Weight w){ return new Weight(this.v+w.v); } }}