01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc.sql.exp;
12:
13: import com.versant.core.jdbc.sql.SqlDriver;
14: import com.versant.core.util.CharBuf;
15:
16: import java.util.Map;
17:
18: /**
19: * This is an entry in an order by list.
20: */
21: public class OrderExp extends UnaryExp {
22:
23: private boolean desc;
24:
25: public OrderExp(SqlExp child, boolean desc) {
26: super (child);
27: this .desc = desc;
28: }
29:
30: public OrderExp() {
31: }
32:
33: public SqlExp createInstance() {
34: return new OrderExp();
35: }
36:
37: public SqlExp getClone(SqlExp clone, Map cloneMap) {
38: super .getClone(clone, cloneMap);
39:
40: ((OrderExp) clone).desc = desc;
41:
42: return clone;
43: }
44:
45: public String toString() {
46: return super .toString() + (desc ? " desc" : "");
47: }
48:
49: /**
50: * Append SQL for this node to s.
51: *
52: * @param driver The driver being used
53: * @param s Append the SQL here
54: * @param leftSibling
55: */
56: public void appendSQLImp(SqlDriver driver, CharBuf s,
57: SqlExp leftSibling) {
58: super .appendSQLImp(driver, s, leftSibling);
59: if (desc)
60: s.append(" DESC");
61: }
62:
63: public boolean isDesc() {
64: return desc;
65: }
66: }
|