cz.cuni.versatile.api
Interface ResultSet

All Superinterfaces:
ResourceEntry

public interface ResultSet
extends ResourceEntry

ResultSet the N-best result list produced by a ResourceProvider in a response to a particular Query. The ResultSet is ordered in descending order with the respect to the score of the individual ResourceEntry items. ResultSet itself implements the interface ResourceEntry and thus exposes facets to its users:

  1. an ordered collection of ResourceEntry items
  2. a shortcut accessor to the first (0-index) ResourceEntry
This approach has been chosen because of the default N-best size, which is equal to 1, and at the same time, a ResultSet always contains at least one item. In a typical situation, the user does not need (and does not want) to deal with a collection of result items and just wants to pick the first one (the closest match) item.

Author:
Jaroslav Gergic

Method Summary
 ResourceEntry get(int i)
          Returns a ResourceEntry at a given index.
 Query getQuery()
          Returns the Query this ResultSet is a response to.
 java.util.Iterator iterator()
          Returns the descending order iterator which reflects the underlying score-ordered collection.
 int size()
          Returns the size of the ResultSet.
 
Methods inherited from interface cz.cuni.versatile.api.ResourceEntry
getIndex, getProperties, getResultSet, getScore, getValue
 

Method Detail

size

public int size()
Returns the size of the ResultSet.

Returns:
the size of the ResultSet.

iterator

public java.util.Iterator iterator()
Returns the descending order iterator which reflects the underlying score-ordered collection.

Returns:
the descending order iterator which reflects the underlying score-ordered collection.

get

public ResourceEntry get(int i)
Returns a ResourceEntry at a given index.

Parameters:
i - a zero-based index, must not exceed size() -1
Returns:
a ResourceEntry at a given index.
Throws:
java.lang.IndexOutOfBoundsException - in case the given index exceeded the size of the result set.

getQuery

public Query getQuery()
Returns the Query this ResultSet is a response to.

Returns:
the Query this ResultSet is a response to.