Ejemplo n.º 1
0
        /// <summary>
        /// Removes the <see cref="IIterationStopCriterium{T}"/> from the internal collection.
        /// </summary>
        /// <param name="stopCriterium">The stop criterium that must be removed.</param>
        public void Remove(IIterationStopCriterium <float> stopCriterium)
        {
            if (stopCriterium == null)
            {
                throw new ArgumentNullException("stopCriterium");
            }

            if (!_stopCriterias.ContainsKey(stopCriterium.GetType()))
            {
                return;
            }

            // Remove from the collection
            _stopCriterias.Remove(stopCriterium.GetType());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds an <see cref="IIterationStopCriterium{T}"/> to the internal collection of stop-criteria. Only a
        /// single stop criterium of each type can be stored.
        /// </summary>
        /// <param name="stopCriterium">The stop criterium to add.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="stopCriterium"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="stopCriterium"/> is of the same type as an already
        /// stored criterium.
        /// </exception>
        public void Add(IIterationStopCriterium <float> stopCriterium)
        {
            if (stopCriterium == null)
            {
                throw new ArgumentNullException("stopCriterium");
            }

            if (_stopCriterias.ContainsKey(stopCriterium.GetType()))
            {
                throw new ArgumentException(Resources.StopCriteriumDuplicate);
            }

            // Store the stop criterium.
            _stopCriterias.Add(stopCriterium.GetType(), stopCriterium);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Indicates if the specific stop criterium is stored by the <see cref="IIterator{T}"/>.
 /// </summary>
 /// <param name="stopCriterium">The stop criterium.</param>
 /// <returns><c>true</c> if the <see cref="IIterator{T}"/> contains the stop criterium; otherwise <c>false</c>.</returns>
 public bool Contains(IIterationStopCriterium <float> stopCriterium)
 {
     return(stopCriterium != null && _stopCriterias.ContainsKey(stopCriterium.GetType()));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Removes the <see cref="IIterationStopCriterium"/> from the internal collection.
        /// </summary>
        /// <param name="stopCriterium">The stop criterium that must be removed.</param>
        public void Remove(IIterationStopCriterium stopCriterium)
        {
            if (stopCriterium == null)
            {
                throw new ArgumentNullException("stopCriterium");
            }

            if (!_stopCriterias.ContainsKey(stopCriterium.GetType()))
            {
                return;
            }

            // Remove from the collection
            _stopCriterias.Remove(stopCriterium.GetType());
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Indicates if the specific stop criterium is stored by the <see cref="IIterator"/>.
 /// </summary>
 /// <param name="stopCriterium">The stop criterium.</param>
 /// <returns><c>true</c> if the <see cref="IIterator"/> contains the stop criterium; otherwise <c>false</c>.</returns>
 public bool Contains(IIterationStopCriterium stopCriterium)
 {
     return stopCriterium != null && _stopCriterias.ContainsKey(stopCriterium.GetType());
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds an <see cref="IIterationStopCriterium"/> to the internal collection of stop-criteria. Only a 
        /// single stop criterium of each type can be stored.
        /// </summary>
        /// <param name="stopCriterium">The stop criterium to add.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="stopCriterium"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="stopCriterium"/> is of the same type as an already 
        /// stored criterium.
        /// </exception>
        public void Add(IIterationStopCriterium stopCriterium)
        {
            if (stopCriterium == null)
            {
                throw new ArgumentNullException("stopCriterium");
            }

            if (_stopCriterias.ContainsKey(stopCriterium.GetType()))
            {
                throw new ArgumentException(Resources.StopCriteriumDuplicate);
            }

            // Store the stop criterium.
            _stopCriterias.Add(stopCriterium.GetType(), stopCriterium);
        }