public void endVisit(Node node) { Iterator<QueryCSTVisitorThread> it = visitorThreads.iterator(); int control = 0; while (it.hasNext()) { QueryCSTVisitorThread qcvt = it.next(); // System.out.println("hilo " + control++); qcvt.endVisit(node); } }
public void startVisit(Node node) { Iterator<QueryCSTVisitorThread> it = visitorThreads.iterator(); int control = 0; while (it.hasNext()) { QueryCSTVisitorThread qcvt = it.next(); // System.out.println("hilo " + control++); qcvt.startVisit(node); } // The cached elements are added to main threads this.visitorThreads.addAll(cacheThreads); this.cacheThreads = new ArrayList<QueryCSTVisitorThread>(); }
/** * Returns all the results of the threads * * @return List of found elements */ public List<Element> getResult() { List<Element> result = new ArrayList<Element>(); int control = 0; Iterator<QueryCSTVisitorThread> it = visitorThreads.iterator(); while (it.hasNext()) { QueryCSTVisitorThread qcvt = it.next(); if (qcvt.getResult().size() > 0) { // System.out.println("Thread " + control++ + ": " + qcvt.getResult().size() + " // results"); result.addAll(qcvt.getResult()); } } return result; }