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 org.openrdf.model.Value;
09:
10: /**
11: * A ValueExpr with a constant value.
12: */
13: public class ValueConstant extends QueryModelNodeBase implements
14: ValueExpr {
15:
16: /*-----------*
17: * Variables *
18: *-----------*/
19:
20: private Value value;
21:
22: /*--------------*
23: * Constructors *
24: *--------------*/
25:
26: public ValueConstant() {
27: }
28:
29: public ValueConstant(Value value) {
30: setValue(value);
31: }
32:
33: /*---------*
34: * Methods *
35: *---------*/
36:
37: public Value getValue() {
38: return value;
39: }
40:
41: public void setValue(Value value) {
42: assert value != null : "value must not be null";
43: this .value = value;
44: }
45:
46: public <X extends Exception> void visit(QueryModelVisitor<X> visitor)
47: throws X {
48: visitor.meet(this );
49: }
50:
51: @Override
52: public String getSignature() {
53: StringBuilder sb = new StringBuilder(64);
54:
55: sb.append(super .getSignature());
56: sb.append(" (value=");
57: sb.append(value.toString());
58: sb.append(")");
59:
60: return sb.toString();
61: }
62:
63: @Override
64: public ValueConstant clone() {
65: return (ValueConstant) super.clone();
66: }
67: }
|