net.sourceforge.javamatch.engine
Class MatchResult

java.lang.Object
  extended bynet.sourceforge.javamatch.engine.MatchResult

public class MatchResult
extends java.lang.Object

Class MatchResult contains the result of a match. This result may contain multiple result items, each with its match value, sorted descending


Constructor Summary
MatchResult(MatchEngine matchEngine)
          Creates a new MatchResult
 
Method Summary
 void addResultItem(java.lang.Object matchedObject, float matchValue)
          Adds the given result item.
 java.util.Iterator getResultIterator()
          Returns an iterator that iterates over all result items in this result, in descending order
 void setMaxNumResultItems(int maxNumResultItems)
          Sets the maximum number of result items in this MatchResult.
 void setThreshold(float threshold)
          Sets the threshold value, the minimum value that each sub-query shoud have, to be included in the match result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatchResult

public MatchResult(MatchEngine matchEngine)
Creates a new MatchResult

Method Detail

addResultItem

public void addResultItem(java.lang.Object matchedObject,
                          float matchValue)
Adds the given result item. This method takes care of sorting the items. If this MatchResult is full (filled with maxNumResultItems ResultItems), and the matchValue is lower than the lowest stored matchValue, the matched object will not be added. When the number of ResultItems grows over maxNumResultItems, the last item will be removed

Parameters:
matchedObject - the object item to be added
matchValue - indicates how good the object matches

getResultIterator

public java.util.Iterator getResultIterator()
Returns an iterator that iterates over all result items in this result, in descending order

Returns:
an iterator that iterates over all result items, in the order of ascending matchValue (best matches first)

setThreshold

public void setThreshold(float threshold)
Sets the threshold value, the minimum value that each sub-query shoud have, to be included in the match result. This method is only valid when no ResultItems have been added.

Parameters:
threshold - the threshold, the minimum query result value before an object is included in the MatchResult
Throws:
java.lang.IllegalStateException - when ResultItems have been added before this method is called

setMaxNumResultItems

public void setMaxNumResultItems(int maxNumResultItems)
Sets the maximum number of result items in this MatchResult. This method is only valid when no ResultItems have been added.

Parameters:
maxNumResultItems - the maximum number of result items to be returned
Throws:
java.lang.IllegalStateException - when ResultItems have been added before this method is called

Hosted by SourceForge.net/