Hides a group of Sequences behind a single Sequence
Наследование: ISequence
Пример #1
0
        public static EventPoller <TEvent> NewInstance(
            IDataProvider <TEvent> dataProvider,
            ISequencer sequencer,
            ISequence sequence,
            ISequence cursorSequence,
            params ISequence[] gatingSequences)
        {
            ISequence gatingSequence;

            switch (gatingSequences.Length)
            {
            case 0:
                gatingSequence = cursorSequence;
                break;

            case 1:
                gatingSequence = gatingSequences[0];
                break;

            default:
                gatingSequence = new FixedSequenceGroup(gatingSequences);
                break;
            }

            return(new EventPoller <TEvent>(dataProvider, sequencer, sequence, gatingSequence));
        }
        public void ShouldReturnMinimumOf2Sequences()
        {
            var sequence1 = new Sequence(34);
            var sequnece2 = new Sequence(47);
            var group = new FixedSequenceGroup(new Sequence[] { sequence1, sequnece2 });

            Assert.AreEqual(group.Value, 34);
            sequence1.Value = 35;
            Assert.AreEqual(group.Value, 35);
            sequence1.Value = 48;
            Assert.AreEqual(group.Value, 47);
        }
Пример #3
0
        public static EventPoller <T> NewInstance(IDataProvider <T> dataProvider,
                                                  ISequencer sequencer,
                                                  ISequence sequence,
                                                  ISequence cursorSequence,
                                                  params ISequence[] gatingSequences)
        {
            ISequence gatingSequence;

            if (gatingSequences.Length == 0)
            {
                gatingSequence = cursorSequence;
            }
            else if (gatingSequences.Length == 1)
            {
                gatingSequence = gatingSequences[0];
            }
            else
            {
                gatingSequence = new FixedSequenceGroup(gatingSequences);
            }

            return(new EventPoller <T>(dataProvider, sequencer, sequence, gatingSequence));
        }