com.languagecomputer.api.query
Class DefaultQueryResult

java.lang.Object
  extended by com.languagecomputer.api.query.DefaultQueryResult
All Implemented Interfaces:
QueryResult

public class DefaultQueryResult
extends Object
implements QueryResult

Default implementation of a QueryResult. Alternatively, the QueryResult interface may be implemented in order to be backed by a different mechanism (i.e., for speed and/or memory performance based on the individual system).

Since:
1.0
Author:
Kirk Roberts

Constructor Summary
DefaultQueryResult()
           
 
Method Summary
 Document getDocument()
          Returns the Document associated with this QueryResult.
 double getScore()
          Returns a score for this QueryResult in the range of (0.0-1.0] (optional).
 void setDocument(Document document)
          Sets the Document to use for this DefaultQueryResult.
 void setScore(double score)
          Sets the score to use for this DefaultQueryResult.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultQueryResult

public DefaultQueryResult()
Method Detail

setDocument

public void setDocument(Document document)
Sets the Document to use for this DefaultQueryResult.

Parameters:
document - non-null Document this result wraps.
Throws:
IllegalArgumentException - If the document is null.
See Also:
getDocument()

getDocument

public Document getDocument()
Returns the Document associated with this QueryResult.

Specified by:
getDocument in interface QueryResult
Returns:
The resulting Document.

setScore

public void setScore(double score)
Sets the score to use for this DefaultQueryResult.

Parameters:
score - Result score, must be within the range (0.0-1.0].
Throws:
IllegalArgumentException - If the score does not fall within the expected range.
See Also:
getScore()

getScore

public double getScore()
Returns a score for this QueryResult in the range of (0.0-1.0] (optional). If the implementor chooses not to provide a score, then 1.0 should be used.

Specified by:
getScore in interface QueryResult
Returns:
The (0.0-1.0] score of this QueryResult.


Copyright © 2009. All Rights Reserved.