@Override public void setFile(String file) throws IOException { this.currentFile = file; init(); attributeList = new Vector<String>(); variableList = new Vector<String>(); List<Group> groups = new ArrayList<Group>(); groups.add(root); parseAttributesAndVariables(groups); }
@Override public void setFile(String file) throws IOException { this.currentFile = file; init(); attributeList = new Vector<String>(); variableList = new Vector<String>(); List<Group> groups = new ArrayList<Group>(); groups.add(root); parseAttributesAndVariables(groups); }
/** * Recursively parses attribute and variable paths, filling * <code>attributeList</code> and <code>variableList</code>. * @param groups List of groups to recursively parse. */ private void parseAttributesAndVariables(List<Group> groups) { for (Group group : groups) { String groupName = group.getName(); List<Attribute> attributes = group.getAttributes(); for (Attribute attribute : attributes) { String attributeName = attribute.getName(); if (!groupName.endsWith("/")) attributeName = "/" + attributeName; attributeList.add(groupName + attributeName); } List<Variable> variables = group.getVariables(); for (Variable variable : variables) { String variableName = variable.getName(); if (!groupName.endsWith("/")) variableName = "/" + variableName; variableList.add(variableName); } groups = group.getGroups(); parseAttributesAndVariables(groups); } }
/** * Recursively parses attribute and variable paths, filling * <code>attributeList</code> and <code>variableList</code>. * @param groups List of groups to recursively parse. */ private void parseAttributesAndVariables(List<Group> groups) { for (Group group : groups) { String groupName = group.getName(); List<Attribute> attributes = group.getAttributes(); for (Attribute attribute : attributes) { String attributeName = attribute.getName(); if (!groupName.endsWith("/")) attributeName = "/" + attributeName; attributeList.add(groupName + attributeName); } List<Variable> variables = group.getVariables(); for (Variable variable : variables) { String variableName = variable.getName(); if (!groupName.endsWith("/")) variableName = "/" + variableName; variableList.add(variableName); } groups = group.getGroups(); parseAttributesAndVariables(groups); } }