org.egothor.duplicity.datastructure
Class TextUnitID

java.lang.Object
  extended by org.egothor.duplicity.datastructure.TextUnitID
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
DocumentUnitID, ParagraphUnitID

public abstract class TextUnitID
extends java.lang.Object
implements java.lang.Comparable

Class represents a unit of text. Its childs correspond to units on different duplicity checking levels (see Constants.CHECK_DUPLICITY_LEVEL).

Author:
Kate�ina Dufkov�

Field Summary
protected  short documentDBRevision
          Document revision number in the document database, the same as DocumentData.docDBRevision field.
protected  long documentUID
          Unique document identifier, the same as DocumentData.uid field.
static java.lang.String GENERAL_SEP
          Separates other elements - paragraph and sentence neumbers.
static java.lang.String REVISION_SEP
          Separates document identificator from revision number.
 
Constructor Summary
protected TextUnitID(long documentUID, int documentDBRevision)
           
 
Method Summary
 int getDocumentDBRevision()
           
 long getDocumentUID()
           
static TextUnitID getInstance()
          The recommended way to create new instance of TextUnitID child class.
static TextUnitID load(DataInputStream dis)
          The method must return another object, it can not change the this value.
static void releasePools()
          The method releases all the text unit IDs in pools.
abstract  void store(DataOutputStream dos)
           
abstract  java.lang.String toNiceMeString()
          Returns textual representation of the unit to be printed in duplicity checking reports.
abstract  java.lang.String toNiceOtherString()
          Returns textual representation of the unit to be printed in duplicity checking reports.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

documentUID

protected final long documentUID
Unique document identifier, the same as DocumentData.uid field.


documentDBRevision

protected final short documentDBRevision
Document revision number in the document database, the same as DocumentData.docDBRevision field.


REVISION_SEP

public static final java.lang.String REVISION_SEP
Separates document identificator from revision number.

See Also:
Constant Field Values

GENERAL_SEP

public static final java.lang.String GENERAL_SEP
Separates other elements - paragraph and sentence neumbers.

See Also:
Constant Field Values
Constructor Detail

TextUnitID

protected TextUnitID(long documentUID,
                     int documentDBRevision)
Method Detail

getInstance

public static TextUnitID getInstance()
The recommended way to create new instance of TextUnitID child class. Returns allways the right child class according to the Constants.CHECK_DUPLICITY_LEVEL constant.

Returns:
instance of TextUnitID child class

getDocumentDBRevision

public int getDocumentDBRevision()

getDocumentUID

public long getDocumentUID()

store

public abstract void store(DataOutputStream dos)
                    throws java.io.IOException
Throws:
java.io.IOException

load

public static TextUnitID load(DataInputStream dis)
                       throws java.io.IOException
The method must return another object, it can not change the this value.

Parameters:
dis -
Throws:
java.io.IOException

releasePools

public static void releasePools()
The method releases all the text unit IDs in pools.


toNiceMeString

public abstract java.lang.String toNiceMeString()
Returns textual representation of the unit to be printed in duplicity checking reports. This is used for identifying units in the examined document and should not contain document id.

Returns:
string representation of the object

toNiceOtherString

public abstract java.lang.String toNiceOtherString()
Returns textual representation of the unit to be printed in duplicity checking reports. This is used for identifying units in the already indexed documents and should contain document id.

Returns:
string representation of the object