public ICoverageState Consume(CircularArray <double>[] buffers, int startBufferIdx, long sampleIdx, Action <long, long> segmentFound) { var isComplete = CoverageStateMachine.IsCompleteAtIndex(sampleIdx, buffers, startBufferIdx); if (isComplete) { return(m_stateFactory.Extend(sampleIdx)); } return(this); }
public ICoverageState Consume(CircularArray <double>[] buffers, int startBufferIdx, long sampleIdx, Action <long, long> segmentFound) { var complete = CoverageStateMachine.IsCompleteAtIndex(sampleIdx, buffers, startBufferIdx); if (complete) { m_endIdx = sampleIdx; return(this); } return(Done(segmentFound)); }
public CoverageCircularBuffer(int[] loggedParametersIds, int loggedParametersRateInMilliHz, int bufferWidthInSeconds, ITimeUtils <TTime> timeUtils) { m_loggedParametersIds = loggedParametersIds; m_loggedParametersRateInMilliHz = loggedParametersRateInMilliHz; m_timeUtils = timeUtils; m_coverageStateMachine = new CoverageStateMachine(new FixedCoverageStateFactory()); var bufferSize = loggedParametersRateInMilliHz * bufferWidthInSeconds / 1000; m_buffers = new CircularArray <double> [loggedParametersIds.Length]; for (int i = 0; i < m_buffers.Length; i++) { m_buffers[i] = new CircularArray <double>(bufferSize, double.NaN); } m_timeZero = timeUtils.Zero(); }