|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.passage.ReadOnlyPassage
final class ReadOnlyPassage
This is a simple proxy to a real Passage object that denies all attempts to write to it.
Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors. |
Licence
Field Summary | |
---|---|
private boolean |
ignore
Do we just silently ignore change attempts or throw up |
private Passage |
ref
The object we are proxying to |
private static long |
serialVersionUID
Serialization ID |
Constructor Summary | |
---|---|
protected |
ReadOnlyPassage(Passage ref,
boolean ignore)
Construct a ReadOnlyPassage from a real Passage to which we proxy. |
Method Summary | |
---|---|
void |
add(VerseBase that)
Add this Verse/VerseRange to this Passage |
void |
addAll(Key key)
Adds the specified element to this set if it is not already present. |
void |
addPassageListener(PassageListener li)
Event Listeners - Add Listener |
void |
blur(int by,
RestrictionType restrict)
Widen the range of the verses/keys in this list. |
int |
booksInPassage()
How many books are there in this Passage |
boolean |
canHaveChildren()
Returns true if the receiver is a leaf node and can not have children. |
int |
chaptersInPassage(int book)
How many chapters are there in a particular book in this Passage |
void |
clear()
Removes all of the elements from this set (optional operation). |
Object |
clone()
This needs to be declared here so that it is visible as a method on a derived Passage. |
int |
compareTo(Object o)
|
boolean |
contains(Key key)
Returns true if this set contains the specified element. |
boolean |
contains(VerseBase that)
Returns true if this collection contains all the specified Verse |
boolean |
containsAll(Passage that)
Returns true if this Passage contains all of the verses in that Passage |
int |
countRanges(RestrictionType restrict)
Like countVerses() that counts VerseRanges instead of Verses Returns the number of fragments in this collection. |
int |
countVerses()
Returns the number of verses in this collection. |
boolean |
equals(Object obj)
|
Key |
get(int index)
Gets a key from a specific point in this list. |
int |
getChildCount()
Returns the number of elements in this set (its cardinality). |
String |
getName()
A Human readable version of the Key. |
String |
getOSISName()
The OSIS defined specification for this Passage. |
String |
getOverview()
A summary of the verses in this Passage For example "10 verses in 4 books" |
Key |
getParent()
All keys have parents unless they are the root of a Key. |
VerseRange |
getRangeAt(int offset,
RestrictionType restrict)
Get a specific VerseRange from this collection |
Verse |
getVerseAt(int offset)
Get a specific Verse from this collection |
int |
hashCode()
|
int |
indexOf(Key that)
Reverse a Key into the position the key holds in the list |
boolean |
isEmpty()
Does this Passage have 0 members |
Iterator |
iterator()
|
void |
optimizeReads()
For preformance reasons we may well want to hint to the Passage that we have done editing it for now and that it is safe to cache certain values to speed up future reads. |
Iterator |
rangeIterator(RestrictionType restrict)
Like verseElements() that iterates over VerseRanges instead of Verses. |
void |
readDescription(Reader in)
To be compatible with humans we read/write ourselves to a file that a human can read and even edit. |
void |
remove(VerseBase that)
Remove this Verse/VerseRange from this Passage |
void |
removeAll(Key key)
Removes the specified elements from this set if it is present. |
void |
removePassageListener(PassageListener li)
Event Listeners - Remove Listener |
void |
retainAll(Key key)
Removes all but the specified element from this set. |
String |
toString()
|
Passage |
trimRanges(int count,
RestrictionType restrict)
Ensures that there are a maximum of count VerseRanges
in this Passage. |
Passage |
trimVerses(int count)
Ensures that there are a maximum of count Verses in
this Passage. |
int |
versesInPassage(int book,
int chapter)
How many chapters are there in a particular book in this Passage Note that versesInPassage(ref, 0, 0) == ref.countVerses() |
void |
writeDescription(Writer out)
To be compatible with humans we read/write ourselves to a file that a human can read and even edit. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Passage ref
private boolean ignore
private static final long serialVersionUID
Constructor Detail |
---|
protected ReadOnlyPassage(Passage ref, boolean ignore)
ref
- The real Passageignore
- Do we throw up if someone tries to change usMethod Detail |
---|
public void addAll(Key key)
Key
addAll
in interface Key
key
- element to be added to this set.public void removeAll(Key key)
Key
removeAll
in interface Key
key
- object to be removed from this set, if present.public void retainAll(Key key)
Key
retainAll
in interface Key
key
- object to be left in this set.public boolean contains(Key key)
Key
contains
in interface Key
key
- element whose presence in this set is to be tested.
public boolean canHaveChildren()
Key
canHaveChildren
in interface Key
public int getChildCount()
Key
getChildCount
in interface Key
public Iterator iterator()
iterator
in interface Key
public Key get(int index)
Key
get
in interface Key
index
- The index of the Key to retrieve
public int indexOf(Key that)
Key
indexOf
in interface Key
that
- The Key to find
public Key getParent()
Key
getParent
in interface Key
public String getName()
Key
getName
in interface Key
public String getOSISName()
Key
getOSISName
in interface Key
public String getOverview()
Passage
getOverview
in interface Passage
public boolean isEmpty()
Key
isEmpty
in interface Key
public int countVerses()
Passage
countVerses
in interface Passage
Verse
public int countRanges(RestrictionType restrict)
Passage
countRanges
in interface Passage
restrict
- Do we break ranges at chapter/book boundries
VerseRange
public Passage trimVerses(int count)
Passage
count
Verses in
this Passage. If there were more than count
Verses
then a new Passage is created containing the Verses from
count
+1 onwards. If there was not greater than
count
in the Passage, then the passage remains
unchanged, and null is returned.
trimVerses
in interface Passage
count
- The maximum number of Verses to allow in this collection
Verse
public Passage trimRanges(int count, RestrictionType restrict)
Passage
count
VerseRanges
in this Passage. If there were more than count
VerseRanges then a new Passage is created containing the
VerseRanges from count
+1 onwards. If there was not
greater than count
in the Passage, then the passage
remains unchanged, and null is returned.
trimRanges
in interface Passage
count
- The maximum number of VerseRanges to allow in this collectionrestrict
- Do we break ranges at chapter/book boundries
VerseRange
public int booksInPassage()
Passage
booksInPassage
in interface Passage
public int chaptersInPassage(int book) throws NoSuchVerseException
Passage
chaptersInPassage
in interface Passage
book
- The book to check (0 for distinct chapters in all books)
NoSuchVerseException
- if the book is invalidpublic int versesInPassage(int book, int chapter) throws NoSuchVerseException
Passage
versesInPassage(ref, 0, 0) == ref.countVerses()
versesInPassage
in interface Passage
book
- The book to check (0 for distinct chapters in all books)chapter
- The chapter to check (0 for distinct verses in all chapters)
NoSuchVerseException
- if the book/chapter is invalidpublic Verse getVerseAt(int offset) throws ArrayIndexOutOfBoundsException
Passage
getVerseAt
in interface Passage
offset
- The verse offset (legal values are 0 to countVerses()-1)
ArrayIndexOutOfBoundsException
- If the offset is out of rangepublic VerseRange getRangeAt(int offset, RestrictionType restrict) throws ArrayIndexOutOfBoundsException
Passage
getRangeAt
in interface Passage
offset
- The verse range offset (legal values are 0 to countRanges()-1)restrict
- Do we break ranges at chapter/book boundries
ArrayIndexOutOfBoundsException
- If the offset is out of rangepublic Iterator rangeIterator(RestrictionType restrict)
Passage
rangeIterator
in interface Passage
restrict
- Do we break ranges over chapters
public boolean contains(VerseBase that)
Passage
contains
in interface Passage
that
- Verse or VerseRange that may exist in this Passage
public void add(VerseBase that)
Passage
add
in interface Passage
that
- The Verses to be removed from this Passagepublic void remove(VerseBase that)
Passage
remove
in interface Passage
that
- The Verses to be removed from this Passagepublic boolean containsAll(Passage that)
Passage
containsAll
in interface Passage
that
- Passage to be checked for containment in this collection.
public void clear()
Key
clear
in interface Key
public void blur(int by, RestrictionType restrict)
Key
blur
in interface Key
by
- The number of verses/keys to widen byrestrict
- How should we restrict the blurring?Passage
public void readDescription(Reader in)
Passage
readDescription
in interface Passage
in
- The stream to read frompublic void writeDescription(Writer out) throws IOException
Passage
writeDescription
in interface Passage
out
- The stream to write to
IOException
- If the file/network etc breakspublic void optimizeReads()
Passage
optimizeReads
in interface Passage
public void addPassageListener(PassageListener li)
Passage
addPassageListener
in interface Passage
li
- The listener to addpublic void removePassageListener(PassageListener li)
Passage
removePassageListener
in interface Passage
li
- The listener to removepublic boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public Object clone()
Passage
clone
in interface Passage
clone
in class Object
public int compareTo(Object o)
compareTo
in interface Comparable
|
Copyright ? 2003-2004 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |