当前位置: 首页>>代码示例>>Java>>正文


Java Node.inEdges方法代码示例

本文整理汇总了Java中y.base.Node.inEdges方法的典型用法代码示例。如果您正苦于以下问题:Java Node.inEdges方法的具体用法?Java Node.inEdges怎么用?Java Node.inEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在y.base.Node的用法示例。


在下文中一共展示了Node.inEdges方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: willCreateCycle

import y.base.Node; //导入方法依赖的package包/类
/**
 * Tests if adding a member of type memberType to containingType would create a cyclic type
 * declaration.
 *
 * @param containingType The base type that contains memberType.
 * @param memberType The base type of a member contained in containingType.
 * @return Returns whether adding memberType to containingType would create a cyclic type
 *         declaration.
 */
public boolean willCreateCycle(final BaseType containingType, final BaseType memberType) {
  Preconditions.checkNotNull(containingType, "Error: Containing type can not be null.");
  Preconditions.checkNotNull(memberType, "Error: Member type can not be null.");
  if (containingType == memberType) {
    return true;
  }
  // 0) The pre-condition is that the existing graph is cycle free.
  // 1) Contained types is the set of types that are explicitly and implicitly contained within
  // the structure this member belongs to.
  // 2) The intersection of this set and all types that are contained by parentType must be empty.
  // TODO(jannewger): instead of creating a copy, the implementation for determining dependent
  // types should be parameterizable whether to include the contained type or not.
  final Set<BaseType> containedTypes = Sets.newHashSet(determineDependentTypes(containingType));
  containedTypes.remove(containingType);
  final Node startNode = containedRelationMap.get(memberType);
  final Queue<Edge> edgesToVisit = new LinkedList<Edge>();
  for (final EdgeCursor ec = startNode.inEdges(); ec.ok(); ec.next()) {
    edgesToVisit.add((Edge) ec.current());
  }
  final Set<Node> visitednodes = new HashSet<Node>();
  while (!edgesToVisit.isEmpty()) {
    final Edge currentEdge = edgesToVisit.poll();
    final Node nextNode = currentEdge.source();
    final BaseType baseType = containedRelationMap.inverse().get(nextNode);
    if (containedTypes.contains(baseType)) {
      return true;
    }
    if (!visitednodes.contains(nextNode)) {
      for (final EdgeCursor ec = nextNode.inEdges(); ec.ok(); ec.next()) {
        edgesToVisit.add((Edge) ec.current());
      }
    }
    visitednodes.add(nextNode);
  }
  return false;
}
 
开发者ID:google,项目名称:binnavi,代码行数:46,代码来源:TypeDependenceGraph.java

示例2: EdgeCursorProxyIterator

import y.base.Node; //导入方法依赖的package包/类
EdgeCursorProxyIterator(final Node node, final boolean incoming) {
  if (incoming) {
    m_edgecursor = node.inEdges();
  } else {
    m_edgecursor = node.outEdges();
  }
  if (m_edgecursor.ok()) {
    m_hasNext = true;
    m_edgecursor.toLast();
    m_last = (Edge) m_edgecursor.current();
    m_edgecursor.toFirst();
  } else {
    m_hasNext = false;
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:16,代码来源:CReilInstructionGraph.java

示例3: closeGroup

import y.base.Node; //导入方法依赖的package包/类
/**
 * Closes a group node.
 * 
 * @param graph The graph the group node belongs to.
 * @param groupNode The group node to be closed.
 */
public static void closeGroup(final Graph2D graph, final Node groupNode) {
  Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
  Preconditions.checkNotNull(groupNode, "Error: Group node argument can not be null");

  final HierarchyManager hierarchy = graph.getHierarchyManager();

  final double w = graph.getWidth(groupNode);
  final double h = graph.getHeight(groupNode);

  final NodeList groupNodes = new NodeList();
  groupNodes.add(groupNode);

  graph.firePreEvent();
  for (final NodeCursor nc = groupNodes.nodes(); nc.ok(); nc.next()) {
    hierarchy.closeGroup(nc.node());
  }
  graph.firePostEvent();

  // if the node size has changed, delete source ports of out-edges
  // and target ports of in-edges to ensure that all edges still connect
  // to the node
  if ((w != graph.getWidth(groupNode)) || (h != graph.getHeight(groupNode))) {
    for (final EdgeCursor ec = groupNode.outEdges(); ec.ok(); ec.next()) {
      graph.setSourcePointRel(ec.edge(), YPoint.ORIGIN);
    }
    for (final EdgeCursor ec = groupNode.inEdges(); ec.ok(); ec.next()) {
      graph.setTargetPointRel(ec.edge(), YPoint.ORIGIN);
    }
  }

  graph.updateViews();

}
 
开发者ID:google,项目名称:binnavi,代码行数:40,代码来源:YHelpers.java

示例4: openFolder

import y.base.Node; //导入方法依赖的package包/类
/**
 * Opens a folder node.
 * 
 * @param graph The graph the folder node belongs to.
 * @param folderNode The folder node to be opened.
 */
public static void openFolder(final Graph2D graph, final Node folderNode) {
  Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
  Preconditions.checkNotNull(folderNode, "Error: Folder node argument can not be null");

  final HierarchyManager hierarchy = graph.getHierarchyManager();

  final double w = graph.getWidth(folderNode);
  final double h = graph.getHeight(folderNode);

  final NodeList folderNodes = new NodeList();
  folderNodes.add(folderNode);

  graph.firePreEvent();

  for (final NodeCursor nc = folderNodes.nodes(); nc.ok(); nc.next()) {
    // get original location of folder node
    final Graph2D innerGraph = (Graph2D) hierarchy.getInnerGraph(nc.node());
    final YPoint folderP = graph.getLocation(nc.node());
    final NodeList innerNodes = new NodeList(innerGraph.nodes());

    hierarchy.openFolder(nc.node());

    // get new location of group node
    final Rectangle2D.Double gBox = graph.getRealizer(nc.node()).getBoundingBox();
    // move grouped nodes to former location of folder node
    LayoutTool.moveSubgraph(graph, innerNodes.nodes(), folderP.x - gBox.x, folderP.y - gBox.y);
  }
  graph.firePostEvent();

  graph.unselectAll();
  for (final NodeCursor nc = folderNodes.nodes(); nc.ok(); nc.next()) {
    graph.setSelected(nc.node(), true);
  }

  // if the node size has changed, delete source ports of out-edges
  // and target ports of in-edges to ensure that all edges still connect
  // to the node
  if ((w != graph.getWidth(folderNode)) || (h != graph.getHeight(folderNode))) {
    for (final EdgeCursor ec = folderNode.outEdges(); ec.ok(); ec.next()) {
      graph.setSourcePointRel(ec.edge(), YPoint.ORIGIN);
    }
    for (final EdgeCursor ec = folderNode.inEdges(); ec.ok(); ec.next()) {
      graph.setTargetPointRel(ec.edge(), YPoint.ORIGIN);
    }
  }

  graph.updateViews();
}
 
开发者ID:google,项目名称:binnavi,代码行数:55,代码来源:YHelpers.java


注:本文中的y.base.Node.inEdges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。