Ejemplo n.º 1
0
 private int getMaxLevelOfParent(EntityNode node) {
   int max = -1;
   for (EntityNode parent : node.getParent()) {
     if (max < parent.getLevel()) {
       max = parent.getLevel();
     }
   }
   return max;
 }
Ejemplo n.º 2
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;
      }
    }
  }
Ejemplo n.º 3
0
 @Override
 public int compare(EntityNode o1, EntityNode o2) {
   return o1.getLevel() - o2.getLevel();
 }