Merge/refactor Equal() and Equivalent() operator implementations
duncand opened this issue · comments
The CQL Engine implementations of the Equal() and Equivalent() operators should be merged and/or refactored so that the code base is easier to read and maintain, and to cut down on a large amount of near-duplicate code.
Make these specific changes:
-
Move the block of DateTime-handling code from EquivalentEvaluator.java into a new equivalent() method in DateTime.java.
-
Move the block of Time-handling code from EquivalentEvaluator.java into a new equivalent() method in Time.java.
-
Move the block of Interval-handling code from EquivalentEvaluator.java into a new equivalent() method in Interval.java.
-
Move the block of Tuple-handling code from EquivalentEvaluator.java into a new equivalent() method in Tuple.java.
-
Replace the last line of EqualEvaluator.equal() from
return left.equals(right);
to a throw of aNotImplementedException
to increase resiliency. -
Take the entire (remaining) routine bodies of EquivalentEvaluator.equivalent() and EqualEvaluator.equal() and merge them into the body of a new routine Value.similar(), such that the new routine has a third
mode
argument that says which of the 2 originating routine's behaviours to perform, and such that the original 2 routines are then just thin shims for the new routine.
The CQL Engine should have identical behaviour after the above merge/refactor, or at the very least should not break any tests that currently pass. No test suite files should be altered. Any intentional behaviour changes should be held off for a separate commit(s) than the one(s) for this issue.