Search in sources :

Example 26 with Node

use of y.base.Node in project binnavi by google.

the class TypeDependenceGraph method addMember.

/**
   * Adds a member to the dependence graph and returns the set of base types that are affected by
   * the changed compound type. This method assumes that all base type nodes that correspond to the
   * member base type already exist.
   *
   * @return The set of base types that are affected by the new member.
   */
public DependenceResult addMember(final BaseType parentType, final BaseType memberType) {
    Preconditions.checkNotNull(parentType, "IE02762: Parent type can not be null.");
    Preconditions.checkNotNull(memberType, "IE02763: Member type can not be null.");
    final Node memberTypeNode = Preconditions.checkNotNull(containedRelationMap.get(memberType), "Type node for member type must exist prior to adding a member.");
    final Node parentNode = Preconditions.checkNotNull(containedRelationMap.get(parentType), "Type node for member parent must exist prior to adding a member");
    if (willCreateCycle(parentType, memberType)) {
        return new DependenceResult(false, ImmutableSet.<BaseType>of());
    }
    containedRelation.createEdge(memberTypeNode, parentNode);
    final TypeSearch search = new TypeSearch(containedRelationMap.inverse());
    search.start(containedRelation, containedRelationMap.get(parentType));
    return new DependenceResult(true, search.getDependentTypes());
}
Also used : Node(y.base.Node)

Example 27 with Node

use of y.base.Node in project binnavi by google.

the class TypeDependenceGraph method createTypeNode.

// Creates a new type node or returns an existing type node.
private static Node createTypeNode(final BaseType baseType, final Graph graph, final BiMap<BaseType, Node> map) {
    final Node node = map.get(baseType);
    if (node == null) {
        final Node newNode = graph.createNode();
        map.put(baseType, newNode);
        return newNode;
    } else {
        return node;
    }
}
Also used : Node(y.base.Node)

Example 28 with Node

use of y.base.Node in project binnavi by google.

the class ZyGraphNodeBuilder method convertNode.

/**
   * Creates a graph node from a raw node.
   * 
   * @param node The raw node that provides the underlying data.
   * @param graph2D The graph object where the node is created.
   * @param graphSettings Graph settings used to build the graph.
   * 
   * @return The created YNode/NaviNode pair.
   */
public static Pair<Node, NaviNode> convertNode(final INaviViewNode node, final Graph2D graph2D, final ZyGraphViewSettings graphSettings) {
    Preconditions.checkNotNull(node, "IE00909: Node argument can not be null");
    Preconditions.checkNotNull(graph2D, "IE00910: Graph2D argument can not be null");
    // Create the node in the Graph2D
    final Node yNode = createNode(graph2D, node);
    final ZyLabelContent content = ZyGraphNodeBuilder.buildContent(node, graphSettings, null);
    final IZyNodeRealizer realizer = createRealizer(node, content);
    // Associate the user data with the Graph2D node
    final NaviNode zyNode = new NaviNode(yNode, realizer, node);
    realizer.setUserData(new ZyNodeData<NaviNode>(zyNode));
    realizer.updateContentSelectionColor();
    graph2D.setRealizer(yNode, realizer.getRealizer());
    return new Pair<Node, NaviNode>(yNode, zyNode);
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) CTextNode(com.google.security.zynamics.binnavi.disassembly.CTextNode) Node(y.base.Node) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) Pair(com.google.security.zynamics.zylib.general.Pair)

Aggregations

Node (y.base.Node)28 ZyGraphNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.nodes.ZyGraphNode)9 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)8 Edge (y.base.Edge)7 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)5 IViewNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.IViewNode)4 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)4 NaviEdge (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)3 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)3 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)3 CStateChange (com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)3 ZyGraph2DView (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.ZyGraph2DView)3 ZyProximityNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.proximity.ZyProximityNode)3 HashSet (java.util.HashSet)3 LinkedHashMap (java.util.LinkedHashMap)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)2 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)2 ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)2 CallGraphSettingsConfigItem (com.google.security.zynamics.binnavi.config.CallGraphSettingsConfigItem)2 CTextNode (com.google.security.zynamics.binnavi.disassembly.CTextNode)2