public boolean isEmpty() { return keys.isEmpty(); }
/** * Utility to remove all the keys from alter that are not in base * * @param alter * The key to remove keys from * @param base * The check key */ protected static void retain(Key alter, Key base) { Iterator<Key> it = alter.iterator(); while (it.hasNext()) { Key sublist = it.next(); if (sublist.canHaveChildren()) { retain(sublist, base); if (sublist.isEmpty()) { it.remove(); } } else { if (!base.contains(sublist)) { it.remove(); } } } }
public Key find(Index index) throws BookException { Key left = getLeftQuery().find(index); Key right = getRightQuery().find(index); if (left.isEmpty()) { return right; } if (right.isEmpty()) { return left; } // If ranking was requested then prioritize it. if (right instanceof PassageTally) { right.addAll(left); return right; } left.addAll(right); return left; } }
public Key find(Index index) throws BookException { Key left = getLeftQuery().find(index); if (left.isEmpty()) { return left; } Key right = getRightQuery().find(index); if (right.isEmpty()) { return right; } right.blur(factor, RestrictionType.getDefaultBlurRestriction()); left.retainAll(right); return left; }
public Key find(Index index) throws BookException { Key left = getLeftQuery().find(index); if (left.isEmpty()) { return left; } Key right = getRightQuery().find(index); if (right.isEmpty()) { return right; } // If ranking was requested then prioritize it. if (right instanceof PassageTally) { right.retainAll(left); return right; } left.retainAll(right); return left; } }
@Override public void addAll(Key key) { //check for key empty. This avoids the AIOBounds with that.getVerseAt, during event firing if (key.isEmpty()) { //nothing to add return; } optimizeWrites(); if (key instanceof BitwisePassage) { BitwisePassage thatRef = (BitwisePassage) key; store.or(thatRef.store); } else { super.addAll(key); } // we do an extra check here because the cost of calculating the // params is non-zero and may be wasted if (suppressEvents == 0 && !key.isEmpty()) { if (key instanceof Passage) { Passage that = (Passage) key; fireIntervalAdded(this, that.getVerseAt(0), that.getVerseAt(that.countVerses() - 1)); } else if (key instanceof VerseRange) { VerseRange that = (VerseRange) key; fireIntervalAdded(this, that.getStart(), that.getEnd()); } else if (key instanceof Verse) { Verse that = (Verse) key; fireIntervalAdded(this, that, that); } } }
public void addAll(Key key) { if (key.isEmpty()) {
@Override public void removeAll(Key key) { optimizeWrites(); if (key instanceof BitwisePassage) { BitwisePassage thatRef = (BitwisePassage) key; store.andNot(thatRef.store); } else { super.removeAll(key); } // we do an extra check here because the cost of calculating the // params is non-zero and may be wasted if (suppressEvents == 0 && !key.isEmpty()) { if (key instanceof Passage) { Passage that = (Passage) key; fireIntervalRemoved(this, that.getVerseAt(0), that.getVerseAt(that.countVerses() - 1)); } else if (key instanceof VerseRange) { VerseRange that = (VerseRange) key; fireIntervalRemoved(this, that.getStart(), that.getEnd()); } else if (key instanceof Verse) { Verse that = (Verse) key; fireIntervalRemoved(this, that, that); } } }