本文整理汇总了Java中y.base.Node.edges方法的典型用法代码示例。如果您正苦于以下问题:Java Node.edges方法的具体用法?Java Node.edges怎么用?Java Node.edges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类y.base.Node
的用法示例。
在下文中一共展示了Node.edges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdjacentSwimlane
import y.base.Node; //导入方法依赖的package包/类
/**
* @param n
* @return
*/
private static Object getAdjacentSwimlane(Node n, Graph2D abstractGraph) {
// Get the vertical layers (y-coordinate) in which nodes are arranged
NodeMap swimlaneMap =
(NodeMap) abstractGraph.getDataProvider(IncrementalHierarchicLayouter.SWIMLANE_DESCRIPTOR_DPKEY);
// This node needs to get a layer info => Inspect adjacent nodes
EdgeCursor ec = n.edges();
Object adjacentSwimlandID = null;
Object adjacentSwimlandID2ndPrio = null;
while (ec.ok()) {
Edge e = (Edge) ec.current();
Node connectedNode = e.opposite(n);
EdgeRealizer r = abstractGraph.getRealizer(e);
if (r instanceof DomainEdgeRealizer) {
adjacentSwimlandID = swimlaneMap.get(connectedNode);
} else if (!(r instanceof CysBridgeEdgeRealizer)) { // Don't consider Cystein Brdidges!
// Most likely GeneralConnectionEdgeRealizer
adjacentSwimlandID2ndPrio = swimlaneMap.get(connectedNode);
}
ec.next();
}
return adjacentSwimlandID != null ? adjacentSwimlandID : adjacentSwimlandID2ndPrio;
}
示例2: highlightEdgesOfNode
import y.base.Node; //导入方法依赖的package包/类
/**
* Highlights all edges of a node.
*
* @param node The node whose edges are highlighted.
* @param highlight True to add highlighting to the edges. False to remove it.
*/
public static void highlightEdgesOfNode(final Node node, final boolean highlight) {
final EdgeCursor edges = node.edges();
int edgeCount = node.degree();
for (Edge edge = edges.edge(); edgeCount > 0; edgeCount--) {
final EdgeRealizer edgeRealizer = ((Graph2D) node.getGraph()).getRealizer(edge);
highlightEdge(edgeRealizer, highlight);
edges.cyclicNext();
edge = edges.edge();
}
}
示例3: getLevelOfAdjacentNodes
import y.base.Node; //导入方法依赖的package包/类
/**
* @param n
* @return
*/
private static Collection<Integer> getLevelOfAdjacentNodes(Node n, Graph2D abstractGraph) {
// Get the vertical layers (y-coordinate) in which nodes are arranged
NodeMap layers = (NodeMap) abstractGraph.getDataProvider(GivenLayersLayerer.LAYER_ID_KEY);
// Inspect mapValues in layers of adjacent nodes
EdgeCursor ec = n.edges();
Set<Integer> adjacentLayer = new HashSet<Integer>();
Set<Integer> adjacentLayerCys2ndPrio = new HashSet<Integer>();
while (ec.ok()) {
Edge e = (Edge) ec.current();
Node connectedNode = e.opposite(n);
EdgeRealizer r = abstractGraph.getRealizer(e);
if (r instanceof DomainEdgeRealizer) {
if (layers.get(connectedNode) != null) {
adjacentLayer.add(layers.getInt(connectedNode));
}
} else if (!(r instanceof CysBridgeEdgeRealizer)) { // Don't consider Cystein Brdidges!
// Most likely GeneralConnectionEdgeRealizer
if (layers.get(connectedNode) != null) {
adjacentLayerCys2ndPrio.add(layers.getInt(connectedNode));
}
}
ec.next();
}
// Consider only backbone edges if available. Else, consider non-cys.
return (adjacentLayer.size() > 0) ? adjacentLayer : adjacentLayerCys2ndPrio;
}