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;
    }
@param position int array of 3 or 4 elements
                int array of 3 : position[0]-which element of the streamEventSize array,
                position[1]-BeforeWindowData or OutputData or AfterWindowData,
                position[2]- which attribute
                int array of 4 : position[0]-which element of the streamEventSize array, position[1]-which
                event of the event chain,
                position[3]- BeforeWindowData or OutputData or AfterWindowData, position[4]- which attribute
@return Attribute
modules/siddhi-core/src/main/java/io/siddhi/core/event/state/StateEvent.java