private void registerListeners(EventGeneratingList<? extends Term> functions) { functions.addListener(this); for (Object o : functions) { if (!(o instanceof Function)) { continue; } Function f = (Function) o; EventGeneratingList<Term> list = (EventGeneratingList<Term>) f.getTerms(); list.addListener(this); registerListeners(list); } }
private void registerListeners(EventGeneratingList<? extends Term> functions) { functions.addListener(this); for (Object o : functions) { if (!(o instanceof Function)) { continue; } Function f = (Function) o; EventGeneratingList<Term> list = (EventGeneratingList<Term>) f.getTerms(); list.addListener(this); registerListeners(list); } }
public void updateHead(Function head) { this.head = head; EventGeneratingList<Term> headterms = (EventGeneratingLinkedList<Term>) head.getTerms(); headterms.removeListener(this); headterms.addListener(this); listChanged(); }
protected CQIEImpl(Function head, Function[] body) { // The syntax for CQ may contain no body, thus, this condition will // check whether the construction of the link list is possible or not. if (body != null) { EventGeneratingList<Function> eventbody = new EventGeneratingLinkedList<Function>(); Collections.addAll(eventbody, body); this.body = eventbody; registerListeners(eventbody); // TODO possible memory leak!!! we should also de-register when objects are removed } // The syntax for CQ may also contain no head, thus, this condition // will check whether we can look for the head terms or not. if (head != null) { this.head = head; EventGeneratingList<Term> headterms = (EventGeneratingList<Term>) head.getTerms(); headterms.addListener(this); } }
protected CQIEImpl(Function head, List<Function> body) { // The syntax for CQ may contain no body, thus, this condition will // check whether the construction of the link list is possible or not. if (body != null) { EventGeneratingList<Function> eventbody = new EventGeneratingLinkedList<Function>(); eventbody.addAll(body); this.body = eventbody; registerListeners(eventbody); // TODO possible memory leak!!! we should also de-register when objects are removed } // The syntax for CQ may also contain no head, thus, this condition // will check whether we can look for the head terms or not. if (head != null) { this.head = head; EventGeneratingList<Term> headterms = (EventGeneratingList<Term>) head.getTerms(); headterms.addListener(this); } }
public void updateTerms(List<Term> newterms) { for (Term term : terms) { if (term instanceof FunctionalTermImpl) { FunctionalTermImpl function = (FunctionalTermImpl) term; EventGeneratingList<Term> innertermlist = (EventGeneratingList<Term>) function.getTerms(); innertermlist.removeListener(this); } } terms.clear(); terms.addAll(newterms); for (Term term : terms) { if (term instanceof FunctionalTermImpl) { FunctionalTermImpl function = (FunctionalTermImpl) term; EventGeneratingList<Term> innertermlist = (EventGeneratingList<Term>) function.getTerms(); innertermlist.addListener(this); } } listChanged(); }