/** * Used to lookup the children of conjunctive and referring features while writing the lexicon, * this method checks {@link #lexiconChildren} if the feature isn't present in {@link #lexicon} * and {@link #lexiconInv}, and will throw an exception if it still can't be found. * * @param f The feature to look up. * @return If the feature was found in {@link #lexicon}, its associated integer index is * returned. Otherwise, <code>-i - 1</code> is returned, where <code>i</code> is the * index associated with the feature in {@link #lexiconChildren}. * @throws UnsupportedOperationException If the feature isn't found anywhere in the lexicon. **/ public int lookupChild(Feature f) { lazyMapCreation(); Integer I = (Integer) lexicon.get(f); if (I != null) return I.intValue(); if (lexiconChildren == null) throw new UnsupportedOperationException( "When calling Lexicon.lookupChild(Feature), the feature must be " + "present in the lexicon."); return -lexiconChildren.lookupChild(f) - 1; }