Hi Mehdi,
I have just noticed your committs.
I have a doubt: I guess the equals method should also return true when
different instances of a DefaultInstant class have the same identical
position.
Using the super.equals(object) will call a Object.equals(object) checking
the reference is the same (which isn't, being different instances). Then the
position check is again skipped returning false immediatly.
What do you think about this?
Cheers,
Daniele
On Tue, Aug 26, 2008 at 5:39 PM, Mehdi Sidhoum <[EMAIL PROTECTED]>wrote:
> Yes Daniele you can commit your fix but I suggest you the logical test
> "if (object instanceof DefaultInstant && super.equals(object))" instead
> the only one "super.equals(object)" check, sorry it was a mistake for
> the equal method in many subclasses.
>
> Thanks
>
> Regards.
>
> Mehdi Sidhoum
>
>
>
> Daniele Romagnoli a écrit :
> > Hi list,
> > I'm leveraging on the Temporal implementations available on the
> > temporal unsupported module.
> > Today I'm comparing some DefaultInstant calling the equals method.
> > I have noticed that in case of different instances of DefaultInstant
> > having anyway the same identical position, the check returns false.
> > Looking at the code of the DefaultInstant, I have noticed this:
> >
> > public boolean equals(final Object object) {
> > if (object == this) {
> > return true;
> > }
> > if (super.equals(object)) {
> > final DefaultInstant that = (DefaultInstant) object;
> >
> > return Utilities.equals(this.position, that.position) &&
> > Utilities.equals(this.begunBy, that.begunBy) &&
> > Utilities.equals(this.endBy, that.endBy);
> > }
> > return false;
> > }
> >
> > The super.equals(object) call checks again if (object == this) which
> > returns false (being 2 different instances) preventing by this way the
> > positions check.
> > I guess the "super.equals(object)" check should be avoided in favor of
> > an "if (object instanceof DefaultInstant)" check.
> >
> > If Mehdi give me the ok I will committ the fix.
> >
> > Cheers,
> > Daniele
> >
> >
> >
> >
> >
> >
> > --
> > -------------------------------------------------------
> > Eng. Daniele Romagnoli
> > Software Engineer
> >
> > GeoSolutions S.A.S.
> > Via Carignoni 51
> > 55041 Camaiore (LU)
> > Italy
> >
> > phone: +39 0584983027
> > fax: +39 0584983027
> > mob: +39 328 0559267
> >
> >
> > http://www.geo-solutions.it
> >
> > -------------------------------------------------------
> >
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Geotools-devel mailing list
> Geotools-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
--
-------------------------------------------------------
Eng. Daniele Romagnoli
Software Engineer
GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy
phone: +39 0584983027
fax: +39 0584983027
mob: +39 328 0559267
http://www.geo-solutions.it
-------------------------------------------------------
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel