Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 54563 invoked from network); 17 Feb 2002 02:48:37 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 17 Feb 2002 02:48:37 -0000 Received: (qmail 7188 invoked by uid 97); 17 Feb 2002 02:48:40 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 7131 invoked by uid 97); 17 Feb 2002 02:48:40 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 26801 invoked by uid 97); 16 Feb 2002 23:21:30 -0000 Date: 16 Feb 2002 23:21:21 -0000 Message-ID: <20020216232121.89308.qmail@icarus.apache.org> From: asmuts@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru LRUStoreImp.java LRUStore.java LRUElementImp.java LRUElement.java ILRUElement.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N asmuts 02/02/16 15:21:21 Modified: util/src/java/org/apache/commons/util/lru LRUStoreImp.java LRUStore.java LRUElementImp.java LRUElement.java ILRUElement.java Log: specialized LRUElement in sample implementation Revision Changes Path 1.2 +18 -0 jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUStoreImp.java Index: LRUStoreImp.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUStoreImp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LRUStoreImp.java 16 Feb 2002 23:12:34 -0000 1.1 +++ LRUStoreImp.java 16 Feb 2002 23:21:21 -0000 1.2 @@ -55,6 +55,8 @@ * . */ +import java.io.Serializable; + /** * Example implementation of LRUStore. Overrides the waterfall method. * @@ -83,6 +85,22 @@ { super( max ); } + + + /** + * Overridden put method. I can control teh wrapper. Created a special + * wrapper that records the creation time. + * Can get wrapper out from get( key, true );. + * + *@param key The key + *@param val The value + */ + public void put( Serializable key, Serializable val ) + { + ILRUElement le = new LRUElementImp( key, val ); + update( le ); + } + /** * Description of the Method 1.2 +8 -10 jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUStore.java Index: LRUStore.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LRUStore.java 16 Feb 2002 23:12:34 -0000 1.1 +++ LRUStore.java 16 Feb 2002 23:21:21 -0000 1.2 @@ -15,12 +15,12 @@ ///////////////////////////////////////////////////// /** - * Example LRU program with O(1) performance degredation. Partial removal - * has O(N) performance. A fast reference management system. The least recently + * Example LRU program with O(1) performance degredation. Partial removal has + * O(N) performance. A fast reference management system. The least recently * used items move to the end of the list and get waterfalled. Pulled from JCS - * project. Based on several generic algorithm book examples. Will change - * into a map interface later. The LRUMemoryCache in JCS will eventually be - * a wrapper around this. + * project. Based on several generic algorithm book examples. Will change into + * a map interface later. The LRUMemoryCache in JCS will eventually be a + * wrapper around this. * *@author asmuts *@created January 31, 2002 @@ -160,20 +160,18 @@ } // end update - // TODO: Implement or modify interface, just implement - // may need insert if we want to distinguish b/wn put and replace /** - * Description of the Method + * Should override to create your own wrapper class. You can get the + * wrapper out if you want. * *@param key Description of the Parameter *@param val Description of the Parameter */ public void put( Serializable key, Serializable val ) { - LRUElement le = new LRUElement( key, val ); + ILRUElement le = new LRUElement( key, val ); update( le ); } - /** * Gets an item from the cache. 1.2 +4 -4 jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUElementImp.java Index: LRUElementImp.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUElementImp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LRUElementImp.java 16 Feb 2002 23:20:32 -0000 1.1 +++ LRUElementImp.java 16 Feb 2002 23:21:21 -0000 1.2 @@ -34,8 +34,8 @@ /** * Constructor for the LRUElement object * - *@param key Description of the Parameter - *@param val Description of the Parameter + *@param key Description of the Parameter + *@param val Description of the Parameter */ public LRUElementImp( Serializable key, Serializable val ) { @@ -50,8 +50,8 @@ /** * Constructor for the LRUElement object * - *@param key Description of the Parameter - *@param val Description of the Parameter + *@param key Description of the Parameter + *@param val Description of the Parameter */ public LRUElementImp( Serializable key, Object val ) { 1.2 +6 -20 jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUElement.java Index: LRUElement.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/LRUElement.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LRUElement.java 16 Feb 2002 23:12:34 -0000 1.1 +++ LRUElement.java 16 Feb 2002 23:21:21 -0000 1.2 @@ -23,25 +23,21 @@ * Description of the Field */ public final Serializable val; - /** - * Description of the Field - */ - public final long createTime; + ////////////////////////////////////////////////////////////////// /** * Constructor for the LRUElement object * - *@param key Description of the Parameter - *@param val Description of the Parameter + *@param key Description of the Parameter + *@param val Description of the Parameter */ public LRUElement( Serializable key, Serializable val ) { this.key = key; this.val = val; - // may want to disable this. - createTime = System.currentTimeMillis(); + } @@ -49,8 +45,8 @@ /** * Constructor for the LRUElement object * - *@param key Description of the Parameter - *@param val Description of the Parameter + *@param key Description of the Parameter + *@param val Description of the Parameter */ public LRUElement( Serializable key, Object val ) { @@ -82,16 +78,6 @@ } - ////////////////////////////////////// - /** - * Gets the createTime attribute of the LRUElement object - * - *@return The createTime value - */ - public long getCreateTime() - { - return this.createTime; - } /////////////////////////////////////////////////////////// /** 1.2 +2 -10 jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/ILRUElement.java Index: ILRUElement.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/util/src/java/org/apache/commons/util/lru/ILRUElement.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ILRUElement.java 16 Feb 2002 23:12:34 -0000 1.1 +++ ILRUElement.java 16 Feb 2002 23:21:21 -0000 1.2 @@ -3,9 +3,8 @@ import java.io.Serializable; /** - * Allows the element to be overriden and customized. - * - * Pulled from JCS project for ease of use. + * Allows the element to be overriden and customized. Pulled from JCS project + * for ease of use. * *@author asmuts *@created January 15, 2002 @@ -27,12 +26,5 @@ */ public Serializable getVal(); - - /** - * Gets the createTime attribute of the ILRUElement object - * - *@return The createTime value - */ - public long getCreateTime(); } -- To unsubscribe, e-mail: For additional commands, e-mail: