public abstract class GraphObjectIterator
extends Object
implements Iterator
GraphObject
,
Graph
Modifier and Type | Field and Description |
---|---|
private boolean |
deep
an indicator of whether to perform a deep or shallow iteration
|
private GraphObject |
GraphObjectToMatch
Used when iterating objects of a particular class, rather than using an
integer type indicator
|
private GraphObject.Kind |
kindToMatch
An indicator GraphObject type or subtype(s) being iterated
|
private ArrayList<GraphObject> |
objectList
Holds the graph objects to be examined
|
Constructor and Description |
---|
GraphObjectIterator(Graph g,
GraphObject go,
GraphObject.Kind kind,
boolean isDeep)
Collect graph objects to form an iteration.
|
Modifier and Type | Method and Description |
---|---|
private void |
addGraphObjects(Graph g)
Adds objects from a graph to the collection to return (in ArrayList v),
based on GraphObjectToMatch or KindToMatch
|
boolean |
hasNext() |
int |
howMany() |
GraphObject |
next() |
void |
remove() |
private ArrayList<GraphObject> objectList
private GraphObject.Kind kindToMatch
private boolean deep
private GraphObject GraphObjectToMatch
public GraphObjectIterator(Graph g, GraphObject go, GraphObject.Kind kind, boolean isDeep)
g
- graph whose elements are collected to form the iterationkind
- one of GraphObject GRAPH, GNODE, GEDGE -- what kind of
objects to collect. Should be zero if all objects are to be collected.isDeep
- whether to recursively collect objects from nested graphs
(true) or notGraphObject.Kind
private void addGraphObjects(Graph g)
g
- the graph whose object are to be tested for whether they should
be included or not.public boolean hasNext()
hasNext
in interface Iterator
public GraphObject next()
next
in interface Iterator
public void remove() throws UnsupportedOperationException
remove
in interface Iterator
UnsupportedOperationException
public int howMany()