use of org.eclipse.titan.log.viewer.views.msc.ui.core.MSCNode in project titan.EclipsePlug-ins by eclipse.
the class MSCModel method addEnqueued.
private MSCNode[] addEnqueued(final String ref, final String target, final String name, final String time, final int occurrence) {
Enqueued message = new Enqueued();
Lifeline source = this.lifelines.get(ref);
Lifeline dest = this.lifelines.get(target);
if ((source == null) || (dest == null)) {
return new MSCNode[] {};
}
source.setCurrentEventOccurrence(occurrence);
dest.setCurrentEventOccurrence(occurrence);
message.setStartLifeline(source);
message.setEndLifeline(dest);
message.setName(name);
return new MSCNode[] { message, new TimeStampNode(occurrence, time) };
}
use of org.eclipse.titan.log.viewer.views.msc.ui.core.MSCNode in project titan.EclipsePlug-ins by eclipse.
the class MSCModel method addFunctionNode.
private MSCNode[] addFunctionNode(FunctionNode function, String ref, String target, String name, String time, int occurrence) {
Lifeline source = this.lifelines.get(ref);
Lifeline destination = this.lifelines.get(target);
if ((source == null) || (destination == null)) {
return new MSCNode[] {};
}
source.setCurrentEventOccurrence(occurrence);
destination.setCurrentEventOccurrence(occurrence);
function.setStartLifeline(source);
function.setEndLifeline(destination);
function.setName(name);
// Create and add Time Stamp
return new MSCNode[] { function, new TimeStampNode(occurrence, time) };
}
use of org.eclipse.titan.log.viewer.views.msc.ui.core.MSCNode in project titan.EclipsePlug-ins by eclipse.
the class MSCModel method addPortEventNode.
private MSCNode[] addPortEventNode(PortEventNode portEventNode, String ref, String target, String time, int occurrence) {
Lifeline source = this.lifelines.get(ref);
Lifeline destination = this.lifelines.get(target);
if ((source == null) || (destination == null)) {
return new MSCNode[] {};
}
source.setCurrentEventOccurrence(occurrence);
destination.setCurrentEventOccurrence(occurrence);
portEventNode.setStartLifeline(source);
portEventNode.setEndLifeline(destination);
// Create and add Time Stamp
return new MSCNode[] { portEventNode, new TimeStampNode(occurrence, time) };
}
use of org.eclipse.titan.log.viewer.views.msc.ui.core.MSCNode in project titan.EclipsePlug-ins by eclipse.
the class MSCModel method extractNodes.
/**
* Extracts the nodes from the provided event object.
*
* @param ievent the event to extract the data from.
* @param occurrence the number at which time this event happened in its order.
*
* @return the resulting list of nodes.
*/
private MSCNode[] extractNodes(final IEventObject ievent, final int occurrence) {
if (!(ievent instanceof EventObject)) {
return new MSCNode[] {};
}
EventObject event = (EventObject) ievent;
String ref = event.getReference();
String target = event.getTarget();
String name = event.getName();
String time = event.getTime();
String type = event.getEventType();
String sourcePort = event.getPort();
String targetPort = event.getTargetPort();
switch(event.getType()) {
// TC start
case TC_START:
return testCaseStart(name, time, this.frame.lifeLinesCount(), occurrence);
// TC end
case TC_END:
return testCaseEnd(name, time, this.frame.lifeLinesCount(), occurrence);
// Creation of System Component
case SYSTEM_CREATE:
ref = Constants.SUT_REFERENCE;
return createComponent(ref, time, this.lifelines.get(ref), occurrence);
// Creation of Host Controller (HC)
case HC_CREATE:
ref = Constants.HC_REFERENCE;
return createComponent(ref, time, this.lifelines.get(ref), occurrence);
// Creation of Main Test Component (MTC)
case MTC_CREATE:
{
ref = Constants.MTC_REFERENCE;
Lifeline lifeLine = this.lifelines.get(ref);
return createComponent(ref, time, lifeLine, occurrence);
}
// Creation of Parallel Test Component (PTC)
case PTC_CREATE:
return createComponent(ref, time, this.lifelines.get(ref), occurrence);
// Termination of System Component
case SYSTEM_TERMINATE:
ref = Constants.SUT_REFERENCE;
return terminateComponent(ref, time, occurrence);
// Termination of Host Controller (HC)
case HC_TERMINATE:
ref = Constants.HC_REFERENCE;
return terminateComponent(ref, time, occurrence);
// Termination of Main Test Component (MTC)
case MTC_TERMINATE:
ref = Constants.MTC_REFERENCE;
return terminateComponent(ref, time, occurrence);
// Termination of Parallel Test Component (PTC)
case PTC_TERMINATE:
return terminateComponent(ref, time, occurrence);
// Messages
case SEND:
return addSignal(new SendSignal(), ref, target, name, time, occurrence);
case RECEIVE:
return addSignal(new ReceiveSignal(), ref, target, name, time, occurrence);
// Enqueued messages
case ENQUEUED:
return addEnqueued(ref, target, name, time, occurrence);
// Silent events
case SILENT_EVENT:
LogRecord logrecord = null;
try {
logrecord = ValueReader.getInstance().readLogRecordFromLogFile(this.logFilePath, event);
} catch (final IOException valueException) {
return addSilentEvent(ref, "", type, time, occurrence);
} catch (final ParseException e) {
return addSilentEvent(ref, "", type, time, occurrence);
}
String messageText = getMessageTextFromRecord(logrecord);
return addSilentEvent(ref, messageText, type, time, occurrence);
// Functions
case FUNCTION:
return addFunctionNode(new Function(), ref, target, name, time, occurrence);
// Function done
case PTC_DONE:
return addFunctionNode(new FunctionDone(), ref, target, name, time, occurrence);
// Setverdict
case SETVERDICT:
case SETVERDICT_INCONC:
case SETVERDICT_NONE:
case SETVERDICT_PASS:
return addSetVerdict(ref, name, time, occurrence);
// Port mappings
case MAPPING_PORT:
return addPortEventNode(new PortMapping(sourcePort, targetPort), ref, target, time, occurrence);
// Port unmappings
case UNMAPPING_PORT:
return addPortEventNode(new PortUnmapping(sourcePort, targetPort), ref, target, time, occurrence);
// Port connections
case CONNECTING_PORT:
return addPortEventNode(new PortConnection(sourcePort, targetPort), ref, target, time, occurrence);
// Port disconnections
case DISCONNECTING_PORT:
return addPortEventNode(new PortDisconnection(sourcePort, targetPort), ref, target, time, occurrence);
default:
return new MSCNode[] {};
}
}
use of org.eclipse.titan.log.viewer.views.msc.ui.core.MSCNode in project titan.EclipsePlug-ins by eclipse.
the class MSCModel method getNodes.
/**
* Collects the nodes that belong to the range provided.
*
* @param startIndex the index of the first event to process.
* @param endIndex the index of the last event to process.
*
* @return the list of the found nodes.
*/
public List<MSCNode> getNodes(final int startIndex, final int endIndex) {
if (sutLifeline == null) {
this.sutLifeline = new Lifeline();
}
List<IEventObject> events = this.model.getEvents(startIndex, endIndex);
List<MSCNode> result = new ArrayList<MSCNode>();
for (int i = 0; i < 3; i++) {
MSCNode[] nodes = extractNodes(events.get(i), i);
for (MSCNode node : nodes) {
if (!(node instanceof Lifeline) && !(node instanceof LifelineHeader)) {
result.add(node);
}
}
}
for (int i = 3; i < events.size(); i++) {
MSCNode[] nodes = extractNodes(events.get(i), startIndex + i);
for (MSCNode node : nodes) {
if (!(node instanceof Lifeline) && !(node instanceof LifelineHeader)) {
result.add(node);
}
}
}
return result;
}
Aggregations