public Boolean ownsBlock(String name) { for (Block child : children) { if (child.getName().equals(name)) return true; } return false; }
@Override public String toString() { String str = ""; for (Statement statement : statements) str += statement.toString(); for (Block child : children) str += child.getName() + "[" + child.toString() + "]"; return str; }
public Block getBlock(String name) { for (Block child : children) { if (child.getName().equals(name)) return child; } Block block; for (Block child : children) { if ((block = child.getBlock(name)) != null) return block; } return null; }