public void getUMLSend(TypedCircularMessage message, long receivedAt, long ts) { UmlSend umlSend = new UmlSend(message); MentorIndex mentorIndex = blackbox.getMentorIndex(); long senderClassId = umlSend.getSenderClassId(); String senderStateMachine = mentorIndex.getClazz((int) senderClassId); final UmlStateMachine sendMachine = getStatemachineByName(senderStateMachine); long receiverClassId = umlSend.getReceiverClassId(); String receiverStateMachine = mentorIndex.getClazz((int) receiverClassId); final UmlStateMachine receiveMachine = getStatemachineByName(receiverStateMachine); SRLSend srlSendEvent = new SRLSend(); srlSendEvent.setSenderId(sendMachine.getId()); srlSendEvent.setSenderInstance((int) umlSend.getSenderInstanceId()); srlSendEvent.setSenderReplicatioIndex(0); srlSendEvent.setReceiverId(receiveMachine.getId()); srlSendEvent.setReceiverInstance((int) umlSend.getReceiverInstanceId()); srlSendEvent.setReceiverReplicationIndex(0); long signalId = umlSend.getSignalId(); String signal = mentorIndex.getSignal((int) signalId); srlSendEvent.setSignal(signal); srlSendEvent.setMessageAddress(umlSend.getSignalInstanceId()); srlSendEvent.setPort(""); srlSendEvent.setPortIndex(Long.valueOf(0)); srlSendEvent.setReceivedAt(resolveTimeStamp(receivedAt)); srlSendEvent.setTs(resolveTimeStamp(((CircularMessage) message.getMessage()).getTs())); getSRLSend(srlSendEvent, ts); }
private void getRoseSend(TypedCircularMessage message, long receivedAt, long ts) { final UmlStateMachine sendMachine = getStatemachineByName(getValue(message, SRLEventReader.FN_SENDER_ACTOR).toString()); final UmlStateMachine receiveMachine = getStatemachineByName( getValue(message, SRLEventReader.FN_RECEIVER_ACTOR.toString()).toString()); final Long msgAddr = (Long) getValue(message, SRLEventReader.FN_MSG_ADDR); SRLSend srlSendEvent = new SRLSend(); srlSendEvent.setSenderId(sendMachine.getId()); srlSendEvent.setSenderInstance( ((Long) getValue(message, SRLEventReader.FN_SENDER_ACTOR_INSTANCE)).intValue()); srlSendEvent.setSenderReplicatioIndex( ((Long) getValue(message, SRLEventReader.FN_SENDER_REPLICATION_INDEX)).intValue()); srlSendEvent.setReceiverId(receiveMachine.getId()); srlSendEvent.setReceiverInstance( ((Long) getValue(message, SRLEventReader.FN_RECEIVER_ACTOR_INSTANCE)).intValue()); srlSendEvent.setReceiverReplicationIndex( ((Long) getValue(message, SRLEventReader.FN_RECEIVER_REPLICATION_INDEX)).intValue()); srlSendEvent.setSignal(getValue(message, SRLEventReader.FN_SIGNAL).toString()); srlSendEvent.setPort(getValue(message, SRLEventReader.FN_PORT).toString()); srlSendEvent.setPortIndex((Long) getValue(message, SRLEventReader.FN_PORT_INDEX)); srlSendEvent.setMessageAddress(msgAddr); srlSendEvent.setReceivedAt(resolveTimeStamp(receivedAt)); srlSendEvent.setTs(resolveTimeStamp(((CircularMessage) message.getMessage()).getTs())); getSRLSend(srlSendEvent, ts); }
private void getStateMachineMap() { if (stateMachineMap == null) { return; } for (final UmlStateMachine machine : stateMachineMap.values()) { client.eventRead( new StateMachineArtifactInfo( machine.getId(), machine.getName(), EventFactory.STATE_MACHINE_EVENT_TYPE_ID, new FieldValues())); for (final UmlState state : machine.getStates()) { int parentId = -1; if (state.getParent() == null) { parentId = machine.getId(); } else { parentId = state.getParent().getId(); } client.eventRead( new StateArtifactInfo( state.getId(), state.getName(), parentId, EventFactory.STATE_EVENT_TYPE_ID, new FieldValues())); } /* * for (final UmlTransition trans : machine.getTransitions()) { * bin.writeInt(trans.getSource()); bin.writeInt(trans.getTarget()); * } */ } }
private void getRoseReceive(TypedCircularMessage message, long ts) { final UmlStateMachine machine = getStatemachineByName(getValue(message, SRLEventReader.FN_RECEIVER_ACTOR).toString()); Object fnState = getValue(message, SRLEventReader.FN_STATE); UmlState state = null; if (fnState != null) { state = getStateByName(fnState.toString(), machine); } final Long msgAddr = (Long) getValue(message, SRLEventReader.FN_MSG_ADDR); final long high = (Long) getValue(message, FINISH_HI); final long low = (Long) getValue(message, FINISH_LO); Long sentAt = getSentAt(msgAddr); SRLReceive receive = new SRLReceive(); receive.setReceiverId(machine.getId()); receive.setReceiverInstance( ((Long) getValue(message, SRLEventReader.FN_RECEIVER_ACTOR_INSTANCE)).intValue()); receive.setReceiverReplicationIndex( ((Long) getValue(message, SRLEventReader.FN_RECEIVER_ACTOR_REPLICATION_INDEX)).intValue()); if (state == null) { receive.setStateId(-1); } else { receive.setStateId(state.getId()); } receive.setSignal(getValue(message, SRLEventReader.FN_SIGNAL).toString()); receive.setPort(getValue(message, SRLEventReader.FN_PORT).toString()); receive.setPortIndex(((Long) getValue(message, SRLEventReader.FN_PORT_INDEX))); receive.setMessageAddress(msgAddr); long finishTime = resolveTimeStamp((high << 32) + low); finishTime = convertTime(finishTime); receive.setTs(finishTime); receive.setSentAt(sentAt); getSRLReceive(receive, ts); }
private UmlStateMachine getStatemachineByName(final String statemachineName) { for (final UmlStateMachine machine : stateMachineMap.values()) { if (!statemachineName.equals(machine.getName())) { continue; } return machine; } final UmlStateMachine unknown = new UmlStateMachine(statemachineName); unknown.setId(Integer.MAX_VALUE - SRLEventReader.unknownIdCnt); SRLEventReader.unknownIdCnt++; stateMachineMap.put(statemachineName, unknown); return unknown; }
private UmlState getStateByName(final String stateName, final UmlStateMachine machine) { if (stateName == null) { return null; } for (final UmlState state : machine.getStates()) { if (stateName.equals(state.getName())) { return state; } } final UmlState state = new UmlState(stateName, machine, 0); state.setId(Integer.MAX_VALUE - SRLEventReader.unknownIdCnt); SRLEventReader.unknownIdCnt++; machine.add(state); return state; }
public void getUMLreceive(TypedCircularMessage message, long ts) { UmlReceive umlReceive = new UmlReceive(message); MentorIndex index = blackbox.getMentorIndex(); long receiverClassId = umlReceive.getReceiverClassId(); String receiverClassName = index.getClazz((int) receiverClassId); if (receiverClassName == null) { receiverClassName = "UnknownClassName"; } final UmlStateMachine machine = getStatemachineByName(receiverClassName); SRLReceive receive = new SRLReceive(); receive.setReceiverId(machine.getId()); receive.setReceiverInstance(umlReceive.getReceiverInstanceId()); receive.setReceiverReplicationIndex(0); long stateId = umlReceive.getNextStateId(); String stateName = index.getState((int) stateId); UmlState umlState = getStateByName(stateName, machine); receive.setStateId(umlState.getId()); long signalId = umlReceive.getSignalId(); String signalName = index.getSignal((int) signalId); receive.setSignal(signalName); Long signalInstanceId = umlReceive.getSignalInstanceId(); receive.setMessageAddress(signalInstanceId); Long sentAt = getSentAt(signalInstanceId); receive.setSentAt(sentAt); receive.setPort(""); receive.setPortIndex(Long.valueOf(0)); final long high = umlReceive.getFinishHi(); final long low = umlReceive.getFinishLo(); long finishTime = resolveTimeStamp((high << 32) + low); finishTime = convertTime(finishTime); receive.setTs(finishTime); getSRLReceive(receive, ts); return; }