archimatetool / archi

Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
MIT License
914 stars 267 forks source link

Wrong sorting order in models tree #1051

Open Sonique opened 3 days ago

Sonique commented 3 days ago

Version of Archi

5.2.0.202311011021 silicon mac

Archi Plug-ins

yep

Operating System

mac silicon

Expected Behaviour

alphanumeric sorting

Actual Behaviour

character sorting

Steps to Reproduce the Behaviour

  1. create folders with numerals in naming like folder-15 folder-100
  2. look up in tree
  3. folder 100 will be first
image
Phillipus commented 3 days ago

This is expected behaviour and can't be changed. Text comparison is based on the Java Collator class. This provides lexical comparison based on locale to account for characters like accents.

Sonique commented 2 days ago

So how can it be changed? Because it's terrible behaviour for sorting, it's not usable at all, maybe only for Wittgenstein Tractatus table of content is good, but not for other cases. Digital sequences should be compared as numbers not as literals one by one.

More over most editors sort in the right way.

Look for example on Intellij Idea on same system

image

So I see it more as bug then expected behaviour

Phillipus commented 2 days ago

So how can it be changed?

As I explained, in Java sorting is done by the Collator class. If you wish, as Archi is open source, you can provide your own solution.

Phillipus commented 2 days ago

For reference - https://github.com/farbodsafaei/alphanumeric-comparator

Phillipus commented 1 day ago

I'll keep the issue open. There are third-party implementations of an AlphaNumericComparator such as the link in the previous comment but I don't know what the impact is in performance. The implementation needs to support Collator.getInstance() so that Locale based sorting is also supported. Needs more investigation.