コード例 #1
0
  private void computeNodeLevel(ActionGraph actionGraph) {
    int max = actionGraph.getAllNodes().size();
    int count = 0;
    while (true && count++ < max) {
      boolean noChange = true;
      for (EntityNode node : actionGraph.getAllNodes()) {
        int maxParentLevel = getMaxLevelOfParent(node);
        int toBeNodeLevel = maxParentLevel + 1;
        if (toBeNodeLevel > node.getLevel()) {
          node.setLevel(toBeNodeLevel);
          noChange = false;
        }
      }

      if (noChange) {
        break;
      }
    }
  }
コード例 #2
0
 private List<EntityNode> getEntityNodeInOrderOfLevelFrom(ActionGraph actionGraph) {
   EntityNode[] arrayData = actionGraph.getAllNodes().toArray(new EntityNode[0]);
   Arrays.sort(arrayData, ENTITY_LEVEL_COMPARATOR);
   return Arrays.asList(arrayData);
 }