spatial4j
spatial4j copied to clipboard
Convert Shape impl interfaces to abstract classes
There is common behaviour, particularly around identity (equals and hashcode) that needs to be shared amongst Shape implementations. All Rectangles, no matter how they are implemented, should be considered equal for example. Currently this is solved by having static equals and hashcode methods which impls can share. A cleaner way is to use abstract classes to control the common behaviour.
There is some concern from David that using abstract classes prevents a Shape impl extending a JTS Geometry for example, and implementing a Shape interface. I believe in these instances it is best to wrap the JTS Geometry rather than extend it.