KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > util > CCache


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Smart Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.util;
15
16 import java.util.*;
17
18 /**
19  * Compiere Cache
20  *
21  * @author Jorg Janke
22  * @version $Id: CCache.java,v 1.2 2003/08/08 16:15:28 jjanke Exp $
23  */

24 public class CCache extends HashMap implements CacheInterface
25 {
26     /**
27      * Compiere Cache
28      * @param name name of the cache
29      * @param initialCapacity initial capacity
30      */

31     public CCache (String JavaDoc name, int initialCapacity)
32     {
33         super(initialCapacity);
34         m_name = name;
35         CacheMgt.get().register(this);
36     } // CCache
37

38     /** Name */
39     private String JavaDoc m_name = null;
40
41     /**
42      * Reset Cache
43      * @return number of items cleared
44      */

45     public int reset()
46     {
47         int no = size();
48         clear();
49         return no;
50     } // reset
51

52     /**
53      * String Representation
54      * @return info
55      */

56     public String JavaDoc toString()
57     {
58         return "CCache[" + m_name + "-#" + size() + "}";
59     }
60
61 } // CCache
62
Popular Tags