private TupleExpr joinOrExpr(BinaryTupleOperator theExpr) { if (theExpr.getLeftArg() != null && theExpr.getRightArg() == null) { return theExpr.getLeftArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() != null) { return theExpr.getRightArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() == null) { return null; } else { return theExpr; } }
/** * Creates a new binary tuple operator. * * @param leftArg * The operator's left argument, must not be <tt>null</tt>. * @param rightArg * The operator's right argument, must not be <tt>null</tt>. */ public BinaryTupleOperator(TupleExpr leftArg, TupleExpr rightArg) { setLeftArg(leftArg); setRightArg(rightArg); }
@Override public Difference clone() { return (Difference)super.clone(); } }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { if (node.getLeftArg() == former) { if (replacement == null) { replaceNode(node, node.getRightArg()); } else { node.setLeftArg((TupleExpr)replacement); } } else { assert former == node.getRightArg(); if (replacement == null) { replaceNode(node, node.getLeftArg()); } else { node.setRightArg((TupleExpr)replacement); } } }
/** * Gets the {@link Side} the current node in the visitor is on relative to the provided node. * @param node - The node used to determine the side of the current visitor node. * @return The {@link Side} the current node is on. */ private Optional<Side> getSide(final QueryModelNode node) { // if query parent is a binary operator, need to determine if it's left or right. if (node.getParentNode() instanceof BinaryTupleOperator) { final BinaryTupleOperator binary = (BinaryTupleOperator) node.getParentNode(); if (node.equals(binary.getLeftArg())) { return Optional.of(Side.LEFT); } else { return Optional.of(Side.RIGHT); } } else { return Optional.empty(); } }
@Override public int hashCode() { return super.hashCode() ^ "Join".hashCode(); }
@Override public boolean equals(Object other) { return other instanceof Intersection && super.equals(other); }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (condition == current) { setCondition((ValueExpr)replacement); } else { super.replaceChildNode(current, replacement); } }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { if (node.getLeftArg() == former) { if (replacement == null) { replaceNode(node, node.getRightArg()); } else { node.setLeftArg((TupleExpr)replacement); } } else { assert former == node.getRightArg(); if (replacement == null) { replaceNode(node, node.getLeftArg()); } else { node.setRightArg((TupleExpr)replacement); } } }
@Override public int hashCode() { return super.hashCode() ^ "Intersection".hashCode(); }
@Override public boolean equals(Object other) { return other instanceof Union && super.equals(other); }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (condition == current) { setCondition((ValueExpr)replacement); } else { super.replaceChildNode(current, replacement); } }
@Override public BinaryTupleOperator clone() { BinaryTupleOperator clone = (BinaryTupleOperator)super.clone(); clone.setLeftArg(getLeftArg().clone()); clone.setRightArg(getRightArg().clone()); return clone; } }
private TupleExpr joinOrExpr(BinaryTupleOperator theExpr) { if (theExpr.getLeftArg() != null && theExpr.getRightArg() == null) { return theExpr.getLeftArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() != null) { return theExpr.getRightArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() == null) { return null; } else { return theExpr; } }
/** * Creates a new binary tuple operator. * * @param leftArg * The operator's left argument, must not be <tt>null</tt>. * @param rightArg * The operator's right argument, must not be <tt>null</tt>. */ public BinaryTupleOperator(TupleExpr leftArg, TupleExpr rightArg) { setLeftArg(leftArg); setRightArg(rightArg); }
@Override public int hashCode() { return super.hashCode() ^ "Union".hashCode(); }
@Override public Intersection clone() { return (Intersection)super.clone(); } }
@Override public boolean equals(Object other) { return other instanceof Join && super.equals(other); }
@Override public BinaryTupleOperator clone() { BinaryTupleOperator clone = (BinaryTupleOperator)super.clone(); clone.setLeftArg(getLeftArg().clone()); clone.setRightArg(getRightArg().clone()); return clone; } }
private TupleExpr joinOrExpr(BinaryTupleOperator theExpr) { if (theExpr.getLeftArg() != null && theExpr.getRightArg() == null) { return theExpr.getLeftArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() != null) { return theExpr.getRightArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() == null) { return null; } else { return theExpr; } }