-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathWindowElement.java
More file actions
81 lines (63 loc) · 1.62 KB
/
Copy pathWindowElement.java
File metadata and controls
81 lines (63 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*-
* #%L
* JSQLParser library
* %%
* Copyright (C) 2004 - 2019 JSQLParser
* %%
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0
* #L%
*/
package net.sf.jsqlparser.expression;
import java.io.Serializable;
import java.util.Locale;
public class WindowElement implements Serializable {
private Type type;
private WindowOffset offset;
private WindowRange range;
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public WindowOffset getOffset() {
return offset;
}
public void setOffset(WindowOffset offset) {
this.offset = offset;
}
public WindowRange getRange() {
return range;
}
public void setRange(WindowRange range) {
this.range = range;
}
@Override
public String toString() {
StringBuilder buffer = new StringBuilder(type.toString());
if (offset != null) {
buffer.append(offset.toString());
} else if (range != null) {
buffer.append(range.toString());
}
return buffer.toString();
}
public WindowElement withType(Type type) {
this.setType(type);
return this;
}
public WindowElement withOffset(WindowOffset offset) {
this.setOffset(offset);
return this;
}
public WindowElement withRange(WindowRange range) {
this.setRange(range);
return this;
}
public enum Type {
ROWS, RANGE;
public static Type from(String type) {
return Enum.valueOf(Type.class, type.toUpperCase(Locale.ROOT));
}
}
}