mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
changes from review
This commit is contained in:
parent
e3aebe3adb
commit
ca58264d65
6 changed files with 41 additions and 277 deletions
|
@ -105,37 +105,6 @@ public class ObjectCache {
|
|||
addToHardCache(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear both hard and weak caches.
|
||||
* The cache should be cleared when all cached objects have become invalid.
|
||||
*/
|
||||
public synchronized void clear() {
|
||||
processQueue();
|
||||
for (KeyedSoftReference<?> ref : hashTable.values()) {
|
||||
ref.clear();
|
||||
}
|
||||
|
||||
hashTable.clear();
|
||||
refQueue = new ReferenceQueue<Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified range of keyed objects from both hard and weak caches.
|
||||
* A cache range should be cleared when the corresponding objects have become invalid.
|
||||
* @param startKey minimum object key value
|
||||
* @param endKey maximum object key value
|
||||
*/
|
||||
public synchronized void remove(long startKey, long endKey) {
|
||||
if ((endKey >> 1) - (startKey >> 1) < (hashTable.size() >> 1)) {
|
||||
for (long i = startKey; i <= endKey; i++) {
|
||||
remove(i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
hashTable.keySet().removeIf(key -> (key >= startKey && key <= endKey));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified keyed object from both hard and weak caches.
|
||||
* An object should be removed from the cache when it becomes invalid.
|
||||
|
|
|
@ -35,7 +35,7 @@ public class StringAttribute<T extends KeyedObject> extends Attribute<T> {
|
|||
*/
|
||||
public StringAttribute(String name, KeyIndexableSet<T> set) {
|
||||
super(name, set);
|
||||
this.values = new HashMap<>(set.capacity());// String[set.capacity()];
|
||||
this.values = new HashMap<>();
|
||||
}
|
||||
|
||||
/** Set the value of this attribute for the specified KeyedObject.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue