Sets the start position of a range.

@param {CKEDITOR.dom.node} startNode The node to start the range.
@param {Number} startOffset An integer greater than or equal to zero
representing the offset for the start of the range from the start
of `startNode`.
439105
function( startNode, startOffset ) {
			// W3C requires a check for the new position. If it is after the end
			// boundary, the range should be collapsed to the new start. It seams
			// we will not need this check for our use of this class so we can
			// ignore it for now.

			// Fixing invalid range start inside dtd empty elements.
			if ( startNode.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$empty[ startNode.getName() ] )
				startOffset = startNode.getIndex(), startNode = startNode.getParent();

			this.startContainer = startNode;
			this.startOffset = startOffset;

			if ( !this.endContainer ) {
				this.endContainer = startNode;
				this.endOffset = startOffset;
			}

			updateCollapsed( this );
		}
62643
function (node) {
            return this.setStart(node, node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length);
        }
50510
function ( range, frag, root ) {
    var node, block, blockContentsAfterSplit, stopPoint, container, offset;
    var firstBlockInFrag, nodeAfterSplit, nodeBeforeSplit, tempRange;

    // Fixup content: ensure no top-level inline, and add cursor fix elements.
    fixContainer( frag, root );
    node = frag;
    while ( ( node = getNextBlock( node, root ) ) ) {
      fixCursor( node, root );
    }

    // Delete any selected content.
    if ( !range.collapsed ) {
      deleteContentsOfRange( range, root );
    }

    // Move range down into text nodes.
    moveRangeBoundariesDownTree( range );
    range.collapse( false ); // collapse to end

    // Where will we split up to? First blockquote parent, otherwise root.
    stopPoint = getNearest( range.endContainer, root, 'BLOCKQUOTE' ) || root;

    // Merge the contents of the first block in the frag with the focused block.
    // If there are contents in the block after the focus point, collect this
    // up to insert in the last block later
    block = getStartBlockOfRange( range, root );
    firstBlockInFrag = getNextBlock( frag, frag );
    if ( block && firstBlockInFrag &&
         // Don't merge table cells or PRE elements into block
         !getNearest( firstBlockInFrag, frag, 'PRE' ) &&
         !getNearest( firstBlockInFrag, frag, 'TABLE' ) ) {
      moveRangeBoundariesUpTree( range, block, block, root );
      range.collapse( true ); // collapse to start
      container = range.endContainer;
      offset = range.endOffset;
      // Remove trailing <br> – we don't want this considered content to be
      // inserted again later
      cleanupBRs( block, root, false );
      if ( isInline( container ) ) {
        // Split up to block parent.
        nodeAfterSplit = split(
          container, offset, getPreviousBlock( container, root ), root );
        container = nodeAfterSplit.parentNode;
        offset = indexOf.call( container.childNodes, nodeAfterSplit );
      }
      if ( /*isBlock( container ) && */offset !== getLength( container ) ) {
        // Collect any inline contents of the block after the range point
        blockContentsAfterSplit =
          root.ownerDocument.createDocumentFragment();
        while ( ( node = container.childNodes[ offset ] ) ) {
          blockContentsAfterSplit.appendChild( node );
        }
      }
      // And merge the first block in.
      mergeWithBlock( container, firstBlockInFrag, range, root );

      // And where we will insert
      offset = indexOf.call( container.parentNode.childNodes, container ) + 1;
      container = container.parentNode;
      range.setEnd( container, offset );
    }

    // Is there still any content in the fragment?
    if ( getLength( frag ) ) {
      moveRangeBoundariesUpTree( range, stopPoint, stopPoint, root );
      // Now split after block up to blockquote (if a parent) or root
      nodeAfterSplit = split(
        range.endContainer, range.endOffset, stopPoint, root );
      nodeBeforeSplit = nodeAfterSplit ?
        nodeAfterSplit.previousSibling :
        stopPoint.lastChild;
      stopPoint.insertBefore( frag, nodeAfterSplit );
      if ( nodeAfterSplit ) {
        range.setEndBefore( nodeAfterSplit );
      } else {
        range.setEnd( stopPoint, getLength( stopPoint ) );
      }
      block = getEndBlockOfRange( range, root );

      // Get a reference that won't be invalidated if we merge containers.
      moveRangeBoundariesDownTree( range );
      container = range.endContainer;
      offset = range.endOffset;

      // Merge inserted containers with edges of split
      if ( nodeAfterSplit && isContainer( nodeAfterSplit ) ) {
        mergeContainers( nodeAfterSplit, root );
      }
      nodeAfterSplit = nodeBeforeSplit && nodeBeforeSplit.nextSibling;
      if ( nodeAfterSplit && isContainer( nodeAfterSplit ) ) {
        mergeContainers( nodeAfterSplit, root );
      }
      range.setEnd( container, offset );
    }

    // Insert inline content saved from before.
    if ( blockContentsAfterSplit ) {
      tempRange = range.cloneRange();
      mergeWithBlock( block, blockContentsAfterSplit, tempRange, root );
      range.setEnd( tempRange.endContainer, tempRange.endOffset );
    }
    moveRangeBoundariesDownTree( range );
  }
1074795
function()
		{
			var startContainer = this.startContainer,
				startOffset = this.startOffset;

			// If the starting node is a text node, and non-empty before the offset,
			// then we're surely not at the start of block.
			if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
			{
				var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
				if ( textBefore.length )
					return false;
			}

			// Antecipate the trim() call here, so the walker will not make
			// changes to the DOM, which would not get reflected into this
			// range otherwise.
			this.trim();

			// We need to grab the block element holding the start boundary, so
			// let's use an element path for it.
			var path = new CKEDITOR.dom.elementPath( this.startContainer );

			// Creates a range starting at the block start until the range start.
			var walkerRange = this.clone();
			walkerRange.collapse( true );
			walkerRange.setStartAt( path.block || path.blockLimit, CKEDITOR.POSITION_AFTER_START );

			var walker = new CKEDITOR.dom.walker( walkerRange );
			walker.evaluator = getCheckStartEndBlockEvalFunction( true );

			return walker.checkBackward();
		}
788347
function () {
            var t = this,
                documentSelection = t.doc.getSelection();

            t.range = null;

            if (!documentSelection || !documentSelection.rangeCount) {
                return;
            }

            var savedRange = t.range = documentSelection.getRangeAt(0),
                range = t.doc.createRange(),
                rangeStart;
            range.selectNodeContents(t.$ed[0]);
            range.setEnd(savedRange.startContainer, savedRange.startOffset);
            rangeStart = (range + '').length;
            t.metaRange = {
                start: rangeStart,
                end: rangeStart + (savedRange + '').length
            };
        }
529269
function setOffsetToRangeLinesForSwitch(
                baseAndStartLine,
                endLine,
                switchStatementNode
            ) {
                /**
                 * Find evaluate token of SwitchCase body from the given line.
                 * @param {number} line The line no to set.
                 * @returns {Token} The evaluate token of SwitchCase.
                 */
                function findSwitchCaseBodyInfoAtLineStart(line) {
                    const index = sourceCode.getIndexFromLoc({
                        line,
                        column: 0,
                    })

                    let switchCaseNode = sourceCode.getNodeByRangeIndex(index)
                    if (
                        !switchCaseNode ||
                        switchCaseNode.type === "SwitchStatement"
                    ) {
                        switchCaseNode = switchStatementNode.cases.find(
                            (_token, i) => {
                                const next = switchStatementNode.cases[i + 1]
                                if (!next || index < next.range[0]) {
                                    return true
                                }
                                return false
                            }
                        )
                    }
                    if (
                        !switchCaseNode ||
                        switchCaseNode.type !== "SwitchCase"
                    ) {
                        // not SwitchCase
                        return null
                    }

                    if (switchCaseNode.test) {
                        if (index < switchCaseNode.test.range[1]) {
                            // not body
                            return null
                        }
                    } else {
                        // default:
                        const fToken = sourceCode.getFirstToken(switchCaseNode)
                        const colon = sourceCode.getTokenAfter(
                            fToken,
                            t => t.type === "Punctuator" && t.value === ":"
                        )
                        if (index < colon.range[1]) {
                            // not body
                            return null
                        }
                    }
                    if (
                        !equalsLocation(
                            switchCaseNode.parent,
                            switchStatementNode
                        )
                    ) {
                        // not target
                        return null
                    }
                    const casesIndex = switchStatementNode.cases.findIndex(c =>
                        equalsLocation(c, switchCaseNode)
                    )
                    const evaluate = evaluates.find(
                        e =>
                            e.range[0] <= switchCaseNode.range[0] &&
                            switchCaseNode.range[0] < e.range[1]
                    )
                    return {
                        evaluate,
                        casesIndex,
                        node: switchCaseNode,
                    }
                }

                const switchStatementLine = baseAndStartLine
                // const switchStatementLineOffset = getBaseLineOffset(
                //     switchStatementLine
                // )

                for (
                    let lineNo = baseAndStartLine + 1;
                    lineNo <= endLine;
                    lineNo++
                ) {
                    const switchCaseInfo = findSwitchCaseBodyInfoAtLineStart(
                        lineNo
                    )
                    if (!switchCaseInfo) {
                        continue
                    }
                    const baseLine = switchCaseInfo.evaluate.loc.start.line

                    const offset = offsets.get(lineNo)
                    if (offset) {
                        if (offset.baseline <= baseLine) {
                            offset.baseline = switchStatementLine
                            offset.offset = 1
                        }
                    } else {
                        setOffsetToLine(lineNo, 1, switchStatementLine)
                    }
                }
            }
695757
void setLength(
      Node node, SourcePosition start, SourcePosition end) {
    node.setLength(end.offset - start.offset);
  }
1276848
private void setContentOffset(int startX, int startY, Translation translation, int movementAmount) {

        if (translation == Translation.VERTICAL) {

            // center the X around the start point
            int originalStartX = startX;
            startX -= contentParams.width / 2;

            // if Y is in the lower half, we want it to go up, otherwise, leave it the same
            boolean moveDown = true;
            if (startY + contentParams.height + FINGER_SIZE > screenHeight) {
                startY -= contentParams.height;
                moveDown = false;

                if (movementAmount > 0) {
                    movementAmount *= -1;
                }
            }

            // when moving the peek view below the finger location, we want to offset it a bit to the right
            // or left as well, just so the hand doesn't cover it up.
            int extraXOffset = 0;
            if (moveDown) {
                extraXOffset = DensityUtils.toPx(getContext(), 200);
                if (originalStartX > screenWidth / 2) {
                    extraXOffset = extraXOffset * -1; // move it a bit to the left
                }
            }

            // make sure they aren't outside of the layout bounds and move them with the movementAmount
            // I move the x just a bit to the right or left here as well, because it just makes things look better
            startX = ensureWithinBounds(startX + extraXOffset, screenWidth, contentParams.width);
            startY = ensureWithinBounds(startY + movementAmount, screenHeight, contentParams.height);

        } else {

            // center the Y around the start point
            startY -= contentParams.height / 2;

            // if X is in the right half, we want it to go left
            if (startX + contentParams.width + FINGER_SIZE > screenWidth) {
                startX -= contentParams.width;
                if (movementAmount > 0) {
                    movementAmount *= -1;
                }
            }

            // make sure they aren't outside of the layout bounds and move them with the movementAmount
            startX = ensureWithinBounds(startX + movementAmount, screenWidth, contentParams.width);
            startY = ensureWithinBounds(startY, screenHeight, contentParams.height);
        }

        // check to see if the system bars are covering anything

        int statusBar = NavigationUtils.getStatusBarHeight(getContext());
        if (startY < statusBar) { // if it is above the status bar and action bar
            startY = statusBar + 10;
        } else if (NavigationUtils.hasNavBar(getContext()) &&
                startY + contentParams.height > screenHeight - NavigationUtils.getNavBarHeight(getContext())) {
            // if there is a nav bar and the popup is underneath it
            startY = screenHeight - contentParams.height - NavigationUtils.getNavBarHeight(getContext()) - DensityUtils.toDp(getContext(), 10);
        } else if (!NavigationUtils.hasNavBar(getContext()) && startY + contentParams.height > screenHeight) {
            startY = screenHeight - contentParams.height - DensityUtils.toDp(getContext(), 10);
        }

        // set the newly computed distances from the start and top sides
        setDistanceFromLeft(startX);
        setDistanceFromTop(startY);
    }
1090991
public void setBlastFromToPosition(int start, int end) {
		if (start >= end) {
			throw new IllegalArgumentException("Start index must be less than end index");
		}
		setAlignmentOption(QUERY_FROM, String.valueOf(start));
		setAlignmentOption(QUERY_TO, String.valueOf(end));
	}
334474
public TextRange newRange(int startOffset, int endOffset) {
    checkMetadata();
    return newRangeValidPointers(newPointer(startOffset), newPointer(endOffset), false);
  }
1038506
function () {
            var me = this;
            return new Range(me.document).setStart(me.startContainer, me.startOffset).setEnd(me.endContainer, me.endOffset);

        }
157707
def fixup_offsets(self, new_start, node):
        """"""
        if hasattr(node, 'start'):
            node.start += new_start
            node.finish += new_start
        for n in node:
            if hasattr(n, 'offset'):
                if hasattr(n, 'start'):
                    n.start += new_start
                    n.finish += new_start
            else:
                self.fixup_offsets(new_start, n)
        return
573128
function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) {
            if (rowIndex === _startPoint.rowPos && _startPoint.colPos >= cell.cellIndex && cell.cellIndex <= cellIndex && !isSelectedCell) {
                _startPoint.colPos++;
            }
        }
30252
function getStartToken(elementNode) {
                if (!elementNode) {
                    return null
                }
                if (elementNode.type !== "HTMLElement") {
                    return null
                }
                if (isDummyElement(elementNode)) {
                    return null
                }
                return elementNode.startTag || elementNode
            }
480822
function getOffsetValues(start, length, correction) {
    var adapter = this.adapter;
    var values = [];

    correction += (start * 2); // offset the positioning query

    for (var i = 0; i < length; i++) {
      values.push(adapter.at((i * 2) + correction));
    }

    return values;
  }
234124
public void setRange(int start, int end) {
    if (end < start || start < 0 || end > size) {
      throw new IllegalArgumentException();
    }
    if (end == start) {
      return;
    }
    end--; // will be easier to treat this as the last actually set bit -- inclusive
    int firstInt = start / 32;
    int lastInt = end / 32;
    for (int i = firstInt; i <= lastInt; i++) {
      int firstBit = i > firstInt ? 0 : start & 0x1F;
      int lastBit = i < lastInt ? 31 : end & 0x1F;
      // Ones from firstBit to lastBit, inclusive
      int mask = (2 << lastBit) - (1 << firstBit);
      bits[i] |= mask;
    }
  }
497378
function (start) {
        var container, parent, sibling, siblingName, root;

        container = parent = start ? startContainer : endContainer;
        siblingName = start ? 'previousSibling' : 'nextSibling';
        root = dom.getRoot();

        // If it's a text node and the offset is inside the text
        if (container.nodeType === 3 && !isWhiteSpaceNode(container)) {
          if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
            return container;
          }
        }

        /*eslint no-constant-condition:0 */
        while (true) {
          // Stop expanding on block elements
          if (!format[0].block_expand && dom.isBlock(parent)) {
            return parent;
          }

          // Walk left/right
          for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
            if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) {
              return parent;
            }
          }

          // Check if we can move up are we at root level or body level
          if (parent === root || parent.parentNode === root) {
            container = parent;
            break;
          }

          parent = parent.parentNode;
        }

        return container;
      }