01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.query.algebra;
07:
08: import java.util.LinkedHashSet;
09: import java.util.Set;
10:
11: /**
12: * The UNION set operator, which return the union of the result sets of two
13: * tuple expressions.
14: */
15: public class Union extends BinaryTupleOperator {
16:
17: /*--------------*
18: * Constructors *
19: *--------------*/
20:
21: public Union() {
22: }
23:
24: /**
25: * Creates a new union operator that operates on the two specified arguments.
26: *
27: * @param leftArg
28: * The left argument of the union operator.
29: * @param rightArg
30: * The right argument of the union operator.
31: */
32: public Union(TupleExpr leftArg, TupleExpr rightArg) {
33: super (leftArg, rightArg);
34: }
35:
36: /*---------*
37: * Methods *
38: *---------*/
39:
40: public Set<String> getBindingNames() {
41: Set<String> bindingNames = new LinkedHashSet<String>(16);
42: bindingNames.addAll(getLeftArg().getBindingNames());
43: bindingNames.addAll(getRightArg().getBindingNames());
44: return bindingNames;
45: }
46:
47: public <X extends Exception> void visit(QueryModelVisitor<X> visitor)
48: throws X {
49: visitor.meet(this );
50: }
51:
52: @Override
53: public Union clone() {
54: return (Union) super.clone();
55: }
56: }
|