1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-07-31 04:36:34 +00:00
parent 563bdc57bc
commit 40b90fc643
3 changed files with 91 additions and 92 deletions

View file

@ -21,11 +21,12 @@ import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
import org.eclipse.cdt.managedbuilder.internal.core.Tool; import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.tcmodification.IFileInfoModification; import org.eclipse.cdt.managedbuilder.tcmodification.IFileInfoModification;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
public class FileInfoModification extends public class FileInfoModification extends
ToolListModification implements IFileInfoModification { ToolListModification implements IFileInfoModification {
private String fFileExt; private String fFileExt;
private Set fApplPathSet; private Set<IPath> fApplPathSet;
private IProject fProject; private IProject fProject;
public FileInfoModification(ResourceConfiguration rcInfo) { public FileInfoModification(ResourceConfiguration rcInfo) {
@ -54,9 +55,9 @@ public class FileInfoModification extends
} }
@Override @Override
protected Set getToolApplicabilityPathSet(Tool realTool, boolean isProject) { protected Set<IPath> getToolApplicabilityPathSet(Tool realTool, boolean isProject) {
if(fApplPathSet == null){ if(fApplPathSet == null){
Set s = new HashSet(1); Set<IPath> s = new HashSet<IPath>(1);
s.add(getResourceInfo().getPath()); s.add(getResourceInfo().getPath());
fApplPathSet = Collections.unmodifiableSet(s); fApplPathSet = Collections.unmodifiableSet(s);
} }
@ -64,8 +65,8 @@ public class FileInfoModification extends
} }
@Override @Override
protected Set getExtensionConflictToolSet(Tool tool, Tool[] toos) { protected Set<Tool> getExtensionConflictToolSet(Tool tool, Tool[] toos) {
return Collections.EMPTY_SET; return Collections.emptySet();
} }
@Override @Override

View file

@ -18,6 +18,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
@ -29,12 +30,14 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo; import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation; import org.eclipse.cdt.managedbuilder.internal.core.IRealBuildObjectAssociation;
import org.eclipse.cdt.managedbuilder.internal.core.ResourceInfo; import org.eclipse.cdt.managedbuilder.internal.core.ResourceInfo;
import org.eclipse.cdt.managedbuilder.internal.core.Tool; import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain; import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider; import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatch;
import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatchSet; import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.ConflictMatchSet;
import org.eclipse.cdt.managedbuilder.tcmodification.CompatibilityStatus; import org.eclipse.cdt.managedbuilder.tcmodification.CompatibilityStatus;
import org.eclipse.cdt.managedbuilder.tcmodification.IFolderInfoModification; import org.eclipse.cdt.managedbuilder.tcmodification.IFolderInfoModification;
@ -47,8 +50,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
private ToolChainCompatibilityInfoElement fCurrentCompatibilityInfo; private ToolChainCompatibilityInfoElement fCurrentCompatibilityInfo;
private ToolChain fSelectedToolChain; private ToolChain fSelectedToolChain;
private IToolChain[] fAllSysToolChains; private IToolChain[] fAllSysToolChains;
private Map fCompatibleToolChains; private Map<ToolChain, ToolChainCompatibilityInfoElement> fCompatibleToolChains;
private Map fInCompatibleToolChains; private Map<ToolChain, ToolChainCompatibilityInfoElement> fInCompatibleToolChains;
private PerTypeMapStorage fParentObjectStorage; private PerTypeMapStorage fParentObjectStorage;
private ConflictMatchSet fParentConflicts; private ConflictMatchSet fParentConflicts;
// private PerTypeMapStorage fChildObjectStorage; // private PerTypeMapStorage fChildObjectStorage;
@ -93,18 +96,18 @@ public class FolderInfoModification extends ToolListModification implements IFol
} }
private static class ToolChainApplicabilityPaths { private static class ToolChainApplicabilityPaths {
private Set fFileInfoPaths = new HashSet(); private Set<IPath> fFileInfoPaths = new HashSet<IPath>();
private Set fFolderInfoPaths = new HashSet(); private Set<IPath> fFolderInfoPaths = new HashSet<IPath>();
private Map fToolPathMap = new HashMap(); private Map<Tool, Set<IPath>> fToolPathMap = new HashMap<Tool, Set<IPath>>();
} }
public static class ToolChainCompatibilityInfoElement { public static class ToolChainCompatibilityInfoElement {
private ToolChain fTc; private ToolChain fTc;
private List fErrComflictMatchList; private List<ConflictMatch> fErrComflictMatchList;
private List fWarningConflictMatchList; // private List fWarningConflictMatchList;
private CompatibilityStatus fStatus; private CompatibilityStatus fStatus;
ToolChainCompatibilityInfoElement(ToolChain tc, List errConflictList){ ToolChainCompatibilityInfoElement(ToolChain tc, List<ConflictMatch> errConflictList){
fTc = tc; fTc = tc;
if(errConflictList != null && errConflictList.size() != 0) if(errConflictList != null && errConflictList.size() != 0)
fErrComflictMatchList = errConflictList; fErrComflictMatchList = errConflictList;
@ -135,14 +138,13 @@ public class FolderInfoModification extends ToolListModification implements IFol
initCompatibilityInfo(); initCompatibilityInfo();
FolderInfo foInfo = (FolderInfo)getResourceInfo(); FolderInfo foInfo = (FolderInfo)getResourceInfo();
List l = new ArrayList(fCompatibleToolChains.size()); List<ToolChain> l = new ArrayList<ToolChain>(fCompatibleToolChains.size());
for(Iterator iter = fCompatibleToolChains.keySet().iterator(); iter.hasNext(); ){ Set<ToolChain> keySet = fCompatibleToolChains.keySet();
ToolChain tc = (ToolChain)iter.next(); for (ToolChain tc : keySet) {
if(tc != fRealToolChain && foInfo.isToolChainCompatible(fRealToolChain, tc)) if(tc != fRealToolChain && foInfo.isToolChainCompatible(fRealToolChain, tc))
l.add(tc); l.add(tc);
} }
return (ToolChain[])l.toArray(new ToolChain[l.size()]); return l.toArray(new ToolChain[l.size()]);
} }
public CompatibilityStatus getToolChainCompatibilityStatus(){ public CompatibilityStatus getToolChainCompatibilityStatus(){
@ -152,9 +154,9 @@ public class FolderInfoModification extends ToolListModification implements IFol
private ToolChainCompatibilityInfoElement getCurrentCompatibilityInfo(){ private ToolChainCompatibilityInfoElement getCurrentCompatibilityInfo(){
if(fCurrentCompatibilityInfo == null){ if(fCurrentCompatibilityInfo == null){
initCompatibilityInfo(); initCompatibilityInfo();
ToolChainCompatibilityInfoElement info = (ToolChainCompatibilityInfoElement)fCompatibleToolChains.get(fRealToolChain); ToolChainCompatibilityInfoElement info = fCompatibleToolChains.get(fRealToolChain);
if(info == null) if(info == null)
info = (ToolChainCompatibilityInfoElement)fInCompatibleToolChains.get(fRealToolChain); info = fInCompatibleToolChains.get(fRealToolChain);
fCurrentCompatibilityInfo = info; fCurrentCompatibilityInfo = info;
} }
return fCurrentCompatibilityInfo; return fCurrentCompatibilityInfo;
@ -168,15 +170,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
if(fCompatibilityInfoInited) if(fCompatibilityInfoInited)
return; return;
fCompatibleToolChains = new HashMap(); fCompatibleToolChains = new HashMap<ToolChain, ToolChainCompatibilityInfoElement>();
fInCompatibleToolChains = new HashMap(); fInCompatibleToolChains = new HashMap<ToolChain, ToolChainCompatibilityInfoElement>();
ConflictMatchSet parentConflicts = getParentConflictMatchSet(); ConflictMatchSet parentConflicts = getParentConflictMatchSet();
ToolChain sysTCs[] = (ToolChain[])getAllSysToolChains(); ToolChain sysTCs[] = (ToolChain[])getAllSysToolChains();
Map conflictMap = parentConflicts.fObjToConflictListMap; Map<Builder, List<ConflictMatch>> conflictMap = parentConflicts.fObjToConflictListMap;
for(int i = 0; i < sysTCs.length; i++){ for (ToolChain tc : sysTCs) {
ToolChain tc = sysTCs[i]; List<ConflictMatch> l = conflictMap.get(tc);
List l = (List)conflictMap.get(tc);
ToolChainCompatibilityInfoElement info = new ToolChainCompatibilityInfoElement(tc, l); ToolChainCompatibilityInfoElement info = new ToolChainCompatibilityInfoElement(tc, l);
if(info.isCompatible()){ if(info.isCompatible()){
fCompatibleToolChains.put(tc, info); fCompatibleToolChains.put(tc, info);
@ -243,14 +244,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
@Override @Override
protected boolean canReplace(Tool fromTool, Tool toTool) { protected boolean canReplace(Tool fromTool, Tool toTool) {
String[] exts = toTool.getPrimaryInputExtensions(); String[] exts = toTool.getPrimaryInputExtensions();
Set curInputExts = null; Set<String> curInputExts = null;
Set inputExts = getInputExtsSet(); Set<String> inputExts = getInputExtsSet();
for(int k = 0; k < exts.length; k++){ for (String ext : exts) {
if(inputExts.contains(exts[k])){ if(inputExts.contains(ext)){
if(curInputExts == null) if(curInputExts == null)
curInputExts = new HashSet(Arrays.asList(fromTool.getPrimaryInputExtensions())); curInputExts = new HashSet<String>(Arrays.asList(fromTool.getPrimaryInputExtensions()));
if(curInputExts.contains(exts[k])){ if(curInputExts.contains(ext)){
return true; return true;
} }
} }
@ -259,17 +260,17 @@ public class FolderInfoModification extends ToolListModification implements IFol
} }
@Override @Override
protected Set getExtensionConflictToolSet(Tool tool, Tool[] tools) { protected Set<Tool> getExtensionConflictToolSet(Tool tool, Tool[] tools) {
String exts[] = tool.getPrimaryInputExtensions(); String exts[] = tool.getPrimaryInputExtensions();
Set extsSet = new HashSet(Arrays.asList(exts)); Set<String> extsSet = new HashSet<String>(Arrays.asList(exts));
Set conflictsSet = null; Set<Tool> conflictsSet = null;
for(int i = 0; i < tools.length; i++){ for(int i = 0; i < tools.length; i++){
Tool t = tools[i]; Tool t = tools[i];
if(t == tool) if(t == tool)
continue; continue;
if(TcModificationUtil.containCommonEntries(extsSet, t.getPrimaryInputExtensions())){ if(TcModificationUtil.containCommonEntries(extsSet, t.getPrimaryInputExtensions())){
if(conflictsSet == null) if(conflictsSet == null)
conflictsSet = new HashSet(); conflictsSet = new HashSet<Tool>();
conflictsSet.add(t); conflictsSet.add(t);
} }
@ -277,14 +278,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
} }
if(conflictsSet == null) if(conflictsSet == null)
conflictsSet = Collections.EMPTY_SET; conflictsSet = Collections.emptySet();
return conflictsSet; return conflictsSet;
} }
@Override @Override
protected Set getToolApplicabilityPathSet(Tool realTool, boolean isProject) { protected Set<IPath> getToolApplicabilityPathSet(Tool realTool, boolean isProject) {
if(isProject) if(isProject)
return (Set)getToolChainApplicabilityPaths().fToolPathMap.get(realTool); return getToolChainApplicabilityPaths().fToolPathMap.get(realTool);
return getToolChainApplicabilityPaths().fFolderInfoPaths; return getToolChainApplicabilityPaths().fFolderInfoPaths;
} }
@ -306,24 +307,24 @@ public class FolderInfoModification extends ToolListModification implements IFol
ToolChainApplicabilityPaths tcApplicabilityPaths = new ToolChainApplicabilityPaths(); ToolChainApplicabilityPaths tcApplicabilityPaths = new ToolChainApplicabilityPaths();
IPath path = getResourceInfo().getPath(); IPath path = getResourceInfo().getPath();
TreeMap pathMap = getCompletePathMapStorage(); TreeMap<IPath, PerTypeSetStorage> pathMap = getCompletePathMapStorage();
PerTypeSetStorage oSet = (PerTypeSetStorage)pathMap.get(path); PerTypeSetStorage oSet = pathMap.get(path);
Set toolSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false); Set<Tool> toolSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
Set tcSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false); Set<IPath> tcSet = oSet.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
ToolChain curTc = (ToolChain)tcSet.iterator().next(); ToolChain curTc = (ToolChain)tcSet.iterator().next();
Set foInfoPaths = tcApplicabilityPaths.fFolderInfoPaths; Set<IPath> foInfoPaths = tcApplicabilityPaths.fFolderInfoPaths;
Set fileInfoPaths = tcApplicabilityPaths.fFileInfoPaths; Set<IPath> fileInfoPaths = tcApplicabilityPaths.fFileInfoPaths;
foInfoPaths.add(path); foInfoPaths.add(path);
Map toolPathsMap = tcApplicabilityPaths.fToolPathMap; Map<Tool, Set<IPath>> toolPathsMap = tcApplicabilityPaths.fToolPathMap;
if(toolSet != null){ if(toolSet != null){
for(Iterator iter = toolSet.iterator(); iter.hasNext(); ){ for (Tool tool : toolSet) {
Set set = new HashSet(); Set<IPath> set = new HashSet<IPath>();
toolPathsMap.put(iter.next(), set); toolPathsMap.put(tool, set);
set.add(path); set.add(path);
} }
} }
@ -339,11 +340,10 @@ public class FolderInfoModification extends ToolListModification implements IFol
fTcApplicabilityPaths = null; fTcApplicabilityPaths = null;
} }
private static void putToolInfo(Set ct, Map toolPathsMap, Set fileInfoPaths, Object p){ private static void putToolInfo(Set<Tool> ct, Map<Tool, Set<IPath>> toolPathsMap, Set<IPath> fileInfoPaths, IPath p){
if(ct != null && ct.size() != 0){ if(ct != null && ct.size() != 0){
for(Iterator toolIter = ct.iterator(); toolIter.hasNext(); ){ for (Tool t : ct) {
Object t = toolIter.next(); Set<IPath> set = toolPathsMap.get(t);
Set set = (Set)toolPathsMap.get(t);
if(set != null){ if(set != null){
if(fileInfoPaths != null) if(fileInfoPaths != null)
fileInfoPaths.add(p); fileInfoPaths.add(p);
@ -353,14 +353,14 @@ public class FolderInfoModification extends ToolListModification implements IFol
} }
} }
private static void calculateChildPaths(TreeMap pathMap, IPath path, ToolChain tc, Set tcPaths, Map toolPathsMap, Set fileInfoPaths){ private static void calculateChildPaths(TreeMap<IPath, PerTypeSetStorage> pathMap, IPath path, ToolChain tc, Set<IPath> tcPaths, Map<Tool,Set<IPath>> toolPathsMap, Set<IPath> fileInfoPaths){
SortedMap directCMap = PathComparator.getDirectChildPathMap(pathMap, path); SortedMap<IPath, PerTypeSetStorage> directCMap = PathComparator.getDirectChildPathMap(pathMap, path);
for(Iterator iter = directCMap.entrySet().iterator(); iter.hasNext(); ){ Set<Entry<IPath, PerTypeSetStorage>> entrySet = directCMap.entrySet();
Map.Entry entry = (Map.Entry)iter.next(); for (Entry<IPath, PerTypeSetStorage> entry : entrySet) {
PerTypeSetStorage cst = (PerTypeSetStorage)entry.getValue(); PerTypeSetStorage cst = entry.getValue();
Set ctc = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false); Set<ToolChain> ctc = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Set ct = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false); Set<Tool> ct = cst.getSet(IRealBuildObjectAssociation.OBJECT_TOOL, false);
if(ctc == null || ctc.size() == 0){ if(ctc == null || ctc.size() == 0){
@ -368,7 +368,7 @@ public class FolderInfoModification extends ToolListModification implements IFol
putToolInfo(ct, toolPathsMap, fileInfoPaths, entry.getKey()); putToolInfo(ct, toolPathsMap, fileInfoPaths, entry.getKey());
} else { } else {
if(ctc.contains(tc)){ if(ctc.contains(tc)){
IPath cp = (IPath)entry.getKey(); IPath cp = entry.getKey();
tcPaths.add(cp); tcPaths.add(cp);
putToolInfo(ct, toolPathsMap, null, entry.getKey()); putToolInfo(ct, toolPathsMap, null, entry.getKey());
//recurse //recurse
@ -384,8 +384,8 @@ public class FolderInfoModification extends ToolListModification implements IFol
ToolChainApplicabilityPaths tcApplicability = getToolChainApplicabilityPaths(); ToolChainApplicabilityPaths tcApplicability = getToolChainApplicabilityPaths();
PerTypeMapStorage storage = getCompleteObjectStore(); PerTypeMapStorage storage = getCompleteObjectStore();
Map tcMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false); Map<ToolChain, Set<IPath>> tcMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, false);
Map toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false); Map<Tool, Set<IPath>> toolMap = storage.getMap(IRealBuildObjectAssociation.OBJECT_TOOL, false);
TcModificationUtil.removePaths(tcMap, fRealToolChain, tcApplicability.fFolderInfoPaths); TcModificationUtil.removePaths(tcMap, fRealToolChain, tcApplicability.fFolderInfoPaths);
@ -396,10 +396,11 @@ public class FolderInfoModification extends ToolListModification implements IFol
newTools[i] = (Tool)ManagedBuildManager.getRealTool(newTools[i]); newTools[i] = (Tool)ManagedBuildManager.getRealTool(newTools[i]);
} }
for(Iterator iter = tcApplicability.fToolPathMap.entrySet().iterator(); iter.hasNext(); ){ Set<Entry<Tool, Set<IPath>>> entrySet = tcApplicability.fToolPathMap.entrySet();
Map.Entry entry = (Map.Entry)iter.next(); for(Iterator<Entry<Tool, Set<IPath>>> iter = entrySet.iterator(); iter.hasNext(); ){
Tool tool = (Tool)entry.getKey(); Map.Entry<Tool, Set<IPath>> entry = iter.next();
Set pathSet = (Set)entry.getValue(); Tool tool = entry.getKey();
Set<IPath> pathSet = entry.getValue();
TcModificationUtil.removePaths(toolMap, tool, pathSet); TcModificationUtil.removePaths(toolMap, tool, pathSet);
} }
@ -414,8 +415,7 @@ public class FolderInfoModification extends ToolListModification implements IFol
IProject project = mProj.getOwner().getProject(); IProject project = mProj.getOwner().getProject();
Tool[] filtered = (Tool[])foInfo.filterTools(newTools, mProj); Tool[] filtered = (Tool[])foInfo.filterTools(newTools, mProj);
if(filtered.length != 0){ if(filtered.length != 0){
for(Iterator iter = tcApplicability.fFileInfoPaths.iterator(); iter.hasNext(); ){ for (IPath p : tcApplicability.fFileInfoPaths) {
IPath p = (IPath)iter.next();
boolean found = false; boolean found = false;
String ext = p.getFileExtension(); String ext = p.getFileExtension();
if(ext == null) if(ext == null)

View file

@ -20,7 +20,7 @@ import java.util.TreeSet;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
public class PathComparator implements Comparator { public class PathComparator implements Comparator<IPath> {
public static PathComparator INSTANCE = new PathComparator(); public static PathComparator INSTANCE = new PathComparator();
// public static final SortedSet EMPTY_SET = Collections.unmodifiableSortedSet(new TreeSet(INSTANCE)); // public static final SortedSet EMPTY_SET = Collections.unmodifiableSortedSet(new TreeSet(INSTANCE));
// public static final SortedMap EMPTY_MAP = Collections.unmodifiableSortedMap(new TreeMap(INSTANCE)); // public static final SortedMap EMPTY_MAP = Collections.unmodifiableSortedMap(new TreeMap(INSTANCE));
@ -28,12 +28,12 @@ public class PathComparator implements Comparator {
private PathComparator(){ private PathComparator(){
} }
public int compare(Object arg0, Object arg1) { public int compare(IPath arg0, IPath arg1) {
if(arg0 == arg1) if(arg0 == arg1)
return 0; return 0;
IPath path1 = (IPath)arg0; IPath path1 = arg0;
IPath path2 = (IPath)arg1; IPath path2 = arg1;
int length1 = path1.segmentCount(); int length1 = path1.segmentCount();
int length2 = path2.segmentCount(); int length2 = path2.segmentCount();
@ -69,45 +69,43 @@ public class PathComparator implements Comparator {
return path.append("\0"); //$NON-NLS-1$ return path.append("\0"); //$NON-NLS-1$
} }
public static SortedMap getChildPathMap(SortedMap map, IPath path, boolean includeThis, boolean copy){ public static SortedMap<IPath, PerTypeSetStorage> getChildPathMap(SortedMap<IPath, PerTypeSetStorage> map, IPath path, boolean includeThis, boolean copy){
IPath start = includeThis ? path : getFirstChild(path); IPath start = includeThis ? path : getFirstChild(path);
IPath next = getNext(path); IPath next = getNext(path);
SortedMap result = next != null ? map.subMap(start, next) : map.tailMap(start); SortedMap<IPath, PerTypeSetStorage> result = next != null ? map.subMap(start, next) : map.tailMap(start);
if(copy) if(copy)
result = new TreeMap(result); result = new TreeMap<IPath, PerTypeSetStorage>(result);
return result; return result;
} }
public static SortedSet getChildPathSet(SortedSet set, IPath path, boolean includeThis, boolean copy){ public static SortedSet<IPath> getChildPathSet(SortedSet<IPath> set, IPath path, boolean includeThis, boolean copy){
IPath start = includeThis ? path : getFirstChild(path); IPath start = includeThis ? path : getFirstChild(path);
IPath next = getNext(path); IPath next = getNext(path);
SortedSet result = next != null ? set.subSet(start, next) : set.tailSet(start); SortedSet<IPath> result = next != null ? set.subSet(start, next) : set.tailSet(start);
if(copy) if(copy)
result = new TreeSet(result); result = new TreeSet<IPath>(result);
return result; return result;
} }
public static SortedSet getDirectChildPathSet(SortedSet set, IPath path){ public static SortedSet<IPath> getDirectChildPathSet(SortedSet<IPath> set, IPath path){
//all children //all children
SortedSet children = getChildPathSet(set, path, false, false); SortedSet<IPath> children = getChildPathSet(set, path, false, false);
SortedSet result = new TreeSet(INSTANCE); SortedSet<IPath> result = new TreeSet<IPath>(INSTANCE);
for(Iterator iter = children.iterator(); iter.hasNext(); iter = children.iterator()){ for (IPath childPath : children) {
IPath childPath = (IPath)iter.next();
result.add(childPath); result.add(childPath);
children = children.tailSet(getNext(childPath));
children = children.tailSet(getNext(childPath));//getChildPathSet(children, getNext(childPath), true, false);
} }
return result; return result;
} }
public static SortedMap getDirectChildPathMap(SortedMap map, IPath path){ public static SortedMap<IPath,PerTypeSetStorage> getDirectChildPathMap(SortedMap<IPath, PerTypeSetStorage> map, IPath path){
//all children //all children
SortedMap children = getChildPathMap(map, path, false, false); SortedMap<IPath,PerTypeSetStorage> children = getChildPathMap(map, path, false, false);
SortedMap result = new TreeMap(INSTANCE); SortedMap<IPath,PerTypeSetStorage> result = new TreeMap<IPath, PerTypeSetStorage>(INSTANCE);
for(Iterator iter = children.entrySet().iterator(); iter.hasNext(); iter = children.entrySet().iterator()){ for(Iterator<Map.Entry<IPath,PerTypeSetStorage>> iter = children.entrySet().iterator(); iter.hasNext(); iter = children.entrySet().iterator()){
Map.Entry entry = (Map.Entry)iter.next(); Map.Entry<IPath,PerTypeSetStorage> entry = iter.next();
IPath childPath = (IPath)entry.getKey(); IPath childPath = entry.getKey();
result.put(childPath, entry.getValue()); result.put(childPath, entry.getValue());
children = children.tailMap(getNext(childPath));//getChildPathMap(children, getNext(childPath), true, false); children = children.tailMap(getNext(childPath));//getChildPathMap(children, getNext(childPath), true, false);