]> git.uio.no Git - ifi-stolz-refaktor.git/commitdiff
StatisticsAspect: adding advice for counting analyzed text selections
authorErlend Kristiansen <erlenkr@ifi.uio.no>
Thu, 20 Feb 2014 16:49:51 +0000 (17:49 +0100)
committerErlend Kristiansen <erlenkr@ifi.uio.no>
Thu, 20 Feb 2014 16:49:51 +0000 (17:49 +0100)
software/no.uio.ifi.refaktor/src/no/uio/ifi/refaktor/aspects/StatisticsAspect.aj

index ef7ed84694a15df5fc04d2520a577fb72b8fe6fc..a8020d679d1b5fcc2996e0ea87e5673acb249549 100644 (file)
@@ -5,6 +5,7 @@ import java.util.Map;
 
 import no.uio.ifi.refaktor.analyze.ExtractAndMoveMethodAnalysisResult;
 import no.uio.ifi.refaktor.analyze.analyzers.CompilationUnitWideExtractAndMoveMethodAnalyzer;
+import no.uio.ifi.refaktor.analyze.analyzers.ExtractAndMoveMethodAnalyzer;
 import no.uio.ifi.refaktor.analyze.analyzers.SearchBasedExtractAndMoveMethodAnalyzer;
 import no.uio.ifi.refaktor.analyze.analyzers.TypeWideExtractAndMoveMethodAnalyzer;
 import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor;
@@ -33,6 +34,7 @@ privileged public aspect StatisticsAspect {
                private int extractAndMoveMethodResultFoundCount;
                private int extractAndMoveMethodResultNotFoundCount;
                private int extractAndMoveMethodResultGeneratedCount;
+               private int selectionsAnalyzedCount;
 
                private Statistics() {
                        startTime = System.currentTimeMillis();
@@ -41,7 +43,7 @@ privileged public aspect StatisticsAspect {
                        notPerformedRefactorings = new HashMap<String, Integer>();
                        extractAndMoveMethodExecutedCount = extractAndMoveMethodNotExecutedCount = 0;
                        extractAndMoveMethodResultFoundCount = extractAndMoveMethodResultNotFoundCount = 0;
-                       extractAndMoveMethodResultGeneratedCount = 0;
+                       extractAndMoveMethodResultGeneratedCount = selectionsAnalyzedCount = 0;
                        snapshotTimeSinceStart = timeSinceStart();
                }
 
@@ -58,6 +60,7 @@ privileged public aspect StatisticsAspect {
                        this.extractAndMoveMethodResultFoundCount = statistics.extractAndMoveMethodResultFoundCount;
                        this.extractAndMoveMethodResultNotFoundCount = statistics.extractAndMoveMethodResultNotFoundCount;
                        this.extractAndMoveMethodResultGeneratedCount = statistics.extractAndMoveMethodResultGeneratedCount;
+                       this.selectionsAnalyzedCount = statistics.selectionsAnalyzedCount;
                        this.snapshotTimeSinceStart = timeSinceStart();
                }
 
@@ -102,6 +105,7 @@ privileged public aspect StatisticsAspect {
                                        + (compilationUnitCount > 0 ? "\nNumber of compilation units analyzed: " + compilationUnitCount : "")
                                        + (typeCount > 0 ? "\nNumber of types analyzed: " + typeCount : "")
                                        + "\nNumber of methods analyzed: " + methodCount 
+                                       + "\nNumber of text selections analyzed: " + selectionsAnalyzedCount 
                                        + "\n\n" + extractAndMoveMethodResultFoundCount 
                                        + " methods are chosen as candidates for the Extract and Move Method refactoring, while " 
                                        + extractAndMoveMethodResultNotFoundCount + " are not"
@@ -134,6 +138,7 @@ privileged public aspect StatisticsAspect {
                this.statistics = new Statistics();
        }
 
+       pointcut selectionAnalyze() : call(* ExtractAndMoveMethodAnalyzer.analyze()) ;
        pointcut methodAnalyze(SearchBasedExtractAndMoveMethodAnalyzer analyzer) : 
                call(* SearchBasedExtractAndMoveMethodAnalyzer.analyze()) && target(analyzer);
        pointcut typeAnalyze() : call(* TypeWideExtractAndMoveMethodAnalyzer.analyze());
@@ -143,6 +148,10 @@ privileged public aspect StatisticsAspect {
                call(* RefactoringPerformer+.performRefactoring(Refactoring)) && args(refactoring);
        pointcut extractAndMoveExecuted() : call(* ExtractAndMoveMethodExecutor.execute(..));
        pointcut analysisResultCreated() : call(public ExtractAndMoveMethodAnalysisResult.new(..));
+       
+       after() : selectionAnalyze() {
+               statistics.selectionsAnalyzedCount++;
+       }
 
        after(SearchBasedExtractAndMoveMethodAnalyzer analyzer) : methodAnalyze(analyzer) {
                statistics.methodCount++;