Search in sources :

Example 6 with EdgeCursor

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);
        }
    }
}
Also used : EdgeCursor(y.base.EdgeCursor) BendCursor(y.view.BendCursor) Bend(y.view.Bend) Edge(y.base.Edge)

Example 7 with EdgeCursor

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();
    }
}
Also used : EdgeCursor(y.base.EdgeCursor) EdgeRealizer(y.view.EdgeRealizer) Edge(y.base.Edge) Graph2D(y.view.Graph2D)

Example 8 with EdgeCursor

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;
}
Also used : IInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.interfaces.IInstructionGraphEdge) EdgeCursor(y.base.EdgeCursor) ArrayList(java.util.ArrayList) IInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.interfaces.IInstructionGraphEdge) Edge(y.base.Edge) ReilEdge(com.google.security.zynamics.reil.ReilEdge) ReilInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.ReilInstructionGraphEdge)

Aggregations

EdgeCursor (y.base.EdgeCursor)8 Edge (y.base.Edge)6 NodeCursor (y.base.NodeCursor)3 NodeList (y.base.NodeList)3 ReilEdge (com.google.security.zynamics.reil.ReilEdge)2 ReilInstructionGraphEdge (com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.ReilInstructionGraphEdge)2 IInstructionGraphEdge (com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.interfaces.IInstructionGraphEdge)2 ArrayList (java.util.ArrayList)2 Node (y.base.Node)2 Graph2D (y.view.Graph2D)2 HierarchyManager (y.view.hierarchy.HierarchyManager)2 BaseType (com.google.security.zynamics.binnavi.disassembly.types.BaseType)1 ZyGraphNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.nodes.ZyGraphNode)1 ZyProximityNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.proximity.ZyProximityNode)1 Rectangle2D (java.awt.geom.Rectangle2D)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 YPoint (y.geom.YPoint)1 Bend (y.view.Bend)1 BendCursor (y.view.BendCursor)1