* Contains the current set of completed nodes. This is a workspace for the
* parser.
*/
- private LinkedList nodeStack = new LinkedList();
+ private LinkedList<Node> nodeStack = new LinkedList<Node>();
/**
* Contains operator nodes that don't yet have values. This is a workspace
* for the parser.
*/
- private LinkedList oppStack = new LinkedList();
+ private LinkedList<OppNode> oppStack = new LinkedList<OppNode>();
/**
* The root node after the expression has been parsed.
*/
}
while (true) {
if (oppStack.size() == 0) break;
- OppNode top = (OppNode)oppStack.get(0);
+ OppNode top = oppStack.get(0);
// If the top is a spacer then don't pop
// anything
if (top == null) break;
*/
private void resolveGroup() {
OppNode top = null;
- while ((top = (OppNode)oppStack.remove(0)) != null) {
+ while ((top = oppStack.remove(0)) != null) {
// Let it fill its branches
top.popValues(nodeStack);
// Stick it on the resolved node stack
if (oppStack.size() != 0) {
throw new ParseException("Unused opp nodes exist.", et.getIndex());
}
- root = (Node)nodeStack.get(0);
+ root = nodeStack.get(0);
}
/**
* Lets the node pop its own branch nodes off the front of the
* specified list. The default pulls two.
*/
- public void popValues(List values) {
- right = (Node)values.remove(0);
- left = (Node)values.remove(0);
+ public void popValues(List<Node> values) {
+ right = values.remove(0);
+ left = values.remove(0);
}
}
private final class NotNode extends OppNode {
/**
* Overridden to pop only one value.
*/
- public void popValues(List values) {
- left = (Node)values.remove(0);
+ public void popValues(List<Node> values) {
+ left = values.remove(0);
}
* @param variableNames
* the collection to add to
*/
- public void addVariableNames(Collection variableNames);
+ public void addVariableNames(Collection<String> variableNames);
public String getVariableValue(String name);
}
- public Collection getVariableNames() {
- Set variableNames = new HashSet();
+ public Collection<String> getVariableNames() {
+ Set<String> variableNames = new HashSet<String>();
//These built-in variables are supplied by the mediator ( if not
// over-written by
// the user ) and always exist
variableNames.add("LAST_MODIFIED");
ssiExternalResolver.addVariableNames(variableNames);
//Remove any variables that are reserved by this class
- Iterator iter = variableNames.iterator();
+ Iterator<String> iter = variableNames.iterator();
while (iter.hasNext()) {
- String name = (String)iter.next();
+ String name = iter.next();
if (isNameReserved(name)) {
iter.remove();
}
String errorMessage = ssiMediator.getConfigErrMsg();
writer.write(errorMessage);
} else {
- Collection variableNames = ssiMediator.getVariableNames();
- Iterator iter = variableNames.iterator();
+ Collection<String> variableNames = ssiMediator.getVariableNames();
+ Iterator<String> iter = variableNames.iterator();
while (iter.hasNext()) {
- String variableName = (String)iter.next();
+ String variableName = iter.next();
String variableValue = ssiMediator
.getVariableValue(variableName);
//This shouldn't happen, since all the variable names must
protected final static String COMMAND_END = "-->";
protected final static int BUFFER_SIZE = 4096;
protected SSIExternalResolver ssiExternalResolver;
- protected HashMap commands = new HashMap();
+ protected HashMap<String,SSICommand> commands =
+ new HashMap<String,SSICommand>();
protected int debug;
// change
// during the loop
String configErrMsg = ssiMediator.getConfigErrMsg();
- SSICommand ssiCommand = (SSICommand)commands
- .get(strCmd.toLowerCase());
+ SSICommand ssiCommand =
+ commands.get(strCmd.toLowerCase());
String errorMessage = null;
if (ssiCommand == null) {
errorMessage = "Unknown command: " + strCmd;
}
- public void addVariableNames(Collection variableNames) {
+ public void addVariableNames(Collection<String> variableNames) {
for (int i = 0; i < VARIABLE_NAMES.length; i++) {
String variableName = VARIABLE_NAMES[i];
String variableValue = getVariableValue(variableName);