Exemple #1
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {

            if (SourcePipe == null)
                return false;

            while (true)
            {

                if (SourcePipe.MoveNext())
                {

                    var _S = SourcePipe.Current;

                    if (CompareObjects(_S))
                    {
                        _CurrentElement = _S;
                        return true;
                    }

                }

                else
                    return false;

            }

        }
Exemple #2
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current;

                if (Min.CompareTo(_CurrentElement) > 0)
                {
                    SideEffect1 = _CurrentElement;
                }

                if (Max.CompareTo(_CurrentElement) < 0)
                {
                    SideEffect2 = _CurrentElement;
                }

                return(true);
            }

            return(false);
        }
Exemple #3
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (true)
            {
                if (SourcePipe.MoveNext())
                {
                    _CurrentElement = SourcePipe.Current;

                    if (Include(_CurrentElement))
                    {
                        return(true);
                    }
                }

                else
                {
                    return(false);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (true)
            {
                if (SourcePipe.MoveNext())
                {
                    var _S = SourcePipe.Current;

                    if (!CompareObjects(_S, _Object))
                    {
                        _CurrentElement = _S;
                        return(true);
                    }
                }

                else
                {
                    return(false);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                Counter++;

                if ((Low == -1 || Counter >= Low) &&
                    (High == -1 || Counter <= High))
                {
                    _CurrentElement = SourcePipe.Current;
                    return(true);
                }

                if (High > 0 && Counter > High)
                {
                    return(false);
                }
            }

            return(false);
        }
Exemple #6
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                _ReturnPosition = this.Path.Count() - 2 - (Int32)Steps;

                if (_ReturnPosition < 0)
                {
                    throw new Exception("The path is shorter than the given number of steps!");
                }

                try
                {
                    _CurrentElement = (S)this.Path.ElementAt(_ReturnPosition);
                }
                catch (Exception)
                {
                    throw new Exception("Invalid type of element within path!");
                }

                return(true);
            }

            return(false);
        }
Exemple #7
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                if (this.StartOfNewLineRegExpr.IsMatch(SourcePipe.Current))
                {
                    if (this.IgnoreFirstLineMatch)
                    {
                        this.IgnoreFirstLineMatch = false;
                        this.FixedLine.Append(SourcePipe.Current).Append(this.NewLineSeperator);
                    }

                    else
                    {
                        _CurrentElement = this.FixedLine.ToString();
                        this.FixedLine.Clear();
                        this.FixedLine.Append(SourcePipe.Current).Append(this.NewLineSeperator);
                        return(true);
                    }
                }

                else
                {
                    this.FixedLine.Append(SourcePipe.Current).Append(this.NewLineSeperator);
                }
            }

            return(false);
        }
Exemple #8
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current;
                var _Counter = Interlocked.Increment(ref Counter);

                var _Sum = AddToSum(_CurrentElement);
                InternalSideEffect1 = AddToQuadratSum(_CurrentElement) - (Math.Pow(_Sum, 2) / _Counter);
                InternalSideEffect2 = _Sum / _Counter;

                if (Counter > 1 && Counter < 30)
                {
                    InternalSideEffect1 = InternalSideEffect1 / (_Counter - 1);  // corr. Var.
                }
                else
                {
                    InternalSideEffect1 = InternalSideEffect1 / _Counter;
                }

                return(true);
            }

            return(false);
        }
Exemple #9
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            // First consume all elements emitted by the _InternalEnumerator
            if (_AggregateEnumerator == null)
            {
                if (SourcePipe == null)
                {
                    return(false);
                }

                while (SourcePipe.MoveNext())
                {
                    InternalSideEffect.Add(SourcePipe.Current);
                }

                _AggregateEnumerator = InternalSideEffect.GetEnumerator();
            }

            // Second emit the collected elements
            if (_AggregateEnumerator.MoveNext())
            {
                _CurrentElement = _AggregateEnumerator.Current;
                return(true);
            }

            else
            {
                return(false);
            }
        }
Exemple #10
0
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                var aa = this.Path;
                var bb = this.Path.ToList()[this.Path.Count() - 2 - (Int32)Steps];

                //_CurrentElement = _InternalEnumerator.Current;
                _CurrentElement = (S)bb;

                return(true);
            }

            //while (true)
            //{
            //    S s = this.starts.next();
            //    this.pipe.setStarts(new SingleIterator<S>(s));
            //    if (pipe.hasNext())
            //    {
            //        while (pipe.hasNext())
            //        {
            //            pipe.next();
            //        }
            //        return s;
            //    }
            //}

            return(false);
        }
Exemple #11
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                var _And = true;

                foreach (var _Pipe in _Pipes)
                {
                    _Pipe.SetSource(new SingleEnumerator <S>(SourcePipe.Current));

                    if (!_Pipe.MoveNext())
                    {
                        _And = false;
                        break;
                    }
                }

                if (_And)
                {
                    _CurrentElement = SourcePipe.Current;
                    return(true);
                }
            }

            return(false);
        }
Exemple #12
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                while (true)
                {
                    if (SourcePipe.MoveNext())
                    {
                        _CurrentElement = SourcePipe.Current;

                        if (CountedInclude(_CurrentElement, SideEffect++))
                        {
                            return(true);
                        }
                    }

                    else
                    {
                        return(false);
                    }
                }
            }

            return(false);
        }
Exemple #13
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (true)
            {
                if (_TempIterator != null && _TempIterator.MoveNext())
                {
                    _CurrentElement = _TempIterator.Current;
                    return(true);
                }

                if (SourcePipe.MoveNext())
                {
                    _TempIterator = SourcePipe.Current.GetEnumerator();
                }

                else
                {
                    return(false);
                }
            }
        }
Exemple #14
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (_Finished)
            {
                return(false);
            }

            this._Finished = true;

            if (_Minimum == -1 && _Maximum == -1)
            {
                return(true);
            }

            while (true)
            {
                if (SourcePipe.MoveNext())
                {
                    if (_Counter == _Maximum)
                    {
                        return(false);
                    }

                    this._Counter++;

                    if (_Minimum != -1 &&
                        _Counter == _Minimum &&
                        _Maximum == -1)
                    {
                        return(true);
                    }
                }

                else if (_Maximum != -1 && _Counter >= _Minimum)
                {
                    return(true);
                }

                else
                {
                    return(false);
                }
            }
        }
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                var _S = SourcePipe.Current;
                var _TaskCancellation = new CancellationTokenSource();
//                    var _NumberOfTasks    = _Pipes.Count();

                Task[] _Tasks = (from _Pipe in _Pipes
                                 select Task <Boolean> .Factory.StartNew((_Pipe2) =>
                {
                    ((IPipe <S, Boolean>)_Pipe2).SetSource(new SingleEnumerator <S>(_S));

                    var _return = ((IPipe <S, Boolean>)_Pipe2).MoveNext();

//                                         Interlocked.Decrement(ref _NumberOfTasks);

                    if (_return == false)
                    {
                        _And = false;
                    }

                    return(_return);
                },
                                                                         _Pipe,
                                                                         _TaskCancellation.Token,
                                                                         TaskCreationOptions.AttachedToParent,
                                                                         TaskScheduler.Current)).ToArray();


                while (_And == true && !_Tasks.All(_T => _T.IsCompleted))
                {
                    // Wait until a task completes, but no longer than 100ms!
                    Task.WaitAny(_Tasks, 100);
                }

                // Canel remaining tasks!
                _TaskCancellation.Cancel();

                return(_And);
            }

            return(false);
        }
Exemple #16
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = (UInt64)SourcePipe.Current.Length;
                return(true);
            }

            return(false);
        }
Exemple #17
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current.ToUpper();
                return(true);
            }

            return(false);
        }
Exemple #18
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SelectDelegate(SourcePipe.Current);

                return(true);
            }

            return(false);
        }
Exemple #19
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current;
                Interlocked.Increment(ref InternalSideEffect);
                return(true);
            }

            return(false);
        }
Exemple #20
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                var _InternalPipe = SourcePipe as IPipe;

                if (_InternalPipe != null)
                {
                    var _TmpSet   = new HashedSet <Object>();
                    var _DoReturn = true;

                    foreach (var _Object in _InternalPipe.Path)
                    {
                        if (_TmpSet.Contains(_Object))
                        {
                            _DoReturn = false;
                            break;
                        }

                        else
                        {
                            _TmpSet.Add(_Object);
                        }
                    }

                    if (_DoReturn)
                    {
                        _CurrentElement = SourcePipe.Current;
                        return(true);
                    }
                }

                else
                {
                    _CurrentElement = SourcePipe.Current;
                    return(true);
                }
            }

            return(false);
        }
Exemple #21
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                if (Bias >= Random.NextDouble())
                {
                    _CurrentElement = SourcePipe.Current;
                    return(true);
                }
            }

            return(false);
        }
Exemple #22
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            #region Process the key array

            if (Keys != null)
            {
                if (SourcePipe.MoveNext())
                {
                    _CurrentElement = (from Key
                                       in     Keys
                                       select SourcePipe.Current.GetProperty(Key)).ToList();

                    return(true);
                }

                return(false);
            }

            #endregion

            #region Process the KeyValue filter

            else
            {
                if (SourcePipe.MoveNext())
                {
                    _CurrentElement = from KeyValuePair
                                      in     SourcePipe.Current
                                      where  KeyValueFilter(KeyValuePair.Key, KeyValuePair.Value)
                                      select KeyValuePair.Value;

                    return(true);
                }

                return(false);
            }

            #endregion
        }
Exemple #23
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (true)
            {
                if (_TempIterator != null && _TempIterator.MoveNext())
                {
                    if (_TempIterator.Current != null)
                    {
                        // No advanced filter given or it matches...
                        if (_FileFilter == null ||
                            (_FileFilter != null && !_FileFilter(_TempIterator.Current)))
                        {
                            _CurrentElement = _TempIterator.Current;
                            return(true);
                        }
                    }
                }

                if (SourcePipe.MoveNext())
                {
                    try
                    {
                        _TempIterator = new DirectoryInfo(SourcePipe.Current).
                                        EnumerateFiles(_SearchPattern, _SearchOption).
                                        GetEnumerator();
                    }
                    catch (Exception)
                    {
                        return(false);
                    }
                }

                else
                {
                    return(false);
                }
            }
        }
Exemple #24
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current;

                if (!ValueSet.Contains(_CurrentElement))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #25
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current;
                UpdateMap(_CurrentElement);
                return(true);
            }

            else
            {
                return(false);
            }
        }
Exemple #26
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
#if SILVERLIGHT
                _CurrentElement = new FileStream(_InternalEnumerator.Current.FullName, _FileMode, _FileAccess, _FileShare, (Int32)_BufferSize);
#else
                _CurrentElement = new FileStream(SourcePipe.Current.FullName, _FileMode, _FileAccess, _FileShare, (Int32)_BufferSize, _FileOptions);
#endif
                return(true);
            }

            return(false);
        }
Exemple #27
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (_StreamReader == null)
            {
                while (SourcePipe.MoveNext())
                {
                    if (SourcePipe.Current != null)
                    {
                        continue;
                    }

                    _StreamReader = new StreamReader(SourcePipe.Current);
                    break;
                }
            }

            if (_StreamReader != null)
            {
                do
                {
                    try
                    {
                        _CurrentElement = _StreamReader.ReadLine();
                    }

                    catch (Exception)
                    {
                        return(false);
                    }
                }while (!_CurrentElement.StartsWith("#"));

                return(true);
            }

            return(false);
        }
Exemple #28
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe.MoveNext())
            {
                _CurrentElement = SourcePipe.Current;

                var EventLocal = Event;
                if (EventLocal != null)
                {
                    EventLocal(_CurrentElement);
                }

                return(true);
            }

            return(false);
        }
Exemple #29
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            if (SourcePipe is IPipe)
            {
                if (SourcePipe.MoveNext())
                {
                    _CurrentElement = ((IPipe)SourcePipe).Path;
                    return(true);
                }

                return(false);
            }

            else
            {
                throw new NoSuchElementException("The source of this pipe was not a pipe!");
            }
        }
Exemple #30
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            if (SourcePipe == null)
            {
                return(false);
            }

            while (SourcePipe.MoveNext())
            {
                if (SourcePipe.Current.TryGetProperty(Key, out ActualValue))
                {
                    if (SourcePipe.Current.TryGetProperty(Key, out ActualValue))
                    {
                        if (ComparisonFilter(ActualValue))
                        {
                            _CurrentElement = SourcePipe.Current;
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }