New code style. No functional changes.

This commit is contained in:
Harald Kuhr
2011-02-21 17:34:15 +01:00
parent c60f80aacb
commit ba4ff3dc45
23 changed files with 426 additions and 429 deletions
@@ -49,8 +49,8 @@ import java.util.Map;
*/
public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
private int mMaxSize = 1000;
private float mTrimFactor = 0.01f;
private int maxSize = 1000;
private float trimFactor = 0.01f;
/**
* Creates an LRUMap with default max size (1000 entries).
@@ -124,7 +124,7 @@ public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
* @return the size limit
*/
public int getMaxSize() {
return mMaxSize;
return maxSize;
}
/**
@@ -142,9 +142,9 @@ public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
throw new IllegalArgumentException("max size must be positive");
}
mMaxSize = pMaxSize;
maxSize = pMaxSize;
while(size() > mMaxSize) {
while(size() > maxSize) {
removeLRU();
}
}
@@ -159,7 +159,7 @@ public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
* @return the current trim factor
*/
public float getTrimFactor() {
return mTrimFactor;
return trimFactor;
}
/**
@@ -179,7 +179,7 @@ public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
throw new IllegalArgumentException("trim factor must be between 0 and 1");
}
mTrimFactor = pTrimFactor;
trimFactor = pTrimFactor;
}
/**
@@ -189,7 +189,7 @@ public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
protected boolean removeEldestEntry(Entry pEldest) {
// NOTE: As removeLRU() may remove more than one entry, this is better
// than simply removing the eldest entry.
if (size() >= mMaxSize) {
if (size() >= maxSize) {
removeLRU();
}
return false;
@@ -221,9 +221,9 @@ public class LRUMap<K, V> extends LinkedMap<K, V> implements ExpiringMap<K, V> {
* @see #getTrimFactor()
*/
public void removeLRU() {
int removeCount = (int) Math.max((size() * mTrimFactor), 1);
int removeCount = (int) Math.max((size() * trimFactor), 1);
while ((removeCount--) > 0) {
removeEntry(mHead.mNext);
removeEntry(head.mNext);
}
}
}