public void removeLastEvent(int position) {
        StreamEvent aStreamEvent = streamEvents[position];
        if (aStreamEvent != null) {
            while (aStreamEvent.getNext() != null) {
                if (aStreamEvent.getNext().getNext() == null) {
                    aStreamEvent.setNext(null);
                    return;
                }
                aStreamEvent = aStreamEvent.getNext();
            }
            streamEvents[position] = null;
        }
    }
@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