private void temporaryVariableAssignment(AbstractCodeMapping mapping) { if(mapping instanceof LeafMapping && mapping.getFragment1() instanceof AbstractExpression && mapping.getFragment2() instanceof StatementObject) { StatementObject statement = (StatementObject) mapping.getFragment2(); List<VariableDeclaration> variableDeclarations = statement.getVariableDeclarations(); boolean validReplacements = true; for(Replacement replacement : mapping.getReplacements()) { if(replacement instanceof MethodInvocationReplacement || replacement instanceof ObjectCreationReplacement) { validReplacements = false; break; } } if(variableDeclarations.size() == 1 && validReplacements) { VariableDeclaration variableDeclaration = variableDeclarations.get(0); ExtractVariableRefactoring ref = new ExtractVariableRefactoring(variableDeclaration, operation2); if(!refactorings.contains(ref)) { refactorings.add(ref); } } } }
initializer.toString().equals(applyOverlappingExtractVariable(prefixBefore)) || (!longestCommonSuffix.isEmpty() && longestCommonSuffix.startsWith("."))) { ExtractVariableRefactoring ref = new ExtractVariableRefactoring(declaration, operation2); if(!refactorings.contains(ref)) { refactorings.add(ref); initializer.toString().equals(applyOverlappingExtractVariable(replacement.getBefore())) || (!longestCommonSuffix.isEmpty() && longestCommonSuffix.startsWith("."))) { ExtractVariableRefactoring ref = new ExtractVariableRefactoring(declaration, operation2); if(!refactorings.contains(ref)) { refactorings.add(ref); for(VariableDeclaration declaration : variableDeclarations) { if(declaration.getVariableName().equals(variable)) { ExtractVariableRefactoring ref = new ExtractVariableRefactoring(declaration, operation2); if(!refactorings.contains(ref)) { refactorings.add(ref);