Search in sources :

Example 1 with ITextNode

use of com.google.security.zynamics.zylib.gui.zygraph.nodes.ITextNode 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 2 with ITextNode

use of com.google.security.zynamics.zylib.gui.zygraph.nodes.ITextNode 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

IGroupNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.IGroupNode)2 ITextNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.ITextNode)2 ViewNodeAdapter (com.google.security.zynamics.zylib.gui.zygraph.wrappers.ViewNodeAdapter)2