Search in sources :

Example 1 with ViewNodeAdapter

use of com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter in project binnavi by google.

the class ProximityRangeCalculator method getParentGroups.

private static <NodeType extends ZyGraphNode<? extends IViewNode<?>>> Set<ViewNodeAdapter> getParentGroups(final NodeType node) {
    final Set<ViewNodeAdapter> parentGroups = new HashSet<ViewNodeAdapter>();
    IGroupNode<?, ?> parentGroup = ((IViewNode<?>) node.getRawNode()).getParentGroup();
    while (parentGroup != null) {
        parentGroups.add(new ViewNodeAdapter(parentGroup));
        parentGroup = parentGroup.getParentGroup();
    }
    return parentGroups;
}
Also used : IViewNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.IViewNode) ViewNodeAdapter(com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with ViewNodeAdapter

use of com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter in project binnavi by google.

the class ProximityRangeCalculator method getSuccessorsInternal.

private static void getSuccessorsInternal(final ViewNodeAdapter node, final int depth, final Set<ViewNodeAdapter> nodes, final HashSet<ViewNodeAdapter> visited) {
    for (final ViewNodeAdapter child : node.getChildren()) {
        if (/* visited.contains(child) || */
        (depth <= 0) && !(child.getNode() instanceof ITextNode)) {
            continue;
        } else if (child.getNode().getParentGroup() != null) {
            IGroupNode<?, ?> previousNode = child.getNode().getParentGroup();
            while (previousNode != null) {
                if (!visited(visited, previousNode)) {
                    final ViewNodeAdapter groupNodeAdapter = new ViewNodeAdapter(previousNode);
                    visited.add(groupNodeAdapter);
                    nodes.add(groupNodeAdapter);
                    previousNode = previousNode.getParentGroup();
                } else {
                    previousNode = null;
                }
            }
        }
        if (NodeHelpers.getVisibleNode(child.getNode()) != child.getNode()) {
            continue;
        }
        visited.add(child);
        nodes.add(child);
        // Silly trick to make attached text nodes visible.
        getPredecessorsInternal(child, -1, nodes, new HashSet<ViewNodeAdapter>());
        getSuccessorsInternal(child, depth - 1, nodes, visited);
    }
}
Also used : ITextNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.ITextNode) IGroupNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.IGroupNode) ViewNodeAdapter(com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter)

Example 3 with ViewNodeAdapter

use of com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter in project binnavi by google.

the class ProximityRangeCalculator method getPredecessorsInternal.

private static void getPredecessorsInternal(final ViewNodeAdapter node, final int depth, final Set<ViewNodeAdapter> nodes, final Set<ViewNodeAdapter> visited) {
    for (final ViewNodeAdapter parent : node.getParents()) {
        if (/* visited.contains(parent) || */
        (depth <= 0) && !(parent.getNode() instanceof ITextNode)) {
            // NH: see getSuccessorsInternal for comment
            continue;
        } else if (parent.getNode().getParentGroup() != null) {
            IGroupNode<?, ?> previousNode = parent.getNode().getParentGroup();
            while (previousNode != null) {
                if (!visited(visited, previousNode)) {
                    final ViewNodeAdapter groupNodeAdapter = new ViewNodeAdapter(previousNode);
                    visited.add(groupNodeAdapter);
                    nodes.add(groupNodeAdapter);
                    previousNode = previousNode.getParentGroup();
                } else {
                    previousNode = null;
                }
            }
        }
        visited.add(parent);
        nodes.add(parent);
        // Silly trick to make the attached text nodes visible
        getSuccessorsInternal(parent, -1, nodes, new HashSet<ViewNodeAdapter>());
        getPredecessorsInternal(parent, depth - 1, nodes, visited);
    }
}
Also used : ITextNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.ITextNode) IGroupNode(com.google.security.zynamics.zylib.gui.zygraph.nodes.IGroupNode) ViewNodeAdapter(com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter)

Aggregations

ViewNodeAdapter (com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter)3 IGroupNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.IGroupNode)2 ITextNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.ITextNode)2 IViewNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.IViewNode)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1