[postgis-devel] [PostGIS] #193: PGgeometry.hashCode() does not satisfy certain requirements that are standard in Java
PostGIS
trac at osgeo.org
Mon Feb 15 12:16:20 PST 2010
#193: PGgeometry.hashCode() does not satisfy certain requirements that are
standard in Java
-------------------------+--------------------------------------------------
Reporter: danpodeanu | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 1.4.2
Component: postgis | Version: 1.3.X
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Comment (by pramsey):
Possibly helpful information from Martin Davis on the JTS list:
{{{
/**
* Gets a hashcode for this object.
*
* @return a hashcode for this object
*/
public int hashCode() {
long bits0 = java.lang.Double.doubleToLongBits(p0.x);
bits0 ^= java.lang.Double.doubleToLongBits(p0.y) * 31;
int hash0 = (((int) bits0) ^ ((int) (bits0 >> 32)));
long bits1 = java.lang.Double.doubleToLongBits(p1.x);
bits1 ^= java.lang.Double.doubleToLongBits(p1.y) * 31;
int hash1 = (((int) bits1) ^ ((int) (bits1 >> 32)));
// XOR is supposed to be a good way to combine hashcodes
return hash0 ^ hash1;
}
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/193#comment:4>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list