forked from oracle/pgql-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphQuery.java
116 lines (92 loc) · 2.45 KB
/
GraphQuery.java
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**
* Copyright (C) 2013 - 2017 Oracle and/or its affiliates. All rights reserved.
*/
package oracle.pgql.lang.ir;
import java.util.Objects;
import static oracle.pgql.lang.ir.PgqlUtils.printPgqlString;
public class GraphQuery {
private final Projection projection;
private final String inputGraphName;
private final GraphPattern graphPattern;
private final GroupBy groupBy;
private final OrderBy orderBy;
private final QueryExpression limit;
private final QueryExpression offset;
/**
* Constructor
*/
public GraphQuery(Projection projection, String inputGraphName, GraphPattern graphPattern, GroupBy groupBy,
OrderBy orderBy, QueryExpression limit, QueryExpression offset) {
this.projection = projection;
this.inputGraphName = inputGraphName;
this.graphPattern = graphPattern;
this.groupBy = groupBy;
this.orderBy = orderBy;
this.limit = limit;
this.offset = offset;
}
public Projection getProjection() {
return projection;
}
public String getInputGraphName() {
return inputGraphName;
}
public GraphPattern getGraphPattern() {
return graphPattern;
}
public GroupBy getGroupBy() {
return groupBy;
}
public OrderBy getOrderBy() {
return orderBy;
}
public QueryExpression getLimit() {
return limit;
}
public QueryExpression getOffset() {
return offset;
}
@Override
public String toString() {
return printPgqlString(this);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GraphQuery that = (GraphQuery) o;
if (!Objects.equals(limit, that.limit)) {
return false;
}
if (!Objects.equals(offset, that.offset)) {
return false;
}
if (!projection.equals(that.projection)) {
return false;
}
if (!graphPattern.equals(that.graphPattern)) {
return false;
}
if (!groupBy.equals(that.groupBy)) {
return false;
}
return orderBy.equals(that.orderBy);
}
@Override
public int hashCode() {
int result = projection.hashCode();
result = 31 * result + graphPattern.hashCode();
result = 31 * result + groupBy.hashCode();
result = 31 * result + orderBy.hashCode();
result = 31 * result + limit.hashCode();
result = 31 * result + offset.hashCode();
return result;
}
public void accept(QueryExpressionVisitor v) {
v.visit(this);
}
}