-
Notifications
You must be signed in to change notification settings - Fork 24.3k
/
Equals.java
39 lines (32 loc) · 1.42 KB
/
Equals.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
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.sql.expression.predicate.operator.comparison;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.predicate.BinaryOperator;
import org.elasticsearch.xpack.sql.expression.predicate.operator.comparison.BinaryComparisonProcessor.BinaryComparisonOperation;
import org.elasticsearch.xpack.sql.tree.Location;
import org.elasticsearch.xpack.sql.tree.NodeInfo;
public class Equals extends BinaryComparison implements BinaryOperator.Negateable {
public Equals(Location location, Expression left, Expression right) {
super(location, left, right, BinaryComparisonOperation.EQ);
}
@Override
protected NodeInfo<Equals> info() {
return NodeInfo.create(this, Equals::new, left(), right());
}
@Override
protected Equals replaceChildren(Expression newLeft, Expression newRight) {
return new Equals(location(), newLeft, newRight);
}
@Override
public Equals swapLeftAndRight() {
return new Equals(location(), right(), left());
}
@Override
public BinaryOperator<?, ?, ?, ?> negate() {
return new NotEquals(location(), left(), right());
}
}