public Object Evaluate(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { IEnumerator <EventBean> events; int size; if (_randomAccessGetter != null) { var randomAccess = _randomAccessGetter.Accessor; events = randomAccess.GetWindowEnumerator(); size = randomAccess.WindowCount; } else { var evalEvent = eventsPerStream[_streamNumber]; var relativeAccess = _relativeAccessGetter.GetAccessor(evalEvent); if (relativeAccess == null) { return(null); } size = relativeAccess.GetWindowToEventCount(); events = relativeAccess.GetWindowToEvent(); } if (size <= 0) { return(null); } var originalEvent = eventsPerStream[_streamNumber]; var result = Array.CreateInstance(_componentType, size); for (int i = 0; i < size; i++) { events.MoveNext(); eventsPerStream[_streamNumber] = events.Current; var evalResult = _evalNode.Evaluate(new EvaluateParams(eventsPerStream, true, exprEvaluatorContext)); result.SetValue(evalResult, i); } eventsPerStream[_streamNumber] = originalEvent; return(result); }
private EventBean GetSubstitute(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { // Use constant if supplied int?index; if (_isConstantIndex) { index = _constantIndexNumber; } else { // evaluate first child, which returns the index var indexResult = _indexNode.Evaluate(new EvaluateParams(eventsPerStream, true, exprEvaluatorContext)); if (indexResult == null) { return(null); } index = indexResult.AsInt(); } // access based on index returned EventBean substituteEvent; if (_randomAccessGetter != null) { RandomAccessByIndex randomAccess = _randomAccessGetter.Accessor; if (!_isTail) { substituteEvent = randomAccess.GetNewData(index.Value); } else { substituteEvent = randomAccess.GetNewDataTail(index.Value); } } else { var evalEvent = eventsPerStream[_streamNumber]; var relativeAccess = _relativeAccessGetter.GetAccessor(evalEvent); if (relativeAccess == null) { return(null); } if (!_isTail) { substituteEvent = relativeAccess.GetRelativeToEvent(evalEvent, index.Value); } else { substituteEvent = relativeAccess.GetRelativeToEnd(index.Value); } } return(substituteEvent); }
public object Evaluate( EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { IEnumerator<EventBean> events; int size; if (randomAccessGetter != null) { RandomAccessByIndex randomAccess = randomAccessGetter.Accessor; events = randomAccess.GetWindowEnumerator(); size = (int) randomAccess.WindowCount; } else { EventBean evalEvent = eventsPerStream[streamNumber]; RelativeAccessByEventNIndex relativeAccess = relativeAccessGetter.GetAccessor(evalEvent); if (relativeAccess == null) { return null; } size = relativeAccess.WindowToEventCount; events = relativeAccess.WindowToEvent; } if (size <= 0) { return null; } EventBean originalEvent = eventsPerStream[streamNumber]; Array result = Array.CreateInstance(componentType, size); for (int i = 0; i < size; i++) { events.MoveNext(); eventsPerStream[streamNumber] = events.Current; result.SetValue(evalNode.Evaluate(eventsPerStream, true, exprEvaluatorContext), i); } eventsPerStream[streamNumber] = originalEvent; return result; }
private EventBean GetSubstitute( EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { // Use constant if supplied int? index; if (isConstantIndex) { index = constantIndexNumber; } else { // evaluate first child, which returns the index object indexResult = indexNode.Evaluate(eventsPerStream, true, exprEvaluatorContext); if (indexResult == null) { return null; } index = (indexResult).AsInt32(); } // access based on index returned EventBean substituteEvent; if (randomAccessGetter != null) { RandomAccessByIndex randomAccess = randomAccessGetter.Accessor; if (!isTail) { substituteEvent = randomAccess.GetNewData(index.Value); } else { substituteEvent = randomAccess.GetNewDataTail(index.Value); } } else { EventBean evalEvent = eventsPerStream[streamNumber]; RelativeAccessByEventNIndex relativeAccess = relativeAccessGetter.GetAccessor(evalEvent); if (relativeAccess == null) { return null; } if (!isTail) { substituteEvent = relativeAccess.GetRelativeToEvent(evalEvent, index.Value); } else { substituteEvent = relativeAccess.GetRelativeToEnd(index.Value); } } return substituteEvent; }
public object Evaluate( EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { long size; if (randomAccessGetter != null) { RandomAccessByIndex randomAccess = randomAccessGetter.Accessor; size = randomAccess.WindowCount; } else { EventBean evalEvent = eventsPerStream[streamNumber]; RelativeAccessByEventNIndex relativeAccess = relativeAccessGetter.GetAccessor(evalEvent); if (relativeAccess == null) { return null; } size = relativeAccess.WindowToEventCount; } return size; }
public Object Evaluate(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext) { long size; if (_randomAccessGetter != null) { var randomAccess = _randomAccessGetter.Accessor; size = randomAccess.WindowCount; } else { var evalEvent = eventsPerStream[_streamNumber]; var relativeAccess = _relativeAccessGetter.GetAccessor(evalEvent); if (relativeAccess == null) { return(null); } size = relativeAccess.GetWindowToEventCount(); } return(size); }