public void putGrammar(Grammar grammar){
  if (!fPoolIsLocked) {
synchronized (fGrammars) {
      XMLGrammarDescription desc=grammar.getGrammarDescription();
      int hash=hashCode(desc);
      int index=(hash & 0x7FFFFFFF) % fGrammars.length;
      for (Entry entry=fGrammars[index]; entry != null; entry=entry.next) {
        if (entry.hash == hash && equals(entry.desc,desc)) {
          entry.grammar=grammar;
          return;
        }
      }
      Entry entry=new Entry(hash,desc,grammar,fGrammars[index]);
      fGrammars[index]=entry;
      fGrammarCount++;
    }
  }
}

public void putGrammar ( Grammar grammar ) { if ( ! fPoolIsLocked ) { synchronized ( fGrammars ) { XMLGrammarDescription desc = grammar . getGrammarDescription ( ) ; int hash = hashCode ( desc ) ; int index = ( hash & 0x7FFFFFFF ) % fGrammars . length ; for ( Entry entry = fGrammars [ index ] ; entry != null ; entry = entry . next ) { if ( entry . hash == hash && equals ( entry . desc , desc ) ) { entry . grammar = grammar ; return ; } } Entry entry = new Entry ( hash , desc , grammar , fGrammars [ index ] ) ; fGrammars [ index ] = entry ; fGrammarCount ++ ; } } }
puts the specified grammar into the grammar pool and associates it to its root element name or its target namespace .
