/** * Adds all the constraints present in the argument into the given List. * * @param list a List of Constraints, to which to add more entries * @param constraint a Constraint to pick apart */ public static void addToList(List<Constraint> list, Constraint constraint) { if (constraint != null) { if (constraint instanceof ConstraintSet) { if (((ConstraintSet) constraint).getOp() == ConstraintOp.AND) { Set<Constraint> constraints = ((ConstraintSet) constraint).getConstraints(); for (Constraint con : constraints) { addToList(list, con); } } else { list.add(constraint); } } else { list.add(constraint); } } }
/** * Adds all the constraints present in the argument into the given List. * * @param list a List of Constraints, to which to add more entries * @param constraint a Constraint to pick apart */ public static void addToList(List<Constraint> list, Constraint constraint) { if (constraint != null) { if (constraint instanceof ConstraintSet) { if (((ConstraintSet) constraint).getOp() == ConstraintOp.AND) { Set<Constraint> constraints = ((ConstraintSet) constraint).getConstraints(); for (Constraint con : constraints) { addToList(list, con); } } else { list.add(constraint); } } else { list.add(constraint); } } }
/** * {@inheritDoc} */ public List<ResultsRow<Object>> execute(Query q, int start, int limit, boolean optimise, boolean explain, Map<Object, Integer> sequence) throws ObjectStoreException { Constraint where = q.getConstraint(); // we know there will be no results if we ORing or NANDing over an empty constraint set if (where instanceof ConstraintSet) { ConstraintSet where2 = (ConstraintSet) where; if (where2.getConstraints().isEmpty() && (ConstraintOp.NAND.equals(where2.getOp()) || ConstraintOp.OR.equals(where2.getOp()))) { return Collections.emptyList(); } } Connection c = null; try { c = getConnection(); return executeWithConnection(c, q, start, limit, optimise, explain, sequence); } catch (SQLException e) { throw new ObjectStoreException("Could not get connection to database", e); } finally { releaseConnection(c); } }
/** * {@inheritDoc} */ public List<ResultsRow<Object>> execute(Query q, int start, int limit, boolean optimise, boolean explain, Map<Object, Integer> sequence) throws ObjectStoreException { Constraint where = q.getConstraint(); // we know there will be no results if we ORing or NANDing over an empty constraint set if (where instanceof ConstraintSet) { ConstraintSet where2 = (ConstraintSet) where; if (where2.getConstraints().isEmpty() && (ConstraintOp.NAND.equals(where2.getOp()) || ConstraintOp.OR.equals(where2.getOp()))) { return Collections.emptyList(); } } Connection c = null; try { c = getConnection(); return executeWithConnection(c, q, start, limit, optimise, explain, sequence); } catch (SQLException e) { throw new ObjectStoreException("Could not get connection to database", e); } finally { releaseConnection(c); } }
if (con instanceof ConstraintSet) { ConstraintSet cs = (ConstraintSet) con; if (cs.getOp() == ConstraintOp.AND) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.OR) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NOR) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NAND) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); throw new IllegalArgumentException("Invalid operation " + cs.getOp());
if (con instanceof ConstraintSet) { ConstraintSet cs = (ConstraintSet) con; if (cs.getOp() == ConstraintOp.AND) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.OR) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NOR) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NAND) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); throw new IllegalArgumentException("Invalid operation " + cs.getOp());
if (con instanceof ConstraintSet) { ConstraintSet cs = (ConstraintSet) con; if (cs.getOp() == ConstraintOp.AND) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.OR) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NOR) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NAND) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); throw new IllegalArgumentException("Invalid operation " + cs.getOp());
if (con instanceof ConstraintSet) { ConstraintSet cs = (ConstraintSet) con; if (cs.getOp() == ConstraintOp.AND) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.OR) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NOR) { boolean retval = false; Iterator<Constraint> csIter = cs.getConstraints().iterator(); } else if (cs.getOp() == ConstraintOp.NAND) { boolean retval = true; Iterator<Constraint> csIter = cs.getConstraints().iterator(); throw new IllegalArgumentException("Invalid operation " + cs.getOp());
if (c instanceof BagConstraint) { ((ConstraintSet) con).removeConstraint(c); if (cs.getOp().equals(ConstraintOp.OR)) { nodes.put((QueryEvaluable) ((BagConstraint) c).getQueryNode(), cs); } else {
if (c instanceof BagConstraint) { ((ConstraintSet) con).removeConstraint(c); if (cs.getOp().equals(ConstraintOp.OR)) { nodes.put((QueryEvaluable) ((BagConstraint) c).getQueryNode(), cs); } else {
throw new ObjectStoreException("Unknown ContainsConstraint safeness: " + safeness); ConstraintOp op = c.getOp(); boolean negate = (op == ConstraintOp.NAND) || (op == ConstraintOp.NOR); boolean disjunctive = (op == ConstraintOp.OR) || (op == ConstraintOp.NOR);
throw new ObjectStoreException("Unknown ContainsConstraint safeness: " + safeness); ConstraintOp op = c.getOp(); boolean negate = (op == ConstraintOp.NAND) || (op == ConstraintOp.NOR); boolean disjunctive = (op == ConstraintOp.OR) || (op == ConstraintOp.NOR);
Constraint con = constraints.removeFirst(); if ((con instanceof ConstraintSet) && ((ConstraintSet) con).getOp().equals(ConstraintOp.AND)) { constraints.addAll(0, ((ConstraintSet) con).getConstraints()); } else {
Constraint con = constraints.removeFirst(); if ((con instanceof ConstraintSet) && ((ConstraintSet) con).getOp().equals(ConstraintOp.AND)) { constraints.addAll(0, ((ConstraintSet) con).getConstraints()); } else {
ConstraintOp op = c.getOp(); boolean negate = (op == ConstraintOp.NAND) || (op == ConstraintOp.NOR); boolean disjunctive = (op == ConstraintOp.OR) || (op == ConstraintOp.NOR);
ConstraintOp op = c.getOp(); boolean negate = (op == ConstraintOp.NAND) || (op == ConstraintOp.NOR); boolean disjunctive = (op == ConstraintOp.OR) || (op == ConstraintOp.NOR);
ConstraintSet newC = new ConstraintSet(origC.getOp()); for (Constraint con : origC.getConstraints()) { newC.addConstraint((Constraint) cloneThing(con, fromElementMap, qopeMap));
ConstraintSet newC = new ConstraintSet(origC.getOp()); for (Constraint con : origC.getConstraints()) { newC.addConstraint((Constraint) cloneThing(con, fromElementMap, qopeMap));