org.apache.xerces.util
Class XMLGrammarPoolImpl
java.lang.Object
org.apache.xerces.util.XMLGrammarPoolImpl
- org.apache.xerces.xni.grammars.XMLGrammarPool
public class XMLGrammarPoolImpl
extends java.lang.Object
implements org.apache.xerces.xni.grammars.XMLGrammarPool
Stores grammars in a pool associated to a specific key. This grammar pool
implementation stores two types of grammars: those keyed by the root element
name, and those keyed by the grammar's target namespace.
This is the default implementation of the GrammarPool interface.
As we move forward, this will become more function-rich and robust.
$Id: XMLGrammarPoolImpl.java,v 1.8 2004/03/25 04:03:22 mrglavas Exp $- Jeffrey Rodriguez, IBM
- Andy Clark, IBM
- Neil Graham, IBM
- Pavani Mukthipudi, Sun Microsystems
- Neeraj Bajaj, SUN Microsystems
void | cacheGrammars(String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)
|
void | clear()
|
boolean | containsGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc) - Returns true if the grammar pool contains a grammar associated
to the specified grammar description.
|
boolean | equals(org.apache.xerces.xni.grammars.XMLGrammarDescription desc1, org.apache.xerces.xni.grammars.XMLGrammarDescription desc2) - This method checks whether two grammars are the same.
|
org.apache.xerces.xni.grammars.Grammar | getGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc) - Returns the grammar associated to the specified grammar description.
|
int | hashCode(org.apache.xerces.xni.grammars.XMLGrammarDescription desc) - Returns the hash code value for the given grammar description.
|
void | lockPool()
|
void | putGrammar(org.apache.xerces.xni.grammars.Grammar grammar) - Puts the specified grammar into the grammar pool and associates it to
its root element name or its target namespace.
|
org.apache.xerces.xni.grammars.Grammar | removeGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc) - Removes the grammar associated to the specified grammar description from the
grammar pool and returns the removed grammar.
|
org.apache.xerces.xni.grammars.Grammar | retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
|
org.apache.xerces.xni.grammars.Grammar[] | retrieveInitialGrammarSet(String grammarType)
|
void | unlockPool()
|
TABLE_SIZE
protected static final int TABLE_SIZE
Default size.
fGrammarCount
protected int fGrammarCount
fPoolIsLocked
protected boolean fPoolIsLocked
XMLGrammarPoolImpl
public XMLGrammarPoolImpl()
Constructs a grammar pool with a default number of buckets.
XMLGrammarPoolImpl
public XMLGrammarPoolImpl(int initialCapacity)
Constructs a grammar pool with a specified number of buckets.
cacheGrammars
public void cacheGrammars(String grammarType,
org.apache.xerces.xni.grammars.Grammar[] grammars)
- cacheGrammars in interface org.apache.xerces.xni.grammars.XMLGrammarPool
clear
public void clear()
- clear in interface org.apache.xerces.xni.grammars.XMLGrammarPool
containsGrammar
public boolean containsGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
Returns true if the grammar pool contains a grammar associated
to the specified grammar description. Currently, the root element name
is used as the key for DTD grammars and the target namespace is used
as the key for Schema grammars.
desc
- The Grammar Description.
equals
public boolean equals(org.apache.xerces.xni.grammars.XMLGrammarDescription desc1,
org.apache.xerces.xni.grammars.XMLGrammarDescription desc2)
This method checks whether two grammars are the same. Currently, we compare
the root element names for DTD grammars and the target namespaces for Schema grammars.
The application can override this behaviour and add its own logic.
desc1
- The grammar descriptiondesc2
- The grammar description of the grammar to be compared to
- True if the grammars are equal, otherwise false
getGrammar
public org.apache.xerces.xni.grammars.Grammar getGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
Returns the grammar associated to the specified grammar description.
Currently, the root element name is used as the key for DTD grammars
and the target namespace is used as the key for Schema grammars.
desc
- The Grammar Description.
hashCode
public int hashCode(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
Returns the hash code value for the given grammar description.
desc
- The grammar description
lockPool
public void lockPool()
- lockPool in interface org.apache.xerces.xni.grammars.XMLGrammarPool
putGrammar
public void putGrammar(org.apache.xerces.xni.grammars.Grammar grammar)
Puts the specified grammar into the grammar pool and associates it to
its root element name or its target namespace.
removeGrammar
public org.apache.xerces.xni.grammars.Grammar removeGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
Removes the grammar associated to the specified grammar description from the
grammar pool and returns the removed grammar. Currently, the root element name
is used as the key for DTD grammars and the target namespace is used
as the key for Schema grammars.
desc
- The Grammar Description.
retrieveGrammar
public org.apache.xerces.xni.grammars.Grammar retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
- retrieveGrammar in interface org.apache.xerces.xni.grammars.XMLGrammarPool
retrieveInitialGrammarSet
public org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet(String grammarType)
- retrieveInitialGrammarSet in interface org.apache.xerces.xni.grammars.XMLGrammarPool
unlockPool
public void unlockPool()
- unlockPool in interface org.apache.xerces.xni.grammars.XMLGrammarPool
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.