JTS equalsTopo()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JTS equalsTopo()

Paul Ramsey
Hrm... so, it seems at some point there was a large retrofit to flip equals() to equalsTopo(). I assume that's because (if I recall right) equals() has some special meaning/uses in the Java world, and having it with a different meaning made some things (maps, I think?) not work.

GEOS never made that flip, not having the same problem. On the one hand, making the flip would potentially make future porting simpler (method names would line up). On the other hand, it could be an error-prone and labour intensive process... what's your feeling?

P

_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: JTS equalsTopo()

Martin Davis-3
Hmmm... where are you seeing this "large retrofit"?  

The confusion over equals VS equalsTopo is indeed a thing in the Java world, and equalsTopo was created to encourage being unambiguous about the intended meaning.  But in JTS equals just delegates to equalsTopo, and equals is still used all over the place in JTS code (equalsTopo - not so much).  

Actually equals is not used at all in the core code (since it's highly inefficient for low-level use).  It's used in the unit tests, where performance doesn't matter as much.  But even there it's mostly only used either where it is being tested, or in a somewhat casual way that should probably be replaced.

So before opining about which way GEOS should go need to know more about where it's being used.

On Thu, Nov 29, 2018 at 1:42 PM Paul Ramsey <[hidden email]> wrote:
Hrm... so, it seems at some point there was a large retrofit to flip equals() to equalsTopo(). I assume that's because (if I recall right) equals() has some special meaning/uses in the Java world, and having it with a different meaning made some things (maps, I think?) not work.

GEOS never made that flip, not having the same problem. On the one hand, making the flip would potentially make future porting simpler (method names would line up). On the other hand, it could be an error-prone and labour intensive process... what's your feeling?

P
_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel

_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: JTS equalsTopo()

Regina Obe
In reply to this post by Paul Ramsey

I'm more leaning on the side of "let sleeping dogs lie."

 

Don't we have so many other things where our GEOS is a bit out of synch with JTS.  E.g. our weird 3Dish support in GEOS.

 

Is equalsTopo / equals() used in that many places to make not changing it really that difficult to port things?  I would think the extra levels like the coordinate array thingy Dan was complaining about are more troubling than this for porting.

 

From: geos-devel [mailto:[hidden email]] On Behalf Of Paul Ramsey
Sent: Thursday, November 29, 2018 4:42 PM
To: GEOS Development List <[hidden email]>
Subject: [geos-devel] JTS equalsTopo()

 

Hrm... so, it seems at some point there was a large retrofit to flip equals() to equalsTopo(). I assume that's because (if I recall right) equals() has some special meaning/uses in the Java world, and having it with a different meaning made some things (maps, I think?) not work.

 

GEOS never made that flip, not having the same problem. On the one hand, making the flip would potentially make future porting simpler (method names would line up). On the other hand, it could be an error-prone and labour intensive process... what's your feeling?

P


_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: JTS equalsTopo()

Paul Ramsey
In reply to this post by Martin Davis-3


On Thu, Nov 29, 2018 at 1:55 PM Martin Davis <[hidden email]> wrote:
Hmmm... where are you seeing this "large retrofit"?  

Admittedly, this was pretty non-scientific, I just did a global search for it and found it in a number of classes more than would fit on one page... :) so I knew it wasn't just one new method in Geometry.java that delegated to equals() ... :) 

Maybe it would all be fine'n'dandy. I'll look more closely tomorrow, if it's only a few dozen locations, I'll just do it in the interests of convergence.

P

 

The confusion over equals VS equalsTopo is indeed a thing in the Java world, and equalsTopo was created to encourage being unambiguous about the intended meaning.  But in JTS equals just delegates to equalsTopo, and equals is still used all over the place in JTS code (equalsTopo - not so much).  

Actually equals is not used at all in the core code (since it's highly inefficient for low-level use).  It's used in the unit tests, where performance doesn't matter as much.  But even there it's mostly only used either where it is being tested, or in a somewhat casual way that should probably be replaced.

So before opining about which way GEOS should go need to know more about where it's being used.

On Thu, Nov 29, 2018 at 1:42 PM Paul Ramsey <[hidden email]> wrote:
Hrm... so, it seems at some point there was a large retrofit to flip equals() to equalsTopo(). I assume that's because (if I recall right) equals() has some special meaning/uses in the Java world, and having it with a different meaning made some things (maps, I think?) not work.

GEOS never made that flip, not having the same problem. On the one hand, making the flip would potentially make future porting simpler (method names would line up). On the other hand, it could be an error-prone and labour intensive process... what's your feeling?

P
_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel

_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel