[josm-dev] Jumbo Patch v3 (or so)

Frederik Ramm frederik at remote.org
Tue Dec 18 00:07:16 GMT 2007


Hi Gabriel,

> Maybe I didn't get my point across clearly, but I think that there
> are concrete problems introduced by the very design of adding the
> reverse-lookup table into the nodes:

As I said earlier, I had once implemented a full reverse lookup for
relations (i.e. every object carried an ArrayList of
RelationBackReference objects which would point to a Relation object
and also contain the information about the role in which the object in
question was part of the relation).

It is well possible that my implementation was buggy and not thought
through very well but the way it worked was that whenever any command
was executed or undone on a Relation, the back references in each of
the Relation's members were completely dropped and re-generated after
the modification was complete. If the command transformed one relation
into another then the dropping of back references had to be done on
the original Relation's members and the re-creation on the new members
of course. This rather plunt process incurred a slightly higher cost
than fine-tooled manipulation of the back reference according to what
had really changed, but saved me the headache of having to detect the
exact scope of changes.

There were some complexities but the general rule "when in doubt,
re-generate the back reference list" seemed to work well. (I remember
that I had a few strange bugs when merging things at first, always a
sign of not having re-generated the list where you should have.)

The only slightly ugly thing about this was that you were actually
changing data stored in individual objects when, from a process point
of view, you were just changig a relation, i.e. conceptually you had
to view the relation's members as "const" members with a "mutable"
list of back references.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'





More information about the josm-dev mailing list