Ejemplo n.º 1
0
        private static bool BufferEqualToString(StringBuffer a, string b)
        {
            if (a is null)
            {
                return(b is null);
            }

            if (a.Count != b?.Length)
            {
                return(false);
            }

            Enumerator     t = a.GetEnumerator();
            CharEnumerator o = b.GetEnumerator();

            bool result = true;

            while (o.MoveNext() && t.MoveNext())
            {
                if (t.Current != o.Current)
                {
                    result = false;
                    break;
                }
            }

            t.Dispose();
            //o.Dispose();

            return(result);
        }
            /// <summary>
            /// Removes all the elements that match the conditions defined by the specified
            /// predicate.
            /// </summary>
            /// <param name="match">
            /// The <see cref="System.Predicate{T}"/> delegate that defines the conditions of the elements
            /// to remove.
            /// </param>
            /// <returns>
            /// The number of elements removed from the <see cref="ImmutableTrieList{T}"/>.
            /// </returns>
            /// <exception cref="ArgumentNullException">
            /// <paramref name="match"/> is null.
            /// </exception>
            public int RemoveAll(Predicate <T> match)
            {
                Requires.NotNull(match, nameof(match));
                int        removed    = 0;
                Enumerator enumerator = new Enumerator(this);

                try
                {
                    int startIndex = 0;
                    while (enumerator.MoveNext())
                    {
                        if (match(enumerator.Current))
                        {
                            this.RemoveAt(startIndex);
                            removed++;
                            enumerator.Dispose();
                            enumerator = new Enumerator(this, startIndex: startIndex);
                        }
                        else
                        {
                            startIndex++;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }

                return(removed);
            }
 public void Dispose()
 {
     if (Enumerator != null)
     {
         Enumerator.Dispose();
     }
 }
Ejemplo n.º 4
0
 // Traverses the system using the given predicates from function PrepareTraversal
 public void PerformTraversal()
 {
     while (m_enumerator.MoveNext())
     {
         ;
     }
     m_enumerator.Dispose();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Releases resources used by the <see cref="DirContentSource"/> and
 /// if overridden in a derived class, optionally releases unmanaged resources.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources;
 /// <c>false</c> to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         inputFiles?.Dispose(); // LUCENENET specific - dispose inputFiles
         inputFiles = null;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Disposal disposes the enumerator
 /// </summary>
 public void Dispose()
 {
     if (!_disposed)
     {
         _disposed = true;
         Enumerator?.Dispose();
     }
 }
Ejemplo n.º 7
0
        public string ToXml()
        {
            StringWriter xmlStream = null;

            System.Xml.XmlTextWriter xmlWriter = null;
            try
            {
                xmlStream = new StringWriter();
                xmlWriter = new System.Xml.XmlTextWriter(xmlStream);

                // Start Document Element
                xmlWriter.WriteStartElement("ServiceParameters");

                if (this.PublicKey != null)
                {
                    xmlWriter.WriteStartElement("Item");
                    xmlWriter.WriteAttributeString("key", "PublicKey");
                    xmlWriter.WriteString(this.PublicKey);
                    xmlWriter.WriteEndElement();
                }

                Enumerator enumerator = this.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        xmlWriter.WriteStartElement("Item");
                        xmlWriter.WriteAttributeString("key", enumerator.Current.Key);
                        xmlWriter.WriteCData(enumerator.Current.Value);
                        xmlWriter.WriteEndElement();
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }

                // End Document Element
                xmlWriter.WriteEndElement();
                xmlWriter.Flush();

                return(xmlStream.ToString());
            }
            catch (Exception)
            {
                return(string.Empty);
            }
            finally
            {
                xmlWriter?.Close();
                xmlStream?.Close();
            }
        }
Ejemplo n.º 8
0
 public void Dispose()
 {
     if (this.Count > 0)
     {
         Enumerator en = this.GetEnumerator();
         while (en.MoveNext())
         {
             SaveMessage(en.Current.Value);
             en.Dispose();
         }
         this.Clear();
     }
 }
Ejemplo n.º 9
0
            private void Dispose(bool disposing)
            {
                if (_disposed)
                {
                    return;
                }

                if (disposing)
                {
                    Enumerator.Dispose();
                }

                _disposed = true;
            }
Ejemplo n.º 10
0
        public bool Equals(string other, char joinCharacter)
        {
            if (other == null)
            {
                return(false);
            }

            Enumerator     fe = new Enumerator(this, joinCharacter);
            CharEnumerator ce = other.GetEnumerator();

            do
            {
                if (fe.MoveNext())
                {
                    if (!ce.MoveNext())
                    {
                        break;
                    }
                }
                else if (ce.MoveNext())
                {
                    break;
                }
                else
                {
                    fe.Dispose();
                    ce.Dispose();

                    return(true);
                }
            }while (fe.Current == ce.Current);

            fe.Dispose();
            ce.Dispose();

            return(false);
        }
Ejemplo n.º 11
0
 public void Dispose()
 {
     if (timer.Enabled)
     {
         timer.Stop();
     }
     if (this.Count > 0)
     {
         Enumerator en = this.GetEnumerator();
         while (en.MoveNext())
         {
             en.Dispose();
         }
         this.Clear();
     }
 }
Ejemplo n.º 12
0
        public void Dispose()
        {
            if (timer.Enabled)
            {
                timer.Stop();
            }
            MessageServer <BroadcastEvent> .Dispose(reg);

            if (this.Count > 0)
            {
                Enumerator en = this.GetEnumerator();
                while (en.MoveNext())
                {
                    en.Dispose();
                }
                this.Clear();
            }
        }
Ejemplo n.º 13
0
        public bool Equals(StringBuffer other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (Count != other.Count)
            {
                return(false);
            }

            Enumerator t = this.GetEnumerator();
            Enumerator o = other.GetEnumerator();

            bool result = true;

            while (o.MoveNext() && t.MoveNext())
            {
                if (t.Current != o.Current)
                {
                    result = false;
                    break;
                }
            }

            t.Dispose();
            o.Dispose();

            return(result);
        }
Ejemplo n.º 14
0
 public void Dispose()
 {
     Enumerator.Dispose();
 }
Ejemplo n.º 15
0
 public void Reset()
 {
     Enumerator.Dispose();
     Enumerator = null;
 }
Ejemplo n.º 16
0
 public void Dispose() => _e.Dispose();
Ejemplo n.º 17
0
 public void Dispose()
 {
     host_enumerator.Dispose();
 }
Ejemplo n.º 18
0
 public void Dispose()
 {
     _it.Dispose();
 }
Ejemplo n.º 19
0
 public void Dispose()
 {
     _state = 3;
     _setEnumerator.Dispose();
     _loopsEnumerator.Dispose();
 }
Ejemplo n.º 20
0
 public void Dispose()
 {
     Enumerator.Dispose();
     List.Disposed = true;
 }
Ejemplo n.º 21
0
 public void Dispose() => _prefixEnumerator.Dispose();
Ejemplo n.º 22
0
        protected override void Terminate(Status status)
        {
            base.Terminate(status);

            Enumerator.Dispose();
        }
Ejemplo n.º 23
0
 /// <summary cref="IDisposable.Dispose"/>
 public void Dispose() => enumerator.Dispose();