org.norvelle.textcite.gui.action.genref
Class ReferenceGeneratorCollection

java.lang.Object
  extended by org.norvelle.textcite.gui.action.genref.ReferenceGeneratorCollection

public class ReferenceGeneratorCollection
extends java.lang.Object

ReferenceGeneratorCollection: A collection of the ReferenceGenerators available to the application, with routines to produce arrays, and to return a reference to the user's chosen default reference generator. Follows the Singleton pattern, allowing global static access via its methods; it constructs its internal collection of generators the first time any of its methods get called.

Author:
Erik Norvelle

Field Summary
protected static java.util.TreeMap<java.lang.String,ReferenceGenerator> generatorCollection
           
protected static boolean initialized
           
 
Constructor Summary
ReferenceGeneratorCollection()
           
 
Method Summary
static ReferenceGenerator getDefaultGenerator()
          Returns the user's currently chosen default reference generator.
static ReferenceGenerator getGeneratorByName(java.lang.String name)
          Return the global instance of the named generator.
static int getPosOfGeneratorInList(ReferenceGenerator generatorToFind)
          Given a name of a ReferenceGenrator, return the position in the array of that class.
static ReferenceGenerator[] getReferenceGenerators()
          Returns an array containing instantiations of all the available ReferenceGenerator subclasses
protected static void initCollection()
          Initialize the collection with objects representing each available kind of reference generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

protected static boolean initialized

generatorCollection

protected static java.util.TreeMap<java.lang.String,ReferenceGenerator> generatorCollection
Constructor Detail

ReferenceGeneratorCollection

public ReferenceGeneratorCollection()
Method Detail

initCollection

protected static void initCollection()
Initialize the collection with objects representing each available kind of reference generator. Called prior to allowing any other acction on the collection, in order to make sure the


getReferenceGenerators

public static ReferenceGenerator[] getReferenceGenerators()
Returns an array containing instantiations of all the available ReferenceGenerator subclasses


getPosOfGeneratorInList

public static int getPosOfGeneratorInList(ReferenceGenerator generatorToFind)
Given a name of a ReferenceGenrator, return the position in the array of that class.

Parameters:
generatorName - The name of the ReferenceGenerator to locate
Returns:
The position in the array of the ReferenceGenerator to locate, 0 if not found.

getGeneratorByName

public static ReferenceGenerator getGeneratorByName(java.lang.String name)
Return the global instance of the named generator.

Parameters:
name - The name of the generator to retrieve
Returns:
The referenced generator.
Throws:
NoSuchReferenceGenerator - if a non-existence ReferenceGenerator is requested.

getDefaultGenerator

public static ReferenceGenerator getDefaultGenerator()
Returns the user's currently chosen default reference generator.

Returns:
The ReferenceGenerator
Throws:
NoSuchReferenceGenerator - if the default ReferenceGenerator is invalid.