| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.expression.analysis; |
| 7 |
|
| 8 |
/** |
| 9 |
* Window frame exclusion clause. |
| 10 |
*/ |
| 11 |
public enum WindowFrameExclusion { |
| 12 |
|
| 13 |
/** |
| 14 |
* EXCLUDE CURRENT ROW exclusion clause. |
| 15 |
*/ |
| 16 |
EXCLUDE_CURRENT_ROW("EXCLUDE CURRENT ROW"), |
| 17 |
|
| 18 |
/** |
| 19 |
* EXCLUDE GROUP exclusion clause. |
| 20 |
*/ |
| 21 |
EXCLUDE_GROUP("EXCLUDE GROUP"), |
| 22 |
|
| 23 |
/** |
| 24 |
* EXCLUDE TIES exclusion clause. |
| 25 |
*/ |
| 26 |
EXCLUDE_TIES("EXCLUDE TIES"), |
| 27 |
|
| 28 |
/** |
| 29 |
* EXCLUDE NO OTHERS exclusion clause. |
| 30 |
*/ |
| 31 |
EXCLUDE_NO_OTHERS("EXCLUDE NO OTHERS"), |
| 32 |
|
| 33 |
; |
| 34 |
|
| 35 |
private final String sql; |
| 36 |
|
| 37 |
private WindowFrameExclusion(String sql) { |
| 38 |
this.sql = sql; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns true if this exclusion clause excludes or includes the whole |
| 43 |
* group. |
| 44 |
* |
| 45 |
* @return true if this exclusion clause is {@link #EXCLUDE_GROUP} or |
| 46 |
* {@link #EXCLUDE_NO_OTHERS} |
| 47 |
*/ |
| 48 |
public boolean isGroupOrNoOthers() { |
| 49 |
return this == WindowFrameExclusion.EXCLUDE_GROUP || this == EXCLUDE_NO_OTHERS; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Returns SQL representation. |
| 54 |
* |
| 55 |
* @return SQL representation. |
| 56 |
* @see org.h2.expression.Expression#getSQL(int) |
| 57 |
*/ |
| 58 |
public String getSQL() { |
| 59 |
return sql; |
| 60 |
} |
| 61 |
|
| 62 |
} |