From 54c8b759c93f34ef5fe6ce796da436a6e26b1b58 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Wed, 16 Oct 2024 11:30:46 -0400 Subject: [PATCH] Compute actual string for leaf statements --- .../gr/uom/java/xmi/decomposition/StatementObject.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/gr/uom/java/xmi/decomposition/StatementObject.java b/src/main/java/gr/uom/java/xmi/decomposition/StatementObject.java index 7bc781542..d4a7408e7 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/StatementObject.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/StatementObject.java @@ -49,12 +49,16 @@ public class StatementObject extends AbstractStatement { private List castExpressions; private List ternaryOperatorExpressions; private List lambdas; + private String actualSignature; public StatementObject(CompilationUnit cu, String filePath, Statement statement, int depth, CodeElementType codeElementType, VariableDeclarationContainer container, String javaFileContent) { super(); this.locationInfo = new LocationInfo(cu, filePath, statement, codeElementType); Visitor visitor = new Visitor(cu, filePath, container, javaFileContent); statement.accept(visitor); + int start = statement.getStartPosition(); + int end = start + statement.getLength(); + this.actualSignature = javaFileContent.substring(start, end); this.variables = visitor.getVariables(); this.types = visitor.getTypes(); this.variableDeclarations = visitor.getVariableDeclarations(); @@ -147,6 +151,10 @@ else if(expression instanceof ClassInstanceCreation) { } } + public String getActualSignature() { + return actualSignature; + } + @Override public List getLeaves() { List leaves = new ArrayList();