maiolum.xml
Class XMLModuleManager.XMLModuleBibleFragmentFactory

java.lang.Object
  extended bymaiolum.BibleFragmentFactory
      extended bymaiolum.xml.XMLModuleManager.XMLModuleBibleFragmentFactory
Enclosing class:
XMLModuleManager

public class XMLModuleManager.XMLModuleBibleFragmentFactory
extends BibleFragmentFactory

This implementation of BibleFragmentFactory serves for retrieving BibleFragments from "subfactories" of modules maintained by outer XMLModuleManager.

In general, most of the BibleFragmentFactory methods are performed in manner similar to Composite pattern: all BibleModules maintained by ModuleManager are requested to perform the according method and their result is used as return value.

For example, to get an all BibleFragments with specified ID, this class asks the "subfactory" of each module for the fragments and returns all of them.


Constructor Summary
protected XMLModuleManager.XMLModuleBibleFragmentFactory()
          Protected constructor, to disable direct instantiation of this class.
 
Method Summary
 BibleFragment[] getFragments(java.lang.String id)
          Returns all BibleFragments with given String ID from the modules maintained factory's ModuleManager.
 BibleFragment getNextSibling(BibleFragment fragment)
          Returns next XMLBibleFragment to the given fragment in the document order.
 BibleFragment getNextSibling(java.lang.String id, Edition edition)
          Returns next XMLBibleFragment to the fragment given by ID in the document order.
 BibleFragment getPreviousSibling(BibleFragment fragment)
          Returns first preceding BibleFragment relative to given BibleFragment in document order.
 BibleFragment getPreviousSibling(java.lang.String id, Edition edition)
          Returns first preceding BibleFragment relative to given BibleFragment specified by its ID in document order.
 BibleFragment newBibleFragment(java.lang.String id, Edition edition)
          Returns new BibleFragment (in this case XMLBibleFragment) which has an ID attribute value of id and has given Edition (since in the ModuleManager there can exist documents with the same ID, but of different editions (this happens when we have multiple languages of same document).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLModuleManager.XMLModuleBibleFragmentFactory

protected XMLModuleManager.XMLModuleBibleFragmentFactory()
Protected constructor, to disable direct instantiation of this class.

Method Detail

newBibleFragment

public BibleFragment newBibleFragment(java.lang.String id,
                                      Edition edition)
                               throws java.lang.Exception
Returns new BibleFragment (in this case XMLBibleFragment) which has an ID attribute value of id and has given Edition (since in the ModuleManager there can exist documents with the same ID, but of different editions (this happens when we have multiple languages of same document).

Returns:
BibleFragment with given ID found in specified Document. null, when no element with required ID exists
Throws:
java.lang.Exception

getNextSibling

public BibleFragment getNextSibling(BibleFragment fragment)
                             throws java.lang.Exception
Returns next XMLBibleFragment to the given fragment in the document order.

Specified by:
getNextSibling in class BibleFragmentFactory
Returns:
XMLBibleFragment which is sibling to the given fragment or null when no such element exists.
Throws:
java.lang.Exception

getNextSibling

public BibleFragment getNextSibling(java.lang.String id,
                                    Edition edition)
                             throws java.lang.Exception
Returns next XMLBibleFragment to the fragment given by ID in the document order.

Returns:
XMLBibleFragment which is next sibling to the fragment with specified ID or null when no such element exists.
Throws:
java.lang.Exception

getPreviousSibling

public BibleFragment getPreviousSibling(BibleFragment fragment)
                                 throws java.lang.Exception
Returns first preceding BibleFragment relative to given BibleFragment in document order.

Specified by:
getPreviousSibling in class BibleFragmentFactory
Throws:
java.lang.Exception

getPreviousSibling

public BibleFragment getPreviousSibling(java.lang.String id,
                                        Edition edition)
                                 throws java.lang.Exception
Returns first preceding BibleFragment relative to given BibleFragment specified by its ID in document order.

Returns:
first preceding BibleFragment to the fragment with given ID, null when no element with given exists, or there is no valid previous element.
Throws:
java.lang.Exception

getFragments

public BibleFragment[] getFragments(java.lang.String id)
                             throws java.lang.Exception
Returns all BibleFragments with given String ID from the modules maintained factory's ModuleManager.

Returns:
an array containing BibleFragments with given ID.
Throws:
java.lang.Exception