org.xnap.search
Interface SearchResult

All Known Subinterfaces:
SearchResultContainer
All Known Implementing Classes:
AbstractSearchResult, AbstractSearchResultContainer, FreewaySearchResult, GiFTSearchResult, GiFTSearchResultContainer, JTellaSearchResult, JTellaSearchResultContainer, LimeWireSearchResult, LimeWireSearchResultContainer, MetaInfoFileSearchResult, OpenNapSearchResult, OpenNapSearchResultContainer, OvernetSearchResult

public interface SearchResult

Defines the requirements for an object that can be used as result in a search (table).


Field Summary
static java.lang.String BITRATE
          The bitrate key.
static java.lang.String FREQUENCY
          The length key.
static java.lang.String HIDE_PREFIX
          If a key is prefixed with the HIDE_PREFIX string, it is not displayed.
static java.lang.String LENGTH
          The length key.
static java.lang.String MD5
          SHA1 hash (hidden).
static java.lang.String SHA1
          SHA1 hash (hidden).
static java.lang.String URN
          URN, see RFC 2141 (hidden).
 
Method Summary
 boolean canGroup(SearchResult result)
          Returns true, if this object and result can be grouped together.
 SearchResultContainer createContainer()
          Creates a group root that has this object's properties.
 java.lang.Object get(java.lang.String key)
          Returns a value.
 javax.swing.Action[] getActions()
          Returns the actions for this search result.
 int getAvailability()
          Returns a score between 1 and 255.
 java.lang.String getFilename()
          Returns the full filename.
 long getFilesize()
          Returns the filesize.
 java.lang.Object getHash()
          Used for grouping of results.
 javax.swing.Icon getIcon()
          Returns a 16x16 icon that is displayed next to the filename.
 java.lang.String[] getPath()
          Returns the tokenized path without delimeters.
 Peer getPeer()
          Returns the peer that offer this result for download.
 Plugin getPlugin()
          Returns the originating plugin.
 java.lang.String getShortFilename()
          Returns the filename presented to the user.
 int getSourcesCount()
          Returns the number of sources.
 java.util.Iterator keys()
          Returns an iterator for all keys that can be retreived by calling get(String).
 

Field Detail

HIDE_PREFIX

static final java.lang.String HIDE_PREFIX
If a key is prefixed with the HIDE_PREFIX string, it is not displayed. This can be used for stuff like checksums.

See Also:
Constant Field Values

BITRATE

static final java.lang.String BITRATE
The bitrate key. The value should be the bitrate of the song in kbps.


FREQUENCY

static final java.lang.String FREQUENCY
The length key. The value should be the frequency of the song in Hz.


LENGTH

static final java.lang.String LENGTH
The length key. The value should be the length of the song in seconds.


SHA1

static final java.lang.String SHA1
SHA1 hash (hidden).

See Also:
Constant Field Values

MD5

static final java.lang.String MD5
SHA1 hash (hidden).

See Also:
Constant Field Values

URN

static final java.lang.String URN
URN, see RFC 2141 (hidden).

See Also:
Constant Field Values
Method Detail

canGroup

boolean canGroup(SearchResult result)
Returns true, if this object and result can be grouped together.


createContainer

SearchResultContainer createContainer()
Creates a group root that has this object's properties.


getActions

javax.swing.Action[] getActions()
Returns the actions for this search result.


getAvailability

int getAvailability()
Returns a score between 1 and 255. Higher number means better availability. Return 1 if unsure.

Returns:
0, if this makes no sense (i.e. for a local file)

get

java.lang.Object get(java.lang.String key)
Returns a value.

Parameters:
key - anything like BITRATE, LENGTH...

getFilename

java.lang.String getFilename()
Returns the full filename. Used by SearchFilter for matching.

See Also:
xnap.search.SearchFilter

getFilesize

long getFilesize()
Returns the filesize.


getHash

java.lang.Object getHash()
Used for grouping of results.


getIcon

javax.swing.Icon getIcon()
Returns a 16x16 icon that is displayed next to the filename.


getPath

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

Returns:
null, if result has no path; the path, otherwise

getPlugin

Plugin getPlugin()
Returns the originating plugin.


getShortFilename

java.lang.String getShortFilename()
Returns the filename presented to the user.


getSourcesCount

int getSourcesCount()
Returns the number of sources.


getPeer

Peer getPeer()
Returns the peer that offer this result for download.


keys

java.util.Iterator keys()
Returns an iterator for all keys that can be retreived by calling get(String).

Returns:
null, if no keys are defined


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