|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.routing.QueryRouteTable
A list of query keywords that a connection can respond to, as well as the minimum TTL for a response. More formally, a QueryRouteTable is a (possibly infinite!) list of keyword TTL pairs, [ <keyword_1, ttl_1>, ..., <keywordN, ttl_N> ]
10/08/2002 - A day after Susheel's birthday, he decided to change this class for the heck of it. Kidding. Functionality has been changed so that keyword depth is 'constant' - meaning that if a keyword is added, then any contains query regarding that keyword will return true. This is because this general idea of QRTs is only used in a specialized way in LW - namely, UPs use it for their leaves ONLY, so the depth is always 1. If you looking for a keyword and it is in the table, a leaf MAY have it, so return true. This only needed a one line change. This class is NOT synchronized.
Field Summary | |
static byte |
DEFAULT_INFINITY
The suggested default max table TTL. |
static int |
DEFAULT_TABLE_SIZE
The suggested default table size. |
static byte |
KEYWORD_ABSENT
What should come across the wire if a keyword is absent. |
static byte |
KEYWORD_NO_CHANGE
What should come across the wire if a keyword status is unchanged. |
static byte |
KEYWORD_PRESENT
What should come across the wire if a keyword is present. |
static int |
MAX_PATCH_SIZE
The maximum size of patch messages, in bytes. |
Constructor Summary | |
QueryRouteTable()
Creates a QueryRouteTable with default sizes. |
|
QueryRouteTable(int size)
Creates a new QueryRouteTable instance with the specified size. |
Method Summary | |
void |
add(java.lang.String filename)
For all keywords k in filename, adds |
void |
addAll(QueryRouteTable qrt)
For all |
void |
addIndivisible(java.lang.String iString)
|
boolean |
contains(QueryRequest qr)
Returns true if a response could be generated for qr. |
java.util.List |
encode(QueryRouteTable prev)
Stub for calling encode(QueryRouteTable, true). |
java.util.List |
encode(QueryRouteTable prev,
boolean allowCompression)
Returns an List of RouteTableMessage that will convey the state of this. |
boolean |
equals(java.lang.Object o)
True if o is a QueryRouteTable with the same entries of this. |
double |
getPercentFull()
Returns the percentage of slots used in this QueryRouteTable's BitTable. |
int |
hashCode()
|
void |
patch(PatchTableMessage patch)
Adds the specified patch message to this query routing table. |
void |
reset(ResetTableMessage rtm)
Resets this QueryRouteTable to the specified size with no data. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte DEFAULT_INFINITY
public static final byte KEYWORD_PRESENT
public static final byte KEYWORD_ABSENT
public static final byte KEYWORD_NO_CHANGE
public static final int DEFAULT_TABLE_SIZE
public static final int MAX_PATCH_SIZE
Constructor Detail |
public QueryRouteTable()
public QueryRouteTable(int size)
size
- the size of the query routing tableMethod Detail |
public double getPercentFull()
public boolean contains(QueryRequest qr)
public void add(java.lang.String filename)
public void addIndivisible(java.lang.String iString)
public void addAll(QueryRouteTable qrt)
public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
public void reset(ResetTableMessage rtm)
rtm
- the ResetTableMessage containing the size
to reset the table topublic void patch(PatchTableMessage patch) throws BadPacketException
patch
- the PatchTableMessage containing the new
data to add
BadPacketException
- if the sequence number or size
is incorrect
BadPacketException
public java.util.List encode(QueryRouteTable prev)
public java.util.List encode(QueryRouteTable prev, boolean allowCompression)
for (Iterator iter=m.encode(); iter.hasNext(); ) prev.update((RouteTableUpdate)iter.next()); Assert.that(prev.equals(m));
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |