Examples of SuccessorsMap


Examples of com.google.devtools.depan.view.SuccessorsMap

  // TODO(leeca):  Move this to
  // RelationFinder.computeSuccessorHierarchy(Collection<Edge<? extends Element>>)
  public Map<GraphNode, ? extends SuccessorEdges>
      computeSuccessorHierarchy(RelationFinder relations) {

    SuccessorsMap builder = new SuccessorsMap();

    // Only include nodes that participate in the relations.
    for (GraphEdge edge : getEdges()) {
      if (relations.match(edge.getRelation())) {
        builder.addForwardEdge(edge);
      }
    }
    return builder.getSuccessorMap();
  }
View Full Code Here

Examples of com.google.devtools.depan.view.SuccessorsMap

  // TODO(leeca):  Move this to
  // RelationFinder.computeSuccessorHierarchy(Collection<Edge<? extends Element>>)
  public Map<GraphNode, ? extends SuccessorEdges>
      computeSuccessorHierarchy(DirectedRelationFinder relations) {

    SuccessorsMap builder = new SuccessorsMap();

    // Only include nodes that participate in the relations.
    for (GraphEdge edge : getEdges()) {
      if (relations.matchForward(edge.getRelation())) {
        builder.addForwardEdge(edge);
      }
      else if (relations.matchBackward(edge.getRelation())) {
        builder.addReverseEdge(edge);
      }
    }
    return builder.getSuccessorMap();
  }
View Full Code Here

Examples of com.google.devtools.depan.view.SuccessorsMap

  // TODO(leeca):  Move this to
  // RelationFinder.computeSuccessorHierarchy(Collection<Edge<? extends Element>>)
  public Map<GraphNode, ? extends SuccessorEdges>
      computeSpanningHierarchy(DirectedRelationFinder relations) {

    SuccessorsMap builder = new SuccessorsMap();

    Set<GraphNode> visited = Sets.newHashSet();

    // Only include nodes that participate in the relations.
    for (GraphEdge edge : getEdges()) {

      // On forward matches, include the link only
      // if the tail has not yet been visited.
      if (relations.matchForward(edge.getRelation())) {
        if (false == visited.contains((edge.getTail()))) {
          builder.addForwardEdge(edge);
          visited.add((edge.getTail()));
        }
      }

      // For spanning hierarchies, each edge gets added only once.
      // And the forward direction is preferred if both are allowed.
      // On reverse matches, include the link only
      // if the head has not yet been visited.
      else if (relations.matchBackward(edge.getRelation())) {
        if (false == visited.contains((edge.getHead()))) {
          builder.addReverseEdge(edge);
          visited.add((edge.getHead()));
        }
      }
    }
    return builder.getSuccessorMap();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.