org.xnap.search
Class MetaInfoFileSearchResult

java.lang.Object
  extended by org.xnap.search.MetaInfoFileSearchResult
All Implemented Interfaces:
FileProvider, SearchResult

public class MetaInfoFileSearchResult
extends java.lang.Object
implements SearchResult, FileProvider

This class stores a local search result.


Field Summary
static javax.swing.Icon ICON
           
 
Fields inherited from interface org.xnap.search.SearchResult
BITRATE, FREQUENCY, HIDE_PREFIX, LENGTH, MD5, SHA1, URN
 
Constructor Summary
MetaInfoFileSearchResult(MetaInfoFile file)
           
 
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.
 java.io.File[] getFiles()
          Invoked by an action to query the selected File objects.
 long getFilesize()
          Returns the filesize.
 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 the peer that offer this result for download.
 Plugin getPlugin()
          Returns the originating plugin.
 java.lang.String getShortFilename()
          Returns the name of the file.
 int getSourcesCount()
          Returns the number of sources.
 java.util.Iterator keys()
          Returns the keys of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON

public static javax.swing.Icon ICON
Constructor Detail

MetaInfoFileSearchResult

public MetaInfoFileSearchResult(MetaInfoFile file)
Method Detail

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()
Description copied from interface: SearchResult
Creates a group root that has this object's properties.

Specified by:
createContainer in interface SearchResult

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...

getActions

public javax.swing.Action[] getActions()
Description copied from interface: SearchResult
Returns the actions for this search result.

Specified by:
getActions in interface SearchResult

getAvailability

public int getAvailability()
Description copied from interface: SearchResult
Returns a score between 1 and 255. Higher number means better availability. Return 1 if unsure.

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

getFiles

public java.io.File[] getFiles()
Description copied from interface: FileProvider
Invoked by an action to query the selected File objects.

Specified by:
getFiles in interface FileProvider
Returns:
null, if no files are selected; the files, otherwise

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

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

getSourcesCount

public int getSourcesCount()
Description copied from interface: SearchResult
Returns the number of sources.

Specified by:
getSourcesCount in interface SearchResult

getShortFilename

public java.lang.String getShortFilename()
Returns the name of the file.

Specified by:
getShortFilename in interface SearchResult

getPeer

public Peer getPeer()
Description copied from interface: SearchResult
Returns the peer that offer this result for download.

Specified by:
getPeer in interface SearchResult

keys

public java.util.Iterator keys()
Returns the keys of the file.

Specified by:
keys in interface SearchResult
Returns:
null, if no keys are defined
See Also:
MetaInfoFile.keys()


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