org.WeaselReader.PalmIO
Class Bookmarks

java.lang.Object
  extended by org.WeaselReader.PalmIO.Bookmarks
Direct Known Subclasses:
ZtxtDB.Annotations

public class Bookmarks
extends java.lang.Object

A collection of bookmarks. Each bookmark is mark/anchor in the text represented by a byte offset from the beginning of the text, plus a title string.

Version:
$Id$
Author:
John Gruenenfelder

Field Summary
 int length
          The number of bookmarks in this collection.
private  int[] offsets
          Bookmark offsets, measured in bytes from the beginning of the document.
private  java.lang.String[] titles
          Bookmark titles.
 
Constructor Summary
Bookmarks(int[] offsets, java.lang.String[] titles)
          Create a new annotation collection.
 
Method Summary
 int getOffset(int index)
          Get the byte offset for the given bookmark.
 int[] getOffsetArray()
          Get the array containing the bookmark offsets.
 java.lang.String getTitle(int index)
          Get the title string for the given bookmark.
 java.lang.String[] getTitleArray()
          Get the array containing the bookmark titles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offsets

private final int[] offsets
Bookmark offsets, measured in bytes from the beginning of the document.


titles

private final java.lang.String[] titles
Bookmark titles.


length

public final int length
The number of bookmarks in this collection.

Constructor Detail

Bookmarks

public Bookmarks(int[] offsets,
                 java.lang.String[] titles)
Create a new annotation collection. The annotation collection is read-only once created.

Parameters:
offsets - an int array containing the byte offsets for each bookmark.
titles - a String array containing the titles for each bookmark.
Method Detail

getOffset

public int getOffset(int index)
Get the byte offset for the given bookmark.

Parameters:
index - the index of the bookmark for which to get the offset.
Returns:
the byte offset of the given bookmark, measured from the beginning of the text.

getOffsetArray

public int[] getOffsetArray()
Get the array containing the bookmark offsets.

Returns:
an int array containing the offsets of all bookmarks.

getTitle

public java.lang.String getTitle(int index)
Get the title string for the given bookmark.

Parameters:
index - the index of the bookmark for which to get the title.
Returns:
the title string of the given bookmark.

getTitleArray

public java.lang.String[] getTitleArray()
Get the array containing the bookmark titles.

Returns:
a String array containing the titles of all bookmarks.