new NameTree()
Creates an empty NameTree.
- Source:
Methods
-
<private, static> installNDN(NDN)
-
Install ndn-lib. Only necessary if you're using require("ndn-Classes/src/DataStructures/NameTree.js"), done for you if require("ndn-Classes").NameTree
Parameters:
Name Type Description NDN
Object ndn-lib object - Source:
-
addNode(prefix) → {NameTreeNode}
-
Add a node to the NameTree, recursively populating all parents
Parameters:
Name Type Description prefix
Name | String the prefix for the new node. - Source:
Returns:
node - the NameTree node created.- Type
- NameTreeNode
-
findAllMatches(prefix, selector) → {Object}
-
Return an Iterator that provides a .next() method which returns the next longest Prefix matching the selector, returning null when depleted.
Parameters:
Name Type Description prefix
Name the prefix to begin iteration selector
function a selector function that returns a boolean when called with selector(node) - Source:
Returns:
Iterator - the .depleted property of the iterator will be true when there are no more matches.- Type
- Object
-
findLongestPrefixMatch(prefix, selector) → {NameTreeNode}
-
Find the Longest Prefix Match in the NameTree that matches the selector
Parameters:
Name Type Description prefix
Name | URI the name to lookup selector
function predicate function - Source:
Returns:
the longest prefix match.- Type
- NameTreeNode
-
lookup(prefix) → {NameTreeNode}
-
Perform a lookup on the NameTree and return the proper node, creating it if necessary.
Parameters:
Name Type Description prefix
Name | URI the name of the node to lookup. - Source:
Returns:
the resulting node.- Type
- NameTreeNode
-
removeNode(prefix) → {NameTree}
-
Delete a node (and all it's children, grandchildren, etc.).
Parameters:
Name Type Description prefix
Name | URI the name of the node to delete. - Source:
Returns:
the nameTree.- Type
- NameTree