private Selector replaceLeadingAppendersByEmptiness(Selector selector) { while (!selector.isEmpty() && selector.getHead().isAppender()) { selector.getHead().setParent(null); selector.removeHead(); } if (selector.isEmpty()) { SimpleSelector empty = createEmptySimpleSelector(selector); selector.addPart(empty); } return selector; }
private Selector chopOffHead(Selector selector) { if (!selector.isCombined()) return null; selector.removeHead(); return selector; }