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) { this.body = new EventGeneratingLinkedList<>(body); registerListeners(this.body); // TODO possible memory leak!!! we should also de-register when objects are removed } setHead(head); }
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) { this.body = new EventGeneratingLinkedList<>(body); registerListeners(this.body); // TODO possible memory leak!!! we should also de-register when objects are removed } setHead(head); }
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; subscribeHeadTerms(head); } }
private void registerListeners(EventGeneratingList<? extends Term> functions) { functions.addListener(this); for (Object o : functions) { if (!(o instanceof Function)) { continue; } else if (o instanceof ListenableFunction) { ListenableFunction f = (ListenableFunction) o; EventGeneratingList<Term> list = f.getTerms(); list.addListener(this); registerListeners(list); } else if (!(o instanceof ImmutableFunctionalTerm)) { throw new IllegalArgumentException("Unknown type of function: not listenable nor immutable: " + o); } } }
private void registerListeners(EventGeneratingList<? extends Term> functions) { functions.addListener(this); for (Object o : functions) { if (!(o instanceof Function)) { continue; } else if (o instanceof ListenableFunction) { ListenableFunction f = (ListenableFunction) o; EventGeneratingList<Term> list = f.getTerms(); list.addListener(this); registerListeners(list); } else if (!(o instanceof ImmutableFunctionalTerm)) { throw new IllegalArgumentException("Unknown type of function: not listenable nor immutable: " + o); } } }
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; subscribeHeadTerms(head); } }