mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[159683] Added a few comments and fixed a couple of warnings while reviewing changes.
This commit is contained in:
parent
a89a6117aa
commit
0f827f7b2b
1 changed files with 85 additions and 70 deletions
|
@ -48,9 +48,9 @@ public abstract class VMCache
|
|||
|
||||
protected HashMap<IDMContext<?>, IDMData> fDataArchive = fData;
|
||||
|
||||
public HashMap[] getCacheData()
|
||||
public HashMap<?,?>[] getCacheData()
|
||||
{
|
||||
return new HashMap[] { fHasChildren, fChildrenCounts, fChildren, fData, fDataArchive };
|
||||
return new HashMap<?,?>[] { fHasChildren, fChildrenCounts, fChildren, fData, fDataArchive };
|
||||
}
|
||||
|
||||
public VMCache()
|
||||
|
@ -58,17 +58,19 @@ public abstract class VMCache
|
|||
|
||||
}
|
||||
|
||||
// Suppress warnings related to the lost type information in getCacheData()
|
||||
@SuppressWarnings("unchecked")
|
||||
public VMCache(VMCache oldCache)
|
||||
{
|
||||
if(oldCache != null)
|
||||
{
|
||||
HashMap oldCacheData[] = oldCache.getCacheData();
|
||||
HashMap<?,?> oldCacheData[] = oldCache.getCacheData();
|
||||
|
||||
fHasChildren = oldCacheData[0];
|
||||
fChildrenCounts = oldCacheData[1];
|
||||
fChildren = oldCacheData[2];
|
||||
fData = oldCacheData[3];
|
||||
fDataArchive = oldCacheData[4];
|
||||
fHasChildren = (HashMap<Object, Boolean>)oldCacheData[0];
|
||||
fChildrenCounts = (HashMap<Object, Integer>)oldCacheData[1];
|
||||
fChildren = (HashMap<Object, HashMap<Integer,Object>>)oldCacheData[2];
|
||||
fData = (HashMap<IDMContext<?>, IDMData>)oldCacheData[3];
|
||||
fDataArchive = (HashMap<IDMContext<?>, IDMData>)oldCacheData[4];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,11 +84,22 @@ public abstract class VMCache
|
|||
fHasChildren.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the data in this cache should used when servicing
|
||||
* view updates. If this method returns false all updates will be
|
||||
* sent to the view model, although the retrieved data should still
|
||||
* be stored in the cache if {@link #isCacheWriteEnabled()} returns true.
|
||||
* @return
|
||||
*/
|
||||
protected boolean isCacheReadEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if data retrieved from the view model should be cached.
|
||||
* If this returns false, then the state of the cache is frozen.
|
||||
*/
|
||||
protected boolean isCacheWriteEnabled()
|
||||
{
|
||||
return true;
|
||||
|
@ -266,7 +279,9 @@ public abstract class VMCache
|
|||
for(int i = 0; i < updates.length; i++)
|
||||
{
|
||||
final IChildrenUpdate update = updatesEntirelyMissingFromCache.elementAt(i);
|
||||
updates[i] = new VMElementsUpdate(update, update.getOffset(), update.getLength(),
|
||||
updates[i] =
|
||||
new VMElementsUpdate(
|
||||
update, update.getOffset(), update.getLength(),
|
||||
new DataRequestMonitor<List<Object>>(fExecutor, null)
|
||||
{
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue