Example #1
0
 private NodeLevelMap levelToNodesMap(ValueStreamMap valueStreamMap) {
   NodeLevelMap nodeLevelMap = new NodeLevelMap();
   Collection<Node> nodes = valueStreamMap.allNodes();
   for (Node node : nodes) {
     nodeLevelMap.add(node);
   }
   return nodeLevelMap;
 }
Example #2
0
  public NodeLevelMap apply(ValueStreamMap valueStreamMap) {
    Node rootNode =
        valueStreamMap.getCurrentPipeline() != null
            ? valueStreamMap.getCurrentPipeline()
            : valueStreamMap.getCurrentMaterial();
    rootNode.setLevel(0);

    if (!rootNode.getParents().isEmpty()) {
      assignLevelsToDependencies(rootNode, new Upstream());
    }

    if (!rootNode.getChildren().isEmpty()) {
      assignLevelsToDependencies(rootNode, new Downstream());
    }

    return levelToNodesMap(valueStreamMap);
  }