org.modeshape.graph
Interface Subgraph

All Superinterfaces:
Graph.BaseResults<SubgraphNode>, Iterable<SubgraphNode>

@Immutable
public interface Subgraph
extends Graph.BaseResults<SubgraphNode>

A subgraph returned by the Graph, containing the nodes in the subgraph as well as the properties and children for each of those nodes. The Iterable.iterator() method may be used to walk the nodes in the subgraph in a pre-order traversal.

Since this subgraph has a single node that is the top of the subgraph, the methods that take a String path or path object will accept absolute or relative paths.

This subgraph will not contain any nodes that exist below the maximum depth. Also, all nodes included in the subgraph have all their properties and children. However, nodes that are at the maximum depth of the subgraph will contain the locations for child nodes that are below the maximum depth and therefore not included in this subgraph.


Method Summary
 Location getLocation()
          Get the location of the subgraph, which is the location of the node at the top of the subgraph.
 int getMaximumDepth()
          Get the maximum depth requested for this subgraph.
 SubgraphNode getNode(Name relativePath)
          Get the node at the supplied location.
 SubgraphNode getRoot()
          Get the node that is at the root of the subgraph.
 
Methods inherited from interface org.modeshape.graph.Graph.BaseResults
getGraph, getNode, getNode, getNode, includes, includes, includes
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

getLocation

Location getLocation()
Get the location of the subgraph, which is the location of the node at the top of the subgraph.

Returns:
the location of the top node in the subgraph; never null

getMaximumDepth

int getMaximumDepth()
Get the maximum depth requested for this subgraph. The actual subgraph may not be as deep, but will never be deeper than this value.

Returns:
the maximum depth requested; always positive

getNode

SubgraphNode getNode(Name relativePath)
Get the node at the supplied location.

Parameters:
relativePath - the name that makes up a relative path to the node that is an immediate child of the root
Returns:
the node, or null if the node is not included in these results

getRoot

SubgraphNode getRoot()
Get the node that is at the root of the subgraph.

Returns:
the root node in the subgraph


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.