Example #1
0
    /**
     * Helper function for move(int). Assumes that count is in range!
     *
     * @param count the number of chars to move. Negative values move back, positive values move
     *     forward.
     * @param currentOffset the current offset for copyCursor
     * @return the updated offset
     */
    private int _move(int count, int currentOffset) {
      if (count == 0) return currentOffset;
      Iterator it = this;

      // make copy of cursor and return new iterator?
      if (count > 0) return it._moveRight(count, currentOffset);
      return it._moveLeft(-count, currentOffset); // count < 0
    }