at.ac.tuwien.infosys.rnue.helpers.search
Class SearchResultImpl

java.lang.Object
  |
  +--at.ac.tuwien.infosys.rnue.helpers.search.SearchResultImpl
All Implemented Interfaces:
ISearchResult

public class SearchResultImpl
extends java.lang.Object
implements ISearchResult

The SearchResultImpl class represents a search result over all known peers. It is set up by the information stored in the SearchResponseImpl objects returned by peers owning the requested * document. The SearchResultImpl is implemented as a Hashtable. The owner is used as key the IFileList file list as value.

Its constructor creates an empty search result. Use putFileList method to add a SearchResponseImpl search responses using the owner (sender of the search response) as the key to the IFileList file lists. The search result can then be retrieved using the owners and getFileList methods.


Constructor Summary
SearchResultImpl()
          Constructs an emtpy SearchResultImpl object.
 
Method Summary
 IFileList getFileList(java.lang.String owner)
          Returns the IFileList file list matching the search request at a specific peer.
 java.util.Enumeration owners()
          Returns an Enumeration of owners.
 void putFileList(java.lang.String owner, IFileList list)
          Use the putFileList method to add SearchResponseImpl search responses to the search result.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchResultImpl

public SearchResultImpl()
Constructs an emtpy SearchResultImpl object.

Method Detail

owners

public java.util.Enumeration owners()
Returns an Enumeration of owners. The owner can the be used to request the IFileList file list using the getFileList method.

Specified by:
owners in interface ISearchResult
Returns:
Enumeration of peers having documents in the file base that match the search request

getFileList

public IFileList getFileList(java.lang.String owner)
Returns the IFileList file list matching the search request at a specific peer.

Specified by:
getFileList in interface ISearchResult
Parameters:
owner - java.lang.String HumanReadabelName identifying the peer owning the file list.
Returns:
IFileList list of files matching the search request on the owner peer, or null if no file list for owner exists.

putFileList

public void putFileList(java.lang.String owner,
                        IFileList list)
Use the putFileList method to add SearchResponseImpl search responses to the search result.

Specified by:
putFileList in interface ISearchResult
Parameters:
owner - java.lang.String identifying the peer ownign the file list
list - IFileList list of files matching the search request on the owner peer.