Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Set<Element> execute(String query, Element rootElement) throws InvalidQueryException {
- Set<Element> interviewed = new TreeSet<>();
- Set<Element> output = new TreeSet<>();
- interviewed.add(rootElement);
- interviewed.addAll(rootElement.getAllDescendants());
- QueryParserImpl selectors = new QueryParserImpl(query);
- Set<Element> outputOfPreviousSelector = new TreeSet<>();
- int i = 0;
- while (selectors.hasNextSelector()) {
- output.addAll(selectors.getNextSelector().apply(outputOfPreviousSelector)); //ono to nepozna ktere apply ma pouzit
- outputOfPreviousSelector = selectors.getNextSelector().apply(outputOfPreviousSelector);
- }
- return output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement