Commit graph

7 commits

Author SHA1 Message Date
Ed Sanders f11db48234 Rename index to offset in AnnotationSet
To avoid confusion between IV store indexes and the index
within the set, rename them to storeIndex and offset.

Change-Id: Ic7d741bd5d39240d63fdc04a2df45658a64441de
2013-07-26 23:04:01 +00:00
Ed Sanders e91cd00a2f Make all annotations additive
Any annotation could have a style attribute which has
a compound effect, and this also prevents roundtrip
errors. Button tool logic should prevent any annotation
from being applied twice which shouldn't be.

Bug: 49755
Change-Id: I8502a55cd2b195d28d0e2ecd63f15de670f80d60
2013-07-05 21:01:20 +00:00
Ed Sanders 2352613b66 Code style fix: (X) -> ( X )
Change-Id: I7f3ac95621f70d9a89e70e9a51905673240cb51f
2013-06-24 18:51:59 +01:00
Ed Sanders 3d64c3043c Further AnnotationSet optimisation: create containsIndex
In most places we call .contains we already know the index, so we
can avoid store lookups by using .containsIndex.

Change-Id: I45a9a421473f9bec479ab8ccceceb162b7004c3a
2013-04-25 22:55:43 +01:00
Ed Sanders 1998496e49 AnnotationSet optimisations.
addSet:
* Instead of indexing items in the store, just union the indexStore arrays

removeSet/removeNotInSet:
* difference or intersect the indexStore arrays

filter:
* push indices into the result set instead of values

simpleArrayUnion/Intersect/Difference have been created as utilities
in ve. They are prefixed 'simple' because they use object keys to
do fast in-array comparisons. This means they are limited to string
values or values which will compare as strings (e.g. numbers).

Change-Id: I079cbdfece4f6d80ec0afd61959913f13217fcb3
2013-04-22 19:37:19 +01:00
Catrope eac44c39f4 Make the AnnotationSet constructor take an array of indexes
Before, it took an array of objects and translated those to indexes
using the store. Literally every caller outside of the test suite got
an array of indexes from the linear model, translated those to objects,
then passed them into the AnnotationSet constructor which translated
them right back to indexes.

The previous behavior was kind of ridiculous on its face, but the
reason we found it is because Inez was investigating the performance
degradation when bolding a line and found that half of it was due
to the hundreds of ve.getHash() calls caused by this behavior.

Change-Id: I38df8ae9f6392849dacf477ea2f804283c964417
2013-04-18 10:56:03 -07:00
Ed Sanders fdf30b1ac8 Store data in LinearData class with an index-value store for objects
Created an IndexValueStore class which can store any object and return
an integer index to its hash map.

Linear data is now stored in ve.dm.LinearData instances. Two subclasses
for element and meta data contain methods specific to those data types
(ElementLinearData and MetaLinearData).

The static methods in ve.dm.Document that inspected data at a given
offset are now instance methods of ve.dm.ElementLinearData.

AnnotationSets (which are no longer OrderedHashSets) have been moved
to /dm and also have to be instantiated with a pointer the store.

Bug: 46320
Change-Id: I249a5d48726093d1cb3e36351893f4bff85f52e2
2013-03-30 10:06:34 +00:00
Renamed from modules/ve/test/ve.AnnotationSet.test.js (Browse further)