private NodeLevelMap levelToNodesMap(ValueStreamMap valueStreamMap) { NodeLevelMap nodeLevelMap = new NodeLevelMap(); Collection<Node> nodes = valueStreamMap.allNodes(); for (Node node : nodes) { nodeLevelMap.add(node); } return nodeLevelMap; }
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); }