gov.nist.nlpir.irf.document
Class DocCollection

java.lang.Object
  |
  +--gov.nist.nlpir.irf.document.DocCollection

public class DocCollection
extends java.lang.Object
implements java.io.Serializable

This class models a document collection

A document collection contains documents and associated information such: what converter and indexing modalities were used to create the documents and index them, what indexes were created and where they are located, etc. Note: The default indexing technique for all indexing features is set here - see method setDefaultIndexingModalities().

Version:
$Revision: 1.7 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.
See Also:
Serialized Form

Field Summary
private  java.lang.String converterClassName
          The name of the converter used to create the documents
private  java.lang.String description
          A brief description of the collection
private  java.lang.String docClassName
          The name of the class of documents in the collection
private  java.util.Vector documents
          The documents that make up this collection
private  java.util.Dictionary indexes
          The indexes created for this collection
private  IndexingModalities indexingModalities
          The indexing modalities that guide indexing of the documents
private  java.lang.String indexLocation
          Information about the location of indexes for the collection Must be set by constructor so existence of DocCollection implies knowledge of index location information.
private  boolean modified
          Flag indicating whether this collection has been modified since it was loaded
private  java.lang.String name
          The collection's name
private  boolean proxyRefsCounted
          Flag, true if refs to proxy docs and indexes can be added to the table of in-memory proxies
(package private) static long serialVersionUID
          serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects
 
Constructor Summary
DocCollection()
          No-argument constructor
DocCollection(java.lang.String n, java.lang.String d, java.lang.String l)
          Constructor - initializes the collection with name, description, and index location information as specified
 
Method Summary
 void addDoc(ProxyDocument doc)
          Adds a document to the collection - if the other documents have been made persistent then the added document must be made persistent before the reference to it is counted.
 void addIndex(ProxyIndex index)
          Adds an index to the list of those associated with this collection
 void addIndexingModalityUnit(IndexingModalityUnit modalityUnit)
          Adds an indexing modality unit
 void editIndexingModalities(DocumentIntrf r)
          Allows indexing modalities to be added/deleted by the end user
protected  void finalize()
          Cleans up table of references to proxies prior to garbage collection If direct references to proxies or Java containers of references have been registered, then unregister them.
 ProxyIndex findIndex(java.lang.String indexname)
          Looks up an index by name in the dictionary of available indexes
 java.lang.String getConverterClassName()
          Gets the name of the class for the document objects in this collection
 java.lang.String getDescription()
          Gets the description of the collection
 java.lang.String getDocClassName()
          Gets the name of the class for the document objects in this collection
 void getFirstInstances()
          Removes any proxies duplicated during deserialization - replacing them with references to a single instance of the proxy.
 IndexingModalities getIndexingModalities()
          Gets the indexing modalities for this collection
 java.util.Enumeration getIndexIter()
          Gets an enumeration to allow iteration over the available indexes
 java.lang.String getIndexLocation()
          Gets the collection-level location of the indexes for this collection
 boolean getModified()
          Tests whether the collection has been modified since last save
 java.lang.String getName()
          Gets the name of the collection
 int getNumDocs()
          Returns the number of documents in the collection
 void present()
          Displays info on contents of the document collection
 void save()
          Save the latest version of the documents, indexes, and indexing modalities associated with this collection.
 void setConverterClassName(java.lang.String name)
          Sets the name of the class of the converter for this collection
 void setDefaultIndexingModalities(DocumentIntrf r)
          Sets the indexing modalities based on supplied sample (proxy) document using reflection.
 void setDescription(java.lang.String desc)
          Sets the description of the collection
 void setDocClassName(java.lang.String name)
          Sets the name of the class for the document objects in this collection
 void setDocuments(java.util.Vector docs)
          Sets the documents
 void setIndexingModalities(IndexingModalities IMs)
          Sets indexing modalities for this collection
private  void setIndexLocation(java.lang.String loc)
          Sets the collection-level location of the indexes for this collection
 void setName(java.lang.String n)
          Sets the name of the collection
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects

documents

private java.util.Vector documents
The documents that make up this collection

name

private java.lang.String name
The collection's name

description

private java.lang.String description
A brief description of the collection

docClassName

private java.lang.String docClassName
The name of the class of documents in the collection

converterClassName

private java.lang.String converterClassName
The name of the converter used to create the documents

indexLocation

private java.lang.String indexLocation
Information about the location of indexes for the collection Must be set by constructor so existence of DocCollection implies knowledge of index location information.

indexingModalities

private IndexingModalities indexingModalities
The indexing modalities that guide indexing of the documents

indexes

private java.util.Dictionary indexes
The indexes created for this collection

proxyRefsCounted

private boolean proxyRefsCounted
Flag, true if refs to proxy docs and indexes can be added to the table of in-memory proxies

modified

private transient boolean modified
Flag indicating whether this collection has been modified since it was loaded
Constructor Detail

DocCollection

public DocCollection()
No-argument constructor

DocCollection

public DocCollection(java.lang.String n,
                     java.lang.String d,
                     java.lang.String l)
Constructor - initializes the collection with name, description, and index location information as specified
Parameters:
n - the initial name for the collection
d - the initial description for the collection
l - information about the location of the collection index(s)
Method Detail

getModified

public final boolean getModified()
Tests whether the collection has been modified since last save
Returns:
whether the collection has been modified

getNumDocs

public final int getNumDocs()
Returns the number of documents in the collection
Returns:
the number of documents in the collection

getName

public final java.lang.String getName()
Gets the name of the collection
Returns:
The name of the collection

setName

public final void setName(java.lang.String n)
Sets the name of the collection

addIndex

public void addIndex(ProxyIndex index)
Adds an index to the list of those associated with this collection
Parameters:
index - the index to be added

getIndexIter

public java.util.Enumeration getIndexIter()
Gets an enumeration to allow iteration over the available indexes
Returns:
an enumeration allowing iteration over the available indexes

findIndex

public ProxyIndex findIndex(java.lang.String indexname)
Looks up an index by name in the dictionary of available indexes
Parameters:
indexname - the name of the index to be looked up
Returns:
the index corresponding to the specified name

setDocuments

public void setDocuments(java.util.Vector docs)
Sets the documents
Parameters:
docs - a vector of documents associated with this collection

addDoc

public void addDoc(ProxyDocument doc)
Adds a document to the collection - if the other documents have been made persistent then the added document must be made persistent before the reference to it is counted. Register the reference to the proxy doc

setDescription

public final void setDescription(java.lang.String desc)
Sets the description of the collection

getDescription

public final java.lang.String getDescription()
Gets the description of the collection
Returns:
The description of the collection

setDocClassName

public final void setDocClassName(java.lang.String name)
Sets the name of the class for the document objects in this collection

getDocClassName

public final java.lang.String getDocClassName()
Gets the name of the class for the document objects in this collection

setConverterClassName

public final void setConverterClassName(java.lang.String name)
Sets the name of the class of the converter for this collection

getConverterClassName

public final java.lang.String getConverterClassName()
Gets the name of the class for the document objects in this collection

setIndexLocation

private final void setIndexLocation(java.lang.String loc)
Sets the collection-level location of the indexes for this collection
Parameters:
loc - the index location info string

getIndexLocation

public final java.lang.String getIndexLocation()
Gets the collection-level location of the indexes for this collection

setIndexingModalities

public final void setIndexingModalities(IndexingModalities IMs)
Sets indexing modalities for this collection

getIndexingModalities

public final IndexingModalities getIndexingModalities()
Gets the indexing modalities for this collection
Returns:
the indexing modalities associated with this collection

addIndexingModalityUnit

public final void addIndexingModalityUnit(IndexingModalityUnit modalityUnit)
Adds an indexing modality unit

setDefaultIndexingModalities

public void setDefaultIndexingModalities(DocumentIntrf r)
Sets the indexing modalities based on supplied sample (proxy) document using reflection. Where an index does not exist for a particular feature, it is created. It is here that the type of the index is determined (e.g. IDF vs. KeyWord).
Parameters:
r - sample document

editIndexingModalities

public void editIndexingModalities(DocumentIntrf r)
Allows indexing modalities to be added/deleted by the end user
Parameters:
r - sample document

getFirstInstances

public void getFirstInstances()
Removes any proxies duplicated during deserialization - replacing them with references to a single instance of the proxy. Proxies may be contained by the indexes dictionary and the indexing modalities.

save

public void save()
Save the latest version of the documents, indexes, and indexing modalities associated with this collection. Note that counting of references to proxy documents and proxy indexes happens here since this class contains (containers of) these references. The counting of references to proxy indexes contained by the IMUs contained within the IndexingModalities contained by this class are handled by each IMU

present

public void present()
Displays info on contents of the document collection

finalize

protected void finalize()
Cleans up table of references to proxies prior to garbage collection If direct references to proxies or Java containers of references have been registered, then unregister them.
Overrides:
finalize in class java.lang.Object