From f08064a05e4d044eb2997dbdb38561737f62be0a Mon Sep 17 00:00:00 2001 From: Chris Recoskie Date: Wed, 28 Oct 2009 16:53:21 +0000 Subject: allow better subclassing of PerFileSICollector --- .../core/scannerconfig2/PerFileSICollector.java | 82 +++++++++++----------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java index c66a3c69b67..09d29419db1 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java @@ -61,15 +61,15 @@ import org.w3c.dom.NodeList; * @author vhirsl */ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner { - private static final int INCLUDE_PATH = 1; - private static final int QUOTE_INCLUDE_PATH = 2; - private static final int INCLUDE_FILE = 3; - private static final int MACROS_FILE = 4; + protected static final int INCLUDE_PATH = 1; + protected static final int QUOTE_INCLUDE_PATH = 2; + protected static final int INCLUDE_FILE = 3; + protected static final int MACROS_FILE = 4; - private class ScannerInfoData implements IDiscoveredScannerInfoSerializable { - private final Map> commandIdToFilesMap; // command id and set of files it applies to - private final Map fileToCommandIdMap; // maps each file to the corresponding command id - private final Map commandIdCommandMap; // map of all commands + protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable { + protected final Map> commandIdToFilesMap; // command id and set of files it applies to + protected final Map fileToCommandIdMap; // maps each file to the corresponding command id + protected final Map commandIdCommandMap; // map of all commands public ScannerInfoData() { commandIdCommandMap = new LinkedHashMap(); // [commandId, command] @@ -153,7 +153,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } - private static class ProjectScannerInfo { + protected static class ProjectScannerInfo { IPath[] includePaths; IPath[] quoteIncludePaths; IPath[] includeFiles; @@ -169,28 +169,28 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$ - private static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$ - private static final String ID_ATTR = "id"; //$NON-NLS-1$ - private static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$ - private static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$ - private static final String FILE_ELEM = "file"; //$NON-NLS-1$ - private static final String PATH_ATTR = "path"; //$NON-NLS-1$ + protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$ + protected static final String ID_ATTR = "id"; //$NON-NLS-1$ + protected static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$ + protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$ + protected static final String FILE_ELEM = "file"; //$NON-NLS-1$ + protected static final String PATH_ATTR = "path"; //$NON-NLS-1$ - private IProject project; - private InfoContext context; + protected IProject project; + protected InfoContext context; - private ScannerInfoData sid; // scanner info data - private ProjectScannerInfo psi = null; // sum of all scanner info + protected ScannerInfoData sid; // scanner info data + protected ProjectScannerInfo psi = null; // sum of all scanner info -// private List siChangedForFileList; // list of files for which scanner info has changed - private final Map siChangedForFileMap; // (file, comandId) map for deltas - private final List siChangedForCommandIdList; // list of command ids for which scanner info has changed +// protected List siChangedForFileList; // list of files for which scanner info has changed + protected final Map siChangedForFileMap; // (file, comandId) map for deltas + protected final List siChangedForCommandIdList; // list of command ids for which scanner info has changed - private final SortedSet freeCommandIdPool; // sorted set of free command ids - private int commandIdCounter = 0; + protected final SortedSet freeCommandIdPool; // sorted set of free command ids + protected int commandIdCounter = 0; /** monitor for data access */ - private final Object fLock = new Object(); + protected final Object fLock = new Object(); /** * @@ -280,7 +280,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param commandId * @param scannerInfo */ - private void addScannerInfo(Integer commandId, Map scannerInfo) { + protected void addScannerInfo(Integer commandId, Map scannerInfo) { assert Thread.holdsLock(fLock); CCommandDSC cmd = sid.commandIdCommandMap.get(commandId); if (cmd != null) { @@ -303,7 +303,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param file * @param object */ - private void addCompilerCommand(IFile file, CCommandDSC cmd) { + protected void addCompilerCommand(IFile file, CCommandDSC cmd) { assert Thread.holdsLock(fLock); List existingCommands = new ArrayList(sid.commandIdCommandMap.values()); int index = existingCommands.indexOf(cmd); @@ -331,7 +331,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param file * @param cmd */ - private void generateFileDelta(IFile file, CCommandDSC cmd) { + protected void generateFileDelta(IFile file, CCommandDSC cmd) { assert Thread.holdsLock(fLock); Integer commandId = cmd.getCommandIdAsInteger(); Integer oldCommandId = sid.fileToCommandIdMap.get(file); @@ -350,7 +350,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param file * @param cmd */ - private void applyFileDeltas() { + protected void applyFileDeltas() { assert Thread.holdsLock(fLock); for (Iterator i = siChangedForFileMap.keySet().iterator(); i.hasNext(); ) { IFile file = (IFile) i.next(); @@ -396,7 +396,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC generateProjectScannerInfo(); } - private void generateProjectScannerInfo() { + protected void generateProjectScannerInfo() { assert Thread.holdsLock(fLock); psi = new ProjectScannerInfo(); psi.includePaths = getAllIncludePaths(INCLUDE_PATH); @@ -406,7 +406,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC psi.definedSymbols = getAllSymbols(); } - private void removeUnusedCommands() { + protected void removeUnusedCommands() { assert Thread.holdsLock(fLock); for (Iterator i = sid.commandIdToFilesMap.entrySet().iterator(); i.hasNext(); ) { Entry entry = (Entry) i.next(); @@ -437,7 +437,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param type * @param object */ - private void addScannerInfo(ScannerInfoTypes type, List delta) { + protected void addScannerInfo(ScannerInfoTypes type, List delta) { // TODO Auto-generated method stub } @@ -487,7 +487,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC return new PerFileDiscoveredPathInfo(); } - private boolean scannerInfoChanged() { + protected boolean scannerInfoChanged() { assert Thread.holdsLock(fLock); // return !siChangedForFileList.isEmpty(); return !siChangedForFileMap.isEmpty(); @@ -621,7 +621,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * * @author vhirsl */ - private class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 { + protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject() */ @@ -797,7 +797,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } - private Map calculatePathInfoMap(){ + protected Map calculatePathInfoMap(){ assert Thread.holdsLock(fLock); Map map = new HashMap(sid.fileToCommandIdMap.size() + 1); Map.Entry entry; @@ -828,7 +828,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC return map; } - private static PathInfo createFilePathInfo(CCommandDSC cmd){ + protected static PathInfo createFilePathInfo(CCommandDSC cmd){ IPath[] includes = stringListToPathArray(cmd.getIncludes()); IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes()); IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile()); @@ -849,7 +849,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param path * @return */ - private CCommandDSC getCommand(IPath path) { + protected CCommandDSC getCommand(IPath path) { try { IFile file = project.getWorkspace().getRoot().getFile(path); return getCommand(file); @@ -859,7 +859,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } } - private CCommandDSC getCommand(IFile file) { + protected CCommandDSC getCommand(IFile file) { CCommandDSC cmd = null; if (file != null) { Integer cmdId = sid.fileToCommandIdMap.get(file); @@ -880,7 +880,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * * @return list of IPath(s). */ - private IPath[] getAllIncludePaths(int type) { + protected IPath[] getAllIncludePaths(int type) { List allIncludes = new ArrayList(); for (Iterator i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext(); ) { Integer cmdId = i.next(); @@ -921,7 +921,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC * @param allIncludes * @return */ - private static IPath[] stringListToPathArray(List discovered) { + protected static IPath[] stringListToPathArray(List discovered) { List allIncludes = new ArrayList(discovered.size()); for (Iterator j = discovered.iterator(); j.hasNext(); ) { String include = j.next(); @@ -935,7 +935,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /** * @return */ - private Map getAllSymbols() { + protected Map getAllSymbols() { assert Thread.holdsLock(fLock); Map symbols = new HashMap(); for (Iterator i = sid.commandIdCommandMap.keySet().iterator(); i.hasNext(); ) { -- cgit v1.2.3