Example #1
0
 /// <summary>
 /// Constructs a {@code FindOp}.
 /// </summary>
 /// <param name="mustFindFirst"> if true, must find the first element in
 ///        encounter order, otherwise can find any element </param>
 /// <param name="shape"> stream shape of elements to search </param>
 /// <param name="emptyValue"> result value corresponding to "found nothing" </param>
 /// <param name="presentPredicate"> {@code Predicate} on result value
 ///        corresponding to "found something" </param>
 /// <param name="sinkSupplier"> supplier for a {@code TerminalSink} implementing
 ///        the matching functionality </param>
 internal FindOp(bool mustFindFirst, StreamShape shape, O emptyValue, Predicate <O> presentPredicate, Supplier <TerminalSink <T, O> > sinkSupplier)
 {
     this.MustFindFirst    = mustFindFirst;
     this.Shape            = shape;
     this.EmptyValue       = emptyValue;
     this.PresentPredicate = presentPredicate;
     this.SinkSupplier     = sinkSupplier;
 }
Example #2
0
        /// <summary>
        /// Creates a slice spliterator given a stream shape governing the
        /// spliterator type.  Requires that the underlying Spliterator
        /// be SUBSIZED.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private static <P_IN> java.util.Spliterator<P_IN> sliceSpliterator(StreamShape shape, java.util.Spliterator<P_IN> s, long skip, long limit)
        private static Spliterator <P_IN> sliceSpliterator <P_IN>(StreamShape shape, Spliterator <P_IN> s, long skip, long limit)
        {
            Debug.Assert(s.hasCharacteristics(java.util.Spliterator_Fields.SUBSIZED));
            long sliceFence = CalcSliceFence(skip, limit);

            switch (shape)
            {
            case java.util.stream.StreamShape.REFERENCE:
                return(new StreamSpliterators.SliceSpliterator.OfRef <>(s, skip, sliceFence));

            case java.util.stream.StreamShape.INT_VALUE:
                return((Spliterator <P_IN>) new StreamSpliterators.SliceSpliterator.OfInt((java.util.Spliterator_OfInt)s, skip, sliceFence));

            case java.util.stream.StreamShape.LONG_VALUE:
                return((Spliterator <P_IN>) new StreamSpliterators.SliceSpliterator.OfLong((java.util.Spliterator_OfLong)s, skip, sliceFence));

            case java.util.stream.StreamShape.DOUBLE_VALUE:
                return((Spliterator <P_IN>) new StreamSpliterators.SliceSpliterator.OfDouble((java.util.Spliterator_OfDouble)s, skip, sliceFence));

            default:
                throw new IllegalStateException("Unknown shape " + shape);
            }
        }
Example #3
0
			/// <summary>
			/// Constructs a {@code MatchOp}.
			/// </summary>
			/// <param name="shape"> the output shape of the stream pipeline </param>
			/// <param name="matchKind"> the kind of quantified match (all, any, none) </param>
			/// <param name="sinkSupplier"> {@code Supplier} for a {@code Sink} of the
			///        appropriate shape which implements the matching operation </param>
			internal MatchOp(StreamShape shape, MatchKind matchKind, Supplier<BooleanTerminalSink<T>> sinkSupplier)
			{
				this.InputShape_Renamed = shape;
				this.MatchKind = matchKind;
				this.SinkSupplier = sinkSupplier;
			}
Example #4
0
 /// <summary>
 /// Create a {@code ReduceOp} of the specified stream shape which uses
 /// the specified {@code Supplier} to create accumulating sinks.
 /// </summary>
 /// <param name="shape"> The shape of the stream pipeline </param>
 internal ReduceOp(StreamShape shape)
 {
     InputShape_Renamed = shape;
 }