mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-02 02:55:28 -04:00
TMS-XXX: Code style.
This commit is contained in:
parent
a2effd7ba0
commit
33ffc14e3f
@ -1089,13 +1089,13 @@ public class HTTPCache {
|
||||
|
||||
// TODO: Extract and make public?
|
||||
final static class SizedLRUMap<K, V> extends LRUHashMap<K, V> {
|
||||
int mSize;
|
||||
int mMaxSize;
|
||||
int currentSize;
|
||||
int maxSize;
|
||||
|
||||
public SizedLRUMap(int pMaxSize) {
|
||||
//super(true);
|
||||
super(); // Note: super.mMaxSize doesn't count...
|
||||
mMaxSize = pMaxSize;
|
||||
super(); // Note: super.maxSize doesn't count...
|
||||
maxSize = pMaxSize;
|
||||
}
|
||||
|
||||
|
||||
@ -1113,11 +1113,11 @@ public class HTTPCache {
|
||||
|
||||
@Override
|
||||
public V put(K pKey, V pValue) {
|
||||
mSize += sizeOf(pValue);
|
||||
currentSize += sizeOf(pValue);
|
||||
|
||||
V old = super.put(pKey, pValue);
|
||||
if (old != null) {
|
||||
mSize -= sizeOf(old);
|
||||
currentSize -= sizeOf(old);
|
||||
}
|
||||
return old;
|
||||
}
|
||||
@ -1126,14 +1126,14 @@ public class HTTPCache {
|
||||
public V remove(Object pKey) {
|
||||
V old = super.remove(pKey);
|
||||
if (old != null) {
|
||||
mSize -= sizeOf(old);
|
||||
currentSize -= sizeOf(old);
|
||||
}
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<K, V> pEldest) {
|
||||
if (mMaxSize <= mSize) { // NOTE: mMaxSize here is mem size
|
||||
if (maxSize <= currentSize) { // NOTE: maxSize here is mem size
|
||||
removeLRU();
|
||||
}
|
||||
return false;
|
||||
@ -1141,7 +1141,7 @@ public class HTTPCache {
|
||||
|
||||
@Override
|
||||
public void removeLRU() {
|
||||
while (mMaxSize <= mSize) { // NOTE: mMaxSize here is mem size
|
||||
while (maxSize <= currentSize) { // NOTE: maxSize here is mem size
|
||||
super.removeLRU();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user