aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/storage/query/Condition.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/storage/query/Condition.java')
-rw-r--r--src/main/java/org/traccar/storage/query/Condition.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/storage/query/Condition.java b/src/main/java/org/traccar/storage/query/Condition.java
new file mode 100644
index 000000000..50d520bc7
--- /dev/null
+++ b/src/main/java/org/traccar/storage/query/Condition.java
@@ -0,0 +1,83 @@
+package org.traccar.storage.query;
+
+public interface Condition {
+
+ class Equals implements Condition {
+ private final String column;
+ private final String variable;
+ private final Object value;
+
+ public Equals(String column, String variable, Object value) {
+ this.column = column;
+ this.variable = variable;
+ this.value = value;
+ }
+
+ public String getColumn() {
+ return column;
+ }
+
+ public String getVariable() {
+ return variable;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+ }
+
+ class Between implements Condition {
+ private final String column;
+ private final String fromVariable;
+ private final Object fromValue;
+ private final String toVariable;
+ private final Object toValue;
+
+ public Between(String column, String fromVariable, Object fromValue, String toVariable, Object toValue) {
+ this.column = column;
+ this.fromVariable = fromVariable;
+ this.fromValue = fromValue;
+ this.toVariable = toVariable;
+ this.toValue = toValue;
+ }
+
+ public String getColumn() {
+ return column;
+ }
+
+ public String getFromVariable() {
+ return fromVariable;
+ }
+
+ public Object getFromValue() {
+ return fromValue;
+ }
+
+ public String getToVariable() {
+ return toVariable;
+ }
+
+ public Object getToValue() {
+ return toValue;
+ }
+ }
+
+ class And implements Condition {
+ private final Condition first;
+ private final Condition second;
+
+ public And(Condition first, Condition second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ public Condition getFirst() {
+ return first;
+ }
+
+ public Condition getSecond() {
+ return second;
+ }
+ }
+
+}