Handling urls

@param cursor
@param limit
@param elements
325778
private void handleUrls(TextCursor cursor, int limit, ArrayList<MDText> elements) {

        if (mode == MODE_FULL || mode == MODE_ONLY_LINKS) {
            while (true) {
                TitledUrl url = findFormattedUrl(cursor, limit);
                if (url != null) {

                    // Handling text before url first
                    handleRawText(cursor, url.getStart(), elements);

                    // Adding url
                    String title = cursor.text.substring(url.getStart() + 1, url.getMiddle());
                    String urlVal = cursor.text.substring(url.getMiddle() + 2, url.getEnd());
                    elements.add(new MDUrl(title, urlVal));

                    // Adjusting offset
                    cursor.currentOffset = url.getEnd() + 1;
                } else {
                    break;
                }
            }
        }

        // Handling remaining text
        handleRawText(cursor, limit, elements);
    }
550271
public void checkLimit(int len) {
        if(cursor == -1) {
            cursor = buffer.start;
            lineptr = buffer.start;
            linectptr = buffer.start;
            marker = buffer.start;
        }
        limit = buffer.start + len;
    }
897093
function(element)
	{
		if (element.style != null)
		{
			element.style.cursor = '';
		}
		
		var children = element.childNodes;
		
		if (children != null)
		{
	        var childCount = children.length;
	        
	        for (var i = 0; i < childCount; i += 1)
	        {
	            mxUtils.removeCursors(children[i]);
	        }
	    }
	}
901576
function Cursor(tree, start, end) {
        this.tree = tree;
        this.start = start;
        this.end = end;
        
        var self = this;
        this.walk = function walk(node, iterator) {
            if (node === null) return;
            
            if (start !== undefined && node.key < start) {
                walk(node.right, iterator);
            } else if (end !== undefined && node.key > end) {
                walk(node.left, iterator);
            } else {
                walk(node.left, iterator);
                iterator(node.value, node.key, self.tree);
                walk(node.right, iterator);
            }
        };
    }
1336668
def find_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
        
        self.wait_for_ready_state_complete()
        if page_utils.is_xpath_selector(selector):
            by = By.XPATH
        if page_utils.is_link_text_selector(selector):
            selector = page_utils.get_link_text_from_selector(selector)
            by = By.LINK_TEXT
        elements = self.driver.find_elements(by=by, value=selector)
        if limit and limit > 0 and len(elements) > limit:
            elements = elements[:limit]
        return elements
1111033
private <T> void addLimit(ElementDescriptor<T> descriptor, T limit)
	{
		if (mLimit == null)
		{
			mLimit = new HashMap<ElementDescriptor<?>, Object>(6);
		}
		mLimit.put(descriptor, limit);
	}
159486
private void onLimit(StringBuilder builder)
    {
        builder.append(CQLTranslator.LIMIT);
        builder.append(this.maxResult);
    }
897074
def _get_paging_controls(request):
        
        start = request.url.query.get('start', None)
        limit = request.url.query.get('limit', None)
        controls = {}

        if limit is not None:
            try:
                controls['limit'] = int(limit)
            except ValueError:
                LOGGER.debug('Request query had an invalid limit: %s', limit)
                raise errors.CountInvalid()

            if controls['limit'] <= 0:
                LOGGER.debug('Request query had an invalid limit: %s', limit)
                raise errors.CountInvalid()

        if start is not None:
            controls['start'] = start

        return controls
1365496
@Required
    public void setUrlRestrictions(Map<String, String> restrictions) {
        urlRestrictions = new LinkedHashMap<>();

        ExpressionParser parser = new SpelExpressionParser();

        for (Map.Entry<String, String> entry : restrictions.entrySet()) {
            urlRestrictions.put(entry.getKey(), parser.parseExpression(entry.getValue()));
        }
    }
1275142
public static void getBufferLimits(WsByteBuffer[] buffers, int[] limits) {
        // Double check that the parameters are non null.
        if ((buffers != null) && (limits != null)) {
            // Loop through the buffers.
            // In case of errant parameters, protect from array out of bounds.
            for (int i = 0; i < buffers.length && i < limits.length; i++) {
                // Double check for null buffers.
                if (buffers[i] != null) {
                    // Save the limit.
                    limits[i] = buffers[i].limit();
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "getBufferLimits: buffer[" + i + "] limit of " + limits[i]);
                    }
                } else {
                    // When buffer is null, save a limit of 0.
                    limits[i] = 0;
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "getBufferLimits: null buffer[" + i + "] limit of " + limits[i]);
                    }
                }
            }
        }
    }
1103150
public static boolean containsURL(final URL[] urls, final URL url) {
        checkNotNull("urls", urls);
        checkNotNull("url", url);
        for (int i = 0; i < urls.length; i++) {
            final URL element = urls[i];
            final String elementStr = element.toExternalForm();
            final String urlStr = url.toExternalForm();
            if (elementStr.equals(urlStr)) {
                return true;
            }
        }
        return false;
    }
1272003
public static void cursorIntToContentValues(Cursor cursor, String field, ContentValues values) {
        cursorIntToContentValues(cursor, field, values, field);
    }
131403
function processURLSegments(parentNode, segments) {
		segments.forEach(function(segment) {
			if (segment.urlStr){
				var link = document.createElement("a"); //$NON-NLS-0$
		        link.href = segment.urlStr;
		        link.appendChild(document.createTextNode(segment.segmentStr));
		        link.dir = bidiUtils.getTextDirection(segment.segmentStr);
				parentNode.appendChild(link);
			} else {
				var plainText = document.createElement("span"); //$NON-NLS-0$
				plainText.textContent = segment.segmentStr;
				plainText.dir = bidiUtils.getTextDirection(segment.segmentStr);
				parentNode.appendChild(plainText);
			}
		});
	}
355395
@Override
	public void setUrls(int type, List<String> urls) throws DatabaseException {
		this.deleteAllUrlsForType(type);
		for (String url : urls) {
			this.insert(type, url);
		}
	}
398303
function crawLink($,result,linkTag, callback) {
      var link = $(linkTag).attr('href');
      var parentUrl = result.url;

      if (link) {

          var rel =  $(linkTag).attr('rel');

          if (result.linkTypes.indexOf(rel) > 0) {
              var linkUri = URI.linkToURI(parentUrl, link);

              pm.crawlLink(parentUrl, linkUri, null, null, function(){
                addLinkToQueue(result, parentUrl, linkUri, null, null, callback);
              });
          }
          else {
            callback();
          }
      }
      else {
        callback();
      }
}
806556
function checkLimit (limit, keys) {
  if (limit && typeof limit === 'string') limit = +limit;
  if (!limit || Number(limit) !== limit || limit % 1 !== 0 ||
      limit > keys.length)
    limit = keys.length;
  if (limit < 0) limit = 0;
  return limit;
}
1073819
public void setLimits(java.util.Collection<Limit> limits) {
        if (limits == null) {
            this.limits = null;
            return;
        }

        this.limits = new java.util.ArrayList<Limit>(limits);
    }