GEOT-4785 backport CompareFilterImpl.equals

Backporting one method from #434 so that GEOS-6463 will be fixed on the 2.5 branch of GeoServer.