Adjacency to edgelist translation host is event object APPC AdjacencyToEdges( from ClassGraph to {Part, Subclass}) { local APPCs: EdgeDistinction, Edge; order(EdgeDistinction, Edge); } APPC Edge( from ClassGraph via cdef:ClassDef to {Part, Subclass}) { before {Part, Subclass} { // print pairs ... // cdef.className and className } } APPC EdgeDistinction( from ClassGraph to {Part, Subclass}) { before Part before Subclass } === APPC OnlyOnce {// prevent infinite loops (strategy s) * // all classes in scope of s {if (!host.get_visited()) { host.set_visited(true); go_on();}} APPC SafePrint (strategy s) local OnlyOnce, Print; order(OnlyOnce, Print) === APPC Checking (strategy s) { local Summing(s), Initial(s), Check(s) // connect them Initial.next = Summing; Check.next = Initial; } APPC Summing (strategy s, Method f) { int total_sum; ... before s.target {total_sum += host.f();} } APPC Initial (strategy s) { int initial; before s.source { initial = next.return(); } return (@ next.return() - initial @) } APPC Check(...){ after s.source return {violations;} } === APPC Average (strategy s) { local Summing(s), Counting(s), Ave(s); Ave.S.return = Summing; Ave.C.return = Counting; APPC Summing APPC Counting APPC Ave(strategy s){ after s.source { int s = S.return(); int c = C.return(); print (s/c); } } if we want the running average: APPC Ave(strategy s){ after s.target { int s = S.return(); int c = C.return(); print (s/c); } } === APPC Marking // Mira's program Input-Class-Interface from via ... Output-Interface from<*>to(EdgeEvent); marking(NodeEvent);{ // Behavior: List visited = new List(); vetoFrom<*>To(EdgeEvent ev) {// traversal will ask for veto adj = ev.toNode(); // not structure-shy? boolean marked = visited.includes(adj); if marked { listeners.From<*>To(ev); throw new DoNotContinueException(this); } } at(NodeEvent node) { visited.addElement(node); listeners.marking(node); } } APPC CycleCheck { Input-Class-Interface from via ... Stack cycle = new Stack(); marking(NodeEvent node) { cycle.addElement(node); // check for cycle } doneAt(NodeEvent node) { cycle.remove(node);} } APPC Connectivity { Input-Class-Interface from to // Behavior int count; fromTo(EdgeEvent ev) {count++};