jkomoros / CASsim

Complex Adaptive Systems Simulator
Apache License 2.0
21 stars 0 forks source link

Automatically set shortNames #38

Closed jkomoros closed 2 years ago

jkomoros commented 2 years ago

Originally captured in #33

Mechanism to automatically set shortNames for configs that don't have a shortName set (it is undefined).

Configs should put more important properties first.

The shortName config helper looks at each object at each level. First, it looks at all existing long names. Then for each it tries to do the naive shortening (first letter, then each Capital Letter aftwerwards), and see if any will collide. If some will collide , then it looks at the ones that collide. If they collide by being the same words except for some segment, then produce their shortNames by following hte normal rules, but for the one word that is different between them, doing the drop-out-vowels shortening trick.

Make sure that an explicit shortName of '' is interpreted as "do not shorten ever"

These configs should be looked at and their 3-digit hash should be included in the diff URL. (The hash should also concatenate the simulatorVersion before the message, so if the version changes OR the config changes then diffs will be invalidated).

jkomoros commented 2 years ago

As noted in #48 this has gotten easier now that min/max typically don't show up conflicting.

The algorithm is:

gneerate shortnames by taking the first letter of the longName, and every subsequent upper-case letter: 'fooBarBaz' --> 'fBB'

check all shortNames for collisions. (It's ok for an item's shortName to be equivalent to its longName).

If there are collisions in the peer, then for each collision ,see which subSegment (e.g. 'foo', 'Bar', 'Baz') is where the collisions are. For each collision, leave that item exapnded, but minus vowels and check for collision again. If still colliding, then include the full thing.

jkomoros commented 2 years ago
jkomoros commented 2 years ago

Sub issues are not covered in other issues