Esempio n. 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="timeBatchViewFactory">for copying this view in a group-by</param>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="timeDeltaComputation">computes the number of milliseconds to batch events for</param>
        /// <param name="referencePoint">is the reference point onto which to base intervals, or null ifthere is no such reference point supplied</param>
        /// <param name="forceOutput">is true if the batch should produce empty output if there is no value to output following time intervals</param>
        /// <param name="isStartEager">is true for start-eager</param>
        /// <param name="viewUpdatedCollection">is a collection that the view must Update when receiving events</param>
        public TimeBatchView(TimeBatchViewFactory timeBatchViewFactory,
                             AgentInstanceViewFactoryChainContext agentInstanceContext,
                             ExprTimePeriodEvalDeltaConst timeDeltaComputation,
                             long?referencePoint,
                             bool forceOutput,
                             bool isStartEager,
                             ViewUpdatedCollection viewUpdatedCollection)
        {
            _agentInstanceContext  = agentInstanceContext;
            _timeBatchViewFactory  = timeBatchViewFactory;
            _timeDeltaComputation  = timeDeltaComputation;
            _initialReferencePoint = referencePoint;
            _isStartEager          = isStartEager;
            _viewUpdatedCollection = viewUpdatedCollection;
            _isForceOutput         = forceOutput;

            _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();

            // schedule the first callback
            if (isStartEager)
            {
                if (_currentReferencePoint == null)
                {
                    _currentReferencePoint = agentInstanceContext.StatementContext.SchedulingService.Time;
                }
                ScheduleCallback();
                _isCallbackScheduled = true;
            }

            agentInstanceContext.AddTerminationCallback(Stop);
        }
Esempio n. 2
0
        private void TryParameter(Object[] param, long msec, long?referencePoint)
        {
            var factory = new TimeBatchViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            var view = (TimeBatchView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.IsTrue(new ExprTimePeriodEvalDeltaConstGivenDelta(msec).EqualsTimePeriod(view.TimeDeltaComputation));
            Assert.AreEqual(referencePoint, view.InitialReferencePoint);
        }
Esempio n. 3
0
 private void TryInvalidParameter(Object param)
 {
     try
     {
         var factory = new TimeBatchViewFactory();
         factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { param }));
         Assert.Fail();
     }
     catch (ViewParameterException)
     {
         // expected
     }
 }
Esempio n. 4
0
 public void SetUp()
 {
     _factory = new TimeBatchViewFactory();
 }
 public void SetUp()
 {
     _container = SupportContainer.Reset();
     _factory   = new TimeBatchViewFactory();
 }