aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/storage/query/Condition.java
blob: 50d520bc7d35ed8a5b3241d829a3490ffd05d147 (plain)
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
82
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;
        }
    }

}