提交 b4fb5f79 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Split and rename getters of subexpressions

上级 e647b73b
......@@ -525,22 +525,22 @@ public abstract class Query extends Prepared {
}
if (expr instanceof Operation) {
Operation operation = (Operation) expr;
Expression right = operation.getExpression(false);
return checkOrderOther(session, operation.getExpression(true), expressionSQL)
Expression right = operation.getRightSubExpression();
return checkOrderOther(session, operation.getLeftSubExpression(), expressionSQL)
&& (right == null || checkOrderOther(session, right, expressionSQL));
}
if (expr instanceof ConditionAndOr) {
ConditionAndOr condition = (ConditionAndOr) expr;
return checkOrderOther(session, condition.getExpression(true), expressionSQL)
&& checkOrderOther(session, condition.getExpression(false), expressionSQL);
return checkOrderOther(session, condition.getLeftSubExpression(), expressionSQL)
&& checkOrderOther(session, condition.getRightSubExpression(), expressionSQL);
}
if (expr instanceof ConditionNot) {
return checkOrderOther(session, ((ConditionNot) expr).getCondition(), expressionSQL);
return checkOrderOther(session, ((ConditionNot) expr).getSubCondition(), expressionSQL);
}
if (expr instanceof Comparison) {
Comparison condition = (Comparison) expr;
return checkOrderOther(session, condition.getExpression(true), expressionSQL)
&& checkOrderOther(session, condition.getExpression(false), expressionSQL);
return checkOrderOther(session, condition.getLeftSubExpression(), expressionSQL)
&& checkOrderOther(session, condition.getRightSubExpression(), expressionSQL);
}
return false;
}
......
......@@ -597,14 +597,21 @@ public class Comparison extends Condition {
}
/**
* Get the left or the right sub-expression of this condition.
* Get the left sub-expression of this condition.
*
* @param getLeft true to get the left sub-expression, false to get the
* right sub-expression.
* @return the sub-expression
* @return the left sub-expression
*/
public Expression getExpression(boolean getLeft) {
return getLeft ? this.left : right;
public Expression getLeftSubExpression() {
return left;
}
/**
* Get the right sub-expression of this condition.
*
* @return the right sub-expression
*/
public Expression getRightSubExpression() {
return right;
}
}
......@@ -284,14 +284,21 @@ public class ConditionAndOr extends Condition {
}
/**
* Get the left or the right sub-expression of this condition.
* Get the left sub-expression of this condition.
*
* @param getLeft true to get the left sub-expression, false to get the
* right sub-expression.
* @return the sub-expression
* @return the left sub-expression
*/
public Expression getExpression(boolean getLeft) {
return getLeft ? this.left : right;
public Expression getLeftSubExpression() {
return left;
}
/**
* Get the right sub-expression of this condition.
*
* @return the right sub-expression
*/
public Expression getRightSubExpression() {
return right;
}
}
......@@ -103,7 +103,7 @@ public class ConditionNot extends Condition {
*
* @return the sub-expression
*/
public Expression getCondition() {
public Expression getSubCondition() {
return condition;
}
......
......@@ -408,14 +408,21 @@ public class Operation extends Expression {
}
/**
* Get the left or the right sub-expression of this condition.
* Get the left sub-expression of this operation.
*
* @param getLeft true to get the left sub-expression, false to get the
* right sub-expression.
* @return the sub-expression
* @return the left sub-expression
*/
public Expression getExpression(boolean getLeft) {
return getLeft ? this.left : right;
public Expression getLeftSubExpression() {
return left;
}
/**
* Get the right sub-expression of this operation.
*
* @return the right sub-expression
*/
public Expression getRightSubExpression() {
return right;
}
}
......@@ -669,14 +669,14 @@ public class FullText {
ArrayList<String> data, Expression expr) {
if (expr instanceof ConditionAndOr) {
ConditionAndOr and = (ConditionAndOr) expr;
Expression left = and.getExpression(true);
Expression right = and.getExpression(false);
Expression left = and.getLeftSubExpression();
Expression right = and.getRightSubExpression();
addColumnData(columns, data, left);
addColumnData(columns, data, right);
} else {
Comparison comp = (Comparison) expr;
ExpressionColumn ec = (ExpressionColumn) comp.getExpression(true);
ValueExpression ev = (ValueExpression) comp.getExpression(false);
ExpressionColumn ec = (ExpressionColumn) comp.getLeftSubExpression();
ValueExpression ev = (ValueExpression) comp.getRightSubExpression();
String columnName = ec.getColumnName();
columns.add(columnName);
if (ev == null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论