[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz] ARGH!
From: |
Benja Fallenstein |
Subject: |
[Gzz] ARGH! |
Date: |
Sat, 10 Aug 2002 00:51:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3 |
Here's another problem with saving I hadn't considered yet. Our saving
process relies on being able to create diffs between SliceVersions. To
do that, we need to be able to put the contents of two slice versions in
a HashSet so as to compute the difference.
This needs to work across saving/loading: It must be possible to load
the last saved SliceVersion, and compare it to the current SliceVersion
for diffing.
Therefore, spans need to be comparable and hashable. (Not that you
wouldn't expect them to be anyway, but this is why they HAVE to be.)
You can hash a span by XORing its bounds with the hash of its scroll block.
You can hash a scrollblock by hashing its ID; you can compare two
scrollblocks by comparing their IDs.
However, you cannot hash and compare a non-finalized scrollblock that way.
You could settle for comparing TransientTextScrolls by object identity,
but then a *saved* TransientTextScroll would not be equal to a
PermanentTextScroll with the same id.
The only way I see around this is comparing TTSs by object identity, and
PTSs by ID, and making sure that there is no PTS with the same ID as an
existing TTS. The problem is: there is no way to make *sure*. I now let
the TTS put themselves into ScrollBlockManager's msCache (UGLY), but
that only works when you create PTSs through ScrollBlockManager, not
directly.
ARGH!
- Benja
- [Gzz] ARGH!,
Benja Fallenstein <=