|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microsoft.tfs.core.clients.versioncontrol.sparsetree.SparseTree<T>
public class SparseTree<T>
Nested Class Summary | |
---|---|
static interface |
SparseTree.EnumNodeCallback<T>
The EnumNodeCallback is used when enumerating the nodes in the store. |
class |
SparseTree.EnumSubTreeEnumerator
|
static interface |
SparseTree.ModifyInPlaceCallback<T>
The ModifyInPlaceCallback is used when a caller wants to look up a node in the tree with a certain token and then change the referenced object for that token, with only a single lookup in the tree. |
Constructor Summary | |
---|---|
SparseTree(char tokenSeparator)
Tokens have variable length segments that are separated by the set of characters given to the constructor. |
|
SparseTree(char tokenSeparator,
java.util.Comparator<java.lang.String> tokenComparison)
Tokens have variable length segments that are separated by the set of characters given to the constructor. |
|
SparseTree(char tokenSeparator,
int fixedElementLength,
java.util.Comparator<java.lang.String> tokenComparison)
|
|
SparseTree(java.util.Comparator<java.lang.String> tokenComparison)
Tokens are assumed to contain fixed length segments (ie. |
|
SparseTree(int fixedElementLength)
Tokens have fixed length segments that are separated by the element length provided. |
|
SparseTree(int fixedElementLength,
java.util.Comparator<java.lang.String> tokenComparison)
Tokens have fixed length segments that are separated by the length provided. |
Method Summary | |
---|---|
void |
add(java.lang.String token,
T referencedObject)
This is used to add an object to the store at a specific path |
void |
add(java.lang.String token,
T referencedObject,
boolean overwrite)
This is used to add an object to the store at a specific path |
void |
clear()
Clears all of the tokens in the store. |
KeyValuePair<java.lang.String,T>[] |
EnumChildren(java.lang.String token)
Given a token that is in the store, returns the children of that node in the SparseTree. |
java.lang.Iterable<EnumeratedSparseTreeNode<T>> |
EnumParents(java.lang.String token,
EnumParentsOptions options)
Queries the SparseTree for the parents of the provided token. |
boolean |
EnumParents(java.lang.String token,
SparseTree.EnumNodeCallback<T> callback)
Enumerates all parents of the specified token. |
boolean |
EnumParents(java.lang.String token,
SparseTree.EnumNodeCallback<T> callback,
EnumParentsOptions options,
SparseTreeAdditionalData additionalData,
java.lang.Object param)
Enumerates all parents of the specified token. |
java.lang.Iterable<T> |
EnumParentsReferencedObjects(java.lang.String token,
EnumParentsOptions options)
Queries the SparseTree for the parents of the provided token. |
java.lang.Iterable<EnumeratedSparseTreeNode<T>> |
EnumRoots()
This enumerates all the immediate children of the root node of the tree -- that is, all entries in the SparseTree which have no parent. |
java.lang.Iterable<T> |
EnumRootsReferencedObjects()
This enumerates all the immediate children of the root node of the tree -- that is, all entries in the SparseTree which have no parent. |
java.lang.Iterable<EnumeratedSparseTreeNode<T>> |
EnumSubTree(java.lang.String token,
EnumSubTreeOptions options,
int depth)
This will enumerate the entire subtree of the path supplied. |
boolean |
EnumSubTree(java.lang.String token,
SparseTree.EnumNodeCallback<T> callback)
This will enumerate the entire subtree of the path supplied. |
boolean |
EnumSubTree(java.lang.String token,
SparseTree.EnumNodeCallback<T> callback,
EnumSubTreeOptions options,
int depth,
SparseTreeAdditionalData additionalData,
java.lang.Object param)
This will enumerate the entire subtree of the path supplied. |
java.lang.Iterable<T> |
EnumSubTreeReferencedObjects(java.lang.String token,
EnumSubTreeOptions options,
int depth)
This will enumerate the entire subtree of the path supplied. |
T |
get(java.lang.String token)
|
T |
get(java.lang.String token,
boolean exactMatch)
|
int |
getCount()
Returns the number of key/value pairs in this SparseTree. |
int |
getFixedElementLength()
The optional element length. |
char |
getTokenSeparator()
The optional separator character. |
boolean |
isSubItem(java.lang.String item,
java.lang.String parent)
Given an item and a possible parent, returns true if item is a subitem of parent given the token separator or fixed element length. |
void |
modifyInPlace(java.lang.String token,
SparseTree.ModifyInPlaceCallback<T> callback,
java.lang.Object param)
Given a token, invokes the callback provided. |
boolean |
remove(java.lang.String token,
boolean removeChildren)
Removes a token from the store. |
void |
set(java.lang.String token,
T referencedObject)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SparseTree(char tokenSeparator)
tokenSeparator
- The set of valid token separator characters.public SparseTree(int fixedElementLength)
fixedElementLength
- The fixed element length to separate the tokens by.public SparseTree(java.util.Comparator<java.lang.String> tokenComparison)
tokenComparison
- The type of comparison to use when comparing tokens.public SparseTree(char tokenSeparator, java.util.Comparator<java.lang.String> tokenComparison)
tokenSeparator
- The token separator character.tokenComparison
- The type of comparison to use when comparing tokens.public SparseTree(int fixedElementLength, java.util.Comparator<java.lang.String> tokenComparison)
fixedElementLength
- The fixed element length to separate the tokens by.tokenComparison
- The type of comparison to use when comparing tokens.public SparseTree(char tokenSeparator, int fixedElementLength, java.util.Comparator<java.lang.String> tokenComparison)
Method Detail |
---|
public void add(java.lang.String token, T referencedObject)
token
- The token we are adding.referencedObject
- The referencedObject we are adding.public void add(java.lang.String token, T referencedObject, boolean overwrite)
token
- The token we are adding.referencedObject
- The referencedObject we are adding.overwrite
- If true and an object already exists for this token, that object
will be removed and this one will take its place.public void modifyInPlace(java.lang.String token, SparseTree.ModifyInPlaceCallback<T> callback, java.lang.Object param)
token
- Token to look upcallback
- Callback to invokeparam
- Object passed through for your own usepublic boolean remove(java.lang.String token, boolean removeChildren)
token
- The token to remove.removeChildren
- True if all of the children should be removed as well.
public T get(java.lang.String token)
public T get(java.lang.String token, boolean exactMatch)
public void set(java.lang.String token, T referencedObject)
public void clear()
public KeyValuePair<java.lang.String,T>[] EnumChildren(java.lang.String token) throws KeyNotFoundException
token
- Token to query (null for the root)
KeyNotFoundException
public boolean EnumParents(java.lang.String token, SparseTree.EnumNodeCallback<T> callback)
token
- The token whose parents should be enumeratedcallback
- The callback invoked for each enumerated node
public boolean EnumParents(java.lang.String token, SparseTree.EnumNodeCallback<T> callback, EnumParentsOptions options, SparseTreeAdditionalData additionalData, java.lang.Object param)
token
- The token whose parents we are enumerating.callback
- The callback to make each time we hit a node.options
- EnumParentsOptions flags to control behavioradditionalData
- If provided, this instance of SparseTreeAdditionalData will be
populated with additional data and passed to you each time the
callback is invoked. Can be null.param
- Object passed through for your own use
public java.lang.Iterable<EnumeratedSparseTreeNode<T>> EnumParents(java.lang.String token, EnumParentsOptions options)
token
- The token whose parents to retrieveoptions
- EnumParentsOptions flags to control behavior
public java.lang.Iterable<T> EnumParentsReferencedObjects(java.lang.String token, EnumParentsOptions options)
token
- The token whose parents to retrieveoptions
- EnumParentsOptions flags to control behaviorpublic boolean EnumSubTree(java.lang.String token, SparseTree.EnumNodeCallback<T> callback)
token
- The token whose subtree to enumeratecallback
- The callback we are invoking on each node
public boolean EnumSubTree(java.lang.String token, SparseTree.EnumNodeCallback<T> callback, EnumSubTreeOptions options, int depth, SparseTreeAdditionalData additionalData, java.lang.Object param)
token
- The token whose subtree to enumeratecallback
- The callback we are invoking on each nodeoptions
- EnumSubTreeOptions flags to control behaviordepth
- The depth of the enumeration. Default is Int32.MaxValueadditionalData
- If provided, this instance of SparseTreeAdditionalData will be
populated with additional data and passed to you each time the
callback is invoked.param
- Object passed through for your own use
public java.lang.Iterable<EnumeratedSparseTreeNode<T>> EnumSubTree(java.lang.String token, EnumSubTreeOptions options, int depth)
token
- The token whose parents to retrieveoptions
- EnumSubTreeOptions flags to control behaviordepth
-
public java.lang.Iterable<T> EnumSubTreeReferencedObjects(java.lang.String token, EnumSubTreeOptions options, int depth)
token
- The token whose parents to retrieveoptions
- EnumSubTreeOptions flags to control behaviordepth
-
public java.lang.Iterable<EnumeratedSparseTreeNode<T>> EnumRoots()
public java.lang.Iterable<T> EnumRootsReferencedObjects()
public boolean isSubItem(java.lang.String item, java.lang.String parent)
item
- Item to checkparent
- Potential parent of item
public int getCount()
public char getTokenSeparator()
public int getFixedElementLength()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |