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