public static Iterator<EventBean> getIterator(
      JoinExecutionStrategy joinExecutionStrategy,
      ResultSetProcessor resultSetProcessor,
      Viewable parentView,
      boolean distinct) {
    Iterator<EventBean> iterator;
    EventType eventType;
    if (joinExecutionStrategy != null) {
      Set<MultiKey<EventBean>> joinSet = joinExecutionStrategy.staticJoin();
      iterator = resultSetProcessor.getIterator(joinSet);
      eventType = resultSetProcessor.getResultEventType();
    } else if (resultSetProcessor != null) {
      iterator = resultSetProcessor.getIterator(parentView);
      eventType = resultSetProcessor.getResultEventType();
    } else {
      iterator = parentView.iterator();
      eventType = parentView.getEventType();
    }

    if (!distinct) {
      return iterator;
    }
    return new EventDistinctIterator(iterator, eventType);
  }
 public Collection<EventBean> getSnapshot(
     EPStatementHandle createWindowStmtHandle, Viewable parent) {
   createWindowStmtHandle.getStatementLock().acquireReadLock();
   try {
     Iterator<EventBean> it = parent.iterator();
     if (!it.hasNext()) {
       return Collections.EMPTY_LIST;
     }
     ArrayDeque<EventBean> list = new ArrayDeque<EventBean>();
     while (it.hasNext()) {
       RevisionEventBeanDeclared fullRevision = (RevisionEventBeanDeclared) it.next();
       MultiKeyUntyped key = fullRevision.getKey();
       RevisionStateDeclared state = statePerKey.get(key);
       list.add(state.getLastEvent());
     }
     return list;
   } finally {
     createWindowStmtHandle.getStatementLock().releaseReadLock();
   }
 }
示例#3
0
 public void setParent(Viewable parent) {
   super.setParent(parent);
   eventType = parent.getEventType();
 }