]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/refaktor-before/src/no/uio/ifi/refaktor/analyze/analyzers/LongestCommonPrefixAnalyzer.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / refaktor-before / src / no / uio / ifi / refaktor / analyze / analyzers / LongestCommonPrefixAnalyzer.java
1 package no.uio.ifi.refaktor.analyze.analyzers;
2
3 import no.uio.ifi.refaktor.analyze.CollectorManager;
4 import no.uio.ifi.refaktor.analyze.collectors.LongestCommonPrefixCollector;
5 import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException;
6 import no.uio.ifi.refaktor.textselection.CompilationUnitTextSelection;
7
8 public class LongestCommonPrefixAnalyzer implements Analyzer {
9
10         private final CompilationUnitTextSelection selection;
11         private final LongestCommonPrefixCollector longestCommonPrefixCollector;
12
13         public LongestCommonPrefixAnalyzer(CompilationUnitTextSelection selection) {
14                 this.selection = selection;
15                 longestCommonPrefixCollector = new LongestCommonPrefixCollector(selection);
16         }
17
18         public String stringProperty() {
19                 return longestCommonPrefixCollector.getProperty().toString();
20         }
21
22         @Override
23         public void analyze() throws RefaktorAnalyzerException {
24                 CollectorManager.collectProperties(selection, longestCommonPrefixCollector);
25         }
26
27         public void checkIfSelectionIsValid() {
28                 SelectionValidator.checkIfSelectionIsValid(selection);
29         }
30 }