net.sourceforge.javamatch.engine
Class MatchEngine

java.lang.Object
  extended bynet.sourceforge.javamatch.engine.MatchEngine
Direct Known Subclasses:
JDOMatchEngine

public class MatchEngine
extends java.lang.Object

Class MatchEngine performs the matching that is done by JavaMatch. The MatchEngine base class matches objects in the JVM only. Subclasses may provide interfaces to any object-relational mapping tools


Constructor Summary
MatchEngine()
           
 
Method Summary
 void addMatchListener(MatchListener listener)
          Registers the givem match listener to receive notifications when events occur in this match engine
protected  void discardObject(java.lang.Object objectToDiscard)
          Discards the given object from memory.
 MatchResult executeQuery(MatchQuery query, java.util.Iterator dataIterator1, java.util.Iterator dataIterator2)
          Executes the specified match query on all objects in the given List.
 MatchResult executeQuery(MatchQuery query, java.util.List itemsToMatch)
          Executes the specified match query on all objects in the given List.
 void removeMatchListener(MatchListener listener)
          Unregisters the given match listener from notifications when events occur in this match engine
protected  java.lang.Object retrieveObject(java.lang.Object objectToRetrieve)
          Retrieves and returns the object or object with the given identifier from the underlying persistent storage mechanism, if any.
 void setMaxNumResultItems(int maxNumResultItems)
          The maximum number of result items to be returned in a query
 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

MatchEngine

public MatchEngine()
Method Detail

executeQuery

public MatchResult executeQuery(MatchQuery query,
                                java.util.List itemsToMatch)
                         throws MatchException
Executes the specified match query on all objects in the given List. Returns a MatchResult, that contains the best matching items with their match value. The number of items that are returned can be specified by

Parameters:
query - the query that is executed
itemsToMatch - the items that are matched
Returns:
a MatchResult, that contains the best matching ResultItems
Throws:
MatchException - when matching failed

executeQuery

public MatchResult executeQuery(MatchQuery query,
                                java.util.Iterator dataIterator1,
                                java.util.Iterator dataIterator2)
                         throws MatchException
Executes the specified match query on all objects in the given List. Returns a MatchResult, that contains the best matching items with their match value. The number of items that are returned can be specified by

Parameters:
query - the query that is executed
dataIterator1 - an iterator that iterates over the items that are matched
dataIterator2 - a second iterator that iterates over the items that are used in the pre-pass of a two-pass query. This iterator may be null if the query is single-pass
Returns:
a MatchResult, that contains the best matching ResultItems
Throws:
MatchException - when matching failed

setMaxNumResultItems

public void setMaxNumResultItems(int maxNumResultItems)
The maximum number of result items to be returned in a query


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

Parameters:
threshold - the threshold, the minimum query result value before an object is included in the MatchResult

retrieveObject

protected java.lang.Object retrieveObject(java.lang.Object objectToRetrieve)
Retrieves and returns the object or object with the given identifier from the underlying persistent storage mechanism, if any. By default, returns the same object.

Parameters:
objectToRetrieve - the object or object identifier to retrieve
Returns:
the object that is retrieved

discardObject

protected void discardObject(java.lang.Object objectToDiscard)
Discards the given object from memory. After discarding, the match engine will not call this object again (the calling application might still do so, but that's up to that application.

Parameters:
objectToDiscard - the object to discard

addMatchListener

public void addMatchListener(MatchListener listener)
Registers the givem match listener to receive notifications when events occur in this match engine

Parameters:
listener - the listener that is registered to be notified of events

removeMatchListener

public void removeMatchListener(MatchListener listener)
Unregisters the given match listener from notifications when events occur in this match engine

Parameters:
listener - the listener that is unregistered from notifications

Hosted by SourceForge.net/