Fixed same package removal to not also wipe out subpackages

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5052 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-05-08 19:30:55 +00:00
parent c112a5c982
commit 8eef2df364
2 changed files with 23 additions and 7 deletions
@@ -126,6 +126,22 @@ public class ImportSet
return removeAll("[*");
}
/**
* Remove all classes that are in the same package.
* @param pkg package to remove
*/
public void removeSamePackage (String pkg)
{
Iterator<String> i = _imports.iterator();
while (i.hasNext()) {
String name = i.next();
if (name.startsWith(pkg) &&
name.indexOf('.', pkg.length() + 1) == -1) {
i.remove();
}
}
}
/**
* Replaces inner class imports (those with a '$') with an import of the parent class.
*/