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;
}
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);
}
}
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);
}
}
Aggregations