cqframework / cql-engine

Clinical Quality Language Evaluation Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. Move the block of DateTime-handling code from EquivalentEvaluator.java into a new equivalent() method in DateTime.java.

  2. Move the block of Time-handling code from EquivalentEvaluator.java into a new equivalent() method in Time.java.

  3. Move the block of Interval-handling code from EquivalentEvaluator.java into a new equivalent() method in Interval.java.

  4. Move the block of Tuple-handling code from EquivalentEvaluator.java into a new equivalent() method in Tuple.java.

  5. Replace the last line of EqualEvaluator.equal() from return left.equals(right); to a throw of a NotImplementedException to increase resiliency.

  6. 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.

Fixed in #93