/** * Increment/Decrement this verses in the rankings * * @param that * The verses to add/increment * @param tally * The amount to increment/decrement by */ private void alterVerseBase(Key that, int tally) { for (Key aKey : that) { Verse verse = (Verse) aKey; increment(verse.getOrdinal(), tally); } if (tally > 0) { incrementMax(tally); } }
/** * Remove/Decrement these verses in the rankings * * @param that * The verses to remove/decrement */ public void unAddAll(Passage that) { optimizeWrites(); if (that instanceof PassageTally) { PassageTally tally = (PassageTally) that; int vib = getVersification().maximumOrdinal(); for (int i = 0; i <= vib; i++) { increment(i, -tally.board[i]); } } else { for (Key aKey : that) { Verse verse = (Verse) aKey; increment(verse.getOrdinal(), -1); } } fireIntervalRemoved(this, null, null); // Just because we've decremented some doesn't // change the max. So we don't need to do: // incrementMax(-1); }
@Override public void addAll(Key that) { optimizeWrites(); if (that instanceof PassageTally) { PassageTally tally = (PassageTally) that; int vib = getVersification().maximumOrdinal(); for (int i = 0; i <= vib; i++) { increment(i, tally.board[i]); } incrementMax(tally.max); } else { for (Key aKey : that) { Verse verse = (Verse) aKey; increment(verse.getOrdinal(), 1); } incrementMax(1); } fireIntervalAdded(this, null, null); }