org.xnap.search
Class AbstractSearchResultContainer

java.lang.Object
  extended by org.xnap.search.AbstractSearchResultContainer
All Implemented Interfaces:
SearchResult, SearchResultContainer
Direct Known Subclasses:
GiFTSearchResultContainer, JTellaSearchResultContainer, LimeWireSearchResultContainer, OpenNapSearchResultContainer

public abstract class AbstractSearchResultContainer
extends java.lang.Object
implements SearchResultContainer

Stores a list of SearchResult objects. Acts as a proxy for the first added result.


Field Summary
protected  java.util.LinkedList results
          A list of SearchResult objects.
 
Fields inherited from interface org.xnap.search.SearchResult
BITRATE, FREQUENCY, HIDE_PREFIX, LENGTH, MD5, SHA1, URN
 
Constructor Summary
AbstractSearchResultContainer()
           
 
Method Summary
 boolean add(SearchResult result)
          Adds result to the container.
 boolean canGroup(SearchResult result)
          Returns true, if this object and result can be grouped together.
 SearchResultContainer createContainer()
          This should not be invoked.
 java.lang.Object get(java.lang.String key)
          Returns a value.
 int getAvailability()
          Returns the sum of the availability of all results.
 int getChildCount()
           
 java.lang.String getFilename()
          Returns the full filename.
 long getFilesize()
          Returns the filesize.
 SearchResult getFirst()
           
 java.lang.Object getHash()
          Used for grouping of results.
 javax.swing.Icon getIcon()
          Returns null;
 java.lang.String[] getPath()
          Returns the tokenized path without delimeters.
 Peer getPeer()
          Returns null.
 Plugin getPlugin()
          Returns the originating plugin.
 java.lang.String getShortFilename()
          Returns the filename presented to the user.
 int getSourcesCount()
          Returns the number of children.
 java.util.Iterator iterator()
          Returns an iterator over all contained SearchResult objects.
 java.util.Iterator keys()
          Returns an iterator for all keys that can be retreived by calling SearchResult.get(String).
 void setPropertiesFrom(SearchResult result)
          Sets all properties of this container to result's properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xnap.search.SearchResult
getActions
 

Field Detail

results

protected java.util.LinkedList results
A list of SearchResult objects.

Constructor Detail

AbstractSearchResultContainer

public AbstractSearchResultContainer()
Method Detail

add

public boolean add(SearchResult result)
Adds result to the container.

Specified by:
add in interface SearchResultContainer

canGroup

public boolean canGroup(SearchResult result)
Description copied from interface: SearchResult
Returns true, if this object and result can be grouped together.

Specified by:
canGroup in interface SearchResult

createContainer

public SearchResultContainer createContainer()
This should not be invoked.

Specified by:
createContainer in interface SearchResult

getAvailability

public int getAvailability()
Returns the sum of the availability of all results.

Specified by:
getAvailability in interface SearchResult
Returns:
0, if this makes no sense (i.e. for a local file)

get

public java.lang.Object get(java.lang.String key)
Description copied from interface: SearchResult
Returns a value.

Specified by:
get in interface SearchResult
Parameters:
key - anything like BITRATE, LENGTH...

getChildCount

public int getChildCount()

getFilename

public java.lang.String getFilename()
Description copied from interface: SearchResult
Returns the full filename. Used by SearchFilter for matching.

Specified by:
getFilename in interface SearchResult
See Also:
xnap.search.SearchFilter

getFilesize

public long getFilesize()
Description copied from interface: SearchResult
Returns the filesize.

Specified by:
getFilesize in interface SearchResult

getFirst

public SearchResult getFirst()

getHash

public java.lang.Object getHash()
Description copied from interface: SearchResult
Used for grouping of results.

Specified by:
getHash in interface SearchResult

getIcon

public javax.swing.Icon getIcon()
Returns null;

Specified by:
getIcon in interface SearchResult

getPath

public java.lang.String[] getPath()
Description copied from interface: SearchResult
Returns the tokenized path without delimeters. Used for the browse tree. C:\Files\Share would be returned as new String[] { "C:", "Files", "Share" }

Specified by:
getPath in interface SearchResult
Returns:
null, if result has no path; the path, otherwise

getPlugin

public Plugin getPlugin()
Description copied from interface: SearchResult
Returns the originating plugin.

Specified by:
getPlugin in interface SearchResult

getShortFilename

public java.lang.String getShortFilename()
Description copied from interface: SearchResult
Returns the filename presented to the user.

Specified by:
getShortFilename in interface SearchResult

getPeer

public Peer getPeer()
Returns null.

Specified by:
getPeer in interface SearchResult

getSourcesCount

public int getSourcesCount()
Returns the number of children.

Specified by:
getSourcesCount in interface SearchResult

iterator

public java.util.Iterator iterator()
Returns an iterator over all contained SearchResult objects.


keys

public java.util.Iterator keys()
Description copied from interface: SearchResult
Returns an iterator for all keys that can be retreived by calling SearchResult.get(String).

Specified by:
keys in interface SearchResult
Returns:
null, if no keys are defined

setPropertiesFrom

public void setPropertiesFrom(SearchResult result)
Sets all properties of this container to result's properties.



Copyright © 2001-2005 XNap Team. All Rights Reserved.