Skip to content
Snippets Groups Projects
Commit 90d22664 authored by Reiner Jung's avatar Reiner Jung
Browse files

Minor changes

parent 05d9a0c2
No related branches found
No related tags found
No related merge requests found
...@@ -15,20 +15,49 @@ ...@@ -15,20 +15,49 @@
***************************************************************************/ ***************************************************************************/
package org.oceandsl.tools.mop.operations; package org.oceandsl.tools.mop.operations;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.oceandsl.tools.mop.EStrategy; import org.oceandsl.tools.mop.EStrategy;
import kieker.analysis.stage.model.ModelRepository; import kieker.analysis.stage.model.ModelRepository;
import kieker.model.analysismodel.type.ComponentType;
import kieker.model.analysismodel.type.TypeModel;
/** /**
* Diff two models and store the result in the last model repository. The difference is defined as
* all elements in last model which are not in second model, and all elements in second model which
* are not in last model. diffModel = lastModel\secondModel combined secondModel\lastModel.
*
* For entities with properties they are equal when their name is the same. The other properties are
* ignored. Contained objects are equal when their name is identical and they belong to the same
* parent. Entities without a name element are not diffed.
*
* @author Reiner Jung * @author Reiner Jung
* @since 1.1 * @since 1.1
*/ */
public class ModelRepositoryDiffer { public class ModelRepositoryDiffer {
public static void perform(final ModelRepository lastModel, final ModelRepository element, public static void perform(final ModelRepository lastModelRepository, final ModelRepository secondModelRepository,
final EStrategy strategy) { final EStrategy strategy) {
// TODO Auto-generated method stub ModelRepositoryDiffer.diffTypeModel(lastModelRepository.getModel(TypeModel.class),
secondModelRepository.getModel(TypeModel.class));
}
private static void diffTypeModel(final TypeModel firstModel, final TypeModel secondModel) {
final Map<String, ComponentType> firstComponentMap = ModelRepositoryDiffer.makeMap(firstModel);
final Map<String, ComponentType> secondComponentMap = ModelRepositoryDiffer.makeMap(secondModel);
// removeType();
}
private static Map<String, ComponentType> makeMap(final TypeModel model) {
final Map<String, ComponentType> componentMap = new HashMap<>();
for (final Entry<String, ComponentType> entry : model.getComponentTypes().entrySet()) {
componentMap.put(entry.getKey(), entry.getValue());
}
return componentMap;
} }
} }
...@@ -54,6 +54,8 @@ import kieker.model.analysismodel.type.StorageType; ...@@ -54,6 +54,8 @@ import kieker.model.analysismodel.type.StorageType;
import kieker.model.analysismodel.type.TypeModel; import kieker.model.analysismodel.type.TypeModel;
/** /**
* Merge two different model repositories
*
* @author Reiner Jung * @author Reiner Jung
* @since 1.1 * @since 1.1
*/ */
...@@ -259,7 +261,8 @@ public class ModelRepositoryMerger { ...@@ -259,7 +261,8 @@ public class ModelRepositoryMerger {
*/ */
final EObject mergeKey = ModelRepositoryMerger.findKey(model.getStatistics(), statistic.getKey()); final EObject mergeKey = ModelRepositoryMerger.findKey(model.getStatistics(), statistic.getKey());
if (mergeKey == null) { if (mergeKey == null) {
model.getStatistics().put(ModelRepositoryMerger.createExecutionModelKey(executionModel, statistic.getKey()), model.getStatistics().put(
ModelRepositoryMerger.createExecutionModelKey(executionModel, statistic.getKey()),
StatisticsModelCloneUtils.duplicate(statistic.getValue())); StatisticsModelCloneUtils.duplicate(statistic.getValue()));
} else { } else {
final Statistics newStatistic = model.getStatistics().get(mergeKey); final Statistics newStatistic = model.getStatistics().get(mergeKey);
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment