org.terrier.indexing
Class CollectionFactory

java.lang.Object
  extended by org.terrier.indexing.CollectionFactory

public class CollectionFactory
extends java.lang.Object

Implements a factory for Collection objects. Pass the name of the desired Collection(s) to loadCollection() or loadCollections(). loadCollection can take a comma separated list of collections, while loadCollections takes a String array of Collection names, in the same order. The package name org.terrier.indexing. is prepended to any Collections named without any explicit packages.

The bottom Collection is specified last, and this is loaded first. Ie Collections are loaded right to left. For instance: PassageCollection,TRECCollection would instantiate a PassageCollection which has as its only constructor parameter, a TREC Collection. Ie, the correponding code would be new PassageCollection(new TRECCollection()); If the optional constructor parameters types and values are specified, then these will be used to instantiate the innermost class.

Since:
1.1.0, 14/01/2007
Author:
Craig Macdonald craigm{a.}dcs.gla.ac.uk

Field Summary
protected static org.apache.log4j.Logger logger
          logger for this class
 
Constructor Summary
CollectionFactory()
           
 
Method Summary
static Collection loadCollection(java.lang.String CollectionName)
          Load collection(s) of the specified name.
static Collection loadCollection(java.lang.String CollectionName, java.lang.Class<?>[] contructorTypes, java.lang.Object[] constructorValues)
          Load collection(s) of the specified name.
static Collection loadCollections()
          Use the default property trec.collection.class, or it's default value TRECCollection
static Collection loadCollections(java.lang.String[] collNames)
          Load collection(s) of the specified name.
static Collection loadCollections(java.lang.String[] collNames, java.lang.Class<?>[] contructorTypes, java.lang.Object[] constructorValues)
          Load collection(s) of the specified name.
protected static java.lang.String normaliseCollectionName(java.lang.String collectionName)
          prepends org.terrier.indexing. to any Collections without a package
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
logger for this class

Constructor Detail

CollectionFactory

public CollectionFactory()
Method Detail

loadCollections

public static Collection loadCollections()
Use the default property trec.collection.class, or it's default value TRECCollection


loadCollection

public static Collection loadCollection(java.lang.String CollectionName)
Load collection(s) of the specified name. Uses empty constructor of innermost Collection. Returns null on error


loadCollection

public static Collection loadCollection(java.lang.String CollectionName,
                                        java.lang.Class<?>[] contructorTypes,
                                        java.lang.Object[] constructorValues)
Load collection(s) of the specified name. Types and values of the construcor as specified. Returns null on error


loadCollections

public static Collection loadCollections(java.lang.String[] collNames,
                                         java.lang.Class<?>[] contructorTypes,
                                         java.lang.Object[] constructorValues)
Load collection(s) of the specified name. Types and values of the construcor as specified.


loadCollections

public static Collection loadCollections(java.lang.String[] collNames)
Load collection(s) of the specified name. Uses default constructor of innermost Collection. Returns null on error


normaliseCollectionName

protected static java.lang.String normaliseCollectionName(java.lang.String collectionName)
prepends org.terrier.indexing. to any Collections without a package



Terrier 3.5. Copyright © 2004-2011 University of Glasgow