ca.uhn.cache.impl
Class QueryResult

java.lang.Object
  extended byca.uhn.cache.impl.CommonsLangObject
      extended byca.uhn.cache.impl.QueryResult
All Implemented Interfaces:
IQueryResult

public class QueryResult
extends CommonsLangObject
implements IQueryResult

TODO complete javadoc for TODO in future versions these might not be full when they are returned (although this isn't supported now). At that time we will have to account for exceptions that arise during iteration, and also for add() called while iterating. One solution would be to use a typed iterator that throws an exception on next(), if there has been an exception in the underlying data retrieval. Another is to use NoSuchElementException and/or getException() on this class.

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:39 $ by $Author: bryan_tripp $
Author:
Alexei Guevara

Constructor Summary
QueryResult()
          Constructs an empty query result.
QueryResult(java.util.Set theItems)
          Constructs query result with the specified data items.
 
Method Summary
 void add(IDataItem theItem)
          Adds a new item to the data set.
 IQueryResult append(IQueryResult theQueryResult)
          Appends the specified query result to the end of this query result.
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int size()
          Returns the number of elements in this query result.
 
Methods inherited from class ca.uhn.cache.impl.CommonsLangObject
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryResult

public QueryResult()
Constructs an empty query result.


QueryResult

public QueryResult(java.util.Set theItems)
Constructs query result with the specified data items.

Parameters:
theItems - The data items.
Throws:
java.lang.ClassCastException - If any of the elements of theItems is not an IDataItem.
Method Detail

append

public IQueryResult append(IQueryResult theQueryResult)
Description copied from interface: IQueryResult
Appends the specified query result to the end of this query result.

If the argument query result is empty, the this query result is returned. Otherwise a new IQueryResult is created, containing the query result items of this query result and the ones of the argument one.

Specified by:
append in interface IQueryResult
Parameters:
theQueryResult - The query result to be appended.
Returns:
A query result that contains the query result items of this query result and the ones of the argument query result.
See Also:
ca.uhn.cache.IQueryResult#append(biz.mobiled.cache.IQueryResult)

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface IQueryResult
Returns:
an Iterator over all the IDataItem s in this data set
See Also:
IQueryResult.iterator()

add

public void add(IDataItem theItem)
Description copied from interface: IQueryResult
Adds a new item to the data set.

Specified by:
add in interface IQueryResult
Parameters:
theItem - the IDataItem to add
See Also:
IQueryResult.add(ca.uhn.cache.IDataItem)

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IQueryResult
Returns:
true if this query result contains no data items
See Also:
IQueryResult.isEmpty()

size

public int size()
Description copied from interface: IQueryResult
Returns the number of elements in this query result. If this query result contains more than Integer.MAX_VALUE data items, returns Integer.MAX_VALUE.

Specified by:
size in interface IQueryResult
Returns:
the number of elements in this query result.
See Also:
IQueryResult.size()


Copyright © 2004-2005 University Health Network. All Rights Reserved.