All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.Search

java.lang.Object
   |
   +----att.grappa.Search

public class Search
extends Object
implements GraphEnumeration
This class generates an enumeration of graph elements that satisfy the search criteria supplied at creation.

Version:
1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Variable Index

 o AND_ATTRS
Used to indicate a search of a set of element attributes
 o ATTR
Used to indicate a search of element attributes
 o ID
Used to indicate a search of element IDs
 o NAME
Used to indicate a search of element names
 o OR_ATTRS
Used to indicate a search of any of a set of element attributes
 o TAG
Used to indicate a search of element tags

Constructor Index

 o Search(GraphEnumeration, int, Object)
Perform a search of elements in the supplied enumeration.
 o Search(Subgraph, int, int, Object)
Perform a search of elements in the defined enumeration.

Method Index

 o findById(Graph, Long)
Search a graph for an element ID.
 o getEnumerationTypes()
Get the types of elements possibly contained in this enumeration.
 o getSearchObject()
Get the search object for this Search instance.
 o getSearchType()
Get the search type for this Search instance.
 o getSubgraphRoot()
Get the root of this enumeration.
 o hasMoreElements()
Tests if this enumeration contains more elements.
 o nextElement()
Returns the next element of this enumeration.
 o nextGraphElement()
A convenience method that just returns a cast of a call to nextElement().

Variables

 o ID
 public static final int ID
Used to indicate a search of element IDs

 o NAME
 public static final int NAME
Used to indicate a search of element names

 o TAG
 public static final int TAG
Used to indicate a search of element tags

 o ATTR
 public static final int ATTR
Used to indicate a search of element attributes

 o AND_ATTRS
 public static final int AND_ATTRS
Used to indicate a search of a set of element attributes

 o OR_ATTRS
 public static final int OR_ATTRS
Used to indicate a search of any of a set of element attributes

Constructors

 o Search
 public Search(GraphEnumeration elemEnum,
               int searchType,
               Object searchObject)
Perform a search of elements in the supplied enumeration.

Parameters:
elemEnum - the enumeration of elements to be searched
searchType - the type of search to perform
searchObject - the search object to match against
See Also:
ID, NAME, TAG, ATTR, AND_ATTRS, OR_ATTRS
 o Search
 public Search(Subgraph root,
               int elemTypes,
               int searchType,
               Object searchObject)
Perform a search of elements in the defined enumeration. The enumeration to be searched is generated using the Subgraph elements(int) method.

Parameters:
root - the root subgraph in which to begin the search
elemTypes - the type of graph elements to search
searchType - the type of search to perform
searchObject - the search object to match against
See Also:
elements, NODE, EDGE, SUBGRAPH, ID, NAME, TAG, ATTR, AND_ATTRS, OR_ATTRS

Methods

 o hasMoreElements
 public boolean hasMoreElements()
Tests if this enumeration contains more elements.

Returns:
true if this enumeration contains more elements; false otherwise.
 o nextElement
 public Object nextElement() throws NoSuchElementException
Returns the next element of this enumeration.

Returns:
the next element of this enumeration.
Throws: NoSuchElementException
if no more elements exist.
 o getSearchObject
 public Object getSearchObject()
Get the search object for this Search instance.

Returns:
the search object
 o getSearchType
 public int getSearchType()
Get the search type for this Search instance.

Returns:
the search type
See Also:
ID, NAME, TAG, ATTR, AND_ATTRS, OR_ATTRS
 o nextGraphElement
 public Element nextGraphElement() throws NoSuchElementException
A convenience method that just returns a cast of a call to nextElement().

Returns:
the next graph element in the enumeration.
Throws: NoSuchElementException
whenever the enumeration has no more elements.
See Also:
nextElement
 o getSubgraphRoot
 public Subgraph getSubgraphRoot()
Get the root of this enumeration.

Returns:
the root subgraph for this enumeration.
 o getEnumerationTypes
 public int getEnumerationTypes()
Get the types of elements possibly contained in this enumeration.

Returns:
an indication of the types of elements in this enumeration
See Also:
NODE, EDGE, SUBGRAPH
 o findById
 public static Element findById(Graph graph,
                                Long id)
Search a graph for an element ID.

Parameters:
graph - the graph to be searched
id - the element ID for which to search
Returns:
the matching graph element or null if no match.
See Also:
getId

All Packages  Class Hierarchy  This Package  Previous  Next  Index