Source:
public String[] optimize(String appModel, String suitableCloudOffer, int numPlansToGenerate) { Map<String, Object> appMap = YAMLoptimizerParser.GetMAPofAPP(appModel); if (IS_DEBUG) { log.info("Getting cloud optoins and characteristics"); } SuitableOptions appInfoSuitableOptions = YAMLmatchmakerToOptimizerParser .GetSuitableCloudOptionsAndCharacteristicsForModules(appModel, suitableCloudOffer); if (IS_DEBUG) { log.info("Getting application Topology"); } Topology topology = null; try { topology = YAMLoptimizerParser.getApplicationTopology(appMap, appInfoSuitableOptions); } catch (Exception E) { log.error("There was an exception while reading topology. More errors ahead"); } if (topology == null) { log.error( "Topology could not be parsed. Not known quantity of calls between modules. Assuming the dummy case where" + "all modules are called in sequence. The order of calls is random}"); topology = createAdHocTopologyFromSuitableOptions(appInfoSuitableOptions); } if (IS_DEBUG) { log.info("Getting application Requirements"); } QualityInformation requirements = loadQualityRequirements(appMap); if (IS_DEBUG) { log.info("following requirements found: " + requirements.toString()); } Solution[] solutions = engine.computeOptimizationProblem(appInfoSuitableOptions.clone(), requirements, topology, numPlansToGenerate); if (solutions == null) { log.error("Map returned by Search engine is null"); } Map<String, Object>[] appMapSolutions = hashMapOfFoundSolutionsWithThresholds(solutions, appMap, topology, appInfoSuitableOptions, numPlansToGenerate, requirements); if (IS_DEBUG) { log.info("Before ReplaceSuitableServiceByHost"); } String[] stringSolutions = new String[numPlansToGenerate]; for (int i = 0; i < appMapSolutions.length; i++) { YAMLoptimizerParser.ReplaceSuitableServiceByHost(appMapSolutions[i]); stringSolutions[i] = YAMLoptimizerParser.FromMAPtoYAMLstring(appMapSolutions[i]); } return stringSolutions; }

Target:
public String[] optimize(String appModel, String suitableCloudOffer, int numPlansToGenerate) { Map<String, Object> appMap = YAMLoptimizerParser.getMAPofAPP(appModel); if (IS_DEBUG) { log.debug("Getting cloud optoins and characteristics"); } SuitableOptions appInfoSuitableOptions = YAMLmatchmakerToOptimizerParser .getSuitableCloudOptionsAndCharacteristicsForModules(appModel, suitableCloudOffer); if (IS_DEBUG) { log.debug("Getting application Topology"); } Topology topology = null; try { topology = YAMLoptimizerParser.getApplicationTopology(appMap, appInfoSuitableOptions); } catch (Exception E) { log.error("There was an exception while reading topology. More errors ahead"); } if (topology == null) { log.error( "Topology could not be parsed. Not known quantity of calls between modules. Assuming the dummy case where" + "all modules are called in sequence. The order of calls is random}"); topology = createAdHocTopologyFromSuitableOptions(appInfoSuitableOptions); } if (IS_DEBUG) { log.debug("Getting application Requirements"); } QualityInformation requirements = loadQualityRequirements(appMap); if (IS_DEBUG) { log.debug("following requirements found: " + requirements.toString()); } Solution[] solutions = engine.computeOptimizationProblem(appInfoSuitableOptions.clone(), requirements, topology, numPlansToGenerate); if (solutions == null) { log.error("Map returned by Search engine is null"); } Map<String, Object>[] appMapSolutions = hashMapOfFoundSolutionsWithThresholds(solutions, appMap, topology, appInfoSuitableOptions, numPlansToGenerate, requirements); if (IS_DEBUG) { log.debug("Before ReplaceSuitableServiceByHost"); } String[] stringSolutions = new String[numPlansToGenerate]; for (int i = 0; i < appMapSolutions.length; i++) { YAMLoptimizerParser.replaceSuitableServiceByHost(appMapSolutions[i]); stringSolutions[i] = YAMLoptimizerParser.fromMAPtoYAMLstring(appMapSolutions[i]); } return stringSolutions; }