good way to implement NotSpecification: isSpecialCaseOf?
- by koen
I'm implementing the specification pattern. The NotSpecification seems simple at first:
NotSpecification.IsSpecialCaseOf(otherSpecification)
return !this.specification.isSpecialCaseOf(otherSpecification)
But it doesn't work for all Specifications:
Not(LesserThan(5)).IsSpecialCaseOf(GreaterThan(4))
This should be true. So far I think that the only way to accomplish the isSpecialCaseOf the NotSpecification is to implement the remainderUnsatisfiedBy (partial subsumption in the paper on the specification pattern). But maybe I am missing something more simple or a logical insight that makes this unnecessary.
Question: Is there another way of implementing this by not using remainderUnsatisfiedBy?