use of y.base.EdgeCursor in project binnavi by google.
the class CNodeMover method moveNode.
public static void moveNode(final AbstractZyGraph<?, ?> graph, final ZyGraphNode<?> node, final double xdist, final double ydist, final Set<Bend> movedBends) {
graph.getGraph().getRealizer(node.getNode()).moveBy(xdist, ydist);
for (final EdgeCursor cursor = node.getNode().edges(); cursor.ok(); cursor.next()) {
final Edge edge = cursor.edge();
for (final BendCursor bendCursor = graph.getGraph().getRealizer(edge).bends(); bendCursor.ok(); bendCursor.next()) {
final Bend bend = bendCursor.bend();
if (movedBends.contains(bend)) {
continue;
}
bend.moveBy(xdist, ydist);
movedBends.add(bend);
}
}
}
use of y.base.EdgeCursor in project binnavi by google.
the class CEdgeHighlighter method highlightEdgesOfNode.
/**
* 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();
}
}
use of y.base.EdgeCursor in project binnavi by google.
the class CReilInstructionGraph method getOutgoingEdgesForAddress.
/**
* Convenience method to obtain the edge in the ReilInstructionGraph that corresponds to LEAVING a
* particular native instruction
*
* @param nativeInstructionAddress The address of the native instruction
*
* @return The edge corresponding to entering the native instruction
*/
public Iterable<IInstructionGraphEdge> getOutgoingEdgesForAddress(final IAddress nativeInstructionAddress) {
final ArrayList<IInstructionGraphEdge> result = new ArrayList<IInstructionGraphEdge>();
final EdgeCursor edgeCursor = m_internalGraph.edges();
while (edgeCursor.ok()) {
final Edge edge = (Edge) edgeCursor.current();
final long sourceAddress = m_nodesMap.get(edge.source()).getReilInstruction().getAddress().toLong();
final long targetAddress = m_nodesMap.get(edge.target()).getReilInstruction().getAddress().toLong();
if (((targetAddress & 0xFF) == 0) && ((sourceAddress >> 8) == nativeInstructionAddress.toLong())) {
result.add(m_edgesMap.get(edge));
}
edgeCursor.next();
}
return result;
}
Aggregations