Revision a2c79680 src/eventlog/sequencechartfacade.cc
src/eventlog/sequencechartfacade.cc  

44  44  
45  45 
biggestEarliestProcessingTime = 0; 
46  46  
47 
biggestEndTimeEvent = NULL; 

48  
47  49 
cachedParallelSet.clear(); 
48  50 
cachedCriticalPath.clear(); 
49  51 
} 
...  ...  
459  461 
break; 
460  462 
case SIMULATION_TIME: 
461  463 
{ 
462 
simtime_t lastEventSimulationTime = eventLog>getLastEvent()>getSimulationTime(); 

464 
IEvent* largestEvent = (IEvent*) getLargestEndtimeInEventRange((ptr_t)(eventLog>getFirstEvent()),(ptr_t)(eventLog>getLastEvent()), upperLimit); 

465 
simtime_t lastEventSimulationTime= largestEvent>getSimulationTime() + largestEvent>getEventEntry()>duration; 

463  466 
simulationTime = max(BigDecimal::Zero, min(lastEventSimulationTime, timelineCoordinate + timelineCoordinateOriginSimulationTime)); 
464  467 
} 
465  468 
break; 
...  ...  
501  504  
502  505 
Assert(!simulationTime.isNaN()); 
503  506 
Assert(simulationTime >= BigDecimal::Zero); 
504 
if (timelineMode != REAL_TIME) 

507 
/*if (timelineMode != REAL_TIME)


505  508 
Assert(simulationTime <= eventLog>getLastEvent()>getSimulationTime()); 
506  
509 
*/ 

507  510 
return simulationTime; 
508  511 
} 
509  512  
...  ...  
515  518 
return 0; 
516  519  
517  520 
Assert(simulationTime >= BigDecimal::Zero); 
518 
if (timelineMode != REAL_TIME) 

521 
/*if (timelineMode != REAL_TIME)


519  522 
Assert(simulationTime <= eventLog>getLastEvent()>getSimulationTime()); 
520  
523 
*/ 

521  524  
522  525 
double timelineCoordinate; 
523  526  
...  ...  
990  993 
* Returns the event with the largest calculated earliest Processing time in REAL_TIME mode 
991  994 
* or the largest endtime in other modes within the given event range. 
992  995 
*/ 
993 
ptr_t SequenceChartFacade::getLargestEndtimeInEventRange(ptr_t startEventPtr, ptr_t endEventPtr) { 

994 
IEvent *startEvent = (IEvent *)startEventPtr; 

995 
IEvent *endEvent = (IEvent *)endEventPtr; 

996 
ptr_t SequenceChartFacade::getLargestEndtimeInEventRange(ptr_t startEventPtr, 

997 
ptr_t endEventPtr, bool duration) 

998 
{ 

999 
IEvent *startEvent = (IEvent *) startEventPtr; 

1000 
IEvent *endEvent = (IEvent *) endEventPtr; 

996  1001 
switch (timelineMode) 
997  1002 
{ 
998  1003 
case REAL_TIME: 
999  1004 
{ 
1000  1005 
//Use cached result when range contains all events 
1001 
if(startEvent == eventLog>getFirstEvent() && endEvent == eventLog>getLastEvent()) { 

1002 
return (ptr_t)biggestEarliestProcessingTimeEvent; 

1006 
if (startEvent == eventLog>getFirstEvent() && endEvent 

1007 
== eventLog>getLastEvent()) 

1008 
{ 

1009 
return (ptr_t) biggestEarliestProcessingTimeEvent; 

1003  1010 
} 
1004  1011  
1005  1012 
long largest = 0; 
1006  1013 
IEvent* largestEvent = startEvent; 
1007  1014  
1008 
for (IEvent* current = startEvent; current; current = current>getNextEvent()) { 

1015 
for (IEvent* current = startEvent; current; current 

1016 
= current>getNextEvent()) 

1017 
{ 

1009  1018 
long temp = current>getEarliestProcessingTime(); 
1010 
if (temp > largest) { 

1019 
if (temp > largest) 

1020 
{ 

1011  1021 
largest = temp; 
1012  1022 
largestEvent = current; 
1013  1023 
} 
1014 
if (current==endEvent) { 

1024 
if (current == endEvent) 

1025 
{ 

1015  1026 
break; 
1016  1027 
} 
1017  1028 
} 
...  ...  
1022  1033 
case STEP: 
1023  1034 
case NONLINEAR: 
1024  1035 
default: 
1025 
return endEventPtr; 

1036 
{ 

1037 
if (!duration) { 

1038 
return endEventPtr; 

1039 
} 

1040 
//Use cached result when range contains all events 

1041 
if (startEvent == eventLog>getFirstEvent() && endEvent 

1042 
== eventLog>getLastEvent() && biggestEndTimeEvent != NULL) 

1043 
{ 

1044 
return (ptr_t) biggestEndTimeEvent; 

1045 
} 

1046 
simtime_t largest = 0; 

1047 
IEvent* largestEvent = endEvent; 

1048  
1049 
for (IEvent* current = endEvent; current; current 

1050 
= current>getPreviousEvent()) 

1051 
{ 

1052 
simtime_t temp = current>getSimulationTime() 

1053 
+ current>getEventEntry()>duration; 

1054 
if (temp > largest) 

1055 
{ 

1056 
largest = temp; 

1057 
largestEvent = current; 

1058 
} 

1059 
if (current == startEvent) 

1060 
{ 

1061 
break; 

1062 
} 

1063 
} 

1064 
if (startEvent == eventLog>getFirstEvent() && endEvent 

1065 
== eventLog>getLastEvent()) 

1066 
{ 

1067 
biggestEndTimeEvent = largestEvent; 

1068 
} 

1069  
1070 
return (ptr_t) largestEvent; 

1071 
} 

1026  1072 
} 
1027  1073  
1028  1074 
} 
1075 
Also available in: Unified diff