public class JGraphHierarchyModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
deterministic
Whether or not cells are ordered according to the order in the graph
model.
|
protected int |
dfsCount
Count of the number of times the ancestor dfs has been used
|
protected java.util.Map |
edgeMapper
Map from graph edges to internal model edges
|
int |
maxRank
Stores the largest rank number allocated
|
java.util.Map |
ranks
Mapping from rank number to actual rank
|
java.lang.Object[] |
roots
Store of roots of this hierarchy model, these are real graph cells, not
internal cells
|
protected boolean |
scanRanksFromSinks
Whether the rank assignment is done from the sinks or sources.
|
protected java.util.Map |
vertexMapper
Map from graph vertices to internal model nodes
|
Constructor and Description |
---|
JGraphHierarchyModel(JGraphFacade facade)
Constructor with no parameters creates a default model
|
JGraphHierarchyModel(JGraphFacade facade,
java.lang.Object[] vertices,
boolean ordered,
boolean deterministic,
boolean scanRanksFromSinks)
Creates an internal ordered graph model using the vertices passed in.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createInternalCells(JGraphFacade facade,
java.lang.Object[] vertices,
JGraphHierarchyNode[] internalVertices)
Creates all edges in the internal model
|
void |
dfs(JGraphFacade.CellVisitor visitor,
java.lang.Object[] dfsRoots,
boolean trackAncestors,
java.util.Set seenNodes)
A depth first search through the internal heirarchy model
|
void |
dfs(JGraphHierarchyNode parent,
JGraphHierarchyNode root,
JGraphHierarchyEdge connectingEdge,
JGraphFacade.CellVisitor visitor,
java.util.Set seen,
int layer)
Performs a depth first search on the internal hierarchy model
|
void |
dfs(JGraphHierarchyNode parent,
JGraphHierarchyNode root,
JGraphHierarchyEdge connectingEdge,
JGraphFacade.CellVisitor visitor,
java.util.Set seen,
int[] ancestors,
int childHash,
int layer)
Performs a depth first search on the internal hierarchy model.
|
void |
fixRanks()
Fixes the layer assignments to the values stored in the nodes.
|
void |
formOrderedHierarchy(JGraphFacade facade,
java.lang.Object[] vertices)
Creates an internal ordered graph model using the vertices passed in.
|
int |
getDfsCount() |
java.util.Map |
getEdgeMapper() |
java.util.Map |
getVertexMapping() |
void |
initialRank()
Basic determination of minimum layer ranking by working from from sources
or sinks and working through each node in the relevant edge direction.
|
boolean |
isDeterministic() |
boolean |
isSinksAtLayerZero() |
void |
setDeterministic(boolean deterministic) |
void |
setDfsCount(int dfsCount) |
void |
setEdgeMapper(java.util.Map edgeMapper) |
void |
setSinksAtLayerZero(boolean sinksAtLayerZero) |
void |
setVertexMapping(java.util.Map vertexMapping) |
protected boolean scanRanksFromSinks
public int maxRank
protected java.util.Map vertexMapper
protected java.util.Map edgeMapper
public java.util.Map ranks
public java.lang.Object[] roots
protected int dfsCount
protected boolean deterministic
public JGraphHierarchyModel(JGraphFacade facade)
facade
- the facade of the graph to be laid outpublic JGraphHierarchyModel(JGraphFacade facade, java.lang.Object[] vertices, boolean ordered, boolean deterministic, boolean scanRanksFromSinks)
facade
- the facade describing the graph to be operated onvertices
- the vertices for this hierarchyordered
- whether or not the vertices are already ordereddeterministic
- whether or not this layout should be deterministic on each
usagescanRanksFromSinks
- Whether the rank assignment is done from the sinks or sources.public void formOrderedHierarchy(JGraphFacade facade, java.lang.Object[] vertices)
facade
- the facade describing the graph to be operated onvertices
- the vertices to be laid outprotected void createInternalCells(JGraphFacade facade, java.lang.Object[] vertices, JGraphHierarchyNode[] internalVertices)
facade
- the facade desrcibing the graph to be laid outvertices
- the vertices whom are to have an internal representation
createdinternalVertices
- the blank internal vertices to have their information filled
in using the real verticespublic void initialRank()
public void fixRanks()
public void dfs(JGraphFacade.CellVisitor visitor, java.lang.Object[] dfsRoots, boolean trackAncestors, java.util.Set seenNodes)
visitor
- the visitor pattern to be called for each nodetrackAncestors
- whether or not the search is to keep track all nodes directly
above this one in the search pathpublic void dfs(JGraphHierarchyNode parent, JGraphHierarchyNode root, JGraphHierarchyEdge connectingEdge, JGraphFacade.CellVisitor visitor, java.util.Set seen, int layer)
parent
- the parent internal node of the current internal noderoot
- the current internal nodeconnectingEdge
- the internal edge connecting the internal node and the parent
internal node, if anyvisitor
- the visitor pattern to be called for each nodeseen
- a set of all nodes seen by this dfs a set of all of the
ancestor node of the current nodelayer
- the layer on the dfs tree ( not the same as the model ranks )public void dfs(JGraphHierarchyNode parent, JGraphHierarchyNode root, JGraphHierarchyEdge connectingEdge, JGraphFacade.CellVisitor visitor, java.util.Set seen, int[] ancestors, int childHash, int layer)
parent
- the parent internal node of the current internal noderoot
- the current internal nodeconnectingEdge
- the internal edge connecting the internal node and the parent
internal node, if anyvisitor
- the visitor pattern to be called for each nodeseen
- a set of all nodes seen by this dfsancestors
- the parent hash codechildHash
- the new hash code for this nodelayer
- the layer on the dfs tree ( not the same as the model ranks )public java.util.Map getVertexMapping()
public void setVertexMapping(java.util.Map vertexMapping)
vertexMapping
- The vertexMapping to set.public java.util.Map getEdgeMapper()
public void setEdgeMapper(java.util.Map edgeMapper)
edgeMapper
- The edgeMapper to set.public int getDfsCount()
public void setDfsCount(int dfsCount)
dfsCount
- The dfsCount to set.public boolean isDeterministic()
public void setDeterministic(boolean deterministic)
deterministic
- The deterministic to set.public boolean isSinksAtLayerZero()
public void setSinksAtLayerZero(boolean sinksAtLayerZero)
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.