if (tools == null) {
throw new IllegalStateException(
"You must always set the toolsFile property on a ToolBean");
}
if (state == null) {
return tools;
}
else {
// Return only tools matching the given "state"
List list = new LinkedList();
for (int i = 0; i < tools.length; i++) {
if (tools[i].getStateFlag().equalsIgnoreCase(state)) {
list.add(tools[i]);
}
}
return (Tool[]) list.toArray(new Tool[0]);
}