Project

General

Profile

bug #6311

Refactor IdentifiableEntity.compareTo method

Added by Andreas Müller almost 2 years ago. Updated almost 2 years ago.

Status:
Rejected
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
01/05/2017
Due date:
% Done:

0%

Severity:
normal
Found in Version:

Description

The IdentifiableEntity.compareTo method needs to be updated.

First of all I added the test of equality of the uuids.

Next step would be the problem if the name of two taxa is the same and the sec is the same (for example both taxa don't have a sec ref) the method would return 0, but this should happen only if the taxa are really equal. Normaly this should not happen but may be the last comparison should be a comparison of the created or updated date?


Related issues

Related to Edit - feature request #922: Implement compareTo method in IdentifiableEntity properly Closed 08/17/2009
Copied from Edit - task #4232: Check all Comparators for fulfilling the Comparator contract Closed 06/02/2014

Associated revisions

Revision dfc40f67 (diff)
Added by Andreas Müller almost 2 years ago

fix #6311 move compareToEntity method to TaxonName and TaxonBase classes and refactor

Revision 44e2abe8 (diff)
Added by Andreas Müller almost 2 years ago

ref #6311 further refactoring for compareToEntity

History

#1 Updated by Andreas Müller almost 2 years ago

  • Copied from task #4232: Check all Comparators for fulfilling the Comparator contract added

#2 Updated by Andreas Müller almost 2 years ago

  • Status changed from New to In Progress
  • Assignee changed from Katja Luther to Andreas Müller
  • Target version changed from Reviewed Next Major Release to Release 4.6

#3 Updated by Andreas Müller almost 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 50

#4 Updated by Andreas Müller almost 2 years ago

#5 Updated by Andreas Müller almost 2 years ago

  • Status changed from Resolved to In Progress
  • Assignee changed from Andreas Müller to Katja Luther
  • % Done changed from 50 to 0

The 2 fixes dfc40f67 and 44e2abe8 primarily fixed #922 and not THIS ticket.

However, during this process we realized that IdentifiableEntity.compareTo does not implement Comparable.compareTo and therefore does not necessarily need to fulfill its contract.

Also with the refactoring into both subclasses using the uuid as final decision is critical as TaxonBase.compareToTaxon uses TaxonNameBase.compareToName now and expects a 0 result if the names are equal on the cache level.

Smae applies for the mentioned requirement that compareToX should never return 0 and use e.g. date instead for sorting. Defined sorting with no equalness we should leave to Comparators and Comparable.compareTo. Here, users of the method sometimes even expect return value 0.

Therefore I suggest that we should close this ticket as won't fix or maybe better we still include a better handling for protected titleCaches in case of TaxonBase but leave the rest as it is.

#6 Updated by Katja Luther almost 2 years ago

  • Status changed from In Progress to Rejected
  • Assignee changed from Katja Luther to Andreas Müller

Close the ticket as we moved the methods to TaxonNameBase and TaxonBase and the compareToX methods do not implement the Comparable.compareTo method.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)