|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.grouping.Grouping
public class Grouping
Instances of this class can be used by algorithms to efficiently query the structure of such type of graphs. The grouping information is provided through DataProviders, whose keys are defined in the GroupingKeys interface.
Field Summary |
---|
Fields inherited from interface y.layout.grouping.GroupingKeys |
---|
GROUP_DPKEY, GROUP_NODE_INSETS_DPKEY, MINIMUM_NODE_SIZE_DPKEY, NODE_ID_DPKEY, PARENT_NODE_ID_DPKEY |
Constructor Summary | |
---|---|
Grouping(Graph graph)
Creates a new instance of Grouping. |
Method Summary | |
---|---|
protected NodeMap |
createInfoMap(Graph graph)
Factory method for a NodeMap |
void |
dispose()
Disposes the data structures held by this instance. |
protected void |
disposeInfoMap(Graph graph,
NodeMap infoMap)
Factory destructor method for a NodeMap |
NodeList |
getChildren(Node parent)
Returns the children of the given group node as a NodeList. |
NodeList |
getDescendants(Node parent)
Returns all descendants of the given group node as a NodeList. |
EdgeList |
getEdgesGoingIn(Node groupNode)
Convenience method that returns a list of all Edges crossing the group node boundary of the given group node in such a way, that there target is inside the group node and the source does not lie inside the group node. |
EdgeList |
getEdgesGoingOut(Node groupNode)
Convenience method that returns a list of all Edges crossing the group node boundary of the given group node in such a way, that there target is outside the group node and the source does not lie outside the group node. |
Graph |
getGraph()
Returns the Graph instance this object provides information for. |
LayoutGraph |
getLayoutGraph()
Returns the LayoutGraph instance this object provides information for. |
Node |
getNearestCommonAncestor(Node n1,
Node n2)
Returns the nearest common ancestor in the hierarchy structure. |
Node |
getParent(Node node)
Returns the parent of the given node or null if the node
is at the top of the hierarchy |
Node |
getRepresentative(Node node,
Node inGroup)
Convenience method that returns a node that can be used to represent node in the group inGroup , that is either the node
itself if it is an immediate child of inGroup , or a node that
is a child of inGroup and an ancestor of node at the
same time or null if neither of the latter applies. |
Node |
getRoot()
Returns a node instance that can be used as a handle to the virtual root of the node hierarchy. |
boolean |
hasChildren(Node v)
Determines if the given node is a group node with children. |
protected void |
init()
Initializes internal data structures. |
static boolean |
isFlat(Graph graph)
A graph is considered to be flat if it is either not grouped or there is no group node that contains child nodes present in the graph. |
static boolean |
isGrouped(Graph graph)
A graph is considered to be grouped if the three low-level grouping data providers GroupingKeys.GROUP_DPKEY ,
GroupingKeys.NODE_ID_DPKEY and GroupingKeys.PARENT_NODE_ID_DPKEY
are registered. |
boolean |
isGroupNode(Node node)
Determines if the given node is a group node. |
boolean |
isNormalEdge(Edge e)
Determines if the given Edge is a normal edge, i.e. whether it does not cross any group node boundaries. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Grouping(Graph graph)
disposed
once the grouping instance is not needed anymore.
Method Detail |
---|
protected void init()
public LayoutGraph getLayoutGraph()
This Grouping instance must have been created with a LayoutGraph
public Graph getGraph()
protected NodeMap createInfoMap(Graph graph)
protected void disposeInfoMap(Graph graph, NodeMap infoMap)
public Node getParent(Node node)
null
if the node
is at the top of the hierarchy
public Node getRoot()
public NodeList getChildren(Node parent)
public NodeList getDescendants(Node parent)
parent
- A group node.
If null
is given, the graph's root is used.
public boolean isGroupNode(Node node)
public boolean hasChildren(Node v)
public boolean isNormalEdge(Edge e)
public EdgeList getEdgesGoingIn(Node groupNode)
public EdgeList getEdgesGoingOut(Node groupNode)
public Node getRepresentative(Node node, Node inGroup)
node
in the group inGroup
, that is either the node
itself if it is an immediate child of inGroup
, or a node that
is a child of inGroup
and an ancestor of node
at the
same time or null
if neither of the latter applies.
node
- the node for which a representative will be returnedinGroup
- the group to which the representative should belong.public void dispose()
public static boolean isGrouped(Graph graph)
GroupingKeys.GROUP_DPKEY
,
GroupingKeys.NODE_ID_DPKEY
and GroupingKeys.PARENT_NODE_ID_DPKEY
are registered.
An instance of this class requires its graph to be grouped.
public static boolean isFlat(Graph graph)
public Node getNearestCommonAncestor(Node n1, Node n2)
This method returns the nearest ancestor of n1
and
n2
that contains both n1
and n2
or
it returns getRoot()
if no such node exists.
In the special cases of n2
being a child of n1
(or vice versa) or if n1 == n2
, the parent of n1
(or n2
respectively) is returned.
n1
- one of the two nodes whose common ancestor is determined.n2
- one of the two nodes whose common ancestor is determined.
getRoot()
.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |