Search this API

y.view
Interface Graph2DTraversal

All Known Implementing Classes:
DefaultGraph2DTraversal

public interface Graph2DTraversal

Specifies the contract of cross-element-type Graph2D traversals. Cross-element-type traversals are useful when rendering and/or performing hit tests on a Graph2D as they can be interpreted as a global z-ordering or visual layering of graph elements.

 

Field Summary
static int ALL
          Type bit mask representing all element types.
static int BENDS
          Type bit mask representing bends.
static int EDGE_LABELS
          Type bit mask representing edge labels.
static int EDGES
          Type bit mask representing edges.
static int NODE_LABELS
          Type bit mask representing node labels.
static int NODE_PORTS
          Type bit mask representing node ports.
static int NODES
          Type bit mask representing nodes.
static int PORTS
          Type bit mask representing ports.
 
Method Summary
 java.util.Iterator firstToLast(Graph2D graph, int elementTypes)
          Creates an Iterator that traverses elements of the specified types of the given Graph2D from first to last.
 java.util.Iterator lastToFirst(Graph2D graph, int elementTypes)
          Creates an Iterator that traverses elements of the specified types of the given Graph2D from last to first.
 

Field Detail

ALL

static final int ALL
Type bit mask representing all element types.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

NODES

static final int NODES
Type bit mask representing nodes.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

EDGES

static final int EDGES
Type bit mask representing edges.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

PORTS

static final int PORTS
Type bit mask representing ports.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

BENDS

static final int BENDS
Type bit mask representing bends.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

NODE_LABELS

static final int NODE_LABELS
Type bit mask representing node labels.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

EDGE_LABELS

static final int EDGE_LABELS
Type bit mask representing edge labels.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values

NODE_PORTS

static final int NODE_PORTS
Type bit mask representing node ports.

See Also:
firstToLast(Graph2D, int), lastToFirst(Graph2D, int), Constant Field Values
Method Detail

firstToLast

java.util.Iterator firstToLast(Graph2D graph,
                               int elementTypes)
Creates an Iterator that traverses elements of the specified types of the given Graph2D from first to last. The order of elements returned by said Iterator has to be the exact reversal of the order implied by lastToFirst(Graph2D, int).

This traversal order is typically used when rendering a Graph2D.

Note that iterators for graph traversal are typically 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.

Parameters:
graph - the Graph2D whose elements should 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 ALL or any bitwise union of BENDS, EDGES, EDGE_LABELS, NODES, NODE_LABELS, PORTS, and/or NODE_PORTS.
Returns:
an Iterator that traverses the elements of the specified Graph2d from first to last.
See Also:
lastToFirst(Graph2D, int)

lastToFirst

java.util.Iterator lastToFirst(Graph2D graph,
                               int elementTypes)
Creates an Iterator that traverses elements of the specified types of the given Graph2D from last to first. The order of elements returned by said Iterator has to be the exact reversal of the order implied by firstToLast(Graph2D, int).

This traversal order is typically used when performing hit tests for a Graph2D.

Note that iterators for graph traversal are typically 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.

Parameters:
graph - the Graph2D whose elements should 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 ALL or any bitwise union of BENDS, EDGES, EDGE_LABELS, NODES, NODE_LABELS, PORTS, and/or NODE_PORTS.
Returns:
an Iterator that traverses the elements of the specified Graph2d from last to first.
See Also:
firstToLast(Graph2D, int)

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