KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > dom > LCount


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.xerces.dom;
17
18
19 /** Internal class LCount is used to track the number of
20     listeners registered for a given event name, as an entry
21     in a global hashtable. This should allow us to avoid generating,
22     or discard, events for which no listeners are registered.
23     
24     ***** There should undoubtedly be methods here to manipulate
25     this table. At the moment that code's residing in NodeImpl.
26     Move it when we have a chance to do so. Sorry; we were
27     rushed.
28     
29     ???? CONCERN: Hashtables are known to be "overserialized" in
30     current versions of Java. That may impact performance.
31     
32     ???? CONCERN: The hashtable should probably be a per-document object.
33     Finer granularity would be even better, but would cost more cycles to
34     resolve and might not save enough event traffic to be worth the investment.
35 */

36 /**
37  * @xerces.internal
38  *
39  * @version $Id: LCount.java,v 1.9 2004/10/21 21:51:05 nddelima Exp $
40  */

41
42 class LCount
43 {
44     static java.util.Hashtable JavaDoc lCounts=new java.util.Hashtable JavaDoc();
45     public int captures=0,bubbles=0,defaults, total=0;
46
47     static LCount lookup(String JavaDoc evtName)
48     {
49         LCount lc=(LCount)lCounts.get(evtName);
50         if(lc==null)
51             lCounts.put(evtName,(lc=new LCount()));
52         return lc;
53     }
54 } // class LCount
55
Popular Tags