p2ps.imp.discovery
Class FileDiscoveryCache
java.lang.Object
p2ps.imp.discovery.FileDiscoveryCache
- public class FileDiscoveryCache
- extends java.lang.Object
A file cache of advertisements and queries. Methods are provided to query the
cached advertisements and queries.
- Version:
- $Revision: 295 $
- Author:
- Ian Wang
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileDiscoveryCache
public FileDiscoveryCache()
init
public void init(java.lang.String name,
Peer peer)
isQuery
public boolean isQuery(Advertisement advert)
- Returns:
- true if the specified advert is a query
cache
public void cache(Advertisement advert)
- Adds an advertisement/query to the cache
advertIterator
public java.util.Iterator advertIterator()
- Returns:
- an iterator over all advertisements (including queries) in the cache
queryIterator
public java.util.Iterator queryIterator()
- Returns:
- an iterator over all queries in the cache
advertIterator
public java.util.Iterator advertIterator(Query query)
- Returns:
- an iterator over the advertisements that match the specified query
queryIterator
public java.util.Iterator queryIterator(Advertisement advert)
- Returns:
- an iterator over the queries that would match the specified
advertisement
isMatch
public static boolean isMatch(Query query,
Advertisement advert)
- Returns:
- true if the advert matches the query according to the P2PS
query naming conventions.