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: public abstract class CompareSubQueryValueOperator extends
09: SubQueryValueOperator {
10:
11: /*-----------*
12: * Variables *
13: *-----------*/
14:
15: protected ValueExpr arg;
16:
17: /*--------------*
18: * Constructors *
19: *--------------*/
20:
21: public CompareSubQueryValueOperator() {
22: }
23:
24: public CompareSubQueryValueOperator(ValueExpr valueExpr,
25: TupleExpr subQuery) {
26: super (subQuery);
27: setArg(valueExpr);
28: }
29:
30: /*---------*
31: * Methods *
32: *---------*/
33:
34: public ValueExpr getArg() {
35: return arg;
36: }
37:
38: public void setArg(ValueExpr arg) {
39: assert arg != null : "arg must not be null";
40: arg.setParentNode(this );
41: this .arg = arg;
42: }
43:
44: @Override
45: public <X extends Exception> void visitChildren(
46: QueryModelVisitor<X> visitor) throws X {
47: arg.visit(visitor);
48: super .visitChildren(visitor);
49: }
50:
51: @Override
52: public void replaceChildNode(QueryModelNode current,
53: QueryModelNode replacement) {
54: if (arg == current) {
55: setArg((ValueExpr) replacement);
56: } else {
57: super .replaceChildNode(current, replacement);
58: }
59: }
60:
61: @Override
62: public CompareSubQueryValueOperator clone() {
63: CompareSubQueryValueOperator clone = (CompareSubQueryValueOperator) super
64: .clone();
65: clone.setArg(getArg().clone());
66: return clone;
67: }
68: }
|