spatial4j icon indicating copy to clipboard operation
spatial4j copied to clipboard

Convert Shape impl interfaces to abstract classes

Open chrismale opened this issue 14 years ago • 0 comments

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.

chrismale avatar Sep 29 '12 08:09 chrismale