//-------------------------------------------------------------------------
        /// <summary>
        /// Streams the set of dates included in the range.
        /// <para>
        /// This returns a stream consisting of each date in the range.
        /// The stream is ordered.
        ///
        /// </para>
        /// </summary>
        /// <param name="startInclusive">  the start date </param>
        /// <param name="endExclusive">  the end date </param>
        /// <returns> the stream of dates from the start to the end </returns>
        internal static Stream <LocalDate> stream(LocalDate startInclusive, LocalDate endExclusive)
        {
            IEnumerator <LocalDate> it = new IteratorAnonymousInnerClass(startInclusive, endExclusive);
            long count = endExclusive.toEpochDay() - startInclusive.toEpochDay() + 1;
            Spliterator <LocalDate> spliterator = Spliterators.spliterator(it, count, Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.DISTINCT | Spliterator.ORDERED | Spliterator.SORTED | Spliterator.SIZED | Spliterator.SUBSIZED);

            return(StreamSupport.stream(spliterator, false));
        }
示例#2
0
        public virtual Stream <NodeResult> GraphAlgosDijkstra(Node start, Node end, string relType, string weightProperty)
        {
            PathFinder <WeightedPath> pathFinder = GraphAlgoFactory.dijkstra(PathExpanders.forTypeAndDirection(RelationshipType.withName(relType), Direction.BOTH), weightProperty);

            WeightedPath path = pathFinder.FindSinglePath(start, end);

//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            return(StreamSupport.stream(path.Nodes().spliterator(), false).map(NodeResult::new));
        }
示例#3
0
        public virtual Stream <AvailableAnalyzer> ListAvailableAnalyzers()
        {
            Stream <AnalyzerProvider> stream = Accessor.listAvailableAnalyzers();

            return(stream.flatMap(provider =>
            {
                string description = provider.description();
                Spliterator <string> spliterator = provider.Keys.spliterator();
                return StreamSupport.stream(spliterator, false).map(name => new AvailableAnalyzer(name, description));
            }));
        }
示例#4
0
        // Service loader can't inject via the constructor
        public virtual void Inject(TopologyService topologyService, Config config, LogProvider logProvider, MemberId myself)
        {
            this.TopologyService = topologyService;
            this.Config          = config;
            this.Log             = logProvider.getLog(this.GetType());
            this.Myself          = myself;
            this.DbName          = config.Get(CausalClusteringSettings.database);

            ReadableName = StreamSupport.stream(Keys.spliterator(), false).collect(Collectors.joining(", "));
            Log.info("Using upstream selection strategy " + ReadableName);
            Init();
        }
示例#5
0
        /// <summary>
        /// Create a stream from the given iterator with given characteristics.
        /// <para>
        /// <b>Note:</b> returned stream needs to be closed via <seealso cref="Stream.close()"/> if the given iterator implements
        /// <seealso cref="Resource"/>.
        ///
        /// </para>
        /// </summary>
        /// <param name="iterator"> the iterator to convert to stream </param>
        /// <param name="characteristics"> the logical OR of characteristics for the underlying <seealso cref="Spliterator"/> </param>
        /// @param <T> the type of elements in the given iterator </param>
        /// <returns> stream over the iterator elements </returns>
        /// <exception cref="NullPointerException"> when the given iterator is {@code null} </exception>
        public static Stream <T> Stream <T>(IEnumerator <T> iterator, int characteristics)
        {
            Objects.requireNonNull(iterator);
            Spliterator <T> spliterator = Spliterators.spliteratorUnknownSize(iterator, characteristics);
            Stream <T>      stream      = StreamSupport.stream(spliterator, false);

            if (iterator is Resource)
            {
                return(stream.onClose((( Resource )iterator).close));
            }
            return(stream);
        }
示例#6
0
        public virtual Stream <Output> TestFailingResourceProcedure(long failCount)
        {
            IEnumerator <Output> failingIterator = new IteratorAnonymousInnerClass(this, failCount);
            IEnumerable <Output> failingIterable = () => failingIterator;
            Stream <Output>      stream          = StreamSupport.stream(failingIterable.spliterator(), false);

            stream.onClose(() =>
            {
                Counters.closeCountTestFailingResourceProcedure++;
            });
            Counters.openCountTestFailingResourceProcedure++;
            return(stream);
        }
示例#7
0
        public override bool?TernaryEquals(AnyValue other)
        {
            if (other == null || other == NO_VALUE)
            {
                return(null);
            }
            else if (!(other is MapValue))
            {
                return(false);
            }
            MapValue otherMap = ( MapValue )other;
            int      size     = size();

            if (size != otherMap.Size())
            {
                return(false);
            }
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            string[] thisKeys = StreamSupport.stream(KeySet().spliterator(), false).toArray(string[] ::new);
            Arrays.sort(thisKeys, string.compareTo);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            string[] thatKeys = StreamSupport.stream(otherMap.Keys.spliterator(), false).toArray(string[] ::new);
            Arrays.sort(thatKeys, string.compareTo);
            for (int i = 0; i < size; i++)
            {
                if (thisKeys[i].CompareTo(thatKeys[i]) != 0)
                {
                    return(false);
                }
            }
            bool?equalityResult = true;

            for (int i = 0; i < size; i++)
            {
                string key = thisKeys[i];
                bool?  s   = Get(key).ternaryEquals(otherMap.Get(key));
                if (s == null)
                {
                    equalityResult = null;
                }
                else if (!s.Value)
                {
                    return(false);
                }
            }
            return(equalityResult);
        }
示例#8
0
        public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator)
        {
            if (!(other is MapValue))
            {
                throw new System.ArgumentException("Cannot compare different virtual values");
            }
            MapValue otherMap = ( MapValue )other;
            int      size     = size();
            int      compare  = Integer.compare(size, otherMap.Size());

            if (compare == 0)
            {
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                string[] thisKeys = StreamSupport.stream(KeySet().spliterator(), false).toArray(string[] ::new);
                Arrays.sort(thisKeys, string.compareTo);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                string[] thatKeys = StreamSupport.stream(otherMap.Keys.spliterator(), false).toArray(string[] ::new);
                Arrays.sort(thatKeys, string.compareTo);
                for (int i = 0; i < size; i++)
                {
                    compare = thisKeys[i].CompareTo(thatKeys[i]);
                    if (compare != 0)
                    {
                        return(compare);
                    }
                }

                for (int i = 0; i < size; i++)
                {
                    string key = thisKeys[i];
                    compare = comparator.Compare(Get(key), otherMap.Get(key));
                    if (compare != 0)
                    {
                        return(compare);
                    }
                }
            }
            return(compare);
        }
示例#9
0
 public virtual Stream <ScoreEntry> Stream()
 {
     return(StreamSupport.stream(Spliterators.spliteratorUnknownSize(this, Spliterator.ORDERED), false));
 }
示例#10
0
 internal virtual Stream <NeighbourOutput> FindNeighbours(Node node)
 {
     return(StreamSupport.stream(node.GetRelationships(Direction.OUTGOING).spliterator(), false).map(relationship => new NeighbourOutput(relationship, relationship.getOtherNode(node))));
 }
示例#11
0
 private static Stream <T> EnumerationAsStream <T>(IEnumerator <T> e)
 {
     return(StreamSupport.stream(Spliterators.spliteratorUnknownSize(new IteratorAnonymousInnerClass(e)
                                                                     , Spliterator.ORDERED), false));
 }
示例#12
0
        /// <summary>
        /// Finds which format, if any, succeeded the specified format. Only formats in the same family are considered.
        /// </summary>
        /// <param name="format"> to find successor to. </param>
        /// <returns> the format with the lowest generation > format.generation, or None if no such format is known. </returns>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Nonnull public static java.util.Optional<RecordFormats> findSuccessor(@Nonnull final RecordFormats format)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public static Optional <RecordFormats> FindSuccessor(RecordFormats format)
        {
            return(StreamSupport.stream(RecordFormatSelector.AllFormats().spliterator(), false).filter(candidate => FormatFamily.IsSameFamily(format, candidate)).filter(candidate => candidate.generation() > format.Generation()).reduce((a, b) => a.generation() < b.generation() ? a : b));
        }
示例#13
0
 private static string NicelyCommaSeparatedList(IEnumerable <string> keys)
 {
     return(StreamSupport.stream(keys.spliterator(), false).collect(Collectors.joining(", ")));
 }
示例#14
0
        public override Stream <AnalyzerProvider> ListAvailableAnalyzers()
        {
            IEnumerable <AnalyzerProvider> providers = AnalyzerProvider.load(typeof(AnalyzerProvider));

            return(StreamSupport.stream(providers.spliterator(), false));
        }
示例#15
0
 /// <param name="resources"> <seealso cref="System.Collections.IEnumerable"/> over resources to close. </param>
 public static void CloseAll <T>(IEnumerable <T> resources) where T : Resource
 {
     CloseAll(StreamSupport.stream(resources.spliterator(), false));
 }
        /// <summary>
        /// Returns a stream that wraps this iterator.
        /// <para>
        /// The stream will process any remaining rows in the CSV file.
        /// As such, it is recommended that callers should use this method or the iterator methods and not both.
        ///
        /// </para>
        /// </summary>
        /// <returns> the stream wrapping this iterator </returns>
        public Stream <CsvRow> asStream()
        {
            Spliterator <CsvRow> spliterator = Spliterators.spliteratorUnknownSize(this, Spliterator.ORDERED | Spliterator.NONNULL);

            return(StreamSupport.stream(spliterator, false));
        }
示例#17
0
 public virtual IEnumerable <File> AllFiles()
 {
     return(StreamSupport.stream(RotationStrategy.candidateFiles().spliterator(), false).filter(_fs.fileExists).collect(Collectors.toList()));
 }
示例#18
0
        public static IList <R> Records <R, A>(IEnumerable <Org.Neo4j.Kernel.impl.transaction.state.RecordAccess_RecordProxy <R, A> > changes) where R : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            return(StreamSupport.stream(changes.spliterator(), false).map(Org.Neo4j.Kernel.impl.transaction.state.RecordAccess_RecordProxy::forChangingData).collect(Collectors.toList()));
        }
示例#19
0
 protected internal virtual Stream <T> Stream <T>(IEnumerable <T> iterable)
 {
     return(StreamSupport.stream(iterable.spliterator(), false));
 }