De-static some bits on ImportSet.
Statics can't be overridden. This class shouldn't have to know about all threerings projects everywhere.
This commit is contained in:
@@ -376,6 +376,35 @@ public class ImportSet
|
||||
return StringUtil.toString(_imports);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the index of the best import group to use for the specified import.
|
||||
*/
|
||||
protected int findImportGroup (String imp)
|
||||
{
|
||||
int bestGroup = -1;
|
||||
int bestPrefixLength = -1;
|
||||
int ii = -1;
|
||||
for (String prefix : getImportGroups()) {
|
||||
ii++;
|
||||
if (!imp.startsWith(prefix)) {
|
||||
continue;
|
||||
}
|
||||
if (prefix.length() > bestPrefixLength) {
|
||||
bestPrefixLength = prefix.length();
|
||||
bestGroup = ii;
|
||||
}
|
||||
}
|
||||
return bestGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an iterable over the import prefixes that should be grouped together.
|
||||
*/
|
||||
protected Iterable<String> getImportGroups ()
|
||||
{
|
||||
return IMPORT_GROUPS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a real regular expression from the dumbed down input.
|
||||
* @param input the dumbed down wildcard expression
|
||||
@@ -405,20 +434,6 @@ public class ImportSet
|
||||
return Pattern.compile(pattern.toString());
|
||||
}
|
||||
|
||||
protected static int findImportGroup (String imp)
|
||||
{
|
||||
String longest = null;
|
||||
for (String prefix : IMPORT_GROUPS) {
|
||||
if (!imp.startsWith(prefix)) {
|
||||
continue;
|
||||
}
|
||||
if (longest == null || prefix.length() > longest.length()) {
|
||||
longest = prefix;
|
||||
}
|
||||
}
|
||||
return IMPORT_GROUPS.indexOf(longest);
|
||||
}
|
||||
|
||||
protected HashSet<String> _imports = Sets.newHashSet();
|
||||
protected List<String> _pushed = Lists.newArrayList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user