JAL-2759 performance improvements to hideColumns
[jalview.git] / src / jalview / datamodel / HiddenColumnsCursor.java
index 04d7189..9cb3298 100644 (file)
@@ -48,15 +48,34 @@ public class HiddenColumnsCursor
    * already exist.
    * 
    * @param hiddenCols
+   *          new hidden columns collection
    */
   protected void resetCursor(List<int[]> hiddenCols)
   {
+    resetCursor(hiddenCols, 0, 0);
+  }
+
+  /**
+   * Reset the cursor with a new hidden columns collection, where we know in
+   * advance the index and hidden columns count of a particular location.
+   * 
+   * @param hiddenCols
+   *          new hidden columns collection
+   * @param index
+   *          cursor index to reset to
+   * @param hiddencount
+   *          hidden columns count to reset to
+   */
+  protected void resetCursor(List<int[]> hiddenCols, int index,
+          int hiddencount)
+  {
     hiddenColumns = hiddenCols;
     if ((hiddenCols != null) && (!hiddenCols.isEmpty()))
     {
       firstColumn = hiddenColumns.get(0)[0];
       HiddenCursorPosition oldpos = cursorPos.get();
-      HiddenCursorPosition newpos = new HiddenCursorPosition(0, 0);
+      HiddenCursorPosition newpos = new HiddenCursorPosition(index,
+              hiddencount);
       cursorPos.compareAndSet(oldpos, newpos);
     }
   }