mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
cosmetics: generics
This commit is contained in:
parent
30f85aaf63
commit
206f3ee6f3
1 changed files with 14 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2010 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -18,32 +18,32 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CDataObject;
|
import org.eclipse.cdt.core.settings.model.extension.CDataObject;
|
||||||
|
|
||||||
public class MapProxyCache implements IProxyCache {
|
public class MapProxyCache implements IProxyCache {
|
||||||
private HashMap fMap;
|
private HashMap<String, CDataProxy> fMap;
|
||||||
|
|
||||||
private HashMap getMap(boolean create){
|
private HashMap<String, CDataProxy> getMap(boolean create){
|
||||||
if(fMap == null && create)
|
if(fMap == null && create)
|
||||||
fMap = new HashMap();
|
fMap = new HashMap<String, CDataProxy>();
|
||||||
return fMap;
|
return fMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDataProxy[] getCachedProxies() {
|
public CDataProxy[] getCachedProxies() {
|
||||||
Map map = getMap(false);
|
Map<String, CDataProxy> map = getMap(false);
|
||||||
if(map != null){
|
if(map != null){
|
||||||
Collection c = map.values();
|
Collection<CDataProxy> c = map.values();
|
||||||
return (CDataProxy[])c.toArray(new CDataProxy[c.size()]);
|
return c.toArray(new CDataProxy[c.size()]);
|
||||||
}
|
}
|
||||||
return new CDataProxy[0];
|
return new CDataProxy[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDataProxy getCachedProxy(String id) {
|
public CDataProxy getCachedProxy(String id) {
|
||||||
Map map = getMap(false);
|
Map<String, CDataProxy> map = getMap(false);
|
||||||
if(map != null)
|
if(map != null)
|
||||||
return (CDataProxy)map.get(id);
|
return map.get(id);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCachedProxy(String id) {
|
public void removeCachedProxy(String id) {
|
||||||
Map map = getMap(false);
|
Map<String, CDataProxy> map = getMap(false);
|
||||||
if(map != null)
|
if(map != null)
|
||||||
map.remove(id);
|
map.remove(id);
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,9 @@ public class MapProxyCache implements IProxyCache {
|
||||||
getMap(true).put(proxy.getId(), proxy);
|
getMap(true).put(proxy.getId(), proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getCachedProxiesMap() {
|
@SuppressWarnings("unchecked")
|
||||||
return (Map)getMap(true).clone();
|
public Map<String, CDataProxy> getCachedProxiesMap() {
|
||||||
|
return (Map<String, CDataProxy>)getMap(true).clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDataProxy getCachedProxy(CDataObject data) {
|
public CDataProxy getCachedProxy(CDataObject data) {
|
||||||
|
@ -68,7 +69,7 @@ public class MapProxyCache implements IProxyCache {
|
||||||
removeCachedProxy(proxy.getId());
|
removeCachedProxy(proxy.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reuseProxies(List dataList, Map freeProxyMap) {
|
public void reuseProxies(List<CDataObject> dataList, Map<String, CDataProxy> freeProxyMap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue