// ref: unambiguous ref of node that just changed public void triggerTriggerables(TreeReference ref) { // turn unambiguous ref into a generic ref TreeReference genericRef = ref.genericize(); // get conditions triggered by this node Vector triggered = (Vector) triggerIndex.get(genericRef); if (triggered == null) return; Vector triggeredCopy = new Vector(); for (int i = 0; i < triggered.size(); i++) triggeredCopy.addElement(triggered.elementAt(i)); evaluateTriggerables(triggeredCopy, ref); }
/** Walks the current set of conditions, and evaluates each of them with the current context. */ private void initializeTriggerables(TreeReference rootRef) { TreeReference genericRoot = rootRef.genericize(); Vector applicable = new Vector(); for (int i = 0; i < triggerables.size(); i++) { Triggerable t = (Triggerable) triggerables.elementAt(i); for (int j = 0; j < t.getTargets().size(); j++) { TreeReference target = (TreeReference) t.getTargets().elementAt(j); if (genericRoot.isParentOf(target, false)) { applicable.addElement(t); break; } } } evaluateTriggerables(applicable, rootRef); }