org.egothor.duplicity.datastructure
Class SentenceUnitID

java.lang.Object
  extended by org.egothor.duplicity.datastructure.TextUnitID
      extended by org.egothor.duplicity.datastructure.ParagraphUnitID
          extended by org.egothor.duplicity.datastructure.SentenceUnitID
All Implemented Interfaces:
java.lang.Comparable

public class SentenceUnitID
extends ParagraphUnitID

Class represents a unit of text on sentence duplicity checking level (see Constants.CHECK_DUPLICITY_LEVEL). This class is *IMMUTABLE*, which means that each time a method that is supposed to change something is called, another instance is returned. The objects of this type are pooled using SentenceUnitIDPool so that only one instance of SentenceUnitID exists for each document.

Author:
Kate�ina Dufkov�

Field Summary
protected  short sentenceInParagraph
          Ordinal number of the sentence, the same as Token.sentenceInParagraph field.
 
Fields inherited from class org.egothor.duplicity.datastructure.ParagraphUnitID
paragraph
 
Fields inherited from class org.egothor.duplicity.datastructure.TextUnitID
documentDBRevision, documentUID, GENERAL_SEP, REVISION_SEP
 
Method Summary
 int compareTo(java.lang.Object obj)
           
 boolean equals(java.lang.Object obj)
           
static SentenceUnitID getInstance(long documentUID, int documentDBRevision, short paragraph, short sentenceInParagraph)
          This is the recommended way to create an instance.
 short getSentenceInParagraph()
           
 int hashCode()
           
static SentenceUnitID load(DataInputStream dis)
           
 void store(DataOutputStream dos)
           
 java.lang.String toNiceMeString()
          Returns textual representation of the unit to be printed in duplicity checking reports.
 java.lang.String toNiceOtherString()
          Returns textual representation of the unit to be printed in duplicity checking reports.
 java.lang.String toString()
           
 
Methods inherited from class org.egothor.duplicity.datastructure.ParagraphUnitID
getInstance, getParagraph
 
Methods inherited from class org.egothor.duplicity.datastructure.TextUnitID
getDocumentDBRevision, getDocumentUID, getInstance, releasePools
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sentenceInParagraph

protected final short sentenceInParagraph
Ordinal number of the sentence, the same as Token.sentenceInParagraph field.

Method Detail

getInstance

public static SentenceUnitID getInstance(long documentUID,
                                         int documentDBRevision,
                                         short paragraph,
                                         short sentenceInParagraph)
This is the recommended way to create an instance.

Parameters:
documentUID -
documentDBRevision -
paragraph -
sentenceInParagraph -

getSentenceInParagraph

public short getSentenceInParagraph()

toString

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

toNiceMeString

public 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.

Overrides:
toNiceMeString in class ParagraphUnitID
Returns:
string representation of the object

toNiceOtherString

public 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.

Overrides:
toNiceOtherString in class ParagraphUnitID
Returns:
string representation of the object

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class ParagraphUnitID

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class ParagraphUnitID

hashCode

public int hashCode()
Overrides:
hashCode in class ParagraphUnitID

store

public void store(DataOutputStream dos)
           throws java.io.IOException
Overrides:
store in class ParagraphUnitID
Throws:
java.io.IOException

load

public static SentenceUnitID load(DataInputStream dis)
                           throws java.io.IOException
Throws:
java.io.IOException