mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
bug 319512: Missing type arguments on managedbuilder.core
This commit is contained in:
parent
31c9cb8c11
commit
7e18b465e2
2 changed files with 148 additions and 150 deletions
|
@ -12,13 +12,10 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
@ -45,25 +42,25 @@ public class ToolChainModificationHelper {
|
||||||
return lMap;
|
return lMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ToolListMap calculateDifference(ToolListMap m1, ToolListMap m2){
|
// private static ListMap calculateDifference(ListMap m1, ListMap m2){
|
||||||
m1 = (ToolListMap)m1.clone();
|
// m1 = (ListMap)m1.clone();
|
||||||
Set ceSet2 = m2.collectionEntrySet();
|
// Set ceSet2 = m2.collectionEntrySet();
|
||||||
|
//
|
||||||
for(Iterator iter = ceSet2.iterator(); iter.hasNext(); ){
|
// for(Iterator iter = ceSet2.iterator(); iter.hasNext(); ){
|
||||||
CollectionEntry entry = (CollectionEntry)iter.next();
|
// CollectionEntry entry = (CollectionEntry)iter.next();
|
||||||
Collection c1 = m2.get(entry.getKey(), false);
|
// Collection c1 = m2.get((ITool) entry.getKey(), false);
|
||||||
if(c1 != null){
|
// if(c1 != null){
|
||||||
Collection c2 = entry.getValue();
|
// Collection c2 = entry.getValue();
|
||||||
int i = c2.size();
|
// int i = c2.size();
|
||||||
for(Iterator c1Iter = c1.iterator(); i >= 0 && c1Iter.hasNext(); i--){
|
// for(Iterator c1Iter = c1.iterator(); i >= 0 && c1Iter.hasNext(); i--){
|
||||||
c1Iter.next();
|
// c1Iter.next();
|
||||||
c1Iter.remove();
|
// c1Iter.remove();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return m1;
|
// return m1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static public ToolListModificationInfo getModificationInfo(IResourceInfo rcInfo, ITool[] fromTools, ITool[] addedTools, ITool[] removedTools){
|
static public ToolListModificationInfo getModificationInfo(IResourceInfo rcInfo, ITool[] fromTools, ITool[] addedTools, ITool[] removedTools){
|
||||||
ToolListMap addedMap = createRealToToolMap(addedTools, false);
|
ToolListMap addedMap = createRealToToolMap(addedTools, false);
|
||||||
|
@ -90,10 +87,9 @@ public class ToolChainModificationHelper {
|
||||||
removedMap.clearEmptyLists();
|
removedMap.clearEmptyLists();
|
||||||
|
|
||||||
ToolListMap curMap = createRealToToolMap(fromTools, false);
|
ToolListMap curMap = createRealToToolMap(fromTools, false);
|
||||||
for(Iterator iter = removedMap.collectionEntrySet().iterator(); iter.hasNext();){
|
for (CollectionEntry entry : removedMap.collectionEntrySet()) {
|
||||||
CollectionEntry entry = (CollectionEntry)iter.next();
|
List<ITool> cur = curMap.get(entry.getKey(), false);
|
||||||
List cur = curMap.get(entry.getKey(), false);
|
List<ITool> removed = entry.getValue();
|
||||||
List removed = entry.getValue();
|
|
||||||
if(cur != null){
|
if(cur != null){
|
||||||
int numToRemove = removed.size();
|
int numToRemove = removed.size();
|
||||||
int curSize = cur.size();
|
int curSize = cur.size();
|
||||||
|
@ -109,10 +105,9 @@ public class ToolChainModificationHelper {
|
||||||
|
|
||||||
curMap.clearEmptyLists();
|
curMap.clearEmptyLists();
|
||||||
|
|
||||||
for(Iterator iter = addedMap.collectionEntrySet().iterator(); iter.hasNext();){
|
for (CollectionEntry entry : addedMap.collectionEntrySet()) {
|
||||||
CollectionEntry entry = (CollectionEntry)iter.next();
|
List<ITool> cur = curMap.get(entry.getKey(), true);
|
||||||
List cur = curMap.get(entry.getKey(), true);
|
List<ITool> added = entry.getValue();
|
||||||
List added = entry.getValue();
|
|
||||||
int numToAdd = added.size();
|
int numToAdd = added.size();
|
||||||
numToAdd -= cur.size();
|
numToAdd -= cur.size();
|
||||||
for(int i = 0; i < numToAdd; i++){
|
for(int i = 0; i < numToAdd; i++){
|
||||||
|
@ -125,19 +120,20 @@ public class ToolChainModificationHelper {
|
||||||
|
|
||||||
curMap.clearEmptyLists();
|
curMap.clearEmptyLists();
|
||||||
|
|
||||||
List resultingList = new ArrayList();
|
List<ITool> resultingList = new ArrayList<ITool>();
|
||||||
curMap.putValuesToCollection(resultingList);
|
curMap.putValuesToCollection(resultingList);
|
||||||
|
|
||||||
return getModificationInfo(rcInfo, fromTools, (ITool[])resultingList.toArray(new ITool[resultingList.size()]));
|
return getModificationInfo(rcInfo, fromTools, resultingList.toArray(new ITool[resultingList.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static public ToolListModificationInfo getModificationInfo(IResourceInfo rcInfo, ITool[] fromTools, ITool[] toTools){
|
static public ToolListModificationInfo getModificationInfo(IResourceInfo rcInfo, ITool[] fromTools, ITool[] toTools){
|
||||||
|
|
||||||
ToolListMap curMap = createRealToToolMap(fromTools, false);
|
ToolListMap curMap = createRealToToolMap(fromTools, false);
|
||||||
List resultingList = new ArrayList();
|
List<ToolInfo> resultingList = new ArrayList<ToolInfo>();
|
||||||
List addedList = new ArrayList(7);
|
List<ToolInfo> addedList = new ArrayList<ToolInfo>(7);
|
||||||
List remainedList = new ArrayList(7);
|
List<ToolInfo> remainedList = new ArrayList<ToolInfo>(7);
|
||||||
List removedList = new ArrayList(7);
|
List<ToolInfo> removedList = new ArrayList<ToolInfo>(7);
|
||||||
|
List<ITool> removedToolsList = new ArrayList<ITool>(7);
|
||||||
|
|
||||||
for(int i = 0; i < toTools.length; i++){
|
for(int i = 0; i < toTools.length; i++){
|
||||||
ITool tool = toTools[i];
|
ITool tool = toTools[i];
|
||||||
|
@ -145,7 +141,7 @@ public class ToolChainModificationHelper {
|
||||||
if(realTool == null)
|
if(realTool == null)
|
||||||
realTool = tool;
|
realTool = tool;
|
||||||
|
|
||||||
ITool remaining = (ITool)curMap.remove(realTool, 0);
|
ITool remaining = curMap.remove(realTool, 0);
|
||||||
ToolInfo tInfo;
|
ToolInfo tInfo;
|
||||||
if(remaining != null){
|
if(remaining != null){
|
||||||
tInfo = new ToolInfo(rcInfo, remaining, ToolInfo.REMAINED);
|
tInfo = new ToolInfo(rcInfo, remaining, ToolInfo.REMAINED);
|
||||||
|
@ -158,10 +154,9 @@ public class ToolChainModificationHelper {
|
||||||
resultingList.add(tInfo);
|
resultingList.add(tInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
curMap.valuesToCollection(removedList);
|
curMap.valuesToCollection(removedToolsList);
|
||||||
for(ListIterator iter = removedList.listIterator(); iter.hasNext(); ){
|
for (ITool t : removedToolsList) {
|
||||||
ITool t = (ITool)iter.next();
|
removedList.add(new ToolInfo(rcInfo, t, ToolInfo.REMOVED));
|
||||||
iter.set(new ToolInfo(rcInfo, t, ToolInfo.REMOVED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolInfo[] added = listToArray(addedList);
|
ToolInfo[] added = listToArray(addedList);
|
||||||
|
@ -198,7 +193,9 @@ public class ToolChainModificationHelper {
|
||||||
|
|
||||||
private static int getLevel(ITool tool){
|
private static int getLevel(ITool tool){
|
||||||
int i= 0;
|
int i= 0;
|
||||||
for(; tool != null; tool = tool.getSuperClass(), i++);
|
for(; tool != null; tool = tool.getSuperClass(), i++) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,15 +235,15 @@ public class ToolChainModificationHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ToolInfo[] listToArray(List list){
|
private static ToolInfo[] listToArray(List<ToolInfo> list){
|
||||||
return (ToolInfo[])list.toArray(new ToolInfo[list.size()]);
|
return list.toArray(new ToolInfo[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map calculateConverterTools(IResourceInfo rcInfo, ToolInfo[] removed, ToolInfo[] added, List remainingRemoved, List remainingAdded){
|
private static Map<ITool, ConverterInfo> calculateConverterTools(IResourceInfo rcInfo, ToolInfo[] removed, ToolInfo[] added, List<ToolInfo> remainingRemoved, List<ToolInfo> remainingAdded){
|
||||||
if(remainingAdded == null)
|
if(remainingAdded == null)
|
||||||
remainingAdded = new ArrayList(added.length);
|
remainingAdded = new ArrayList<ToolInfo>(added.length);
|
||||||
if(remainingRemoved == null)
|
if(remainingRemoved == null)
|
||||||
remainingRemoved = new ArrayList(removed.length);
|
remainingRemoved = new ArrayList<ToolInfo>(removed.length);
|
||||||
|
|
||||||
remainingAdded.clear();
|
remainingAdded.clear();
|
||||||
remainingRemoved.clear();
|
remainingRemoved.clear();
|
||||||
|
@ -254,22 +251,22 @@ public class ToolChainModificationHelper {
|
||||||
remainingAdded.addAll(Arrays.asList(added));
|
remainingAdded.addAll(Arrays.asList(added));
|
||||||
remainingRemoved.addAll(Arrays.asList(removed));
|
remainingRemoved.addAll(Arrays.asList(removed));
|
||||||
|
|
||||||
Map resultMap = new HashMap();
|
Map<ITool, ConverterInfo> resultMap = new HashMap<ITool, ConverterInfo>();
|
||||||
|
|
||||||
for(Iterator rIter = remainingRemoved.iterator(); rIter.hasNext();){
|
for(Iterator<ToolInfo> rIter = remainingRemoved.iterator(); rIter.hasNext();){
|
||||||
ToolInfo rti = (ToolInfo)rIter.next();
|
ToolInfo rti = rIter.next();
|
||||||
ITool r = rti.getInitialTool();
|
ITool r = rti.getInitialTool();
|
||||||
|
|
||||||
if(r == null || r.getParentResourceInfo() != rcInfo)
|
if(r == null || r.getParentResourceInfo() != rcInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
Map map = ManagedBuildManager.getConversionElements(r);
|
Map<String, IConfigurationElement> map = ManagedBuildManager.getConversionElements(r);
|
||||||
if(map.size() == 0)
|
if(map.size() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(Iterator aIter = remainingAdded.iterator(); aIter.hasNext();){
|
for(Iterator<ToolInfo> aIter = remainingAdded.iterator(); aIter.hasNext();){
|
||||||
ToolInfo ati = (ToolInfo)aIter.next();
|
ToolInfo ati = aIter.next();
|
||||||
ITool a = ati.getBaseTool();
|
ITool a = ati.getBaseTool();
|
||||||
|
|
||||||
if(a == null || a.getParentResourceInfo() == rcInfo)
|
if(a == null || a.getParentResourceInfo() == rcInfo)
|
||||||
|
|
|
@ -10,61 +10,61 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
package org.eclipse.cdt.managedbuilder.internal.tcmodification;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.AbstractSet;
|
import java.util.AbstractSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
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 org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
|
|
||||||
public class ToolListMap implements Cloneable {
|
public class ToolListMap implements Cloneable {
|
||||||
private HashMap fMap;
|
private HashMap<ITool, List<ITool>> fMap;
|
||||||
private CollectionEntrySet fCollectionEntrySet;
|
private CollectionEntrySet fCollectionEntrySet;
|
||||||
|
|
||||||
public ToolListMap(){
|
public ToolListMap(){
|
||||||
fMap = new HashMap();
|
fMap = new HashMap<ITool, List<ITool>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ValueIter {
|
// public class ValueIter {
|
||||||
private Map fIterMap;
|
// private Map fIterMap;
|
||||||
|
//
|
||||||
public ValueIter() {
|
// public ValueIter() {
|
||||||
fIterMap = new HashMap(fMap);
|
// fIterMap = new HashMap(fMap);
|
||||||
for(Iterator iter = fIterMap.entrySet().iterator(); iter.hasNext();){
|
// for(Iterator iter = fIterMap.entrySet().iterator(); iter.hasNext();){
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
// Map.Entry entry = (Map.Entry)iter.next();
|
||||||
Collection c = (Collection)entry.getValue();
|
// Collection c = (Collection)entry.getValue();
|
||||||
entry.setValue(c.iterator());
|
// entry.setValue(c.iterator());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Iterator get(Object key){
|
// public Iterator get(Object key){
|
||||||
Iterator iter = (Iterator)fIterMap.get(key);
|
// Iterator iter = (Iterator)fIterMap.get(key);
|
||||||
if(iter != null && !iter.hasNext()){
|
// if(iter != null && !iter.hasNext()){
|
||||||
fIterMap.remove(key);
|
// fIterMap.remove(key);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
return iter;
|
// return iter;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public class CollectionEntry {
|
public class CollectionEntry {
|
||||||
private Map.Entry fEntry;
|
private Map.Entry<ITool, List<ITool>> fEntry;
|
||||||
|
|
||||||
CollectionEntry(Map.Entry entry){
|
CollectionEntry(Map.Entry<ITool, List<ITool>> entry){
|
||||||
fEntry = entry;
|
fEntry = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getKey(){
|
public ITool getKey(){
|
||||||
return fEntry.getKey();
|
return fEntry.getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getValue(){
|
public List<ITool> getValue(){
|
||||||
return (List)fEntry.getValue();
|
return fEntry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,11 +87,11 @@ public class ToolListMap implements Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CollectionEntrySet extends AbstractSet {
|
private class CollectionEntrySet extends AbstractSet<CollectionEntry> {
|
||||||
private Set fMapEntrySet;
|
private Set<Entry<ITool, List<ITool>>> fMapEntrySet;
|
||||||
|
|
||||||
private class Iter implements Iterator {
|
private class Iter implements Iterator<CollectionEntry> {
|
||||||
private Iterator fIter;
|
private Iterator<Entry<ITool, List<ITool>>> fIter;
|
||||||
|
|
||||||
private Iter(){
|
private Iter(){
|
||||||
fIter = fMapEntrySet.iterator();
|
fIter = fMapEntrySet.iterator();
|
||||||
|
@ -100,8 +100,8 @@ public class ToolListMap implements Cloneable {
|
||||||
return fIter.hasNext();
|
return fIter.hasNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object next() {
|
public CollectionEntry next() {
|
||||||
return new CollectionEntry((Map.Entry)fIter.next());
|
return new CollectionEntry(fIter.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
public void remove() {
|
||||||
|
@ -115,7 +115,7 @@ public class ToolListMap implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator iterator() {
|
public Iterator<CollectionEntry> iterator() {
|
||||||
return new Iter();
|
return new Iter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,17 +126,17 @@ public class ToolListMap implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void add(Object key, Object value){
|
public void add(ITool key, ITool value){
|
||||||
List l = get(key, true);
|
List<ITool> l = get(key, true);
|
||||||
l.add(value);
|
l.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List removeAll(Object key){
|
public List<ITool> removeAll(ITool key){
|
||||||
return (List)fMap.remove(key);
|
return fMap.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List get(Object key, boolean create){
|
public List<ITool> get(ITool key, boolean create){
|
||||||
List l = (List)fMap.get(key);
|
List<ITool> l = fMap.get(key);
|
||||||
if(l == null && create){
|
if(l == null && create){
|
||||||
l = newList(1);
|
l = newList(1);
|
||||||
fMap.put(key, l);
|
fMap.put(key, l);
|
||||||
|
@ -145,46 +145,46 @@ public class ToolListMap implements Cloneable {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection valuesToCollection(Collection c){
|
public List<ITool> valuesToCollection(List<ITool> c){
|
||||||
if(c == null)
|
if(c == null)
|
||||||
c = newList(20);
|
c = newList(20);
|
||||||
|
|
||||||
for(Iterator iter = fMap.values().iterator(); iter.hasNext(); ){
|
for (List<ITool> l : fMap.values()) {
|
||||||
List l = (List)iter.next();
|
|
||||||
c.addAll(l);
|
c.addAll(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getValues(){
|
// public List<ITool> getValues(){
|
||||||
return (List)valuesToCollection(null);
|
// return valuesToCollection(null);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public ITool[] getValuesArray(Class clazz){
|
||||||
|
// List<ITool> list = getValues();
|
||||||
|
// ITool[] result = (ITool[])Array.newInstance(clazz, list.size());
|
||||||
|
// return list.toArray(result);
|
||||||
|
// }
|
||||||
|
|
||||||
|
protected List<ITool> newList(int size){
|
||||||
|
return new ArrayList<ITool>(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getValuesArray(Class clazz){
|
@SuppressWarnings("unchecked")
|
||||||
List list = getValues();
|
protected List<ITool> cloneList(List<ITool> l){
|
||||||
Object[] result = (Object[])Array.newInstance(clazz, list.size());
|
return (List<ITool>)((ArrayList<ITool>)l).clone();
|
||||||
return list.toArray(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List newList(int size){
|
public List<ITool> putValuesToCollection(List<ITool> c){
|
||||||
return new ArrayList(size);
|
for (CollectionEntry entry : collectionEntrySet()) {
|
||||||
}
|
List<ITool> l = entry.getValue();
|
||||||
|
|
||||||
protected List cloneList(List l){
|
|
||||||
return (List)((ArrayList)l).clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection putValuesToCollection(Collection c){
|
|
||||||
for(Iterator iter = collectionEntrySet().iterator(); iter.hasNext(); ){
|
|
||||||
List l = ((CollectionEntry)iter.next()).getValue();
|
|
||||||
c.addAll(l);
|
c.addAll(l);
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Object key, Object value){
|
public void remove(ITool key, ITool value){
|
||||||
Collection c = get(key, false);
|
List<ITool> c = get(key, false);
|
||||||
if(c != null){
|
if(c != null){
|
||||||
if(c.remove(value) && c.size() == 0){
|
if(c.remove(value) && c.size() == 0){
|
||||||
fMap.remove(key);
|
fMap.remove(key);
|
||||||
|
@ -192,18 +192,18 @@ public class ToolListMap implements Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object get(Object key, int num){
|
public ITool get(ITool key, int num){
|
||||||
List l = get(key, false);
|
List<ITool> l = get(key, false);
|
||||||
if(l != null){
|
if(l != null){
|
||||||
return l.get(num);
|
return l.get(num);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object remove(Object key, int num){
|
public ITool remove(ITool key, int num){
|
||||||
List l = get(key, false);
|
List<ITool> l = get(key, false);
|
||||||
if(l != null){
|
if(l != null){
|
||||||
Object result = null;
|
ITool result = null;
|
||||||
if(l.size() > num){
|
if(l.size() > num){
|
||||||
result = l.remove(num);
|
result = l.remove(num);
|
||||||
}
|
}
|
||||||
|
@ -213,10 +213,10 @@ public class ToolListMap implements Cloneable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object removeLast(Object key){
|
public ITool removeLast(ITool key){
|
||||||
List l = get(key, false);
|
List<ITool> l = get(key, false);
|
||||||
if(l != null){
|
if(l != null){
|
||||||
Object result = null;
|
ITool result = null;
|
||||||
if(l.size() > 0){
|
if(l.size() > 0){
|
||||||
result = l.remove(l.size() - 1);
|
result = l.remove(l.size() - 1);
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,8 @@ public class ToolListMap implements Cloneable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAll(Object key, Collection values){
|
public void removeAll(ITool key, List<ITool> values){
|
||||||
Collection c = get(key, false);
|
List<ITool> c = get(key, false);
|
||||||
if(c != null){
|
if(c != null){
|
||||||
if(c.removeAll(values) && c.size() == 0){
|
if(c.removeAll(values) && c.size() == 0){
|
||||||
fMap.remove(key);
|
fMap.remove(key);
|
||||||
|
@ -235,34 +235,34 @@ public class ToolListMap implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearEmptyLists(){
|
public void clearEmptyLists(){
|
||||||
for(Iterator iter = fMap.entrySet().iterator(); iter.hasNext(); ){
|
for(Iterator<Entry<ITool, List<ITool>>> iter = fMap.entrySet().iterator(); iter.hasNext(); ){
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
Map.Entry<ITool, List<ITool>> entry = iter.next();
|
||||||
if(((List)entry.getValue()).size() == 0)
|
if((entry.getValue()).size() == 0)
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set collectionEntrySet(){
|
public Set<CollectionEntry> collectionEntrySet(){
|
||||||
if(fCollectionEntrySet == null)
|
if(fCollectionEntrySet == null)
|
||||||
fCollectionEntrySet = new CollectionEntrySet();
|
fCollectionEntrySet = new CollectionEntrySet();
|
||||||
return fCollectionEntrySet;
|
return fCollectionEntrySet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void difference(ToolListMap map){
|
// public void difference(ListMap map){
|
||||||
for(Iterator iter = map.fMap.entrySet().iterator(); iter.hasNext(); ){
|
// for(Iterator<Entry<ITool, List<ITool>>> iter = map.fMap.entrySet().iterator(); iter.hasNext(); ){
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
// Map.Entry<ITool, List<ITool>> entry = iter.next();
|
||||||
Collection thisC = (Collection)fMap.get(entry.getKey());
|
// List<ITool> thisC = fMap.get(entry.getKey());
|
||||||
if(thisC != null){
|
// if(thisC != null){
|
||||||
if(thisC.removeAll((Collection)entry.getValue()) && thisC == null){
|
// if(thisC.removeAll(entry.getValue()) && thisC == null){
|
||||||
fMap.remove(entry.getKey());
|
// fMap.remove(entry.getKey());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public ValueIter valueIter(){
|
// public ValueIter valueIter(){
|
||||||
return new ValueIter();
|
// return new ValueIter();
|
||||||
}
|
// }
|
||||||
|
|
||||||
// protected Collection createCollection(Object key){
|
// protected Collection createCollection(Object key){
|
||||||
// return new ArrayList(1);
|
// return new ArrayList(1);
|
||||||
|
@ -272,10 +272,11 @@ public class ToolListMap implements Cloneable {
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
try {
|
try {
|
||||||
ToolListMap clone = (ToolListMap)super.clone();
|
ToolListMap clone = (ToolListMap)super.clone();
|
||||||
clone.fMap = (HashMap)fMap.clone();
|
@SuppressWarnings("unchecked")
|
||||||
for(Iterator iter = clone.fMap.entrySet().iterator(); iter.hasNext();){
|
HashMap<ITool, List<ITool>> clone2 = (HashMap<ITool, List<ITool>>)fMap.clone();
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
clone.fMap = clone2;
|
||||||
entry.setValue(cloneList((List)entry.getValue()));
|
for (Entry<ITool, List<ITool>> entry : clone.fMap.entrySet()) {
|
||||||
|
entry.setValue(cloneList(entry.getValue()));
|
||||||
}
|
}
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
ManagedBuilderCorePlugin.log(e);
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue