public int getCardinality() { return countVerses(); }
public Verse getVerseAt(int offset) throws ArrayIndexOutOfBoundsException { Iterator<Key> it = iterator(); Object retcode = null; for (int i = 0; i <= offset; i++) { if (!it.hasNext()) { throw new ArrayIndexOutOfBoundsException(JSOtherMsg.lookupText("Index out of range (Given {0,number,integer}, Max {1,number,integer}).", Integer.valueOf(offset), Integer.valueOf(countVerses()))); } retcode = it.next(); } return (Verse) retcode; }
public VerseRange getRangeAt(int offset, RestrictionType restrict) throws ArrayIndexOutOfBoundsException { Iterator<VerseRange> it = rangeIterator(restrict); Object retcode = null; for (int i = 0; i <= offset; i++) { if (!it.hasNext()) { throw new ArrayIndexOutOfBoundsException(JSOtherMsg.lookupText("Index out of range (Given {0,number,integer}, Max {1,number,integer}).", Integer.valueOf(offset), Integer.valueOf(countVerses()))); } retcode = it.next(); } return (VerseRange) retcode; }
public String getOverview() { // TRANSLATOR: This provides an overview of the verses in one or more books. The placeholders here deserve extra comment. // {0,number,integer} is a placeholder for the count of verses. It will be displayed as an integer using the number system of the user's locale. // {0,choice,0#verses|1#verse|1<verses} uses the value of the number of verses to display the correct singular or plural form for the word "verse" // Choices are separated by |. And each choice consists of a number, a comparison and the value to use when the comparison is met. // Choices are ordered from smallest to largest. The numbers represent boundaries that determine when a choice is used. // The comparison # means to match exactly. // The comparison < means that the number on the left is less than the number being evaluated. // Here, 0 is the first boundary specified by a #. So every number less than or equal to 0 get the first choice. // In this situation, we are dealing with counting numbers, so we'll never have negative numbers. // Next choice is 1 with a boundary specified by #. So all numbers greater than 0 (the first choice) but less than or equal to 1 get the second choice. // In this situation, the only number that will match is 1. // The final choice is 1<. This means that every number greater than 1 will get this choice. // Putting the first two placeholders together we get "0 verses", "1 verse" or "n verses" (where n is 2 or more) // The reason to go into this is that this pattern works for English. Other languages might have different ways of representing singular and plurals. // {1,number,integer} is a placeholder for the count of Bible books. It works the same way as the count of verses. // {1,choice,0#books|1#book|1<books} is the placeholder for the singular or plural of "book" return JSMsg.gettext("{0,number,integer} {0,choice,0#verses|1#verse|1<verses} in {1,number,integer} {1,choice,0#books|1#book|1<books}", Integer.valueOf(countVerses()), Integer.valueOf(booksInPassage() )); }
public int compareTo(Key obj) { Passage thatref = (Passage) obj; if (thatref.countVerses() == 0) { if (countVerses() == 0) { return 0; } // that is empty so he should come before me return -1; } if (countVerses() == 0) { // we are empty be he isn't so we are first return 1; } Verse thatfirst = thatref.getVerseAt(0); Verse thisfirst = getVerseAt(0); return getVersification().distance(thatfirst, thisfirst); }
int distinctSize = 4 * countVerses(); out.writeInt(countVerses());
public void readDescription(Reader in) throws IOException, NoSuchVerseException { raiseEventSuppresion(); raiseNormalizeProtection(); int count = 0; // number of lines read // Quiet Android from complaining about using the default BufferReader buffer size. // The actual buffer size is undocumented. So this is a good idea any way. BufferedReader bin = new BufferedReader(in, 8192); String v11nName = bin.readLine(); v11n = Versifications.instance().getVersification(v11nName); while (true) { String line = bin.readLine(); if (line == null) { break; } count++; addVerses(line, null); } // If the file was empty then there is nothing to do if (count == 0) { return; } lowerNormalizeProtection(); if (lowerEventSuppressionAndTest()) { fireIntervalAdded(this, getVerseAt(0), getVerseAt(countVerses() - 1)); } }