Table of Interests, holding an arbitrary value for any Interest or ContentName. More...
Classes | |
interface | Entry< T > |
class | Holder< T > |
class | InterestHolder< T > |
class | LongestFirstContentName |
We need names in longest first order, not canonical order. More... | |
class | NameHolder< T > |
Public Member Functions | |
void | setCapacity (int capacity) |
Set capacity for LRU size control. | |
Integer | getCapacity () |
Gets the current capacity for LRU size control. | |
void | add (Interest interest, V value) |
Add a value associated with an interest to the table. | |
void | add (ContentName name, V value) |
Add a value associated with content to the table. | |
Entry< V > | remove (ContentName name, V value) |
Remove first exact match entry (both name and value match). | |
Entry< V > | remove (Interest interest, V value) |
Remove first exact match entry (both interest and value match). | |
V | getValue (ContentObject target) |
Get value of longest matching Interest for a ContentObject, where longest is defined as longest ContentName. | |
Entry< V > | getMatch (ContentObject target) |
Get longest matching Interest for a ContentObject. | |
List< V > | getValues (ContentObject target) |
Get values of all matching Interests for a ContentObject. | |
List< Entry< V > > | getMatches (ContentObject target) |
Get all matching Interests for a ContentObject. | |
V | getValue (ContentName target) |
Get value of longest matching Interest for a ContentName, where longest is defined as longest ContentName. | |
Entry< V > | getMatch (ContentName target) |
Get longest matching Interest. | |
List< V > | getValues (ContentName target) |
Get values matching a target ContentName. | |
List< Entry< V > > | getMatches (ContentName target) |
Get all matching entries for a ContentName. | |
Collection< Entry< V > > | values () |
Get all entries. | |
V | removeValue (ContentObject target) |
Remove and return value of the longest matching Interest for a ContentObject, where best is defined as longest ContentName. | |
Entry< V > | removeMatch (ContentObject target) |
Remove and return the longest matching Interest for a ContentObject, where best is defined as longest ContentName. | |
List< V > | removeValues (ContentObject target) |
Remove and return values for all matching Interests for a ContentObject. | |
List< Entry< V > > | removeMatches (ContentObject target) |
Remove and return all matching Interests for a ContentObject. | |
int | size () |
Get the number of distinct entries in the table. | |
int | sizeNames () |
Get the number of distinct ContentNames in the table. | |
void | clear () |
Clear the table. | |
Protected Member Functions | |
void | add (Holder< V > holder) |
Add a value holder - could be interest or content. | |
Holder< V > | getMatchByName (ContentName name, ContentObject target) |
List< Holder< V > > | getAllMatchByName (ContentName name, ContentObject target) |
Internal: return all the entries having exactly the specified name, useful once you have found the matching names to collect entries from them. | |
Holder< V > | removeMatchByName (ContentName name, ContentObject target) |
List< Holder< V > > | removeAllMatchByName (ContentName name, ContentObject target) |
Protected Attributes | |
SortedMap < LongestFirstContentName, List< Holder< V > > > | _contents |
ArrayList < LongestFirstContentName > | _contentNamesLRU = new ArrayList<LongestFirstContentName>() |
Integer | _capacity = null |
Table of Interests, holding an arbitrary value for any Interest or ContentName.
This is conceptually like a Map<Interest, V> except it supports duplicate entries and has operations for access based on CCN matching. An InterestTable may be used to hold real Interests, or merely ContentNames only, though mixing the two in the same instance of InterestTable is not recommended. InterestTables are synchronized using _contents as a synchronization object
Since interests can be reexpressed we could end up with duplicate interests in the table. To avoid that an LRU algorithm is optionally implemented to keep the table from growing without bounds.
void org.ccnx.ccn.impl.InterestTable< V >.add | ( | Holder< V > | holder | ) | [protected] |
Add a value holder - could be interest or content.
holder |
void org.ccnx.ccn.impl.InterestTable< V >.add | ( | ContentName | name, | |
V | value | |||
) |
Add a value associated with content to the table.
name | name of the content | |
value | associated object |
void org.ccnx.ccn.impl.InterestTable< V >.add | ( | Interest | interest, | |
V | value | |||
) |
Add a value associated with an interest to the table.
interest | the interest | |
value | associated object |
List<Holder<V> > org.ccnx.ccn.impl.InterestTable< V >.getAllMatchByName | ( | ContentName | name, | |
ContentObject | target | |||
) | [protected] |
Internal: return all the entries having exactly the specified name, useful once you have found the matching names to collect entries from them.
name | ||
target |
Integer org.ccnx.ccn.impl.InterestTable< V >.getCapacity | ( | ) |
Gets the current capacity for LRU size control.
Entry<V> org.ccnx.ccn.impl.InterestTable< V >.getMatch | ( | ContentName | target | ) |
Get longest matching Interest.
This method is the same as getValue() except that the Entry is returned so the matching item may be retrieved and null value may be detected.
target | desired ContentName |
Entry<V> org.ccnx.ccn.impl.InterestTable< V >.getMatch | ( | ContentObject | target | ) |
Get longest matching Interest for a ContentObject.
This is the same as getValue() except that the Entry is returned so the matching item may be retrieved and null value may be detected. The Entry returned will have a non-null interest because this method matches only Interests in the table.
target | - desired ContentObject |
List<Entry<V> > org.ccnx.ccn.impl.InterestTable< V >.getMatches | ( | ContentName | target | ) |
Get all matching entries for a ContentName.
This will return a mix of ContentName and Interest entries if they exist (and match) in the table, i.e. the Interest of an Entry may be null in some cases.
target | desired ContentName |
List<Entry<V> > org.ccnx.ccn.impl.InterestTable< V >.getMatches | ( | ContentObject | target | ) |
Get all matching Interests for a ContentObject.
Any ContentName entries in the table will be ignored by this operation, so every Entry returned will have a non-null interest. This is the same as getValues() except that Entry objects are returned.
target | - desired ContentObject |
V org.ccnx.ccn.impl.InterestTable< V >.getValue | ( | ContentName | target | ) |
Get value of longest matching Interest for a ContentName, where longest is defined as longest ContentName.
If there are multiple matches, first is returned. This will return a mix of ContentName and Interest entries if they exist (and match) in the table, i.e. the Interest of an Entry may be null in some cases.
target | desired ContentName |
V org.ccnx.ccn.impl.InterestTable< V >.getValue | ( | ContentObject | target | ) |
Get value of longest matching Interest for a ContentObject, where longest is defined as longest ContentName.
Any ContentName entries in the table will be ignored by this operation. If there are multiple matches, first is returned.
target | - desired ContentObject |
List<V> org.ccnx.ccn.impl.InterestTable< V >.getValues | ( | ContentName | target | ) |
Get values matching a target ContentName.
target | the desired ContentName |
List<V> org.ccnx.ccn.impl.InterestTable< V >.getValues | ( | ContentObject | target | ) |
Get values of all matching Interests for a ContentObject.
Any ContentName entries in the table will be ignored by this operation and any null values will be ignored.
target | target ContentObject |
Entry<V> org.ccnx.ccn.impl.InterestTable< V >.remove | ( | Interest | interest, | |
V | value | |||
) |
Remove first exact match entry (both interest and value match).
interest | Interest to match | |
value | associated value |
Entry<V> org.ccnx.ccn.impl.InterestTable< V >.remove | ( | ContentName | name, | |
V | value | |||
) |
Remove first exact match entry (both name and value match).
name | ContentName of name | |
value | associated value |
Entry<V> org.ccnx.ccn.impl.InterestTable< V >.removeMatch | ( | ContentObject | target | ) |
Remove and return the longest matching Interest for a ContentObject, where best is defined as longest ContentName.
Any ContentName entries in the table will be ignored by this operation, so the Entry returned will have a non-null interest.
target | - desired ContentObject |
List<Entry<V> > org.ccnx.ccn.impl.InterestTable< V >.removeMatches | ( | ContentObject | target | ) |
Remove and return all matching Interests for a ContentObject.
Any ContentName entries in the table will be ignored by this operation, so every Entry returned will have a non-null interest.
target | - desired ContentObject |
V org.ccnx.ccn.impl.InterestTable< V >.removeValue | ( | ContentObject | target | ) |
Remove and return value of the longest matching Interest for a ContentObject, where best is defined as longest ContentName.
Any ContentName entries in the table will be ignored by this operation, as will null values.
target | - desired ContentObject |
List<V> org.ccnx.ccn.impl.InterestTable< V >.removeValues | ( | ContentObject | target | ) |
Remove and return values for all matching Interests for a ContentObject.
Any ContentName entries in the table will be ignored by this operation. Null values will not be represented in returned list though their Interests will have been removed if any.
target | - desired ContentObject |
void org.ccnx.ccn.impl.InterestTable< V >.setCapacity | ( | int | capacity | ) |
Set capacity for LRU size control.
Defaults to no size control
capacity |
int org.ccnx.ccn.impl.InterestTable< V >.size | ( | ) |
Get the number of distinct entries in the table.
Note that duplicate entries are fully supported, so the number of entries may be much larger than the number of ContentNames (sizeNames()).
int org.ccnx.ccn.impl.InterestTable< V >.sizeNames | ( | ) |
Get the number of distinct ContentNames in the table.
Note that duplicate entries are fully supported, so the number of ContentNames may be much smaller than the number of entries (size()).
Collection<Entry<V> > org.ccnx.ccn.impl.InterestTable< V >.values | ( | ) |
Get all entries.
This will return a mix of ContentName and Interest entries if they exist in the table, i.e. the Interest of an Entry may be null in some cases.
SortedMap<LongestFirstContentName,List<Holder<V> > > org.ccnx.ccn.impl.InterestTable< V >._contents [protected] |
new TreeMap<LongestFirstContentName,List<Holder<V>>>() { private static final long serialVersionUID = -2774858588706066528L; public String toString() { StringBuffer s = new StringBuffer(); for(LongestFirstContentName n : keySet() ) s.append(n.toString() + " "); return s.toString(); } }