org.crosswire.jsword.passage
Interface KeyFactory

All Known Subinterfaces:
Book
All Known Implementing Classes:
AbstractBook, PassageAbstractBook, PassageKeyFactory, ReadingsBook, SwordBook, SwordDictionary

public interface KeyFactory

A Factory for new Keys and KeyLists.

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.

Version:
$Id: KeyFactory.java,v 1.4 2004/08/16 22:08:44 joe Exp $
Author:
Joe Walker [joe at eireneh dot com]
See Also:
Licence

Method Summary
 Key createEmptyKeyList()
          Fetch an empty Key to which we can add Keys.
 Key getGlobalKeyList()
          Get a complete list of index entries.
 Key getKey(String name)
          Someone has typed in a reference to find, but we need a Key to actually look it up.
 

Method Detail

getGlobalKeyList

Key getGlobalKeyList()
Get a complete list of index entries. Create a Key that encompasses all of the known valid keys for the given context. For a dictionary this will include all of the entries in the dictionary, for a Bible this will probably include all the verses in the Bible, but a commentary may well miss some out.

Returns:
A Key that includes all of the known Keys

getKey

Key getKey(String name)
           throws NoSuchKeyException
Someone has typed in a reference to find, but we need a Key to actually look it up. So we create a Key from the string if such a translation is possible. The returned Key may be a BranchKey if the string represents more than one Key.

Parameters:
name - The string to translate into a Key
Returns:
The Key corresponding to the input text
Throws:
NoSuchKeyException - If the name can not be parsed.

createEmptyKeyList

Key createEmptyKeyList()
Fetch an empty Key to which we can add Keys. Not all implementations of Key are able to hold any type of Key, It isn't reasonable to expect a Key of Bible verses (=Passage) to hold a dictionary Key. So each KeyFactory must be able to create you an empty Key to which you can safely add other Keys it generates.

Returns:
An empty Key that can hold other Keys from this factory.

Copyright ? 2003-2004