iglu.ir
Class AbstractDocument

java.lang.Object
  |
  +--iglu.ir.AbstractDocument
All Implemented Interfaces:
Document, java.io.Serializable
Direct Known Subclasses:
ASCIIDocument, HTMLDocument

public abstract class AbstractDocument
extends java.lang.Object
implements Document, java.io.Serializable

Implements some of the basic Document methods using a TermVector. Assumes that the document does not change. All that subclasses have to implement to complete a Document class are the getIndexibleContent, getFullContent, and getStylizedText methods. The get/set content methods here ensure that the document information is updated properly. Methods descended from this class should set the full and indexible content by calling the methods defined here rather than setting the variables directly.

Since:
1.0
Version:
1.0
Author:
Travis Bauer
See Also:
Serialized Form

Field Summary
private  java.lang.String fullContent
           
private  java.lang.String indexibleContent
           
private  int size
           
private  TermVector tv
          Contains a list of words occurring and how often they occur
 
Fields inherited from interface iglu.ir.Document
STYLE_BOLD, STYLE_DEEMPHASIZED, STYLE_EMPHSIZED, STYLE_ITALIC
 
Constructor Summary
AbstractDocument()
           
 
Method Summary
 java.lang.String getFullContent()
          Returns the unmodified contents of this document.
 java.lang.String getIndexibleContent()
          Returns a string containing the content of this document which might be indexible.
abstract  java.lang.String getStylizedText(int style)
          Allows the user to query the document about text which is highlighted in some way.
private  void loadTermVector()
           
 int numOccurs(java.lang.String w)
          The number of times w occurs in the indexible content.
 int numUniqueWords()
          The number of unique words in the indexible content of the document.
 int numWords()
          The number of total words in the document.
 void setFullContent(java.lang.String content)
           
 void setIndexibleContent(java.lang.String content)
          Changes the indexible content of the current document to content.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fullContent

private java.lang.String fullContent

indexibleContent

private java.lang.String indexibleContent

tv

private TermVector tv
Contains a list of words occurring and how often they occur


size

private int size
Constructor Detail

AbstractDocument

public AbstractDocument()
Method Detail

getStylizedText

public abstract java.lang.String getStylizedText(int style)
Description copied from interface: Document
Allows the user to query the document about text which is highlighted in some way. All classes implementing this interface must at lease respond to the basic types listed above. They may also implement thier own specific type.

Specified by:
getStylizedText in interface Document
Parameters:
style - an int value
Returns:
a String value

getFullContent

public java.lang.String getFullContent()
Description copied from interface: Document
Returns the unmodified contents of this document.

Specified by:
getFullContent in interface Document
Returns:
a String value

getIndexibleContent

public java.lang.String getIndexibleContent()
Description copied from interface: Document
Returns a string containing the content of this document which might be indexible. Must do the following:

Specified by:
getIndexibleContent in interface Document
Returns:
a String value

setIndexibleContent

public void setIndexibleContent(java.lang.String content)
Description copied from interface: Document
Changes the indexible content of the current document to content. Can be used by the DocumentFilters to change the content.

Specified by:
setIndexibleContent in interface Document

setFullContent

public void setFullContent(java.lang.String content)

numOccurs

public int numOccurs(java.lang.String w)
Description copied from interface: Document
The number of times w occurs in the indexible content.

Specified by:
numOccurs in interface Document
Parameters:
w - a String value
Returns:
an int value

numWords

public int numWords()
Description copied from interface: Document
The number of total words in the document.

Specified by:
numWords in interface Document
Returns:
an int value

numUniqueWords

public int numUniqueWords()
Description copied from interface: Document
The number of unique words in the indexible content of the document.

Specified by:
numUniqueWords in interface Document
Returns:
an int value

loadTermVector

private void loadTermVector()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object