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

bug 284699: Added some annotations/comments

This commit is contained in:
Andrew Gvozdev 2012-01-19 16:39:56 -05:00
parent 533c75662e
commit c7adafb18b
3 changed files with 80 additions and 75 deletions

View file

@ -8,8 +8,8 @@
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.) * James Blackburn (Broadcom Corp.)
* Christian Walther (Indel AG) - [335344] test for changing language IDs * Christian Walther (Indel AG) - bug 335344: test for changing language IDs
* Raphael Zulliger (Indel AG) - [284699][237771] test having macros with same * Raphael Zulliger (Indel AG) - bug 284699: test having macros with same
* name but different values in same project * name but different values in same project
* configuration * configuration
*******************************************************************************/ *******************************************************************************/
@ -17,6 +17,7 @@ package org.eclipse.cdt.core.settings.model;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.IPDOMManager; import org.eclipse.cdt.core.dom.IPDOMManager;

View file

@ -7,8 +7,8 @@
* *
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
* Christian Walther (Indel AG) - [335344] test for changing language IDs * Christian Walther (Indel AG) - bug 335344: test for changing language IDs
* Raphael Zulliger (Indel AG) - [284699][237771] test having macros with same * Raphael Zulliger (Indel AG) - bug 284699: test having macros with same
* name but different values in same project * name but different values in same project
* configuration * configuration
*******************************************************************************/ *******************************************************************************/

View file

@ -7,7 +7,7 @@
* *
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
* Raphael Zulliger (Indel AG) - [284699][237771] fixing issues when using same * Raphael Zulliger (Indel AG) - bug 284699: fixing issues when using same
* macro names with different values * macro names with different values
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.settings.model.util; package org.eclipse.cdt.core.settings.model.util;
@ -21,14 +21,18 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
/**
* Cache of setting entries stored with multidimentional maps.
* See bug 284699 comment 7 for a possible insight into it.
*/
public class CSettingEntryFactory { public class CSettingEntryFactory {
private static final HashSet<IPath> EMPTY_SET = new HashSet<IPath>(0); private static final HashSet<IPath> EMPTY_SET = new HashSet<IPath>(0);
private KindBasedStore<HashMap<String, ?>> fStore = new KindBasedStore<HashMap<String, ?>>(false); private KindBasedStore<HashMap<String, ?>> fStore = new KindBasedStore<HashMap<String, ?>>(false);
private <K, V> HashMap<String, HashMap<K, V>> getNameMap(int kind, boolean create, HashMap<K, V> type){ private <K, V> HashMap<String, HashMap<K, V>> getNameMap(int kind, boolean create){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
HashMap<String, HashMap<K, V>> map = (HashMap<String, HashMap<K, V>>) fStore.get(kind); HashMap<String/*name*/, HashMap<K, V>> map = (HashMap<String, HashMap<K, V>>) fStore.get(kind);
if(map == null && create){ if(map == null && create){
map = new HashMap<String, HashMap<K, V>>(); map = new HashMap<String, HashMap<K, V>>();
fStore.put(kind, map); fStore.put(kind, map);
@ -36,18 +40,18 @@ public class CSettingEntryFactory {
return map; return map;
} }
private <K, V> HashMap<K, V> getValueMap(String name, boolean create, HashMap<K, V> type){ private HashMap<String, HashMap<Integer, ICSettingEntry>> getValueMap(String name, boolean create){
HashMap<String, HashMap<K, V>> nameMap = getNameMap(ICSettingEntry.MACRO, create, (HashMap<K, V>)null); HashMap<String/*name*/, HashMap<String/*value*/, HashMap<Integer/*flags*/, ICSettingEntry>>> nameMap = getNameMap(ICSettingEntry.MACRO, create);
if(nameMap != null){ if(nameMap != null){
return getMap(nameMap, name, create); return getMap(nameMap, name, create);
} }
return null; return null;
} }
private HashMap<Integer, ICSettingEntry> getFlagMap(int kind, String name, String value, IPath[] exclusionPatters, boolean create){ private HashMap<Integer, ICSettingEntry> getFlagMap(int kind, String name, String value, IPath[] exclusionPatterns, boolean create){
switch(kind){ switch(kind){
case ICSettingEntry.MACRO: case ICSettingEntry.MACRO:
HashMap<String, HashMap<Integer, ICSettingEntry>> valueMap = getValueMap(name, create, (HashMap<String, HashMap<Integer, ICSettingEntry>>)null); HashMap<String, HashMap<Integer, ICSettingEntry>> valueMap = getValueMap(name, create);
if(valueMap != null){ if(valueMap != null){
return getMap(valueMap, value, create); return getMap(valueMap, value, create);
} }
@ -56,12 +60,12 @@ public class CSettingEntryFactory {
case ICSettingEntry.OUTPUT_PATH: case ICSettingEntry.OUTPUT_PATH:
HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> excPatternMap = getExclusionPatternsMap(kind, name, create); HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> excPatternMap = getExclusionPatternsMap(kind, name, create);
if(excPatternMap != null){ if(excPatternMap != null){
HashSet<IPath> setKey = exclusionPatters == null || exclusionPatters.length == 0 ? EMPTY_SET : new HashSet<IPath>(Arrays.asList(exclusionPatters)); HashSet<IPath> setKey = exclusionPatterns == null || exclusionPatterns.length == 0 ? EMPTY_SET : new HashSet<IPath>(Arrays.asList(exclusionPatterns));
return getMap(excPatternMap, setKey, create); return getMap(excPatternMap, setKey, create);
} }
return null; return null;
default: default:
HashMap<String, HashMap<Integer, ICSettingEntry>> nameMap = getNameMap(kind, create, (HashMap<Integer, ICSettingEntry>)null); HashMap<String, HashMap<Integer, ICSettingEntry>> nameMap = getNameMap(kind, create);
if(nameMap != null){ if(nameMap != null){
return getMap(nameMap, name, create); return getMap(nameMap, name, create);
} }
@ -70,7 +74,7 @@ public class CSettingEntryFactory {
} }
private HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> getExclusionPatternsMap(int kind, String name, boolean create){ private HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> getExclusionPatternsMap(int kind, String name, boolean create){
HashMap<String, HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>>> nameMap = getNameMap(kind, create, (HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>>)null); HashMap<String/*name*/, HashMap<HashSet<IPath>/*exclusionPatterns*/, HashMap<Integer/*flags*/, ICSettingEntry>>> nameMap = getNameMap(kind, create);
if(nameMap != null){ if(nameMap != null){
return getMap(nameMap, name, create); return getMap(nameMap, name, create);
} }