@Override public void clear() { optimizeWrites(); store.clear(); fireIntervalRemoved(this, null, null); }
@Override public void retainAll(Key key) { optimizeWrites(); BitSet thatStore = null; if (key instanceof BitwisePassage) { thatStore = ((BitwisePassage) key).store; } else { Versification v11n = getVersification(); thatStore = new BitSet(v11n.maximumOrdinal() + 1); for (Key aKey : key) { int ord = ((Verse) aKey).getOrdinal(); if (store.get(ord)) { thatStore.set(ord); } } } store.and(thatStore); fireIntervalRemoved(this, null, null); }
@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); } } }