gr.demokritos.iit.jinsect.documentModel.comparators
Class StandardDocumentComparator

java.lang.Object
  extended by gr.demokritos.iit.jinsect.documentModel.comparators.StandardDocumentComparator
All Implemented Interfaces:
SimilarityComparatorListener, java.io.Serializable
Direct Known Subclasses:
CachedDocumentComparator, DocumentHistoComparator

public class StandardDocumentComparator
extends java.lang.Object
implements SimilarityComparatorListener

This class implements the SimilarityComparatorListener interface, describing objects that can perform comparison between NGramDocument objects.

See Also:
Serialized Form

Field Summary
protected  double GraphImportance
           
protected  GraphSimilarity sGraph
           
protected  GraphSimilarity sHistogram
           
 
Constructor Summary
StandardDocumentComparator()
          Creates a new instance of StandardComparator
StandardDocumentComparator(double dGraphImportance)
          Creates a new instance of StandardComparator, given the importance of the n-gram graph similarity in the calculation of overall similarity.
 
Method Summary
 GraphSimilarity getGraphSimilarity()
          Returns the graph similarity part of the overall similality measurement, performed for the last comparison.
 GraphSimilarity getHistogramSimilarity()
          Returns the graph similarity part of the overall similality measurement, performed for the last comparison.
 GraphSimilarity getSimilarityBetween(java.lang.Object oFirst, java.lang.Object oSecond)
          Returns the similarity of two given NGramDocuments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GraphImportance

protected double GraphImportance

sGraph

protected GraphSimilarity sGraph

sHistogram

protected GraphSimilarity sHistogram
Constructor Detail

StandardDocumentComparator

public StandardDocumentComparator()
Creates a new instance of StandardComparator


StandardDocumentComparator

public StandardDocumentComparator(double dGraphImportance)
Creates a new instance of StandardComparator, given the importance of the n-gram graph similarity in the calculation of overall similarity.

Parameters:
dGraphImportance - A value between 0.0 and 1.0 indicating how important is the graph in the calculation. If zero, then only histogram information is used. If 1.0, then only graph information is used.
Method Detail

getSimilarityBetween

public GraphSimilarity getSimilarityBetween(java.lang.Object oFirst,
                                            java.lang.Object oSecond)
                                     throws java.io.InvalidClassException
Returns the similarity of two given NGramDocuments.

Specified by:
getSimilarityBetween in interface SimilarityComparatorListener
Parameters:
oFirst - The first object participating in the similarity calculation. If not an NGramDocument then an InvalidClassException is thrown.
oSecond - The first object participating in the similarity calculation. If not an NGramDocument then an InvalidClassException is thrown.
Returns:
A GraphSimilarity object indicating the similarity between the two given objects.
Throws:
java.io.InvalidClassException - Throws this exception when the objects are not comparable due to class restrictions.
See Also:
ISimilarity

getGraphSimilarity

public GraphSimilarity getGraphSimilarity()
Returns the graph similarity part of the overall similality measurement, performed for the last comparison.

Returns:
The graph similarity of the objects last evaluated.

getHistogramSimilarity

public GraphSimilarity getHistogramSimilarity()
Returns the graph similarity part of the overall similality measurement, performed for the last comparison.

Returns:
The histogram similarity of the objects last evaluated.