KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > cache > LFUConfigImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.object.cache;
6
7 import com.tc.properties.TCProperties;
8 import com.tc.util.Assert;
9
10 public class LFUConfigImpl implements LFUConfig {
11
12   private final float agingFactor;
13   private final int ignorePercentage;
14   private final boolean debug;
15
16   public LFUConfigImpl(TCProperties lfuProperties) {
17     agingFactor = lfuProperties.getFloat("agingFactor");
18     Assert.assertTrue("Invalid agingFactor in properties file", agingFactor >= 0.0 && agingFactor <= 1.0);
19     ignorePercentage = lfuProperties.getInt("recentlyAccessedIgnorePercentage");
20     Assert.assertTrue("Invalid recentlyAccessedIgnorePercentage in properties file", ignorePercentage >= 0
21                                                                                      && ignorePercentage <= 100);
22     debug = lfuProperties.getBoolean("debug.enabled");
23   }
24
25   public float getAgingFactor() {
26     return agingFactor;
27   }
28
29   public int getRecentlyAccessedIgnorePercentage() {
30     return ignorePercentage;
31   }
32
33   public boolean isDebugEnabled() {
34     return debug;
35   }
36
37 }
38
Popular Tags