buckets.add(new ArrayList<String>()); for (Node node : and.getChildren()) { Set<String> hasVariables = new HashSet<String>(); getVariableNames(hasVariables, node);
private Operator(AST ast) { if (ast != null) { AST child = ast.getFirstChild(); while (child != null) { Node childNode = null; if ("or".equals(child.getText().toLowerCase())) { childNode = new Or(child); } else if ("and".equals(child.getText().toLowerCase())) { childNode = new And(child); } else { childNode = new Variable(child.getText()); } addChild(childNode); child = child.getNextSibling(); } } }
buckets.add(new ArrayList<String>()); for (Node node : and.getChildren()) { Set<String> hasVariables = new HashSet<String>(); getVariableNames(hasVariables, node);
StringBuffer retval = new StringBuffer(); boolean needComma = false; for (Node node : and.getChildren()) { Set<String> hasVariables = new HashSet<String>(); getVariableNames(hasVariables, node);
StringBuffer retval = new StringBuffer(); boolean needComma = false; for (Node node : and.getChildren()) { Set<String> hasVariables = new HashSet<String>(); getVariableNames(hasVariables, node);
rootNode = new Or(ast); } else if ("and".equals(ast.getText().toLowerCase())) { rootNode = new And(ast); } else { rootNode = new Variable(ast.getText());
rootNode = new Or(ast); } else if ("and".equals(ast.getText().toLowerCase())) { rootNode = new And(ast); } else { rootNode = new Variable(ast.getText());
/** * Finds all the codes in a constraint logic that are ANDed in the given constraint logic. * * @param codes codes are added to this * @param node a node to traverse */ protected static void findAndCodes(Set<String> codes, LogicExpression.Node node) { if (node instanceof LogicExpression.Variable) { codes.add(((LogicExpression.Variable) node).getName()); } else if (node instanceof LogicExpression.And) { for (LogicExpression.Node child : ((LogicExpression.And) node).getChildren()) { findAndCodes(codes, child); } } }
private Operator(AST ast) { if (ast != null) { AST child = ast.getFirstChild(); while (child != null) { Node childNode = null; if ("or".equals(child.getText().toLowerCase())) { childNode = new Or(child); } else if ("and".equals(child.getText().toLowerCase())) { childNode = new And(child); } else { childNode = new Variable(child.getText()); } addChild(childNode); child = child.getNextSibling(); } } }
/** * Finds all the codes in a constraint logic that are ANDed in the given constraint logic. * * @param codes codes are added to this * @param node a node to traverse */ protected static void findAndCodes(Set<String> codes, LogicExpression.Node node) { if (node instanceof LogicExpression.Variable) { codes.add(((LogicExpression.Variable) node).getName()); } else if (node instanceof LogicExpression.And) { for (LogicExpression.Node child : ((LogicExpression.And) node).getChildren()) { findAndCodes(codes, child); } } }
/** * {@inheritDoc} */ @Override protected void addChild(Node child) { if (child instanceof And) { for (Node subChild : ((And) child).getChildren()) { addChild(subChild); } } else { super.addChild(child); } } }
/** * {@inheritDoc} */ @Override protected void addChild(Node child) { if (child instanceof And) { for (Node subChild : ((And) child).getChildren()) { addChild(subChild); } } else { super.addChild(child); } } }