Package org.eclipse.lemminx.extensions.contentmodel.participants.diagnostics

## Class LSPXMLGrammarPoolWrapper

- java.lang.Object
- - org.eclipse.lemminx.extensions.contentmodel.participants.diagnostics.LSPXMLGrammarPool
  - - org.eclipse.lemminx.extensions.contentmodel.participants.diagnostics.LSPXMLGrammarPoolWrapper

All Implemented Interfaces:
  `org.apache.xerces.xni.grammars.XMLGrammarPool`

    public class LSPXMLGrammarPoolWrapper
    extends LSPXMLGrammarPool

Xerces grammar pool which tracks all DTD grammars which are cached for an XML validation.

Author:
  Angelo ZERR

### Nested Class Summary

### Nested classes/interfaces inherited from class org.eclipse.lemminx.extensions.contentmodel.participants.diagnostics.LSPXMLGrammarPool

`LSPXMLGrammarPool.Entry`

### Constructor Summary

Constructors
`LSPXMLGrammarPoolWrapper​(LSPXMLGrammarPool delegate)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `cacheGrammars​(String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)`
`void` `clear()` Clear the cached grammar.
`boolean` `equals​(Object obj)`
`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.
`int` `hashCode()`
`int` `hashCode​(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)` Returns the hash code value for the given grammar description.
`void` `lockPool()`
`void` `removeGrammar​(String grammarURI)`
`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)`
`boolean` `setInternalSubset​(org.apache.xerces.impl.dtd.XMLDTDDescription grammarDesc, String internalSubset)` Update the DTD internal subset entry for the given XML DTD description and return true if the cached DTD grammar internal subset is equal to the given internal subset and false otherwise.
`String` `toString()`
`void` `unlockPool()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### LSPXMLGrammarPoolWrapper

    public LSPXMLGrammarPoolWrapper​(LSPXMLGrammarPool delegate)

### Method Detail

#### retrieveInitialGrammarSet

    public org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet​(String grammarType)

Specified by:
  `retrieveInitialGrammarSet` in interface `org.apache.xerces.xni.grammars.XMLGrammarPool`
Overrides:
  `retrieveInitialGrammarSet` in class `LSPXMLGrammarPool`

#### cacheGrammars

    public void cacheGrammars​(String grammarType,
                              org.apache.xerces.xni.grammars.Grammar[] grammars)

Specified by:
  `cacheGrammars` in interface `org.apache.xerces.xni.grammars.XMLGrammarPool`
Overrides:
  `cacheGrammars` in class `LSPXMLGrammarPool`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### retrieveGrammar

    public org.apache.xerces.xni.grammars.Grammar retrieveGrammar​(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)

Specified by:
  `retrieveGrammar` in interface `org.apache.xerces.xni.grammars.XMLGrammarPool`
Overrides:
  `retrieveGrammar` in class `LSPXMLGrammarPool`

#### removeGrammar

    public org.apache.xerces.xni.grammars.Grammar removeGrammar​(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)

Description copied from class: `LSPXMLGrammarPool`
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.

Overrides:
  `removeGrammar` in class `LSPXMLGrammarPool`
Parameters:
  `desc` - The Grammar Description.
Returns:
  The removed grammar.

#### equals

    public boolean equals​(Object obj)

Overrides:
  `equals` in class `Object`

#### removeGrammar

    public void removeGrammar​(String grammarURI)

Overrides:
  `removeGrammar` in class `LSPXMLGrammarPool`

#### lockPool

    public void lockPool()

Specified by:
  `lockPool` in interface `org.apache.xerces.xni.grammars.XMLGrammarPool`
Overrides:
  `lockPool` in class `LSPXMLGrammarPool`

#### unlockPool

    public void unlockPool()

Specified by:
  `unlockPool` in interface `org.apache.xerces.xni.grammars.XMLGrammarPool`
Overrides:
  `unlockPool` in class `LSPXMLGrammarPool`

#### clear

    public void clear()

Clear the cached grammar.

Specified by:
  `clear` in interface `org.apache.xerces.xni.grammars.XMLGrammarPool`
Overrides:
  `clear` in class `LSPXMLGrammarPool`

#### equals

    public boolean equals​(org.apache.xerces.xni.grammars.XMLGrammarDescription desc1,
                          org.apache.xerces.xni.grammars.XMLGrammarDescription desc2)

Description copied from class: `LSPXMLGrammarPool`
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.

Overrides:
  `equals` in class `LSPXMLGrammarPool`
Parameters:
  `desc1` - The grammar description
  `desc2` - The grammar description of the grammar to be compared to
Returns:
  True if the grammars are equal, otherwise false

#### hashCode

    public int hashCode​(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)

Description copied from class: `LSPXMLGrammarPool`
Returns the hash code value for the given grammar description.

Overrides:
  `hashCode` in class `LSPXMLGrammarPool`
Parameters:
  `desc` - The grammar description
Returns:
  The hash code value

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### setInternalSubset

    public boolean setInternalSubset​(org.apache.xerces.impl.dtd.XMLDTDDescription grammarDesc,
                                     String internalSubset)

Description copied from class: `LSPXMLGrammarPool`
Update the DTD internal subset entry for the given XML DTD description and return true if the cached DTD grammar internal subset is equal to the given internal subset and false otherwise.

Overrides:
  `setInternalSubset` in class `LSPXMLGrammarPool`
Parameters:
  `grammarDesc` - the XML DTD description.
  `internalSubset` - the internal subset.
Returns:
  true if the cached DTD grammar internal subset is equal to the given internal subset and false otherwise.