本文整理汇总了Java中com.espertech.esper.collection.ArrayEventIterator类的典型用法代码示例。如果您正苦于以下问题:Java ArrayEventIterator类的具体用法?Java ArrayEventIterator怎么用?Java ArrayEventIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArrayEventIterator类属于com.espertech.esper.collection包,在下文中一共展示了ArrayEventIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> iterator() {
if (tailView.getRevisionProcessor() != null) {
Collection<EventBean> coll = tailView.getRevisionProcessor().getSnapshot(agentInstanceContext.getEpStatementAgentInstanceHandle(), parent);
return coll.iterator();
}
agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().acquireReadLock();
try {
Iterator<EventBean> it = parent.iterator();
if (!it.hasNext()) {
return CollectionUtil.NULL_EVENT_ITERATOR;
}
ArrayList<EventBean> list = new ArrayList<EventBean>();
while (it.hasNext()) {
list.add(it.next());
}
return new ArrayEventIterator(list.toArray(new EventBean[list.size()]));
} finally {
agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().releaseReadLock();
}
}
示例2: getIterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> getIterator(Set<MultiKey<EventBean>> joinSet) {
EventBean[] result;
if (prototype.getOptionalHavingNode() == null) {
if (orderByProcessor == null) {
result = ResultSetProcessorUtil.getSelectJoinEventsNoHaving(selectExprProcessor, joinSet, true, true, exprEvaluatorContext);
} else {
result = ResultSetProcessorUtil.getSelectJoinEventsNoHavingWithOrderBy(aggregationService, selectExprProcessor, orderByProcessor, joinSet, true, true, exprEvaluatorContext);
}
} else {
if (orderByProcessor == null) {
result = ResultSetProcessorUtil.getSelectJoinEventsHaving(selectExprProcessor, joinSet, prototype.getOptionalHavingNode(), true, true, exprEvaluatorContext);
} else {
result = ResultSetProcessorUtil.getSelectJoinEventsHavingWithOrderBy(aggregationService, selectExprProcessor, orderByProcessor, joinSet, prototype.getOptionalHavingNode(), true, true, exprEvaluatorContext);
}
}
return new ArrayEventIterator(result);
}
示例3: iteratorCodegen
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public static CodegenExpression iteratorCodegen(int slot, CodegenClassScope classScope, CodegenMethodNode parentMethod, CodegenNamedMethods namedMethods) {
CodegenMethodNode initArray = initArrayCodegen(slot, namedMethods, classScope);
CodegenMethodNode method = parentMethod.makeChildWithScope(Iterator.class, AggregationStateLinearJoinImpl.class, CodegenSymbolProviderEmpty.INSTANCE, classScope);
method.getBlock().ifRefNull(refCol("array", slot))
.localMethod(initArray)
.blockEnd()
.methodReturn(newInstance(ArrayEventIterator.class, refCol("array", slot)));
return localMethod(method);
}
示例4: getIteratorJoinCodegen
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public static void getIteratorJoinCodegen(ResultSetProcessorRowPerGroupForge forge, CodegenClassScope classScope, CodegenMethodNode method, CodegenInstanceAux instance) {
CodegenMethodNode generateGroupKeyArrayJoin = generateGroupKeyArrayJoinTakingMapCodegen(forge, classScope, instance);
CodegenMethodNode generateOutputEventsJoin = generateOutputEventsJoinCodegen(forge, classScope, instance);
method.getBlock()
.declareVar(Map.class, "keysAndEvents", newInstance(HashMap.class))
.expression(localMethod(generateGroupKeyArrayJoin, REF_JOINSET, ref("keysAndEvents"), constantTrue()))
.declareVar(EventBean[].class, "selectNewEvents", localMethod(generateOutputEventsJoin, ref("keysAndEvents"), constantTrue(), constantTrue()))
.methodReturn(newInstance(ArrayEventIterator.class, ref("selectNewEvents")));
}
示例5: obtainIterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
private Iterator<EventBean> obtainIterator(Viewable parent) {
resetEventPerGroupBufView();
EventBean[] events = CollectionUtil.iteratorToArrayEvents(parent.iterator());
generateGroupKeysView(events, eventPerGroupBufView, true);
EventBean[] output = generateOutputEventsView(eventPerGroupBufView, true, true);
return new ArrayEventIterator(output);
}
示例6: obtainIteratorCodegen
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
private static CodegenMethodNode obtainIteratorCodegen(ResultSetProcessorRowPerGroupRollupForge forge, CodegenClassScope classScope, CodegenMethodNode parent, CodegenInstanceAux instance) {
CodegenMethodNode resetEventPerGroupBufView = resetEventPerGroupBufCodegen(NAME_EVENTPERGROUPBUFVIEW, classScope, instance);
CodegenMethodNode generateGroupKeysView = generateGroupKeysViewCodegen(forge, classScope, instance);
CodegenMethodNode generateOutputEventsView = generateOutputEventsViewCodegen(forge, classScope, instance);
CodegenMethodNode iterator = parent.makeChild(Iterator.class, ResultSetProcessorRowPerGroupRollupImpl.class, classScope).addParam(Viewable.class, NAME_VIEWABLE);
iterator.getBlock().localMethod(resetEventPerGroupBufView)
.declareVar(EventBean[].class, "events", staticMethod(CollectionUtil.class, METHOD_ITERATORTOARRAYEVENTS, exprDotMethod(REF_VIEWABLE, "iterator")))
.localMethod(generateGroupKeysView, ref("events"), ref(NAME_EVENTPERGROUPBUFVIEW), constantTrue())
.declareVar(EventBean[].class, "output", localMethod(generateOutputEventsView, ref(NAME_EVENTPERGROUPBUFVIEW), constantTrue(), constantTrue()))
.methodReturn(newInstance(ArrayEventIterator.class, ref("output")));
return iterator;
}
示例7: getIteratorJoinCodegen
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
static void getIteratorJoinCodegen(ResultSetProcessorRowPerGroupRollupForge forge, CodegenClassScope classScope, CodegenMethodNode method, CodegenInstanceAux instance) {
CodegenMethodNode generateGroupKeysJoin = generateGroupKeysJoinCodegen(forge, classScope, instance);
CodegenMethodNode generateOutputEventsJoin = generateOutputEventsJoinCodegen(forge, classScope, instance);
CodegenMethodNode resetEventPerGroupBuf = resetEventPerGroupBufCodegen(NAME_EVENTPERGROUPBUFJOIN, classScope, instance);
method.getBlock().localMethod(resetEventPerGroupBuf)
.localMethod(generateGroupKeysJoin, REF_JOINSET, ref(NAME_EVENTPERGROUPBUFJOIN), constantTrue())
.declareVar(EventBean[].class, "output", localMethod(generateOutputEventsJoin, ref(NAME_EVENTPERGROUPBUFJOIN), constantTrue(), constantTrue()))
.methodReturn(newInstance(ArrayEventIterator.class, ref("output")));
}
示例8: getIterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> getIterator(Viewable parent) {
if (orderByProcessor == null) {
// Return an iterator that gives row-by-row a result
return new TransformEventIterator(parent.iterator(), new ResultSetProcessorHandtruTransform(this));
}
// Pull all events, generate order keys
EventBean[] eventsPerStream = new EventBean[1];
List<EventBean> events = new ArrayList<>();
List<Object> orderKeys = new ArrayList<>();
Iterator parentIterator = parent.iterator();
if (parentIterator == null) {
return CollectionUtil.NULL_EVENT_ITERATOR;
}
for (EventBean aParent : parent) {
eventsPerStream[0] = aParent;
Object orderKey = orderByProcessor.getSortKey(eventsPerStream, true, exprEvaluatorContext);
EventBean[] result;
if (prototype.getOptionalHavingNode() == null) {
// ignore orderByProcessor
result = ResultSetProcessorUtil.getSelectEventsNoHaving(selectExprProcessor, eventsPerStream, true, true, exprEvaluatorContext);
} else {
// ignore orderByProcessor
result = ResultSetProcessorUtil.getSelectEventsHaving(selectExprProcessor, eventsPerStream, prototype.getOptionalHavingNode(), true, true, exprEvaluatorContext);
}
if (result != null && result.length != 0) {
events.add(result[0]);
orderKeys.add(orderKey);
}
}
// sort
EventBean[] outgoingEvents = CollectionUtil.toArrayEvents(events);
Object[] orderKeysArr = CollectionUtil.toArrayObjects(orderKeys);
EventBean[] orderedEvents = orderByProcessor.sortWOrderKeys(outgoingEvents, orderKeysArr, exprEvaluatorContext);
return new ArrayEventIterator(orderedEvents);
}
示例9: getIteratorViewCodegen
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public static void getIteratorViewCodegen(ResultSetProcessorSimpleForge forge, CodegenClassScope classScope, CodegenMethodNode method, CodegenInstanceAux instance) {
if (!forge.isSorting()) {
// Return an iterator that gives row-by-row a result
method.getBlock().methodReturn(newInstance(TransformEventIterator.class, exprDotMethod(REF_VIEWABLE, "iterator"), newInstance(ResultSetProcessorHandtruTransform.class, ref("this"))));
return;
}
// Pull all events, generate order keys
method.getBlock().declareVar(EventBean[].class, "eventsPerStream", newArrayByLength(EventBean.class, constant(1)))
.declareVar(List.class, "events", newInstance(ArrayList.class))
.declareVar(List.class, "orderKeys", newInstance(ArrayList.class))
.declareVar(Iterator.class, "parentIterator", exprDotMethod(REF_VIEWABLE, "iterator"))
.ifCondition(equalsNull(ref("parentIterator"))).blockReturn(publicConstValue(CollectionUtil.class, "NULL_EVENT_ITERATOR"));
{
CodegenBlock loop = method.getBlock().forEach(EventBean.class, "aParent", REF_VIEWABLE);
loop.assignArrayElement("eventsPerStream", constant(0), ref("aParent"))
.declareVar(Object.class, "orderKey", exprDotMethod(REF_ORDERBYPROCESSOR, "getSortKey", ref("eventsPerStream"), constantTrue(), REF_AGENTINSTANCECONTEXT));
if (forge.getOptionalHavingNode() == null) {
loop.declareVar(EventBean[].class, "result", staticMethod(ResultSetProcessorUtil.class, METHOD_GETSELECTEVENTSNOHAVING, REF_SELECTEXPRPROCESSOR, ref("eventsPerStream"), constantTrue(), constantTrue(), REF_AGENTINSTANCECONTEXT));
} else {
CodegenMethodNode select = ResultSetProcessorUtil.getSelectEventsHavingCodegen(classScope, instance);
loop.declareVar(EventBean[].class, "result", localMethod(select, REF_SELECTEXPRNONMEMBER, ref("eventsPerStream"), constantTrue(), constantTrue(), REF_AGENTINSTANCECONTEXT));
}
loop.ifCondition(and(notEqualsNull(ref("result")), not(equalsIdentity(arrayLength(ref("result")), constant(0)))))
.exprDotMethod(ref("events"), "add", arrayAtIndex(ref("result"), constant(0)))
.exprDotMethod(ref("orderKeys"), "add", ref("orderKey"));
}
method.getBlock().declareVar(EventBean[].class, "outgoingEvents", staticMethod(CollectionUtil.class, METHOD_TOARRAYEVENTS, ref("events")))
.declareVar(Object[].class, "orderKeysArr", staticMethod(CollectionUtil.class, METHOD_TOARRAYOBJECTS, ref("orderKeys")))
.declareVar(EventBean[].class, "orderedEvents", exprDotMethod(REF_ORDERBYPROCESSOR, "sortWOrderKeys", ref("outgoingEvents"), ref("orderKeysArr"), REF_AGENTINSTANCECONTEXT))
.methodReturn(newInstance(ArrayEventIterator.class, ref("orderedEvents")));
}
示例10: getIteratorJoinCodegen
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public static void getIteratorJoinCodegen(ResultSetProcessorAggregateGroupedForge forge, CodegenClassScope classScope, CodegenMethodNode method, CodegenInstanceAux instance) {
CodegenMethodNode generateGroupKeyArrayJoin = generateGroupKeyArrayJoinCodegen(forge.getGroupKeyNodeExpressions(), classScope, instance);
CodegenMethodNode generateOutputEventsJoin = generateOutputEventsJoinCodegen(forge, classScope, instance);
method.getBlock().declareVar(Object[].class, "groupByKeys", localMethod(generateGroupKeyArrayJoin, REF_JOINSET, constantTrue()))
.declareVar(EventBean[].class, "result", localMethod(generateOutputEventsJoin, REF_JOINSET, ref("groupByKeys"), constantTrue(), constantTrue()))
.methodReturn(newInstance(ArrayEventIterator.class, ref("result")));
}
示例11: iterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public final Iterator<EventBean> iterator()
{
if (lastInsertedEvents != null)
{
return new ArrayEventIterator(lastInsertedEvents);
}
return new SingleEventIterator(lastInsertedEvent);
}
示例12: iterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> iterator()
{
if (tailView.getRevisionProcessor() != null)
{
Collection<EventBean> coll = tailView.getRevisionProcessor().getSnapshot(agentInstanceContext.getEpStatementAgentInstanceHandle(), parent);
return coll.iterator();
}
agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().acquireReadLock();
try
{
Iterator<EventBean> it = parent.iterator();
if (!it.hasNext())
{
return CollectionUtil.NULL_EVENT_ITERATOR;
}
ArrayList<EventBean> list = new ArrayList<EventBean>();
while (it.hasNext())
{
list.add(it.next());
}
return new ArrayEventIterator(list.toArray(new EventBean[list.size()]));
}
finally
{
agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().releaseReadLock();
}
}
示例13: iterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> iterator()
{
if (array == null) {
initArray();
}
return new ArrayEventIterator(array);
}
示例14: getIterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> getIterator(Set<MultiKey<EventBean>> joinSet)
{
Map<Object, EventBean[]> keysAndEvents = new HashMap<Object, EventBean[]>();
generateGroupKeys(joinSet, keysAndEvents, true);
EventBean[] selectNewEvents = generateOutputEventsJoin(keysAndEvents, true, true);
return new ArrayEventIterator(selectNewEvents);
}
示例15: getIterator
import com.espertech.esper.collection.ArrayEventIterator; //导入依赖的package包/类
public Iterator<EventBean> getIterator(Viewable parent)
{
if (orderByProcessor == null)
{
return new ResultSetAggregateGroupedIterator(parent.iterator(), this, aggregationService,agentInstanceContext);
}
// Pull all parent events, generate order keys
EventBean[] eventsPerStream = new EventBean[1];
List<EventBean> outgoingEvents = new ArrayList<EventBean>();
List<Object> orderKeys = new ArrayList<Object>();
for (EventBean candidate : parent) {
eventsPerStream[0] = candidate;
Object groupKey = generateGroupKey(eventsPerStream, true);
aggregationService.setCurrentAccess(groupKey, agentInstanceContext.getAgentInstanceId());
Boolean pass = true;
if (prototype.getOptionalHavingNode() != null) {
pass = (Boolean) prototype.getOptionalHavingNode().evaluate(eventsPerStream, true, agentInstanceContext);
}
if ((pass == null) || (!pass))
{
continue;
}
outgoingEvents.add(selectExprProcessor.process(eventsPerStream, true, true, agentInstanceContext));
Object orderKey = orderByProcessor.getSortKey(eventsPerStream, true, agentInstanceContext);
orderKeys.add(orderKey);
}
// sort
EventBean[] outgoingEventsArr = outgoingEvents.toArray(new EventBean[outgoingEvents.size()]);
Object[] orderKeysArr = orderKeys.toArray(new Object[orderKeys.size()]);
EventBean[] orderedEvents = orderByProcessor.sort(outgoingEventsArr, orderKeysArr, agentInstanceContext);
return new ArrayEventIterator(orderedEvents);
}