Ejemplo n.º 1
0
        /// <summary>
        /// The DuplicateFilterArrow will not allow a duplicate object to pass through it.
        /// This is accomplished by the Arrow maintaining an internal HashSet that is used
        /// to store a history of previously seen objects.
        /// Thus, the more unique objects that pass through this Arrow, the slower it
        /// becomes as a log_2 index is checked for every object.
        /// </summary>
        /// <param name="ArrowSender">The sender of the messages/objects.</param>
        /// <param name="Recipient">A recipient of the processed messages.</param>
        /// <param name="Recipients">Further recipients of the processed messages.</param>
        public static DuplicateFilterArrow <TMessage> DuplicateFilter <TMessage>(this IArrowSender <TMessage> ArrowSender, IArrowReceiver <TMessage> Recipient, params IArrowReceiver <TMessage>[] Recipients)
        {
            var _DuplicateFilterArrow = new DuplicateFilterArrow <TMessage>(Recipient, Recipients);

            ArrowSender.OnMessageAvailable += _DuplicateFilterArrow.ReceiveMessage;
            return(_DuplicateFilterArrow);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The DuplicateFilterArrow will not allow a duplicate object to pass through it.
        /// This is accomplished by the Arrow maintaining an internal HashSet that is used
        /// to store a history of previously seen objects.
        /// Thus, the more unique objects that pass through this Arrow, the slower it
        /// becomes as a log_2 index is checked for every object.
        /// </summary>
        /// <param name="ArrowSender">The sender of the messages/objects.</param>
        public static DuplicateFilterArrow <TMessage> DuplicateFilter <TMessage>(this IArrowSender <TMessage> ArrowSender)
        {
            var _DuplicateFilterArrow = new DuplicateFilterArrow <TMessage>();

            ArrowSender.OnMessageAvailable += _DuplicateFilterArrow.ReceiveMessage;
            return(_DuplicateFilterArrow);
        }