Package org.terrier.indexing
Class CollectionFactory
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description protected static org.slf4j.Logger
logger
logger for this class
-
Constructor Summary
Constructors Constructor Description CollectionFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 TRECCollectionstatic 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.static java.util.List<java.lang.String>
loadCollectionSpecFileList(java.lang.String CollectionSpecFilename)
protected static java.lang.String
normaliseCollectionName(java.lang.String collectionName)
prepends org.terrier.indexing. to any Collections without a packagestatic java.util.List<java.util.List<java.lang.String>>
splitCollectionSpecFileList(java.lang.String CollectionSpecFilename, int k)
static <T> java.util.List<java.util.List<T>>
splitList(java.util.List<T> all, int k)
-
-
-
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 constructor 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 constructor 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
-
splitCollectionSpecFileList
public static java.util.List<java.util.List<java.lang.String>> splitCollectionSpecFileList(java.lang.String CollectionSpecFilename, int k)
-
splitList
public static <T> java.util.List<java.util.List<T>> splitList(java.util.List<T> all, int k)
-
loadCollectionSpecFileList
public static java.util.List<java.lang.String> loadCollectionSpecFileList(java.lang.String CollectionSpecFilename)
-
-