Esempio n. 1
0
        private static void ConcludeCurrentEvent()
        {
            CausalEvent formerEvent = currentEvent;

            currentEvent = formerEvent.Conclude();
            eventPool.Push(formerEvent);
        }
Esempio n. 2
0
 private static void StartNewEvent(IOutcome eventOutcome)
 {
     CausalEvent newEvent = (EventPool.Count > 0)? EventPool.Pop() :
                                                   new CausalEvent();
     newEvent.Outcome    = eventOutcome;
     newEvent.PriorEvent = currentEvent;
     currentEvent        = newEvent;
 }
Esempio n. 3
0
        public void ToString_should_return_representation_of_event()
        {
            // Arrange
            var vve = new CausalEvent("r", 1);

            // Act
            string repr = vve.ToString();

            // Assert
            repr.Should().Be("(r,1)");
        }
Esempio n. 4
0
            public CausalEvent Conclude()
            {
                CausalEvent eventToReturn = PriorEvent;

                IState[] factors;

                if (Influences.Count > 0 && Outcome.IsValid)
                {
                    factors = Influences.ToArray();
                    Influences.Clear();
                }
                else
                {
                    factors = Array.Empty <IState>();
                }

                Outcome?.SetInfluences(factors);
                Outcome    = null;
                PriorEvent = null;

                return(eventToReturn);
            }