Source:
private void createFuncTypeMap(FuncTypeEnum funcType) { List<EntryExitFunctionDescription> functionList = new LinkedList<EntryExitFunctionDescription>(); String source = ""; String bevaiorCode = ""; String compositeRelatedCode = ""; String name = ""; for (State item : stateList) { Behavior behavior = null; String unknownName = null; switch (funcType) { case Entry: { behavior = item.getEntry(); unknownName = unknownEntryName; break; } case Exit: { behavior = item.getExit(); unknownName = unknownExitName; break; } } if (behavior != null && behavior.eClass().equals(UMLPackage.Literals.ACTIVITY)) { bevaiorCode = activityExporter.createFunctionBody((Activity) behavior).toString(); } if(item.isComposite()) { switch (funcType) { case Entry: compositeRelatedCode = ActivityTemplates.simpleIf(GenerationNames.CurrentMachineName, ActivityTemplates.operationCallOnPointerVariable(GenerationNames.CurrentMachineName, StateMachineMethodNames.InitializeFunctionName, Arrays.asList(EventTemplates.EventFParamName))); source = bevaiorCode + compositeRelatedCode; break; case Exit: compositeRelatedCode = ActivityTemplates.simpleIf(GenerationNames.CurrentMachineName, ActivityTemplates.operationCallOnPointerVariable(GenerationNames.CurrentMachineName, StateMachineMethodNames.FinalizeFunctionName, Arrays.asList(EventTemplates.EventFParamName))); source = compositeRelatedCode + bevaiorCode; break; default: break; } } else { source = bevaiorCode; } if (source != "") { name = item.getName() + "_" + unknownName; functionList.add(new EntryExitFunctionDescription(item.getName(), name, source, item.isComposite() || activityExporter.isContainsSignalAccess())); } } if (funcType == FuncTypeEnum.Entry) { entryList = functionList; } else if (funcType == FuncTypeEnum.Exit) { exitList = functionList; } }

Target:
private void createFuncTypeMap(FuncTypeEnum funcType) { List<EntryExitFunctionDescription> functionList = new LinkedList<EntryExitFunctionDescription>(); for (State item : stateList) { String source = ""; String name = ""; Behavior behavior = null; String unknownName = null; switch (funcType) { case Entry: { behavior = item.getEntry(); unknownName = unknownEntryName; break; } case Exit: { behavior = item.getExit(); unknownName = unknownExitName; break; } } ActivityExportResult activityResult = new ActivityExportResult(); activityResult = activityExporter.createFunctionBody(behavior); if (item.isComposite()) { String compositeRelatedCode = ""; switch (funcType) { case Entry: compositeRelatedCode = ActivityTemplates.simpleIf(GenerationNames.CurrentMachineName, ActivityTemplates.operationCallOnPointerVariable(GenerationNames.CurrentMachineName, StateMachineMethodNames.InitializeFunctionName, Arrays.asList(EventTemplates.EventFParamName))); source = activityResult.getActivitySource() + compositeRelatedCode; break; case Exit: compositeRelatedCode = ActivityTemplates.simpleIf(GenerationNames.CurrentMachineName, ActivityTemplates.operationCallOnPointerVariable(GenerationNames.CurrentMachineName, StateMachineMethodNames.FinalizeFunctionName, Arrays.asList(EventTemplates.EventFParamName))); source = compositeRelatedCode + activityResult.getActivitySource(); break; default: break; } } else { source = activityResult.getActivitySource(); } if (source != "") { name = item.getName() + "_" + unknownName; functionList.add(new EntryExitFunctionDescription(item.getName(), name, source, item.isComposite() || activityResult.sourceHasSignalReference())); } } if (funcType == FuncTypeEnum.Entry) { entryList = functionList; } else if (funcType == FuncTypeEnum.Exit) { exitList = functionList; } }