Set the iteration limit for nextCaseMapCP() to an index within the string.
If the limit parameter is negative or past the string, then the
string length is restored as the iteration limit.

@param lim The iteration limit.
356339
public void setLimit(int lim) {
        if(0<=lim && lim<=rep.length()) {
            limit=lim;
        } else {
            limit=rep.length();
        }
        reachedLimit=false;
    }
258057
@Override
    public synchronized void mark(final int limit) {
        try {
            in.mark(limit);
        }
        catch (IOException ioe) {
            throw new RuntimeException(ioe.getMessage());
        }
    }
774010
public static function codePointAt($chars, int $index, int $limit = null): int
    {
        if (\is_array($chars) === false && ($chars instanceof CharSequence) === false) {
            throw new InvalidArgumentException('Only char arrays and sequences can be processed!');
        }

        // Validate char array
        if (\is_array($chars)) {
            $test = reset($chars);

            if ($test === false || ($test instanceof static) === false) {
                throw new InvalidArgumentException('Array must contain char elements!');
            }
        }

        // Validate specified index
        if ($index < 0) {
            throw new InvalidArgumentException('Index cannot be negative!');
        }

        // Validate length
        if ($limit !== null) {
            if ($limit < 0 || $index >= $limit) {
                throw new InvalidArgumentException('Limit cannot be negative and index must be lower than specified limit!');
            }

            $length = \is_array($chars) ? count($chars) : $chars->length();

            if ($limit > $length) {
                throw new InvalidArgumentException('Limit cannot be greater than char array/sequence!');
            }
        }

        $char       = \is_array($chars) ? $chars[$index] : $chars->charAt($index);
        $stringChar = (string) $char;

        return mb_ord($stringChar, mb_detect_encoding($stringChar));
    }
580260
@Override
    public final LongStream limit(long maxSize) {
        if (maxSize < 0)
            throw new IllegalArgumentException(Long.toString(maxSize));
        return SliceOps.makeLong(this, 0, maxSize);
    }
517581
public AddressbookQuery limitNumberOfResults(int limit)
	{
		if (limit > 0)
		{
			addLimit(WebDavSearch.NRESULTS, limit);
		}
		else
		{
			removeLimit(WebDavSearch.NRESULTS);
		}
		return this;
	}
1043329
public void limitItems(int limit) {
        buildNumbers = copyLastElements(buildNumbers, limit);

        passedFeatures = copyLastElements(passedFeatures, limit);
        failedFeatures = copyLastElements(failedFeatures, limit);
        totalFeatures = copyLastElements(totalFeatures, limit);

        passedScenarios = copyLastElements(passedScenarios, limit);
        failedScenarios = copyLastElements(failedScenarios, limit);
        totalScenarios = copyLastElements(totalScenarios, limit);

        passedSteps = copyLastElements(passedSteps, limit);
        failedSteps = copyLastElements(failedSteps, limit);
        skippedSteps = copyLastElements(skippedSteps, limit);
        pendingSteps = copyLastElements(pendingSteps, limit);
        undefinedSteps = copyLastElements(undefinedSteps, limit);
        totalSteps = copyLastElements(totalSteps, limit);

        durations = copyLastElements(durations, limit);
    }
1506
public void setLineRoundLimit( Float value) {
    PropertyValue propertyValue = lineRoundLimit(value);
    constantPropertyUsageMap.put(PROPERTY_LINE_ROUND_LIMIT, propertyValue);
    layer.setProperties(propertyValue);
  }
1235539
public R setLimit(final int limit){
        mQueryMap.put(FIELD_LIMIT, Integer.toString(limit));
        return (R)this;
    }
782162
public void setMaxSequenceNumber(int maxSequenceNumber) throws Exception {
        if (this.isStarted)
            throw new Exception("MaxSequenceNumber parameter can be updated only when M3UA stack is NOT running");

        if (maxSequenceNumber < 1) {
            maxSequenceNumber = 1;
        } else if (maxSequenceNumber > MAX_SEQUENCE_NUMBER) {
            maxSequenceNumber = MAX_SEQUENCE_NUMBER;
        }
        this.maxSequenceNumber = maxSequenceNumber;
    }
102432
private SearchResult searchMap(Map<String, ?> map, String pattern, int limit) {

        if (pattern == null) {
            throw new IllegalArgumentException("pattern is null");
        }
        if (pattern.isEmpty()) {
            throw new IllegalArgumentException("pattern is an empty String");
        }

        String regexPattern = convertToRegex(pattern);

        if (limit < 0) {
            return new SearchResult();
        }
        if (map.size() == 0) {
            return new SearchResult();
        }
        int count = 0;
        // Set the stopping point 1 past our limit. If we reach
        // this point, then we know there are more entries than
        // limit which match pattern, so we can say hasMore is
        // true. We have to keep trying to match 1 past the limit
        // because if we stop at limit, we can't be sure the
        // other entries will match pattern.
        int stoppingPoint = (limit == 0) ? 0 : limit + 1;
        boolean hasMore = false;
        List<String> matched = new ArrayList<String>();
        Set<String> userNames = map.keySet();
        Iterator<String> itr = userNames.iterator();
        while (itr.hasNext()) {
            String name = itr.next();
            if (name.matches(regexPattern)) {
                matched.add(name);
                count++;
                if (count == stoppingPoint) {
                    matched.remove(name);
                    hasMore = true;
                    break;
                }
            }
        }

        if (count > 0) {
            return new SearchResult(matched, hasMore);
        } else {
            return new SearchResult();
        }
    }
991563
public void setLimits(int softLimit, int hardLimit) {
    if ((softLimit > 0 && hardLimit > softLimit) || (softLimit == 0 && hardLimit == 0)) {
      this.softLimit = softLimit;
      this.hardLimit = hardLimit;
      garbageCollect();
    } else {
      throw new IllegalArgumentException();
    }
  }
160534
public function setLimit($limit) {
        if(is_numeric($limit))
            $this->items_per_page = $limit;
        $this->setCurrent( self::findCurrentPage($this->routeKey));
    }
1199952
static int codePointAtImpl(char[] a, int index, int limit) {
        char c1 = a[index];
        if (isHighSurrogate(c1) && ++index < limit) {
            char c2 = a[index];
            if (isLowSurrogate(c2)) {
                return toCodePoint(c1, c2);
            }
        }
        return c1;
    }
11427
public void setMaxConcurrentThreadCount(String pMaxConcurrentThreadCount) {
        if (!StringUtil.isEmpty(pMaxConcurrentThreadCount)) {
            try {
                maxConcurrentThreadCount = Integer.parseInt(pMaxConcurrentThreadCount);
            }
            catch (NumberFormatException nfe) {
                // Use default
            }
        }
    }
477767
private void setLevels(int start, int limit, byte newLevel) {
        for (int i = start; i < limit; ++i) {
            resultLevels[i] = newLevel;
        }
    }
1111033
private <T> void addLimit(ElementDescriptor<T> descriptor, T limit)
	{
		if (mLimit == null)
		{
			mLimit = new HashMap<ElementDescriptor<?>, Object>(6);
		}
		mLimit.put(descriptor, limit);
	}
950839
private function setLimit($limit = self::NO_LIMIT)
    {
        if (! is_int($limit)) {
            throw new Exceptions\InvalidIntegerType(gettype($limit));
        }

        // A limit of 0 or less is useless, fallback to no limit
        if ($limit !== self::NO_LIMIT && $limit <= 0) {
            throw new Exceptions\PositiveIntegerRequired($limit);
        }

        $this->limit = $limit;
    }