On 15/02/12 15:16, Zheng Xudong wrote: > Because I use multiline string to compute hashcode, so it may affect my final > result observably.
The use of hashCodes on floats or doubles (or types based on them) will likely be nonportable (as I don't think JTS uses strictfp everywhere). Because of the effect of platform-specific rounding, float and double types (and geometries based on them) should be regarded as fuzzy and thus having unpredictable hashCode. The good news is that this is a well-known problem with a solution that is implemented in JTS. Please read the javadoc for JTS PrecisionModel. You should be able to convert your geometries (with a GeometryFactory?) to a grid with (for example) a 0.001 precision. These will then likely behave as discrete values (not the continuous values of the underlying doubles) and will have much more stable hashCodes. Jody knows more. Any time anyone want to introduce a new geometry implementation, Jody asks "does it have a precision model?" so I think Jody knows rather a lot about this issue. Kind regards, -- Ben Caradoc-Davies <[email protected]> Software Engineer CSIRO Earth Science and Resource Engineering Australian Resources Research Centre ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
