use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class ConversionStreamEventChunk method convertAndAssign.
// @Override
// public void convertAndAssignFirst(StreamEvent streamEvent) {
// StreamEvent newEvent = streamEventFactory.borrowEvent();
// eventConverter.convertComplexEvent(streamEvent, newEvent);
// first = newEvent;
// last = first;
// }
public void convertAndAssign(Event[] events) {
StreamEvent firstEvent = streamEventFactory.newInstance();
streamEventConverter.convertEvent(events[0], firstEvent);
StreamEvent currentEvent = firstEvent;
for (int i = 1, eventsLength = events.length; i < eventsLength; i++) {
StreamEvent nextEvent = streamEventFactory.newInstance();
streamEventConverter.convertEvent(events[i], nextEvent);
currentEvent.setNext(nextEvent);
currentEvent = nextEvent;
}
first = firstEvent;
last = currentEvent;
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class StateEvent method getStreamEvent.
public StreamEvent getStreamEvent(int[] position) {
StreamEvent streamEvent = streamEvents[position[STREAM_EVENT_CHAIN_INDEX]];
if (streamEvent == null) {
return null;
}
int streamEventIndex = position[STREAM_EVENT_INDEX_IN_CHAIN];
if (streamEventIndex >= 0) {
for (int i = 1; i <= position[STREAM_EVENT_INDEX_IN_CHAIN]; i++) {
streamEvent = streamEvent.getNext();
if (streamEvent == null) {
return null;
}
}
} else if (streamEventIndex == CURRENT) {
while (streamEvent.getNext() != null) {
streamEvent = streamEvent.getNext();
}
} else if (streamEventIndex == LAST) {
if (streamEvent.getNext() == null) {
return null;
}
while (streamEvent.getNext().getNext() != null) {
streamEvent = streamEvent.getNext();
}
} else {
List<StreamEvent> stateEventList = new ArrayList<StreamEvent>();
while (streamEvent != null) {
stateEventList.add(streamEvent);
streamEvent = streamEvent.getNext();
}
int index = stateEventList.size() + streamEventIndex;
if (index < 0) {
return null;
} else {
streamEvent = stateEventList.get(index);
}
}
return streamEvent;
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class SnapshotableStreamEventQueue method poll.
public StreamEvent poll() {
reset();
if (first != null) {
StreamEvent firstEvent = first;
first = first.getNext();
firstEvent.setNext(null);
if (!isFullSnapshot()) {
if (isOperationLogEnabled) {
operationChangeLog.add(new Operation(Operator.REMOVE));
}
operationChangeLogSize++;
} else {
operationChangeLog.clear();
operationChangeLogSize = 0;
forceFullSnapshot = true;
}
return firstEvent;
} else {
return null;
}
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class SnapshotableStreamEventQueue method overwrite.
public void overwrite(StreamEvent streamEvent) {
if (!isFullSnapshot()) {
if (isOperationLogEnabled) {
operationChangeLog.add(new Operation(Operator.OVERWRITE, new Object[] { eventIndex, eventClonerHolder.getStreamEventCloner().copyStreamEvent(streamEvent) }));
}
operationChangeLogSize++;
} else {
operationChangeLog.clear();
operationChangeLogSize = 0;
forceFullSnapshot = true;
}
if (previousToLastReturned != null) {
previousToLastReturned.setNext(streamEvent);
} else {
first = streamEvent;
}
StreamEvent next = lastReturned.getNext();
if (next != null) {
streamEvent.setNext(next);
} else {
last = streamEvent;
}
lastReturned = streamEvent;
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class BatchingWindowProcessor method processEventChunk.
@Override
protected void processEventChunk(ComplexEventChunk<StreamEvent> streamEventChunk, Processor nextProcessor, StreamEventCloner streamEventCloner, ComplexEventPopulater complexEventPopulater, S state) {
streamEventChunk.reset();
while (streamEventChunk.hasNext()) {
StreamEvent streamEvent = streamEventChunk.next();
streamEvent.setBeforeWindowData(null);
}
streamEventChunk.reset();
process(streamEventChunk, nextProcessor, streamEventCloner, state);
}
Aggregations