From 50c3705543e07e0d75b1aeeffbe60a2eb9c919c3 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Fri, 27 Sep 2024 11:34:09 -0400 Subject: [PATCH] Avoid removing leaf, if the refactoring is already detected --- .../xmi/decomposition/UMLOperationBodyMapper.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java b/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java index 67cae4a56..939acd1d7 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java @@ -908,8 +908,10 @@ else if(mapping instanceof CompositeStatementObjectMapping) { LeafMapping leafMapping = new LeafMapping(subExpression, initializer, operation1, operation2); ref.addSubExpressionMapping(leafMapping); } - refactorings.add(ref); - leavesToBeRemovedT2.add(statement); + if(!refactorings.contains(ref)) { + refactorings.add(ref); + leavesToBeRemovedT2.add(statement); + } } } } @@ -956,8 +958,10 @@ else if(mapping instanceof CompositeStatementObjectMapping) { LeafMapping leafMapping = new LeafMapping(initializer, subExpression, operation1, operation2); ref.addSubExpressionMapping(leafMapping); } - refactorings.add(ref); - leavesToBeRemovedT1.add(statement); + if(!refactorings.contains(ref)) { + refactorings.add(ref); + leavesToBeRemovedT1.add(statement); + } } } }