TODO createSegment for RemoteRange
177862
public Segment createSegment(RemoteRange remoteRange)
			throws SQLException, IOException
	{
		if (connection == null&&entryDAOUtils==null)
			return null;
		else
		{
			if (remoteRange != null)
			{
				String accession = remoteRange.getAccession() + (remoteRange.getVersion() == null ? "" : ("." + remoteRange.getVersion().toString()));
				if(entryDAOUtils==null)
				{
					setEntryDAOUtils(new EntryDAOUtilsImpl(connection));
				}
				byte[] subSequence=entryDAOUtils.getSubSequence(accession, remoteRange.getBeginPosition(), (remoteRange.getEndPosition()-remoteRange.getBeginPosition())+1);
				
				if(subSequence==null)
				{
					throw new SQLException("Invalid Accession "+accession+" , which does not exist in database");
				}
				
				if(remoteRange.getLength()!=subSequence.length)
				{
					StringBuilder lcoationString=new StringBuilder();
					LocationToStringCoverter.renderLocation(lcoationString, remoteRange, false, false);
					throw new SQLException("invalid Remote Location range:"+ lcoationString.toString() +", not within the entry \""+ remoteRange.getAccession()+"\" sequence length");
				}
				if(remoteRange.isComplement())
				{
					ReverseComplementer reversecomplementer=new ReverseComplementer();
					return new Segment(remoteRange,reversecomplementer.reverseComplementByte(subSequence));
				}
				return new Segment(
						remoteRange,subSequence);

			}
		}
		return null;
	}
511111
@Override
    public void selectRangeExpl(int anchorParagraph, int anchorColumn, int caretParagraph, int caretColumn) {
        selectRangeExpl(textPosition(anchorParagraph, anchorColumn), textPosition(caretParagraph, caretColumn));
    }
777404
function buildSegmentsForEvent(event) {
		var startDate = event.start;
		var endDate = exclEndDay(event);
		var segments = rangeToSegments(startDate, endDate);
		for (var i=0; i<segments.length; i++) {
			segments[i].event = event;
		}
		return segments;
	}
1165319
public static void exports(Xml root, CollisionRange range)
    {
        Check.notNull(root);
        Check.notNull(range);

        final Xml node = root.createChild(NODE_RANGE);
        node.writeString(ATT_AXIS, range.getOutput().name());
        node.writeInteger(ATT_MIN_X, range.getMinX());
        node.writeInteger(ATT_MIN_Y, range.getMinY());
        node.writeInteger(ATT_MAX_X, range.getMaxX());
        node.writeInteger(ATT_MAX_Y, range.getMaxY());
    }
1347773
function getRangeTextNodes(range) {
  var container = range.commonAncestorContainer
    , nodes = getTextNodes(container.parentNode || container)

  return nodes.filter(function (node) {
    return rangeIntersectsNode(range, node) && isNonEmptyTextNode(node)
  })
}
1285223
function toElement(str) {
    if (!range && doc.createRange) {
        range = doc.createRange();
        range.selectNode(doc.body);
    }

    var fragment;
    if (range && range.createContextualFragment) {
        fragment = range.createContextualFragment(str);
    } else {
        fragment = doc.createElement('body');
        fragment.innerHTML = str;
    }
    return fragment.childNodes[0];
}
1304338
public static Range<RowPosition> makeRowRange(Token left, Token right, IPartitioner partitioner)
    {
        return new Range<RowPosition>(left.maxKeyBound(partitioner), right.maxKeyBound(partitioner), partitioner);
    }
1324249
function createRange(desc) {
  var fields = ['exact', 'offset', 'selector'];
  utils.check(fields, desc);
  return { exact: desc.exact, offset: desc.offset, selector: desc.selector};
}
460122
function (tplUrl, data) {
      if (urlPrefix) {
        tplUrl = urlPrefix + tplUrl;
      }
      if (urlSuffix) {
        tplUrl += urlSuffix;
      }
      var html = '';
      debug('  retrieve remote content from ' + tplUrl);
      var remoteFragmentKey = getTemplateCacheKeyFromRemoteUrl(tplUrl);
      if (data && !data.cache) {
        html = retrieveFromUrl(tplUrl, remoteFragmentKey, true);
      } else {
        if (!_.has(cache, remoteFragmentKey)) {
          cache[remoteFragmentKey] = retrieveFromUrl(tplUrl, remoteFragmentKey, false);
          debug('  stash content in memory');
        } else {
          debug('  get content from memory');
        }
        html = getTemplateFromCache(remoteFragmentKey);
      }
      return html;
    }
22287
public RemoteTask createRemoteTask(String strServer, String strRemoteApp, String strUserID, String strPassword)
    {
        RemoteTask remoteTask = super.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword);
        return remoteTask;
    }
1223554
function makeGetter (arrayType) {
      return function GetViewValue (byteOffset, littleEndian) {
        byteOffset = ToUint32(byteOffset);

        if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { throw RangeError('Array index out of range'); }

        byteOffset += this.byteOffset;

        var uint8Array = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT),
            bytes = [];
        for (var i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { bytes.push(r(uint8Array, i)); }

        if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { bytes.reverse(); }

        return r(new arrayType(new Uint8Array(bytes).buffer), 0);
      };
    }
1328478
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException
    {
        try   {
            Application app = this.getApplication();
            RemoteTask remoteServer = new TaskSession(app);
            ((TaskSession)remoteServer).setProperties(properties);
            return remoteServer;
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
430464
function getRange(sel) {
	sel = sel || getSelection();
	return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
}
892504
function transformIERangeToRange( ieRange, range ) {
        if ( ieRange.item ) {
            range.selectNode( ieRange.item( 0 ) );
        } else {
            var bi = getBoundaryInformation( ieRange, true );
            range.setStart( bi.container, bi.offset );
            if ( ieRange.compareEndPoints( 'StartToEnd', ieRange ) != 0 ) {
                bi = getBoundaryInformation( ieRange, false );
                range.setEnd( bi.container, bi.offset );
            }
        }
        return range;
    }
277438
function createNodes(entityRanges, decoratorRanges = [], textArray, block) {
  let lastIndex = 0;
  const mergedRanges = [...entityRanges, ...decoratorRanges].sort((a, b) => a.offset - b.offset);
  const nodes = [];
  // if thers no entities will return just a single item
  if (mergedRanges.length < 1) {
    nodes.push(new ContentNode({ block, start: 0, end: textArray.length }));
    return nodes;
  }

  mergedRanges.forEach((range) => {
    // create an empty node for content between previous and this entity
    if (range.offset > lastIndex) {
      nodes.push(new ContentNode({ block, start: lastIndex, end: range.offset }));
    }
    // push the node for the entity
    nodes.push(new ContentNode({
      block,
      entity: range.key,
      decorator: range.component,
      decoratorProps: range.decoratorProps,
      decoratedText: range.component
        ? getString(textArray, range.offset, range.offset + range.length)
        : undefined,
      start: range.offset,
      end: range.offset + range.length,
      contentState: range.contentState,
    }));
    lastIndex = range.offset + range.length;
  });

  // finaly add a node for the remaining text if any
  if (lastIndex < textArray.length) {
    nodes.push(new ContentNode({
      block,
      start: lastIndex,
      end: textArray.length,
    }));
  }
  return nodes;
}
653139
public Range getAbsoluteRangeFor(Range relativeRange) {
        int from = convertBoundaryToAbsolutePosition(relativeRange.getFrom()),
                to = convertBoundaryToAbsolutePosition(relativeRange.getTo());
        return new Range(from, to);
    }
1347263
public Object doRemoteCommand(String strCommand, Map<String,Object> properties) throws RemoteException, DBException
    {
        if (properties == null)
            properties = new Hashtable<String,Object>();
        this.setProperties(properties);
        
        StringWriter stringWriter = new StringWriter();
        PrintWriter out = new PrintWriter(stringWriter);
        
        if (CREATE_SCREEN.equals(strCommand))
        {
            BaseScreen screen = this.getScreen(properties);
            int iErrorCode = screen.checkSecurity();
            if ((iErrorCode != DBConstants.NORMAL_RETURN) && (iErrorCode != Constants.READ_ACCESS))
            {
                String strError = this.getTask().getLastError(iErrorCode);
                if ((strError == null)
                    || (strError.length() == 0)
                    || ((iErrorCode >= DBConstants.ACCESS_DENIED) && (iErrorCode <= DBConstants.CREATE_USER_REQUIRED)))
                        strError = Integer.toString(iErrorCode);
                RemoteException ex = new RemoteException(strError);
                throw ex;
            }
            this.printScreen(screen, out);
        }
        else if (strCommand != null)
        {
            if (strCommand.indexOf('=') != -1)
                Utility.parseArgs(properties, strCommand);
            else
                properties.put(DBParams.COMMAND, strCommand);
            
            BaseScreen screen = this.getScreen(properties);
            if (screen != null)
            {
                screen = (BaseScreen)screen.doServletCommand(m_topScreen);  // Move the input params to the record fields
                if (screen != null)
                {
                    screen.processInputData(out);
                    if (stringWriter.getBuffer().length() == 0)
                        if (HtmlConstants.DISPLAY.equalsIgnoreCase((String)properties.get(HtmlConstants.FORMS)))
                            this.printScreen(screen, out);    // This is a report
                }
                else
                {   // Special case - command success, client needs to reset (to main menu)
                    String strMessage = this.getTask().getStatusText(DBConstants.INFORMATION_MESSAGE);
                    out.println(Utility.startTag(XMLTags.STATUS_TEXT));
                    if (strMessage != null)
                        out.println(Utility.startTag(XMLTags.TEXT) + strMessage + Utility.endTag(XMLTags.TEXT));
                    out.println(Utility.startTag(XMLTags.ERROR) + "information" + Utility.endTag(XMLTags.ERROR));
                    String strReturnCommand = Utility.addURLParam(null, XMLTags.MENU, DBConstants.BLANK);   // User's main menu
                    strReturnCommand = Utility.addURLParam(strReturnCommand, DBParams.USER_NAME, this.getProperty(DBParams.USER_NAME));
                    strReturnCommand = Utility.addURLParam(strReturnCommand, DBParams.AUTH_TOKEN, this.getProperty(DBParams.AUTH_TOKEN));
                    out.println(Utility.startTag(DBParams.COMMAND) + Utility.encodeXML(strReturnCommand) + Utility.endTag(DBParams.COMMAND));
                    out.println(Utility.endTag(XMLTags.STATUS_TEXT));
                }
            }
        }
        
        out.flush();
        out.close();
        
        return stringWriter.toString();
    }