本文整理汇总了Java中com.espertech.esper.event.EventBeanUtility类的典型用法代码示例。如果您正苦于以下问题:Java EventBeanUtility类的具体用法?Java EventBeanUtility怎么用?Java EventBeanUtility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventBeanUtility类属于com.espertech.esper.event包,在下文中一共展示了EventBeanUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyDelta
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
static void applyDelta(OneEventCollection newData, OneEventCollection oldData, NamedWindowOnMergeViewFactory parent, NamedWindowRootViewInstance rootView, ViewSupport viewable) {
if (!newData.isEmpty() || (oldData != null && !oldData.isEmpty())) {
if ((MetricReportingPath.isMetricsEnabled) && (parent.getCreateNamedWindowMetricHandle().isEnabled()) && !newData.isEmpty()) {
parent.getMetricReportingService().accountTime(parent.getCreateNamedWindowMetricHandle(), 0, 0, newData.toArray().length);
}
// Events to delete are indicated via old data
// The on-merge listeners receive the events deleted, but only if there is interest
if (parent.getStatementResultService().isMakeNatural()) {
EventBean[] eventsPerStreamNaturalNew = newData.isEmpty() ? null : newData.toArray();
EventBean[] eventsPerStreamNaturalOld = (oldData == null || oldData.isEmpty()) ? null : oldData.toArray();
rootView.update(EventBeanUtility.denaturalize(eventsPerStreamNaturalNew), EventBeanUtility.denaturalize(eventsPerStreamNaturalOld));
viewable.updateChildren(eventsPerStreamNaturalNew, eventsPerStreamNaturalOld);
} else {
EventBean[] eventsPerStreamNew = newData.isEmpty() ? null : newData.toArray();
EventBean[] eventsPerStreamOld = (oldData == null || oldData.isEmpty()) ? null : oldData.toArray();
rootView.update(eventsPerStreamNew, eventsPerStreamOld);
if (parent.getStatementResultService().isMakeSynthetic()) {
viewable.updateChildren(eventsPerStreamNew, eventsPerStreamOld);
}
}
}
}
示例2: filter
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public boolean filter(int streamLookup, int streamIndexed, ExcludePlanFilterOperatorType opType, ExprNode... exprNodes) {
EventBean event = ExcludePlanHintExprUtil.toEvent(streamLookup,
streamIndexed, streamNames[streamLookup], streamNames[streamIndexed],
opType.name().toLowerCase(Locale.ENGLISH), exprNodes);
if (queryPlanLogging && QUERY_PLAN_LOG.isInfoEnabled()) {
QUERY_PLAN_LOG.info("Exclude-plan-hint combination " + EventBeanUtility.printEvent(event));
}
EventBean[] eventsPerStream = new EventBean[]{event};
for (ExprEvaluator evaluator : evaluators) {
Boolean pass = (Boolean) evaluator.evaluate(eventsPerStream, true, exprEvaluatorContext);
if (pass != null && pass) {
if (queryPlanLogging && QUERY_PLAN_LOG.isInfoEnabled()) {
QUERY_PLAN_LOG.info("Exclude-plan-hint combination : true");
}
return true;
}
}
if (queryPlanLogging && QUERY_PLAN_LOG.isInfoEnabled()) {
QUERY_PLAN_LOG.info("Exclude-plan-hint combination : false");
}
return false;
}
示例3: get
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Collection<EventBean> get(EventBean[] eventsPerStream, Map parent, ExprEvaluatorContext context, CompositeIndexQueryResultPostProcessor postProcessor) {
EventBean[] eventsToUse;
if (isNWOnTrigger) {
eventsToUse = eventsPerStream;
} else {
System.arraycopy(eventsPerStream, 0, events, 1, eventsPerStream.length);
eventsToUse = events;
}
MultiKeyUntyped mk = EventBeanUtility.getMultiKey(eventsToUse, evaluators, context, keyCoercionTypes);
Map innerIndex = (Map) parent.get(mk);
if (innerIndex == null) {
return null;
}
return next.get(eventsPerStream, innerIndex, context, postProcessor);
}
示例4: getCollectKeys
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Collection<EventBean> getCollectKeys(EventBean[] eventsPerStream, Map parent, ExprEvaluatorContext context, ArrayList<Object> keys, CompositeIndexQueryResultPostProcessor postProcessor) {
EventBean[] eventsToUse;
if (isNWOnTrigger) {
eventsToUse = eventsPerStream;
} else {
System.arraycopy(eventsPerStream, 0, events, 1, eventsPerStream.length);
eventsToUse = events;
}
MultiKeyUntyped mk = EventBeanUtility.getMultiKey(eventsToUse, evaluators, context, keyCoercionTypes);
Collections.addAll(keys, mk.getKeys());
Map innerIndex = (Map) parent.get(mk);
if (innerIndex == null) {
return null;
}
return next.getCollectKeys(eventsPerStream, innerIndex, context, keys, postProcessor);
}
示例5: lookup
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Set<EventBean> lookup(EventBean theEvent, Map parent, Set<EventBean> result, CompositeIndexQuery next, ExprEvaluatorContext context, ArrayList<Object> optionalKeyCollector, CompositeIndexQueryResultPostProcessor postProcessor) {
Object comparableStart = super.evaluateLookupStart(theEvent, context);
if (optionalKeyCollector != null) {
optionalKeyCollector.add(comparableStart);
}
if (comparableStart == null) {
return null;
}
Object comparableEnd = super.evaluateLookupEnd(theEvent, context);
if (optionalKeyCollector != null) {
optionalKeyCollector.add(comparableEnd);
}
if (comparableEnd == null) {
return null;
}
comparableStart = EventBeanUtility.coerce(comparableStart, coercionType);
comparableEnd = EventBeanUtility.coerce(comparableEnd, coercionType);
TreeMap index = (TreeMap) parent;
SortedMap<Object, Set<EventBean>> submapOne = index.headMap(comparableStart, !includeStart);
SortedMap<Object, Set<EventBean>> submapTwo = index.tailMap(comparableEnd, !includeEnd);
return CompositeIndexQueryRange.handle(theEvent, submapOne, submapTwo, result, next, postProcessor);
}
示例6: evaluateGetCollEvents
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Collection<EventBean> evaluateGetCollEvents(EventBean[] eventsPerStream, boolean newData, Collection<EventBean> matchingEvents, ExprEvaluatorContext context, ExprSubselectRowNode parent) {
EventBean[] events = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
ArrayDeque<EventBean> filtered = null;
for (EventBean subselectEvent : matchingEvents) {
events[0] = subselectEvent;
Boolean pass = (Boolean) parent.filterExpr.evaluate(events, true, context);
if ((pass != null) && pass) {
if (filtered == null) {
filtered = new ArrayDeque<EventBean>();
}
filtered.add(subselectEvent);
}
}
return filtered;
}
示例7: evaluate
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean newData, Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext, ExprSubselectRowNode parent) {
AggregationService aggregationService = parent.getSubselectAggregationService().getContextPartitionAggregationService(exprEvaluatorContext.getAgentInstanceId());
Collection<Object> groupKeys = aggregationService.getGroupKeys(exprEvaluatorContext);
if (groupKeys.isEmpty()) {
return null;
}
EventBean[] events = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
boolean haveResult = false;
Object result = null;
for (Object groupKey : groupKeys) {
aggregationService.setCurrentAccess(groupKey, exprEvaluatorContext.getAgentInstanceId(), null);
Boolean pass = (Boolean) havingClause.evaluate(events, newData, exprEvaluatorContext);
if (pass != null && pass) {
if (haveResult) {
return null;
}
result = super.evaluate(eventsPerStream, newData, matchingEvents, exprEvaluatorContext, parent);
haveResult = true;
}
}
return haveResult ? result : null;
}
开发者ID:espertechinc,项目名称:esper,代码行数:27,代码来源:SubselectEvalStrategyRowUnfilteredSelectedGroupedWHaving.java
示例8: evaluateGetCollEvents
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Collection<EventBean> evaluateGetCollEvents(EventBean[] eventsPerStream, boolean newData, Collection<EventBean> matchingEvents, ExprEvaluatorContext context, ExprSubselectRowNode parent) {
AggregationService aggregationService = parent.getSubselectAggregationService().getContextPartitionAggregationService(context.getAgentInstanceId());
Collection<Object> groupKeys = aggregationService.getGroupKeys(context);
if (groupKeys.isEmpty()) {
return null;
}
EventBean[] events = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
Collection<EventBean> result = new ArrayDeque<EventBean>(groupKeys.size());
for (Object groupKey : groupKeys) {
aggregationService.setCurrentAccess(groupKey, context.getAgentInstanceId(), null);
Boolean pass = (Boolean) havingClause.evaluate(events, newData, context);
if (pass != null && pass) {
Map<String, Object> row = parent.evaluateRow(events, true, context);
EventBean event = parent.subselectMultirowType.getEventAdapterService().adapterForTypedMap(row, parent.subselectMultirowType.getEventType());
result.add(event);
}
}
return result;
}
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:SubselectEvalStrategyRowUnfilteredSelectedGroupedWHaving.java
示例9: evaluate
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean newData, Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext, ExprSubselectRowNode parent) {
EventBean[] eventsZeroBased = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
EventBean subSelectResult = ExprSubselectRowNodeUtility.evaluateFilterExpectSingleMatch(eventsZeroBased, newData, matchingEvents, exprEvaluatorContext, parent);
if (subSelectResult == null) {
return null;
}
eventsZeroBased[0] = subSelectResult;
Object result;
if (parent.selectClauseEvaluator.length == 1) {
result = parent.selectClauseEvaluator[0].evaluate(eventsZeroBased, true, exprEvaluatorContext);
} else {
// we are returning a Map here, not object-array, preferring the self-describing structure
result = parent.evaluateRow(eventsZeroBased, true, exprEvaluatorContext);
}
return result;
}
示例10: evaluate
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext, AggregationService aggregationServiceAnyPartition) {
if (matchingEvents == null || matchingEvents.size() == 0) {
return false;
}
AggregationService aggregationService = aggregationServiceAnyPartition.getContextPartitionAggregationService(exprEvaluatorContext.getAgentInstanceId());
Collection<Object> groupKeys = aggregationService.getGroupKeys(exprEvaluatorContext);
EventBean[] events = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
for (Object groupKey : groupKeys) {
aggregationService.setCurrentAccess(groupKey, exprEvaluatorContext.getAgentInstanceId(), null);
Boolean pass = (Boolean) havingEval.evaluate(events, true, exprEvaluatorContext);
if ((pass == null) || (!pass)) {
continue;
}
return true;
}
return false;
}
示例11: evaluate
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean newData, Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext, ExprSubselectRowNode parent) {
EventBean[] eventsZeroBased = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
Boolean pass = (Boolean) parent.havingExpr.evaluate(eventsZeroBased, newData, exprEvaluatorContext);
if ((pass == null) || (!pass)) {
return null;
}
Object result;
if (parent.selectClauseEvaluator.length == 1) {
result = parent.selectClauseEvaluator[0].evaluate(eventsZeroBased, true, exprEvaluatorContext);
} else {
// we are returning a Map here, not object-array, preferring the self-describing structure
result = parent.evaluateRow(eventsZeroBased, true, exprEvaluatorContext);
}
return result;
}
示例12: evaluate
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
public Object evaluate(EventBean[] eventsPerStream, boolean newData, Collection<EventBean> matchingEvents, ExprEvaluatorContext exprEvaluatorContext,
ExprSubselectRowNode parent) {
if (matchingEvents.size() > 1) {
log.warn(parent.getMultirowMessage());
return null;
}
EventBean[] events = EventBeanUtility.allocatePerStreamShift(eventsPerStream);
events[0] = EventBeanUtility.getNonemptyFirstEvent(matchingEvents);
Object result;
if (parent.selectClauseEvaluator.length == 1) {
result = parent.selectClauseEvaluator[0].evaluate(events, true, exprEvaluatorContext);
} else {
// we are returning a Map here, not object-array, preferring the self-describing structure
result = parent.evaluateRow(events, true, exprEvaluatorContext);
}
return result;
}
示例13: applyFilterExpression
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
/**
* Apply a filter expression.
*
* @param filter expression
* @param streamZeroEvent the event that represents stream zero
* @param streamOneEvents all events thate are stream one events
* @param exprEvaluatorContext context for expression evaluation
* @return filtered stream one events
*/
public static EventBean[] applyFilterExpression(ExprEvaluator filter, EventBean streamZeroEvent, EventBean[] streamOneEvents, ExprEvaluatorContext exprEvaluatorContext) {
EventBean[] eventsPerStream = new EventBean[2];
eventsPerStream[0] = streamZeroEvent;
EventBean[] filtered = new EventBean[streamOneEvents.length];
int countPass = 0;
for (EventBean eventBean : streamOneEvents) {
eventsPerStream[1] = eventBean;
Boolean result = (Boolean) filter.evaluate(eventsPerStream, true, exprEvaluatorContext);
if ((result != null) && result) {
filtered[countPass] = eventBean;
countPass++;
}
}
if (countPass == streamOneEvents.length) {
return streamOneEvents;
}
return EventBeanUtility.resizeArray(filtered, countPass);
}
示例14: output
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
private UniformPair<EventBean[]> output(boolean isSynthesize) {
// generate remaining key events
for (Map.Entry<Object, EventBean[]> entry : repsPerGroup.entrySet()) {
if (lastSeenKeys.contains(entry.getKey())) {
continue;
}
EventBean newEvent = processor.generateOutputBatchedSingle(entry.getKey(), entry.getValue(), true, isSynthesize);
if (newEvent != null) {
eventsNew.add(newEvent);
}
}
lastSeenKeys.clear();
EventBean[] newEventsArr = EventBeanUtility.toArray(eventsNew);
EventBean[] oldEventsArr = null;
if (processor.isSelectRStream()) {
oldEventsArr = EventBeanUtility.toArray(eventsOld);
}
eventsNew.clear();
eventsOld.clear();
if ((newEventsArr == null) && (oldEventsArr == null)) {
return null;
}
return new UniformPair<>(newEventsArr, oldEventsArr);
}
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ResultSetProcessorAggregateGroupedOutputAllHelperImpl.java
示例15: output
import com.espertech.esper.event.EventBeanUtility; //导入依赖的package包/类
private UniformPair<EventBean[]> output(boolean isGenerateSynthetic, boolean isJoin) {
EventBean[] oldEvents = EventBeanUtility.toArrayNullIfEmpty(eventsOld);
EventBean[] newEvents = EventBeanUtility.toArrayNullIfEmpty(eventsNew);
if (newEvents == null) {
newEvents = processor.getSelectListEventsAsArray(true, isGenerateSynthetic, isJoin);
}
if (oldEvents == null && processor.isSelectRStream()) {
oldEvents = processor.getSelectListEventsAsArray(false, isGenerateSynthetic, isJoin);
}
UniformPair<EventBean[]> result = null;
if (oldEvents != null || newEvents != null) {
result = new UniformPair<>(newEvents, oldEvents);
}
eventsOld.clear();
eventsNew.clear();
return result;
}