JAL-3383 JAL-3253-applet additional efficiencies; FeatureStore
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Sat, 3 Aug 2019 04:26:18 +0000 (23:26 -0500)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Sat, 3 Aug 2019 04:26:18 +0000 (23:26 -0500)
commit3d4ead4880755ec949de0300c232544ba965e60d
tree1342b4abb38c33395186fb19cbdf7cb4c5b7554f
parent0a94254977a8824ad154325a8ccb6d6d1d4e4dec
JAL-3383 JAL-3253-applet additional efficiencies; FeatureStore
alternative to IntervalStore

- implemented for JavaScript only (see SequenceFeatures):

    boolean useIntervalStore = /**
                                * @j2sNative false &&
                                */
            true;

but can be tested in Java and JavaScript by changing either of those to
true/false.

- only requires storage for one sorted array in FeatureSorter:

  private SequenceFeature[] orderedFeatureStarts;

and one additional linked-list field pointer in SequenceFeature:

SequenceFeature containedBy

- when running, the position is looked up in the begin-sorted feature
array, and then the containedBy links are simply traversed using:

    SequenceFeature sf = findClosestFeature(orderedFeatureStarts, pos);
    while (sf != null) {
      if (sf.end >= pos)
      {
        result.add(sf);
      }
      sf = sf.containedBy;
    }

- my preliminary timing tests suggest this is 2x faster than
IntervalStore in JavaScript.
src/jalview/api/FeatureColourI.java
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceFeature.java
src/jalview/datamodel/SequenceI.java
src/jalview/datamodel/features/FeatureStore.java
src/jalview/datamodel/features/SequenceFeatures.java
src/jalview/datamodel/features/SequenceFeaturesI.java
src/jalview/renderer/OverviewRenderer.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java