]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/refaktor-before/src/no/uio/ifi/refaktor/analyze/collectors/LongestCommonPrefixCollector.java
Some talks, mostly identical.
[ifi-stolz-refaktor.git] / case-study / refaktor-before / src / no / uio / ifi / refaktor / analyze / collectors / LongestCommonPrefixCollector.java
CommitLineData
1b2798f6
EK
1package no.uio.ifi.refaktor.analyze.collectors;
2
3import no.uio.ifi.refaktor.prefix.Prefix;
4import no.uio.ifi.refaktor.textselection.CompilationUnitTextSelection;
5
6public class LongestCommonPrefixCollector extends AbstractPrefixCollector {
7 private Prefix longestCommonPrefix;
8
9 public LongestCommonPrefixCollector(CompilationUnitTextSelection selection) {
10 super(selection);
11 }
12
13 protected void registerPrefix(Prefix prefix) {
14 if (longestCommonPrefix == null) {
15 longestCommonPrefix = prefix;
16 } else {
17 longestCommonPrefix = longestCommonPrefix.intersectWith(prefix);
18 }
19 }
20
21 public Prefix getProperty() {
22 return longestCommonPrefix;
23 }
24
25 @Override
26 public void clearData() {
27 longestCommonPrefix = null;
28 }
29}