package org.simantics.scl.ui.modulebrowser;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map.Entry;
import gnu.trove.map.hash.THashMap;
return entry;
}
- public Collection<ModuleNameTreeEntry> children() {
- ArrayList<ModuleNameTreeEntry> children = new ArrayList<ModuleNameTreeEntry>(childMap.values());
- Collections.sort(children);
- return children;
+ public Object[] children() {
+ Object[] result = childMap.values().toArray();
+ Arrays.sort(result);
+ return result;
+ }
+
+ public void clearModuleFlags() {
+ isModule = false;
+ for(ModuleNameTreeEntry child : childMap.values())
+ child.clearModuleFlags();
}
@Override
return name.compareTo(o.name);
}
- @Override
- public String toString() {
- return name;
+ public boolean prune() {
+ Iterator<ModuleNameTreeEntry> it = childMap.values().iterator();
+ while(it.hasNext()) {
+ ModuleNameTreeEntry entry = it.next();
+ if(!entry.prune())
+ it.remove();
+ }
+ return isModule || !childMap.isEmpty();
}
}