private static QueryCriteria parseStatement(LinkedList<String> postFixStatement)
throws QueryFormulationException {
Stack<QueryCriteria> stack = new Stack<QueryCriteria>();
for (String item : postFixStatement) {
if (item.equals("AND")) {
BooleanQueryCriteria bQC = new BooleanQueryCriteria();
bQC.addTerm(stack.pop());
bQC.addTerm(stack.pop());
stack.push(bQC);
} else if (item.equals("OR")) {
BooleanQueryCriteria bQC = new BooleanQueryCriteria();
bQC.setOperator(BooleanQueryCriteria.OR);
bQC.addTerm(stack.pop());
bQC.addTerm(stack.pop());
stack.push(bQC);
} else if (item.equals("NOT")) {
BooleanQueryCriteria bQC = new BooleanQueryCriteria();
bQC.setOperator(BooleanQueryCriteria.NOT);
bQC.addTerm(stack.pop());
stack.push(bQC);
} else {
stack.push(new Expression(item).convertToQueryCriteria());
}
}