Search this API

y.view
Class DefaultGraph2DTraversal

java.lang.Object
  extended by y.view.DefaultGraph2DTraversal
All Implemented Interfaces:
Graph2DTraversal

public class DefaultGraph2DTraversal
extends java.lang.Object
implements Graph2DTraversal

Default Graph2DTraversal that provides the (layer-unrelated) rendering order used in DefaultGraph2DRenderer.

 

Field Summary
 
Fields inherited from interface y.view.Graph2DTraversal
ALL, BENDS, EDGE_LABELS, EDGES, NODE_LABELS, NODE_PORTS, NODES, PORTS
 
Constructor Summary
DefaultGraph2DTraversal()
          Constructs a new DefaultGraph2DTraversal.
 
Method Summary
 java.util.Iterator firstToLast(Graph2D graph, int elementTypes)
          Creates an Iterator that traverses the specified Graph2D's elements that match the specified element types.
 boolean isEdgesFirst()
          Returns true, if edge elements are generally traversed before (incident) node elements in a first-to-last traversal and false if edge elements are generally traversed after (incident) node elements in a first-to-last traversal.
 boolean isHierarchicOrder()
          Returns true, if node elements of nested graphs are traversed in the order induced by HierarchyManager.preTraversal() for first-to-last traversals and HierarchyManager.postTraversal() for last-to-first traversals.
 boolean isNestedEdgeOrder()
          Returns true, if node elements and edge elements of nested graphs are traversed in an interleaved fashion.
 java.util.Iterator lastToFirst(Graph2D graph, int elementTypes)
          Creates an Iterator that traverses the specified Graph2D's elements that match the specified element types.
 void setEdgesFirst(boolean edgesFirst)
          Specifies the general order of edge elements in relation to (incident) node elements.
 void setHierarchicOrder(boolean hierarchicOrder)
          Specifies whether to traverse node elements of nested graphs in the order induced by HierarchyManager.preTraversal() for first-to-last traversals and HierarchyManager.postTraversal() for last-to-first traversals; false otherwise.
 void setNestedEdgeOrder(boolean nestedEdgeOrder)
          Specifies whether node elements and edge elements of nested graphs should be traversed in an interleaved fashion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGraph2DTraversal

public DefaultGraph2DTraversal()
Constructs a new DefaultGraph2DTraversal.

Method Detail

isEdgesFirst

public boolean isEdgesFirst()
Returns true, if edge elements are generally traversed before (incident) node elements in a first-to-last traversal and false if edge elements are generally traversed after (incident) node elements in a first-to-last traversal.

Defaults to false.

Returns:
true if edge elements are generally traversed before (incident) node elements in a first-to-last traversal and false if edge elements are generally traversed after (incident) node elements in a first-to-last traversal.
See Also:
setEdgesFirst(boolean), isNestedEdgeOrder(), setNestedEdgeOrder(boolean)

setEdgesFirst

public void setEdgesFirst(boolean edgesFirst)
Specifies the general order of edge elements in relation to (incident) node elements.

Defaults to false.

Parameters:
edgesFirst - if true edge elements are usually traversed before (incident) node elements are traversed when doing a first-to-last traversal.
See Also:
isEdgesFirst(), isNestedEdgeOrder(), setNestedEdgeOrder(boolean)

isHierarchicOrder

public boolean isHierarchicOrder()
Returns true, if node elements of nested graphs are traversed in the order induced by HierarchyManager.preTraversal() for first-to-last traversals and HierarchyManager.postTraversal() for last-to-first traversals.

Defaults to true.

Returns:
true if node elements of nested graphs are traversed in the order induced by HierarchyManager.preTraversal() for first-to-last traversals and HierarchyManager.postTraversal() for last-to-first traversals; false otherwise.
See Also:
setHierarchicOrder(boolean)

setHierarchicOrder

public void setHierarchicOrder(boolean hierarchicOrder)
Specifies whether to traverse node elements of nested graphs in the order induced by HierarchyManager.preTraversal() for first-to-last traversals and HierarchyManager.postTraversal() for last-to-first traversals; false otherwise.

Defaults to true.

Parameters:
hierarchicOrder - if true, node elements are traversed in the order induced by HierarchyManager's preTraversal and postTraversal methods, else nodes are traversed in the order implied by Graph.nodes().
See Also:
isHierarchicOrder()

isNestedEdgeOrder

public boolean isNestedEdgeOrder()
Returns true, if node elements and edge elements of nested graphs are traversed in an interleaved fashion.

Defaults to false.

Returns:
true, if node elements and edge elements of nested graphs are traversed in an interleaved fashion.
See Also:
setNestedEdgeOrder(boolean), isEdgesFirst(), setEdgesFirst(boolean)

setNestedEdgeOrder

public void setNestedEdgeOrder(boolean nestedEdgeOrder)
Specifies whether node elements and edge elements of nested graphs should be traversed in an interleaved fashion. Depending on edgesFirst, edges are either traversed before or after the group node to which their endpoints belong.

Defaults to false.

Parameters:
nestedEdgeOrder - if true nodes and edges of nested graphs should be traversed in an interleaved fashion; else all node elements are traversed before or after all edge elements.
See Also:
isNestedEdgeOrder(), isEdgesFirst(), setEdgesFirst(boolean)

firstToLast

public java.util.Iterator firstToLast(Graph2D graph,
                                      int elementTypes)
Creates an Iterator that traverses the specified Graph2D's elements that match the specified element types. The traversal order of node and edge elements depends on the properties edgesFirst, hierarchicOrder, and nestedEdgeOrder. Independent of these settings, a node will always be followed directly by its associated node labels and an edge will always be followed directly by its source and target port, its associated bends, and finally its associated edge labels (assuming, of course, that all of these are included in the specified element types).

Note, the iterators created with this method are not fail-fast as one is used to from the Java™ Collections Framework, because there is no reliable way to check for concurrent modifications of the traversed graph.

Specified by:
firstToLast in interface Graph2DTraversal
Parameters:
graph - the Graph2D whose elements are to be traversed.
elementTypes - determines the types of graph elements that should be included in the traversal. The elementTypes argument is an integer bit mask that may be Graph2DTraversal.ALL or any bitwise union of Graph2DTraversal.BENDS, Graph2DTraversal.EDGES, Graph2DTraversal.EDGE_LABELS, Graph2DTraversal.NODES, Graph2DTraversal.NODE_LABELS, Graph2DTraversal.PORTS, and/or Graph2DTraversal.NODE_PORTS.
Returns:
an Iterator that traverses the specified Graph2D's elements first to last.
See Also:
Graph2DTraversal.lastToFirst(Graph2D, int)

lastToFirst

public java.util.Iterator lastToFirst(Graph2D graph,
                                      int elementTypes)
Creates an Iterator that traverses the specified Graph2D's elements that match the specified element types. The traversal order of node and edge elements depends on the properties edgesFirst, hierarchicOrder, and nestedEdgeOrder. Independent of these settings, a node will always be returned right after its associated node labels and an edge will always be returned right after by its associated edge labels, its associated bends, and finally its target and source port (assuming, of course, that all of these are included in the specified element types).

Note, the iterators created with this method are not fail-fast as one is used to from the Java™ Collections Framework, because there is no reliable way to check for concurrent modifications of the traversed graph.

Specified by:
lastToFirst in interface Graph2DTraversal
Parameters:
graph - the Graph2D whose elements are to be traversed.
elementTypes - determines the types of graph elements that should be included in the traversal. The elementTypes argument is an integer bit mask that may be Graph2DTraversal.ALL or any bitwise union of Graph2DTraversal.BENDS, Graph2DTraversal.EDGES, Graph2DTraversal.EDGE_LABELS, Graph2DTraversal.NODES, Graph2DTraversal.NODE_LABELS, Graph2DTraversal.PORTS, and/or Graph2DTraversal.NODE_PORTS.
Returns:
an Iterator that traverses the specified Graph2D's elements last to first.
See Also:
Graph2DTraversal.firstToLast(Graph2D, int)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.