| java.lang.Object com.jofti.btree.BTOperations
BTOperations | public class BTOperations (Code) | | Provides the group of low level operations that can be performed on the BTree. All
operations on the BTree are performed by this class ,rather than directly on the tree.
The class is essentially an encapsulation of the functional update,search, contains and remove variants used
by the TreeIndex. The class does not retain a handle to any particular
BTree and so the same instance can be used
for the transactional
BTree instances found in some Tree instances.
author: Steve Woodcock
version: 1.31 |
Method Summary | |
public static boolean | contains(BTree tree, Comparable obj, int dimension) Checks if the tree contains a particular value in a dimension. | public static Map | getAllResultsForDimension(BTree tree, int dimension) Gets a collection of all uniqueIds in tree for a specific dimension.
Parameters: tree - - the Tree to search Parameters: dimension - - the dimension where the key is by type. | public static Collection | getAllValuesForKey(BTree tree, Comparable obj, int startDimension) Gets a collection of all value/dimension matches in the tree for a specific uniqueid.
This method is used when we have a uniqueId and no object left in the cache (due to expiry etc)
and so the only alternative is a scan of the leaf nodes to find matches. | public static INode | getHighestNodeForDimension(BTree tree, int dimension) Gets the node containing the last entry for a dimension.
Parameters: tree - - the Tree to search Parameters: dimension - - the dimension where the key is by type. | public static Collection | getKeyAttributes(BTree tree, Comparable obj, int dimension) Returns the keys that are mapped against the comparable value. | public static INode | getLowestNodeForDimension(BTree tree, int dimension) Gets the node containing the first entry for a dimension.
Parameters: tree - - the Tree to search Parameters: dimension - - the dimension where the key is by type. | public static Map | getSubTreeKeyValues(BTree tree, Comparable startObj, Comparable endObj, int dimension, int endDimension, boolean inclusive) Gets all the uniqueIds that are contained in the tree between two values irrespective of the dimension. | public static void | insertKeyValue(BTree tree, Comparable key, Map attributes, int dimension) Inserts a key and the object attributes in the tree using a specific key dimension. | public static void | insertValue(BTree tree, Comparable key, Comparable object, int dimension) Inserts a value in the tree using a specific dimension. | public static Map | match(BTree tree, Comparable obj, int dimension) Retrieves the matching uniqueIds for a particular value and dimension (if any). | public static Map | match(BTree tree, Comparable obj, int dimension, Object valueReturn) Retrieves the matching uniqueIds for a particular value and dimension (if any). | public static Map | match(BTree tree, Comparable[] obj, int dimension) Retrieves the matching uniqueIds for a particular array of values and dimension (if any). | public static Map | match(BTree tree, Comparable[] obj, int dimension, Object alias) Retrieves the matching uniqueIds for a particular array of values and dimension (if any).
The alias is used to pecify which alis we should use for the id. | public static Map | notEqual(BTree tree, Comparable obj, int dimension, Object valueReturn) Gets all the uniqueIds that do not equal the object for a dimension. | public static Map | range(BTree tree, Comparable startObj, Comparable endObj, int dimension, boolean inclusive) Gets all the uniqueIds that fall between the two objects for a dimension. | public static Map | range(BTree tree, Comparable startObj, Comparable endObj, int dimension, boolean inclusive, Object alias) Gets all the uniqueIds that fall between the two objects for a dimension. | public static void | removeValue(BTree tree, Object uniqueId, Comparable object, int dimension) Removes a particular uniqueId from the tree if it is indexed with that value and dimension. | public static void | removeValueObject(BTree tree, Object uniqueId, Comparable object) Removes a particular uniqueId from the tree if it is indexed with that
valueObject. |
contains | public static boolean contains(BTree tree, Comparable obj, int dimension) throws JoftiException(Code) | | Checks if the tree contains a particular value in a dimension. This does not check if any
uniqueIds are stored against the value.
Parameters: tree - - the tree to perform the search upon.
Parameters: obj - - the object to search for.
Parameters: dimension - - the dimension that the value is in. the Map of results.
throws: JoftiException - |
getAllResultsForDimension | public static Map getAllResultsForDimension(BTree tree, int dimension) throws JoftiException(Code) | | Gets a collection of all uniqueIds in tree for a specific dimension.
Parameters: tree - - the Tree to search Parameters: dimension - - the dimension where the key is by type. - a Collection of all the matching values throws: JoftiException - |
getAllValuesForKey | public static Collection getAllValuesForKey(BTree tree, Comparable obj, int startDimension) throws JoftiException(Code) | | Gets a collection of all value/dimension matches in the tree for a specific uniqueid.
This method is used when we have a uniqueId and no object left in the cache (due to expiry etc)
and so the only alternative is a scan of the leaf nodes to find matches. This is very inefficient
if there are a lot of values in the tree but some cache implementations leave us with no alternative, as there are
no callbacks for some events.
Parameters: tree - - the Tree to search Parameters: obj - - the unique id to look for Parameters: startDimension - - the dimension where the key is by type. - a Collection of all the matching values that has the uniqueId throws: JoftiException - |
getHighestNodeForDimension | public static INode getHighestNodeForDimension(BTree tree, int dimension) throws JoftiException(Code) | | Gets the node containing the last entry for a dimension.
Parameters: tree - - the Tree to search Parameters: dimension - - the dimension where the key is by type. - the starting node throws: JoftiException - |
getLowestNodeForDimension | public static INode getLowestNodeForDimension(BTree tree, int dimension) throws JoftiException(Code) | | Gets the node containing the first entry for a dimension.
Parameters: tree - - the Tree to search Parameters: dimension - - the dimension where the key is by type. - the starting node throws: JoftiException - |
getSubTreeKeyValues | public static Map getSubTreeKeyValues(BTree tree, Comparable startObj, Comparable endObj, int dimension, int endDimension, boolean inclusive) throws JoftiException(Code) | | Gets all the uniqueIds that are contained in the tree between two values irrespective of the dimension. If the startObj is NULL
it is assumed that the lower range starts from the first value in the dimension. Similarly, if the endObj is NULL
it is assumed the upper bound is the maximum value in the dimension.
Parameters: tree - - the Tree to search Parameters: startObj - - the starting value for the range search Parameters: endObj - - the end value for the range search Parameters: startdimension - - the dimension of the startObj. Parameters: enddimension - - the dimension of the end Obj. Parameters: inclusive - - sets whether the range search should be inclusive of the start and end objects. - A Map of the results. throws: JoftiException - |
insertKeyValue | public static void insertKeyValue(BTree tree, Comparable key, Map attributes, int dimension) throws JoftiException(Code) | | Inserts a key and the object attributes in the tree using a specific key dimension. The key/attributes/dimension are
grouped into a leaf node entry.
This method delegates the insert to the BTree insert method.
Parameters: tree - - the tree to insert the value into
Parameters: key - - the key to use as the unique id
Parameters: object - - the value to be inserted into the tree. This must be Comparable.
Parameters: dimension - - the dimension that this value is part of.
throws: JoftiException - a wrapping exception to trap errors in the tree. |
insertValue | public static void insertValue(BTree tree, Comparable key, Comparable object, int dimension) throws JoftiException(Code) | | Inserts a value in the tree using a specific dimension. The key/value/dimension are
grouped into a leaf node entry as a single entity.
This method delegates the insert to the
BTree insert method.
Parameters: tree - - the tree to insert the value into
Parameters: key - - the key to use as the unique id
Parameters: object - - the value to be inserted into the tree. This must be Comparable.
Parameters: dimension - - the dimension that this value is part of.
throws: JoftiException - a wrapping exception to trap errors in the tree. |
match | public static Map match(BTree tree, Comparable obj, int dimension) throws JoftiException(Code) | | Retrieves the matching uniqueIds for a particular value and dimension (if any).
Failure to find a match returns an empty Map.
Parameters: tree - - the tree to perform the search upon.
Parameters: obj - - the object to search for.
Parameters: dimension - - the dimension that the value is in. the Map of results.
throws: JoftiException - |
match | public static Map match(BTree tree, Comparable obj, int dimension, Object valueReturn) throws JoftiException(Code) | | Retrieves the matching uniqueIds for a particular value and dimension (if any). The valueReturn object is used to specify what field alias we should
be looking for against this ID.
Failure to find a match returns an empty Map.
Parameters: tree - - the tree to perform the search upon.
Parameters: obj - - the object to search for.
Parameters: dimension - - the dimension that the value is in.
Parameters: valueReturn - - The alias value of the object to return or null if we do not want to indicate a return restriction. the Map of results.
throws: JoftiException - |
match | public static Map match(BTree tree, Comparable[] obj, int dimension) throws JoftiException(Code) | | Retrieves the matching uniqueIds for a particular array of values and dimension (if any).
Failure to find a match returns an empty Map.
Parameters: tree - - the tree to perofrm the search upon.
Parameters: obj - - the object to search for.
Parameters: dimension - - the dimension that the value is in. the Map of results.
throws: JoftiException - |
match | public static Map match(BTree tree, Comparable[] obj, int dimension, Object alias) throws JoftiException(Code) | | Retrieves the matching uniqueIds for a particular array of values and dimension (if any).
The alias is used to pecify which alis we should use for the id. Failure to find a match returns an empty Map.
Parameters: tree - - the tree to perform the search upon.
Parameters: obj - - the object array containing the objects to search for.
Parameters: dimension - - the dimension that the value is in.
Parameters: alias - - The alias value of the object to return or null if we do not want to indicate a return restriction. the Map of results.
throws: JoftiException - |
notEqual | public static Map notEqual(BTree tree, Comparable obj, int dimension, Object valueReturn) throws JoftiException(Code) | | Gets all the uniqueIds that do not equal the object for a dimension.
Parameters: tree - - the Tree to search Parameters: obj - - the value we want to exclude Parameters: dimension - - the dimension of the object. - the starting node throws: JoftiException - |
range | public static Map range(BTree tree, Comparable startObj, Comparable endObj, int dimension, boolean inclusive) throws JoftiException(Code) | | Gets all the uniqueIds that fall between the two objects for a dimension. If the startObj is NULL
it is assumed that the lower range starts from the first value in the dimension. Similarly, if the endObj is NULL
it is assumed the upper bound is the maximum value in the dimension.
Parameters: tree - - the Tree to search Parameters: startObj - - the starting value for the range search Parameters: endObj - - the end value for the range search Parameters: dimension - - the dimension where the key is by type. Parameters: inclusive - - sets whether the range search should be inclusive of the start and end objects. - A Map of the results. throws: JoftiException - |
range | public static Map range(BTree tree, Comparable startObj, Comparable endObj, int dimension, boolean inclusive, Object alias) throws JoftiException(Code) | | Gets all the uniqueIds that fall between the two objects for a dimension. If the startObj is NULL
it is assumed that the lower range starts from the first value in the dimension. Similarly, if the endObj is NULL
it is assumed the upper bound is the maximum value in the dimension.
Parameters: tree - - the Tree to search Parameters: startObj - - the starting value for the range search Parameters: endObj - - the end value for the range search Parameters: dimension - - the dimension where the key is by type. Parameters: inclusive - - sets whether the range search should be inclusive of the start and end objects. Parameters: alias - - passed back in the result map as the value to indicate what fields the key should filter on. - a Map of the results. throws: JoftiException - |
removeValue | public static void removeValue(BTree tree, Object uniqueId, Comparable object, int dimension) throws JoftiException(Code) | | Removes a particular uniqueId from the tree if it is indexed with that value and dimension. If the value
exists but the uniqueId is not stored with the value then no remove is performed. Otherwise the
the uniqueid is removed from the value's id set.
Parameters: tree - - the tree to operate on.
Parameters: uniqueId - - the uniqueId to remove
Parameters: object - - the value to look for in the tree
Parameters: dimension - - the dimension that the value is in.
throws: JoftiException - |
removeValueObject | public static void removeValueObject(BTree tree, Object uniqueId, Comparable object) throws JoftiException(Code) | | Removes a particular uniqueId from the tree if it is indexed with that
valueObject. If the value
exists but the uniqueId is not stored with the value then no remove is performed. Otherwise the
the uniqueid is removed from the value's id set.
Parameters: tree - - the tree to operate on.
Parameters: uniqueId - - the uniqueId to remove
Parameters: object - - the value to look for in the tree
throws: JoftiException - |
|
|