-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #98 Refactored comparison and like class structure
- Loading branch information
1 parent
4f6c592
commit a041d23
Showing
18 changed files
with
314 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SQL Statement Builder 4.3.1, released 2020-XX-XX | ||
|
||
Code Name: Refactoring | ||
|
||
## Refactoring | ||
|
||
* #98: Refactored comparison and like class structure | ||
The refactoring changed the internal representation of the `Comparison`. | ||
The public API from `BooleanTerm` did however not change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
src/main/java/com/exasol/sql/expression/comparison/AbstractComparison.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.exasol.sql.expression.comparison; | ||
|
||
import com.exasol.sql.expression.AbstractBooleanExpression; | ||
import com.exasol.sql.expression.BooleanExpressionVisitor; | ||
import com.exasol.sql.expression.ValueExpression; | ||
|
||
/** | ||
* Abstract basis for comparisons. | ||
*/ | ||
public abstract class AbstractComparison extends AbstractBooleanExpression implements Comparison { | ||
protected final ComparisonOperator operator; | ||
protected final ValueExpression leftOperand; | ||
protected final ValueExpression rightOperand; | ||
|
||
/** | ||
* Create a new instance of {@link AbstractComparison}. | ||
* | ||
* @param comparisonOperator comparison operator | ||
* @param leftOperand left-hand side operator of the comparison | ||
* @param rightOperand right-hand side operator of the comparison | ||
*/ | ||
protected AbstractComparison(final ComparisonOperator comparisonOperator, final ValueExpression leftOperand, | ||
final ValueExpression rightOperand) { | ||
this.operator = comparisonOperator; | ||
this.leftOperand = leftOperand; | ||
this.rightOperand = rightOperand; | ||
} | ||
|
||
@Override | ||
public final void acceptConcrete(final BooleanExpressionVisitor visitor) { | ||
visitor.visit(this); | ||
} | ||
|
||
@Override | ||
public final void dismissConcrete(final BooleanExpressionVisitor visitor) { | ||
// empty on purpose | ||
} | ||
|
||
/** | ||
* Get the left-hand side operator of the comparison | ||
* | ||
* @return left operator | ||
*/ | ||
@Override | ||
public ValueExpression getLeftOperand() { | ||
return this.leftOperand; | ||
} | ||
|
||
/** | ||
* Get the right-hand side operator of the comparison | ||
* | ||
* @return right operator | ||
*/ | ||
@Override | ||
public ValueExpression getRightOperand() { | ||
return this.rightOperand; | ||
} | ||
|
||
/** | ||
* Get the comparison operator | ||
* | ||
* @return comparison operator | ||
*/ | ||
@Override | ||
public ComparisonOperator getOperator() { | ||
return this.operator; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/exasol/sql/expression/comparison/Comparison.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.exasol.sql.expression.comparison; | ||
|
||
import com.exasol.sql.expression.BooleanExpression; | ||
import com.exasol.sql.expression.ValueExpression; | ||
|
||
/** | ||
* Interface for classes that implement comparisons between two columns. | ||
*/ | ||
public interface Comparison extends BooleanExpression { | ||
|
||
/** | ||
* Get the left-hand side operator of the comparison | ||
* | ||
* @return left operator | ||
*/ | ||
public ValueExpression getLeftOperand(); | ||
|
||
/** | ||
* Get the right-hand side operator of the comparison | ||
* | ||
* @return right operator | ||
*/ | ||
public ValueExpression getRightOperand(); | ||
|
||
/** | ||
* Get the comparison operator | ||
* | ||
* @return comparison operator | ||
*/ | ||
public ComparisonOperator getOperator(); | ||
|
||
/** | ||
* Accept {@link ComparisonVisitor}. | ||
* | ||
* @param visitor visitor to accept | ||
*/ | ||
public void accept(ComparisonVisitor visitor); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/exasol/sql/expression/comparison/ComparisonOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.exasol.sql.expression.comparison; | ||
|
||
/** | ||
* Interface for comparison operators. | ||
*/ | ||
public interface ComparisonOperator { | ||
/** | ||
* Returns the operator symbol that represents the comparison. | ||
* | ||
* @return operator symbol | ||
*/ | ||
@Override | ||
public String toString(); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/exasol/sql/expression/comparison/ComparisonVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.exasol.sql.expression.comparison; | ||
|
||
/** | ||
* Visitor for {@link Comparison}. | ||
*/ | ||
public interface ComparisonVisitor { | ||
public void visit(SimpleComparison simpleComparison); | ||
|
||
public void visit(LikeComparison like); | ||
} |
Oops, something went wrong.