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

Merge branch 'reiner' into 'main'

Fixed nearest merge feature

See merge request !87
parents 524ef8c2 fdbd226b
No related branches found
No related tags found
1 merge request!87Fixed nearest merge feature
Pipeline #13171 passed
...@@ -51,9 +51,8 @@ ...@@ -51,9 +51,8 @@
<exclude name="AssignmentInOperand" /> <exclude name="AssignmentInOperand" />
<exclude name="AvoidCatchingNPE" /> <exclude name="AvoidCatchingNPE" />
<exclude name="AvoidLiteralsInIfCondition" /> <exclude name="AvoidLiteralsInIfCondition" />
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="DataflowAnomalyAnalysis" /> <exclude name="DataflowAnomalyAnalysis" />
<exclude name="DoNotCallSystemExit" /> <exclude name="DoNotTerminateVM" />
<exclude name="UseProperClassLoader" /> <exclude name="UseProperClassLoader" />
<exclude name="LoggerIsNotStaticFinal" /> <exclude name="LoggerIsNotStaticFinal" />
</rule> </rule>
......
...@@ -58,8 +58,8 @@ public final class DeploymentModelMerger { ...@@ -58,8 +58,8 @@ public final class DeploymentModelMerger {
} }
private static void mergeDepolymentComponents(final AssemblyModel assemblyModel, private static void mergeDepolymentComponents(final AssemblyModel assemblyModel,
final DeploymentContext deploymentContext, final EMap<String, DeployedComponent> components) { final DeploymentContext deploymentContext, final EMap<String, DeployedComponent> mergeComponents) {
for (final DeployedComponent mergeComponent : components.values()) { for (final DeployedComponent mergeComponent : mergeComponents.values()) {
if (!deploymentContext.getComponents().containsKey(mergeComponent.getSignature())) { if (!deploymentContext.getComponents().containsKey(mergeComponent.getSignature())) {
deploymentContext.getComponents().put(mergeComponent.getSignature(), deploymentContext.getComponents().put(mergeComponent.getSignature(),
DeploymentModelCloneUtils.duplicate(assemblyModel, mergeComponent)); DeploymentModelCloneUtils.duplicate(assemblyModel, mergeComponent));
......
...@@ -19,6 +19,7 @@ import java.util.Map.Entry; ...@@ -19,6 +19,7 @@ import java.util.Map.Entry;
import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.common.util.EMap;
import kieker.model.analysismodel.deployment.DeployedComponent;
import kieker.model.analysismodel.deployment.DeployedOperation; import kieker.model.analysismodel.deployment.DeployedOperation;
import kieker.model.analysismodel.deployment.DeployedStorage; import kieker.model.analysismodel.deployment.DeployedStorage;
import kieker.model.analysismodel.deployment.DeploymentModel; import kieker.model.analysismodel.deployment.DeploymentModel;
...@@ -41,14 +42,20 @@ public final class ExecutionModelMerger { ...@@ -41,14 +42,20 @@ public final class ExecutionModelMerger {
} }
/* default */ static void mergeExecutionModel(final DeploymentModel deploymentModel, // NOPMD /* default */ static void mergeExecutionModel(final DeploymentModel deploymentModel, // NOPMD
final ExecutionModel lastModel, final ExecutionModel mergeModel) { final ExecutionModel lastModel, final DeploymentModel mergeDeploymentModel,
ExecutionModelMerger.mergeInvocations(deploymentModel, lastModel, mergeModel); final ExecutionModel mergeModel) {
ExecutionModelMerger.mergeInvocations(deploymentModel, lastModel, mergeDeploymentModel, mergeModel);
ExecutionModelMerger.mergeStorageDataflows(deploymentModel, lastModel, mergeModel); ExecutionModelMerger.mergeStorageDataflows(deploymentModel, lastModel, mergeModel);
ExecutionModelMerger.mergeOperationDataflows(deploymentModel, lastModel, mergeModel); ExecutionModelMerger.mergeOperationDataflows(deploymentModel, lastModel, mergeModel);
} }
private static void mergeInvocations(final DeploymentModel deploymentModel, final ExecutionModel lastModel, private static void mergeInvocations(final DeploymentModel deploymentModel, final ExecutionModel lastModel,
final ExecutionModel mergeModel) { final DeploymentModel mergeDeploymentModel, final ExecutionModel mergeModel) {
// checkExecution(lastModel, "LAST");
// checkExecution(mergeModel, "MERGE");
// checkDeployment(deploymentModel, "LAST");
// checkDeployment(mergeDeploymentModel, "MERGE");
// checkWhereResourceAreFrom(mergeDeploymentModel, mergeModel, "MERGE");
for (final Entry<Tuple<DeployedOperation, DeployedOperation>, Invocation> entry : mergeModel.getInvocations()) { for (final Entry<Tuple<DeployedOperation, DeployedOperation>, Invocation> entry : mergeModel.getInvocations()) {
if (!ExecutionModelMerger.compareTupleOperationKeys(lastModel.getInvocations(), entry.getKey())) { if (!ExecutionModelMerger.compareTupleOperationKeys(lastModel.getInvocations(), entry.getKey())) {
final Invocation value = ExecutionModelCloneUtils.duplicate(deploymentModel, entry.getValue()); final Invocation value = ExecutionModelCloneUtils.duplicate(deploymentModel, entry.getValue());
...@@ -60,12 +67,87 @@ public final class ExecutionModelMerger { ...@@ -60,12 +67,87 @@ public final class ExecutionModelMerger {
} }
} }
private static void checkWhereResourceAreFrom(final DeploymentModel dm, final ExecutionModel em,
final String string) {
System.err.println("++++++ " + string);
em.getInvocations().forEach(entry -> {
checkPerOp(dm, entry.getKey().getFirst());
checkPerOp(dm, entry.getKey().getSecond());
checkPerOp(dm, entry.getValue().getCaller());
checkPerOp(dm, entry.getValue().getCallee());
});
}
private static void checkPerOp(final DeploymentModel dm, final DeployedOperation op) {
dm.getContexts().values().forEach(context -> {
context.getComponents().values().forEach(component -> {
final DeployedOperation dop = component.getOperations()
.get(op.getAssemblyOperation().getOperationType().getSignature());
if (dop != null) {
if (dop != op) {
System.err.println("OP " + op.eResource());
System.err.println("DOP " + dop.eResource());
} else {
// System.err.println("context " +
// op.eContainer().eContainer().eContainer().eContainer());
}
}
});
});
}
private static void checkDeployment(final DeploymentModel deploymentModel, final String string) {
System.err.println("###### " + string);
deploymentModel.getContexts().forEach(entry -> {
System.err.println(" context " + entry.getKey());
entry.getValue().getComponents().forEach(cEntry -> {
final DeployedComponent component = cEntry.getValue();
if (component.getContext() == null) {
System.err.printf(" component %s has no context\n", component.getSignature());
}
});
});
}
private static void checkExecution(final ExecutionModel em, final String name) {
System.err.println("!!!!! " + name);
em.getInvocations().entrySet().forEach(m -> {
final Tuple<DeployedOperation, DeployedOperation> key = m.getKey();
final Invocation value = m.getValue();
check(key.getFirst(), "first");
check(key.getSecond(), "second");
check(value.getCaller(), "caller");
check(value.getCallee(), "callee");
});
}
private static void check(final DeployedOperation op, final String string) {
final DeployedComponent dc = (DeployedComponent) op.eContainer().eContainer();
if (dc == null) {
System.err.println(
">> container " + op.getAssemblyOperation().getOperationType().getSignature() + " " + string);
return;
}
if (op.getComponent() == null) {
System.err.println(
">> component " + op.getAssemblyOperation().getOperationType().getSignature() + " " + string);
return;
}
if (dc.getAssemblyComponent().getComponentType() == null) {
System.err.println("shite " + string);
return;
}
// System.err.println("op " + op.getAssemblyOperation().getOperationType().getSignature());
}
private static boolean compareTupleOperationKeys( private static boolean compareTupleOperationKeys(
final EMap<Tuple<DeployedOperation, DeployedOperation>, Invocation> invocations, final EMap<Tuple<DeployedOperation, DeployedOperation>, Invocation> invocations,
final Tuple<DeployedOperation, DeployedOperation> key) { final Tuple<DeployedOperation, DeployedOperation> searchKey) {
for (final Tuple<DeployedOperation, DeployedOperation> invocationKey : invocations.keySet()) { for (final Tuple<DeployedOperation, DeployedOperation> invocationKey : invocations.keySet()) {
if (ModelUtils.isEqual(invocationKey.getFirst(), key.getFirst()) if (ModelUtils.isEqual(invocationKey.getFirst(), searchKey.getFirst())
&& ModelUtils.isEqual(invocationKey.getSecond(), key.getSecond())) { && ModelUtils.isEqual(invocationKey.getSecond(), searchKey.getSecond())) {
return true; return true;
} }
} }
......
...@@ -48,6 +48,7 @@ public final class ModelRepositoryMergerUtils { ...@@ -48,6 +48,7 @@ public final class ModelRepositoryMergerUtils {
ExecutionModelMerger.mergeExecutionModel( ExecutionModelMerger.mergeExecutionModel(
lastModelRepository.getModel(DeploymentPackage.Literals.DEPLOYMENT_MODEL), lastModelRepository.getModel(DeploymentPackage.Literals.DEPLOYMENT_MODEL),
lastModelRepository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL), lastModelRepository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL),
mergeModelRepository.getModel(DeploymentPackage.Literals.DEPLOYMENT_MODEL),
mergeModelRepository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL)); mergeModelRepository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL));
StatisticsModelMerger.mergeStatisticsModel( StatisticsModelMerger.mergeStatisticsModel(
lastModelRepository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL), lastModelRepository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL),
......
...@@ -191,6 +191,8 @@ public final class ModelUtils { ...@@ -191,6 +191,8 @@ public final class ModelUtils {
} }
public static boolean isEqual(final DeployedComponent leftComponent, final DeployedComponent rightComponent) { public static boolean isEqual(final DeployedComponent leftComponent, final DeployedComponent rightComponent) {
isContained(leftComponent, "left component " + leftComponent.getSignature());
isContained(rightComponent, "right component " + rightComponent.getSignature());
return ModelUtils.isEqual(leftComponent.getSignature(), rightComponent.getSignature()) return ModelUtils.isEqual(leftComponent.getSignature(), rightComponent.getSignature())
&& ModelUtils.isEqual(leftComponent.getContext(), rightComponent.getContext()); && ModelUtils.isEqual(leftComponent.getContext(), rightComponent.getContext());
} }
...@@ -206,8 +208,10 @@ public final class ModelUtils { ...@@ -206,8 +208,10 @@ public final class ModelUtils {
} }
public static boolean isEqual(final DeploymentContext leftDeploymentContext, public static boolean isEqual(final DeploymentContext leftDeploymentContext,
final DeploymentContext deploymentContext) { final DeploymentContext rightDeploymentContext) {
return leftDeploymentContext.getName().equals(deploymentContext.getName()); ModelUtils.check(leftDeploymentContext, "left deployment context");
ModelUtils.check(rightDeploymentContext, "right deployment context");
return leftDeploymentContext.getName().equals(rightDeploymentContext.getName());
} }
/** -- debug output. -- */ /** -- debug output. -- */
...@@ -256,4 +260,18 @@ public final class ModelUtils { ...@@ -256,4 +260,18 @@ public final class ModelUtils {
throw new InternalError("Object of type " + name + " could not be resolved."); throw new InternalError("Object of type " + name + " could not be resolved.");
} }
} }
private static void isContained(final DeployedComponent component, final String signature) {
check(component, signature);
final EObject container = component.eContainer();
if (container == null) {
throw new InternalError("DC Container of " + signature + " is null" + component.eResource());
}
if (container.eIsProxy()) {
throw new InternalError("DC Container of " + signature + " could not be resolved." + component.eResource());
}
if (component.getContext() == null) {
throw new InternalError("DC Context " + signature + " is null " + component.eResource());
}
}
} }
/***************************************************************************
* Copyright (C) 2023 OceanDSL (https://oceandsl.uni-kiel.de)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package org.oceandsl.tools.mop.stages;
import org.csveed.bean.conversion.AbstractConverter;
import kieker.model.analysismodel.type.ComponentType;
import kieker.model.analysismodel.type.TypeFactory;
/**
* @author Reiner Jung
* @since 1.3.1
*
*/
public class ComponentTypeConverter extends AbstractConverter<ComponentType> {
public ComponentTypeConverter() {
super(ComponentType.class);
}
public ComponentTypeConverter(final Class<ComponentType> clazz) {
super(clazz);
}
@Override
public ComponentType fromString(final String text) throws Exception {
final ComponentType componentType = TypeFactory.eINSTANCE.createComponentType();
componentType.setSignature(text);
return componentType;
}
@Override
public String toString(final ComponentType value) throws Exception {
return value.getSignature();
}
}
...@@ -26,8 +26,13 @@ import kieker.model.analysismodel.assembly.AssemblyComponent; ...@@ -26,8 +26,13 @@ import kieker.model.analysismodel.assembly.AssemblyComponent;
import kieker.model.analysismodel.assembly.AssemblyModel; import kieker.model.analysismodel.assembly.AssemblyModel;
import kieker.model.analysismodel.assembly.AssemblyPackage; import kieker.model.analysismodel.assembly.AssemblyPackage;
import kieker.model.analysismodel.deployment.DeployedComponent; import kieker.model.analysismodel.deployment.DeployedComponent;
import kieker.model.analysismodel.deployment.DeployedOperation;
import kieker.model.analysismodel.deployment.DeploymentModel; import kieker.model.analysismodel.deployment.DeploymentModel;
import kieker.model.analysismodel.deployment.DeploymentPackage; import kieker.model.analysismodel.deployment.DeploymentPackage;
import kieker.model.analysismodel.execution.ExecutionModel;
import kieker.model.analysismodel.execution.ExecutionPackage;
import kieker.model.analysismodel.execution.Invocation;
import kieker.model.analysismodel.execution.Tuple;
import kieker.model.analysismodel.type.ComponentType; import kieker.model.analysismodel.type.ComponentType;
import kieker.model.analysismodel.type.TypeModel; import kieker.model.analysismodel.type.TypeModel;
import kieker.model.analysismodel.type.TypePackage; import kieker.model.analysismodel.type.TypePackage;
...@@ -75,14 +80,71 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR ...@@ -75,14 +80,71 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR
this.sortForBestFit(entries); this.sortForBestFit(entries);
this.removeLesserFittingEntries(entries); this.removeLesserFittingEntries(entries);
this.removeEntriesBelowThreshold(entries); this.removeEntriesBelowThreshold(entries);
this.ensureNoNameClashes(entries, repository);
this.similarityOutputPort.send(this.makeTable(entries, repository.getName())); this.similarityOutputPort.send(this.makeTable(entries, repository.getName()));
// this.checkExecution(repository, "BEFORE");
this.changeComponentNamesBasedOnBestFit(repository, entries); this.changeComponentNamesBasedOnBestFit(repository, entries);
// this.checkExecution(repository, "AFTER");
} }
this.outputPort.send(repository); this.outputPort.send(repository);
} }
private void checkExecution(final ModelRepository repository, final String name) {
System.err.println("++ " + name);
final ExecutionModel em = repository.getModel(ExecutionPackage.Literals.EXECUTION_MODEL);
em.getInvocations().entrySet().forEach(m -> {
final Tuple<DeployedOperation, DeployedOperation> key = m.getKey();
final Invocation value = m.getValue();
this.check(key.getFirst(), "first");
this.check(key.getSecond(), "second");
this.check(value.getCaller(), "caller");
this.check(value.getCallee(), "callee");
});
}
private void check(final DeployedOperation op, final String string) {
final DeployedComponent dc = (DeployedComponent) op.eContainer().eContainer();
if (dc == null) {
System.err.println(
">> container " + op.getAssemblyOperation().getOperationType().getSignature() + " " + string);
return;
}
if (op.getComponent() == null) {
System.err.println(
">> component " + op.getAssemblyOperation().getOperationType().getSignature() + " " + string);
return;
}
if (dc.getAssemblyComponent().getComponentType() == null) {
System.err.println("shite " + string);
return;
}
if (dc.eContainer() == null) {
System.err.println(">> component NOT CONTAINED " + dc.getSignature());
}
if (dc.getContext() == null) {
System.err.println(">> component NO CONTEXT " + dc.getSignature());
}
}
private void ensureNoNameClashes(final List<SimilarityEntry> entries, final ModelRepository repository) {
final TypeModel model = repository.getModel(TypePackage.Literals.TYPE_MODEL);
// we need to ensure that the new name for a component is not already present in the
// model.
entries.forEach(entry -> {
final String signature = entry.getLeft().getSignature();
final ComponentType component = model.getComponentTypes().get(signature);
if (component != null && entry.getRight() != component) {
entry.incrementEqualNamesCount();
}
});
}
private List<SimilarityEntry> computeComponentNameSimilarites(final ModelRepository repository) { private List<SimilarityEntry> computeComponentNameSimilarites(final ModelRepository repository) {
final TypeModel lastTypeModel = this.lastRepository.getModel(TypePackage.Literals.TYPE_MODEL); final TypeModel lastTypeModel = this.lastRepository.getModel(TypePackage.Literals.TYPE_MODEL);
final TypeModel newTypeModel = repository.getModel(TypePackage.Literals.TYPE_MODEL); final TypeModel newTypeModel = repository.getModel(TypePackage.Literals.TYPE_MODEL);
...@@ -120,8 +182,9 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR ...@@ -120,8 +182,9 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR
final SimilarityEntry current = entries.get(i); final SimilarityEntry current = entries.get(i);
for (int j = i + 1; j < entries.size(); j++) { for (int j = i + 1; j < entries.size(); j++) {
final SimilarityEntry next = entries.get(j); final SimilarityEntry next = entries.get(j);
if ((current.getLeft() == next.getLeft()) || (current.getLeft() == next.getRight()) // really check if objects are identical
|| (current.getRight() == next.getLeft()) || (current.getRight() == next.getRight())) { if (current.getLeft() == next.getLeft() || current.getLeft() == next.getRight() // NOPMD
|| current.getRight() == next.getLeft() || current.getRight() == next.getRight()) { // NOPMD
entries.remove(j); entries.remove(j);
j--; // NOCS, NOPMD this is necessary due to list operations j--; // NOCS, NOPMD this is necessary due to list operations
} }
...@@ -141,29 +204,38 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR ...@@ -141,29 +204,38 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR
private void changeComponentNamesBasedOnBestFit(final ModelRepository repository, private void changeComponentNamesBasedOnBestFit(final ModelRepository repository,
final List<SimilarityEntry> entries) { final List<SimilarityEntry> entries) {
entries.forEach(entry -> { entries.forEach(entry -> {
final String replacement;
final ComponentType componentToRename;
if (this.isNumber(entry.getRight().getSignature()) || this.isHash(entry.getRight().getSignature())) { if (this.isNumber(entry.getRight().getSignature()) || this.isHash(entry.getRight().getSignature())) {
this.fixDeploymentSignature(repository, entry.getRight().getSignature(), // use left signature
entry.getLeft().getSignature()); replacement = this.makeName(entry.getLeft().getSignature(), entry.getEqualNamesCount());
this.fixAssemblySignature(repository, entry.getRight().getSignature(), entry.getLeft().getSignature()); componentToRename = entry.getRight();
this.fixTypeSignature(repository, entry.getRight().getSignature(), entry.getLeft().getSignature());
entry.getRight().setSignature(entry.getLeft().getSignature());
} else if (this.isNumber(entry.getLeft().getSignature()) || this.isHash(entry.getLeft().getSignature())) { } else if (this.isNumber(entry.getLeft().getSignature()) || this.isHash(entry.getLeft().getSignature())) {
this.fixDeploymentSignature(repository, entry.getLeft().getSignature(), // use right signature
entry.getRight().getSignature()); replacement = this.makeName(entry.getRight().getSignature(), entry.getEqualNamesCount());
this.fixAssemblySignature(repository, entry.getLeft().getSignature(), entry.getRight().getSignature()); componentToRename = entry.getLeft();
this.fixTypeSignature(repository, entry.getLeft().getSignature(), entry.getRight().getSignature());
entry.getLeft().setSignature(entry.getRight().getSignature());
} else { } else {
this.fixDeploymentSignature(repository, entry.getRight().getSignature(), // default to left signature
entry.getLeft().getSignature()); replacement = this.makeName(entry.getLeft().getSignature(), entry.getEqualNamesCount());
this.fixAssemblySignature(repository, entry.getRight().getSignature(), entry.getLeft().getSignature()); componentToRename = entry.getRight();
this.fixTypeSignature(repository, entry.getRight().getSignature(), entry.getLeft().getSignature());
entry.getRight().setSignature(entry.getLeft().getSignature());
} }
final String search = componentToRename.getSignature();
this.fixDeploymentSignature(repository, search, replacement);
this.fixAssemblySignature(repository, search, replacement);
this.fixTypeSignature(repository, search, replacement);
componentToRename.setSignature(replacement);
}); });
} }
private String makeName(final String signature, final int equalNamesCount) {
if (equalNamesCount > 0) {
return String.format("%s_%d", signature, equalNamesCount);
} else {
return signature;
}
}
private Table<String, SimilarityEntry> makeTable(final List<SimilarityEntry> entries, final String name) { private Table<String, SimilarityEntry> makeTable(final List<SimilarityEntry> entries, final String name) {
final Table<String, SimilarityEntry> table = new Table<>(name); final Table<String, SimilarityEntry> table = new Table<>(name);
table.getRows().addAll(entries); table.getRows().addAll(entries);
...@@ -222,6 +294,6 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR ...@@ -222,6 +294,6 @@ public class MergeClosestFitComponentStage extends AbstractTransformation<ModelR
final double leftMatch = leftSet.stream().filter(l -> rightSet.contains(l)).count(); final double leftMatch = leftSet.stream().filter(l -> rightSet.contains(l)).count();
final double rightMatch = rightSet.stream().filter(r -> leftSet.contains(r)).count(); final double rightMatch = rightSet.stream().filter(r -> leftSet.contains(r)).count();
return ((leftMatch / leftSet.size()) + (rightMatch / rightSet.size())) / 2.0d; return (leftMatch / leftSet.size() + rightMatch / rightSet.size()) / 2.0d;
} }
} }
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.oceandsl.tools.mop.stages; package org.oceandsl.tools.mop.stages;
import org.csveed.annotations.CsvCell; import org.csveed.annotations.CsvCell;
import org.csveed.annotations.CsvConverter;
import org.csveed.annotations.CsvIgnore;
import kieker.model.analysismodel.type.ComponentType; import kieker.model.analysismodel.type.ComponentType;
...@@ -28,11 +30,15 @@ import kieker.model.analysismodel.type.ComponentType; ...@@ -28,11 +30,15 @@ import kieker.model.analysismodel.type.ComponentType;
public class SimilarityEntry { public class SimilarityEntry {
@CsvCell(columnIndex = 1, columnName = "left-type") @CsvCell(columnIndex = 1, columnName = "left-type")
@CsvConverter(converter = ComponentTypeConverter.class)
private ComponentType left; private ComponentType left;
@CsvCell(columnIndex = 2, columnName = "right-type") @CsvCell(columnIndex = 2, columnName = "right-type")
@CsvConverter(converter = ComponentTypeConverter.class)
private ComponentType right; private ComponentType right;
@CsvCell(columnIndex = 3, columnName = "similarity") @CsvCell(columnIndex = 3, columnName = "similarity")
private double similarity; private double similarity;
@CsvIgnore
private transient int equalNamesCount;
public SimilarityEntry() { public SimilarityEntry() {
// csveed API // csveed API
...@@ -42,6 +48,7 @@ public class SimilarityEntry { ...@@ -42,6 +48,7 @@ public class SimilarityEntry {
this.left = left; this.left = left;
this.right = right; this.right = right;
this.similarity = similarity; this.similarity = similarity;
this.equalNamesCount = 0;
} }
public ComponentType getLeft() { public ComponentType getLeft() {
...@@ -67,4 +74,12 @@ public class SimilarityEntry { ...@@ -67,4 +74,12 @@ public class SimilarityEntry {
public void setSimilarity(final double similarity) { public void setSimilarity(final double similarity) {
this.similarity = similarity; this.similarity = similarity;
} }
public int getEqualNamesCount() {
return this.equalNamesCount;
}
public void incrementEqualNamesCount() {
this.equalNamesCount++;
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment