TMS-XXX: Code style.

This commit is contained in:
Harald Kuhr 2013-06-05 10:56:12 +02:00
parent a2effd7ba0
commit 33ffc14e3f

View File

@ -1089,13 +1089,13 @@ public class HTTPCache {
// TODO: Extract and make public? // TODO: Extract and make public?
final static class SizedLRUMap<K, V> extends LRUHashMap<K, V> { final static class SizedLRUMap<K, V> extends LRUHashMap<K, V> {
int mSize; int currentSize;
int mMaxSize; int maxSize;
public SizedLRUMap(int pMaxSize) { public SizedLRUMap(int pMaxSize) {
//super(true); //super(true);
super(); // Note: super.mMaxSize doesn't count... super(); // Note: super.maxSize doesn't count...
mMaxSize = pMaxSize; maxSize = pMaxSize;
} }
@ -1113,11 +1113,11 @@ public class HTTPCache {
@Override @Override
public V put(K pKey, V pValue) { public V put(K pKey, V pValue) {
mSize += sizeOf(pValue); currentSize += sizeOf(pValue);
V old = super.put(pKey, pValue); V old = super.put(pKey, pValue);
if (old != null) { if (old != null) {
mSize -= sizeOf(old); currentSize -= sizeOf(old);
} }
return old; return old;
} }
@ -1126,14 +1126,14 @@ public class HTTPCache {
public V remove(Object pKey) { public V remove(Object pKey) {
V old = super.remove(pKey); V old = super.remove(pKey);
if (old != null) { if (old != null) {
mSize -= sizeOf(old); currentSize -= sizeOf(old);
} }
return old; return old;
} }
@Override @Override
protected boolean removeEldestEntry(Map.Entry<K, V> pEldest) { 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(); removeLRU();
} }
return false; return false;
@ -1141,7 +1141,7 @@ public class HTTPCache {
@Override @Override
public void removeLRU() { public void removeLRU() {
while (mMaxSize <= mSize) { // NOTE: mMaxSize here is mem size while (maxSize <= currentSize) { // NOTE: maxSize here is mem size
super.removeLRU(); super.removeLRU();
} }
} }