Project

General

Profile

Actions

bug #6311

closed

Refactor IdentifiableEntity.compareTo method

Added by Andreas Müller about 7 years ago. Updated about 7 years ago.

Status:
Rejected
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
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 properlyClosedAndreas Müller

Actions
Copied from EDIT - task #4232: Check all Comparators for fulfilling the Comparator contractClosedKatja Luther

Actions
Actions #1

Updated by Andreas Müller about 7 years ago

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

Updated by Andreas Müller about 7 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
Actions #3

Updated by Andreas Müller about 7 years ago

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

Updated by Andreas Müller about 7 years ago

Actions #5

Updated by Andreas Müller about 7 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.

Actions #6

Updated by Katja Luther about 7 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.

Actions

Also available in: Atom PDF