Lines Matching defs:limit

44      * skip, and the number of elements to limit.
48 * @param limit the number of elements to limit, assumed to be >= 0, with
49 * a value of {@code Long.MAX_VALUE} if there is no limit
52 private static long calcSize(long size, long skip, long limit) {
53 return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1;
60 * @param limit the number of elements to limit, assumed to be >= 0, with
61 * a value of {@code Long.MAX_VALUE} if there is no limit
64 private static long calcSliceFence(long skip, long limit) {
65 long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE;
78 long skip, long limit) {
80 long sliceFence = calcSliceFence(skip, limit);
106 * may be may be skip-only, limit-only, or skip-and-limit.
111 * @param limit the maximum size of the resulting stream, or -1 if no limit
115 long skip, long limit) {
120 flags(limit)) {
122 long skip, long limit, long sizeIfKnown) {
124 // Use just the limit if the number of elements
126 limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
129 return new StreamSpliterators.UnorderedSliceSpliterator.OfRef<>(s, skip, limit);
139 calcSliceFence(skip, limit));
143 skip, limit, size);
146 // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n)
150 // This will limit the size of the buffers created at the leaf nodes
154 return new SliceTask<>(this, helper, spliterator, castingArray(), skip, limit).
170 Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
175 skip, limit, size);
183 return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
192 long m = limit >= 0 ? limit : Long.MAX_VALUE;
223 * operation may be may be skip-only, limit-only, or skip-and-limit.
227 * @param limit The maximum size of the resulting stream, or -1 if no limit
231 long skip, long limit) {
236 flags(limit)) {
238 Spliterator.OfInt s, long skip, long limit, long sizeIfKnown) {
240 // Use just the limit if the number of elements
242 limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
245 return new StreamSpliterators.UnorderedSliceSpliterator.OfInt(s, skip, limit);
256 calcSliceFence(skip, limit));
260 skip, limit, size);
263 return new SliceTask<>(this, helper, spliterator, Integer[]::new, skip, limit).
279 Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
284 skip, limit, size);
292 return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
301 long m = limit >= 0 ? limit : Long.MAX_VALUE;
332 * operation may be may be skip-only, limit-only, or skip-and-limit.
336 * @param limit The maximum size of the resulting stream, or -1 if no limit
340 long skip, long limit) {
345 flags(limit)) {
347 Spliterator.OfLong s, long skip, long limit, long sizeIfKnown) {
349 // Use just the limit if the number of elements
351 limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
354 return new StreamSpliterators.UnorderedSliceSpliterator.OfLong(s, skip, limit);
365 calcSliceFence(skip, limit));
369 skip, limit, size);
372 return new SliceTask<>(this, helper, spliterator, Long[]::new, skip, limit).
388 Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
393 skip, limit, size);
401 return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
410 long m = limit >= 0 ? limit : Long.MAX_VALUE;
441 * operation may be may be skip-only, limit-only, or skip-and-limit.
445 * @param limit The maximum size of the resulting stream, or -1 if no limit
449 long skip, long limit) {
454 flags(limit)) {
456 Spliterator.OfDouble s, long skip, long limit, long sizeIfKnown) {
458 // Use just the limit if the number of elements
460 limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip;
463 return new StreamSpliterators.UnorderedSliceSpliterator.OfDouble(s, skip, limit);
474 calcSliceFence(skip, limit));
478 skip, limit, size);
481 return new SliceTask<>(this, helper, spliterator, Double[]::new, skip, limit).
497 Spliterator<P_IN> s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit);
502 skip, limit, size);
510 return new SliceTask<>(this, helper, spliterator, generator, skip, limit).
519 long m = limit >= 0 ? limit : Long.MAX_VALUE;
548 private static int flags(long limit) {
549 return StreamOpFlag.NOT_SIZED | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0);