HumanActivity humanActivity = ((HumanActivity)act);
int duration = humanActivity.getDuration();
activityList.add(new ActivityPosition(humanActivity, currentFrom, currentFrom+duration));
return duration;
}else if(act instanceof AllActivity || act instanceof SwitchActivity){
ComplexActivity complexActivity = (ComplexActivity)act;
int maxOfDuration = 0;
for(int i=0; i<complexActivity.getChildActivities().size(); i++){
Activity child = (Activity) complexActivity.getChildActivities().get(i);
int durationOfChild = traverse(child, currentFrom, context);
if(durationOfChild > maxOfDuration) maxOfDuration = durationOfChild;
}
return maxOfDuration;
}else if(act instanceof ComplexActivity){
int initialCurrentFrom = currentFrom;
ComplexActivity complexActivity = (ComplexActivity)act;
for(int i=0; i<complexActivity.getChildActivities().size(); i++){
Activity child = (Activity) complexActivity.getChildActivities().get(i);
currentFrom += traverse(child, currentFrom, context);
}
return currentFrom - initialCurrentFrom;
}