public void populateStateEvent(ComplexEvent complexEvent) { StateEvent stateEvent = (StateEvent) complexEvent; for (StateMappingElement stateMappingElement : stateMappingElements) { int toPosition = stateMappingElement.getToPosition(); stateEvent.setOutputData( getFromData(stateEvent, stateMappingElement.getFromPosition()), toPosition); // switch (toPosition[0]) { // case 0: // stateEvent.setPreOutputData(getFromData(stateEvent, // stateMappingElement.getFromPosition()), // toPosition[1]); // break; // case 1: // stateEvent.setOutputData(getFromData(stateEvent, // stateMappingElement.getFromPosition()), // toPosition[1]); // break; // default: // //will not happen // throw new IllegalStateException("To Position cannot be :" + // toPosition[0]); // } } }
private Object getFromData(StateEvent stateEvent, int[] fromPosition) { return stateEvent.getAttribute(fromPosition); // StreamEvent streamEvent = stateEvent.getStreamEvent(fromPosition[0]); // if (streamEvent == null) { // return null; // } // if (fromPosition[1] > 0) { // for (int i = 0, size = fromPosition[1]; i < size; i++) { // streamEvent = streamEvent.getNext(); // } // } // switch (fromPosition[2]) { // case 0: // return streamEvent.getBeforeWindowData()[fromPosition[3]]; // case 1: // return streamEvent.getOnAfterWindowData()[fromPosition[3]]; // case 2: // return streamEvent.getEventTime()[fromPosition[3]]; // default: // //will not happen // throw new IllegalStateException("3rd element in from position cannot be :" + // fromPosition[2]); // } }