borland Packages Class Hierarchy jbcl.model Package Index
java.lang.Object +----borland.jbcl.model.GraphModelSearch
Variables Constructors Properties Methods
Implements Serializable
This class is designed to facilitate searching through GraphModel data structures. It supports four types of top-down searching:
All searching algorithm logic can be modified by setting the depthFirstSearch and fullSearch properties.
The depthFirstSearch property, which defaults to false, tells the search algorithms to check all sibling children of a node before drilling down into the first child node's children, and so on. This results in the first (most shallow) occurrence of a data object to be located. If the depthFirstSearch property is set to true, the search drills to the absolute bottom of each node before moving onto the next. This results in a potentially deeper GraphLocation as a search result.
The fullSearch property tells the different search methods wether or not to fetch children when node returns TriState.UNKNOWN to the GraphLocation.hasChildren() method. Typically, UNKNOWN is only returned by an implementor of GraphLocation when the process of fetching the children is potentially costly (in CPU cycles). If the fullSearch property is set to false, all search algorithms treat an UNKNOWN response to GraphLocation.hasChildren() as NO and continue on without fetching the children of that node. This can potentially affect search results in that any nodes below an UNKNOWN child node is not checked. By default, this property is true, and all children are checked.
protected boolean depthFirstSearch
protected boolean fullSearch
protected transient GraphModel model
public GraphModelSearch()Constructs a GraphModelSearch object with all default settings, which is a null model, depthFirstSearch = true, and fullSearch = true.
public GraphModelSearch(borland.jbcl.model.GraphModel model)Constructs a GraphModelSearch object with the specified model setting. (depthFirstSearch = false and fullSearch = true)
Parameters:
public GraphModelSearch(borland.jbcl.model.GraphModel model, boolean depthFirstSearch)Constructs a GraphModelSearch object with the specified model and depthFirstSearch settings. (fullSearch = true)
Parameters:
public GraphModelSearch(borland.jbcl.model.GraphModel model, boolean depthFirstSearch, boolean fullSearch)Constructs a GraphModelSearch object with the specified model, depthFirstSearch, and fullSearch settings.
Parameters:
public boolean isDepthFirstSearch() public void setDepthFirstSearch(boolean depthFirstSearch)The depthFirstSearch property specifies whether the search algorithms should check all sibling children of a node before drilling down into the first child node's children, etc.
The default setting is false, which results in the most shallow occurrence of a data object to be located. If this property is set to true, the search drills to the absolute bottom of each node before moving onto the next. This results in a potentially deeper GraphLocation as a search result.
Parameters:
public boolean isFullSearch() public void setFullSearch(boolean fullSearch)The fullSearch property tells the different search methods whether to fetch children when the node returns TriState.UNKNOWN to the GraphLocation.hasChildren() method. Typically, UNKNOWN is only returned by an implementor of GraphLocation when the process of fetching the children is potentially costly (in CPU cycles). If the fullSearch property is set to false, all search algorithms treats an UNKNOWN response to GraphLocation.hasChildren() as NO and continue on without fetching the child nodes of that node. This can potentially effect search results in that any nodes below an UNKNOWN children node is not checked. By default, this property is true, and all children are checked.
Parameters:
public GraphModel getModel() public void setModel(borland.jbcl.model.GraphModel model)The model property specifies a GraphModel to search. This property must be set before any search routines can be called.
Parameters:
protected boolean checkMatch(java.lang.Object first, java.lang.Object second)This method (called from several other methods) compares the two passed data objects see if they matc h,first with a straight '==' check, then with a '.equals' check.
NOTE: subclasses may wish to override this method to allow for incremental searching or partial matches.
Parameters:
protected void checkModel()
public GraphLocation exactPathSearch(borland.jbcl.model.GraphLocation node, java.lang.Object[] data)This path searching method will search the GraphModel structure (starting at the passed node), looking for matches to the passed data objects. As each data object is found in the immediate child list of the previous, the algorythm will dig deeper under that node to find the next data object. If the last data object is found, this method returns a GraphLocation representing its address in the GraphModel structure. If the last data object cannot be found in the GraphModel structure, or any of the passed data objects cannot be found in order in the child list of the previous found node, this method returns null. The passed data object array need not directly correspond to the heirarchy of the GraphModel, following the exact parent hierarchy.
Parameters:
public GraphLocation exactPathSearch(java.lang.Object[] data)This path searching method will search the entire GraphModel structure (starting at the root node), looking for matches to the passed data objects. As each data object is found in the immediate child list of the previous, the algorithm digs deeper under that node to find the next data object. If the last data object is found, this method returns a GraphLocation representing its address in the GraphModel structure. If the last data object cannot be found in the GraphModel structure, or any of the passed data objects cannot be found in order in the child list of the previous found node, this method returns null. This method requires the passed data object array to directly correspond to the heirarchy of the GraphModel, following the exact parent hierarchy.
Parameters:
public GraphLocation partialPathSearch(borland.jbcl.model.GraphLocation node, java.lang.Object[] data)This path searching method will search the GraphModel structure (starting at the passed node), looking for matches to the passed data objects. As each data object is found, the algorythm will dig deeper under that node to find the next data object. If a data object cannot be found, it will return a GraphLocation representing the deepest object it was able to locate - ignoring the rest of the data object array contents.
Parameters:
public GraphLocation partialPathSearch(java.lang.Object[] data)This path searching method searches the entire GraphModel structure (starting at the root node), looking for matches to the passed data objects. As each data object is found, the algorithm digs deeper under that node to find the next data object. If a data object cannot be found, it returns a GraphLocation representing the deepest object it was able to locate,ignoring the rest of the data object array contents.
Parameters:
public GraphLocation pathSearch(borland.jbcl.model.GraphLocation node, java.lang.Object[] data)This path searching method will search the GraphModel structure (starting at the passed node), looking for matches to the passed data objects. As each data object is found, the algorithm digs deeper under that node to find the next data object. If the last data object is found, it returns a GraphLocation representing its address. If the last data object cannot be found in the GraphModel structure, this method returns null. The passed data object array need not directly correspond to the heirarchy of the GraphModel, but each data object must exist in the GraphModel and must exist under the same parent hierarchy.
Parameters:
public GraphLocation pathSearch(java.lang.Object[] data)This path searching method searches the entire GraphModel structure (starting at the root node), looking for matches to the passed data objects. As each data object is found, the algorithm digs deeper under that node to find the next data object. If the last data object is found, it returns a GraphLocation representing its address. If the last data object cannot be found in the GraphModel structure, this method returns null. The passed data object array need not directly correspond to the heirarchy of the GraphModel, but each data object must exist in the GraphModeland must exist under the same parent hierarchy.
Parameters:
protected GraphLocation scanNodes(borland.jbcl.model.GraphLocation[] nodes, java.lang.Object data)This method (called from several other methods) scans the passed GraphLocation array to see if the corresponding data objects in the GraphModel are equal to the passed data object.
Parameters:
public GraphLocation search(borland.jbcl.model.GraphLocation node, java.lang.Object data)This search method searches the GraphModel structure starting at the passed node and down, looking for a match to the passed data object. If the data object is found, it returna a GraphLocation representing the address of the data object. If the data object cannot be found in the GraphModel structure, this method returns null.
NOTE: This is a recursive method (it calls itself), and subclasses should be consider this carefully when overriding this method.
Parameters:
public GraphLocation search(java.lang.Object data)This search method searches the entire GraphModel structure (starting at the root node), looking for a match to the passed data object. If the data object is found, it returns a GraphLocation representing the address of the data object. If the data object cannot be found in the GraphModel structure, this method returns null.
Parameters: