70 public int getDepth() { 71 return depth; 72 } 73 74 public int getIndex() { 75 return index; 76 } 77 78 public T getHeader() { 79 return header; 80 } 81 82 public List<T> getBlocks() { 83 return blocks; 84 } 85 86 public List<T> getExits() { 87 return exits; 88 } 89 90 /** 91 * Determines if one loop is a transitive parent of another loop. 92 * 93 * @param childLoop The loop for which parentLoop might be a transitive parent loop. 94 * @param parentLoop The loop which might be a transitive parent loop of child loop. 95 * @return {@code true} if parentLoop is a (transitive) parent loop of childLoop, {@code false} 96 * otherwise 97 */ 98 public static <T extends AbstractBlockBase<T>> boolean transitiveParentLoop(Loop<T> childLoop, Loop<T> parentLoop) { 99 Loop<T> curr = childLoop; 100 while (curr != null) { 101 if (curr == parentLoop) { 102 return true; 103 } 104 curr = curr.getParent(); 105 } 106 return false; 107 } 108 109 @Override | 70 public int getDepth() { 71 return depth; 72 } 73 74 public int getIndex() { 75 return index; 76 } 77 78 public T getHeader() { 79 return header; 80 } 81 82 public List<T> getBlocks() { 83 return blocks; 84 } 85 86 public List<T> getExits() { 87 return exits; 88 } 89 90 public void addExit(T t) { 91 exits.add(t); 92 } 93 94 /** 95 * Determines if one loop is a transitive parent of another loop. 96 * 97 * @param childLoop The loop for which parentLoop might be a transitive parent loop. 98 * @param parentLoop The loop which might be a transitive parent loop of child loop. 99 * @return {@code true} if parentLoop is a (transitive) parent loop of childLoop, {@code false} 100 * otherwise 101 */ 102 public static <T extends AbstractBlockBase<T>> boolean transitiveParentLoop(Loop<T> childLoop, Loop<T> parentLoop) { 103 Loop<T> curr = childLoop; 104 while (curr != null) { 105 if (curr == parentLoop) { 106 return true; 107 } 108 curr = curr.getParent(); 109 } 110 return false; 111 } 112 113 @Override |