/// <summary> /// Returns the entry of the symbol table 'table' /// </summary> /// <param name="table"> which symbol table </param> /// <returns> the entry of the symbol table 'table' </returns> public virtual int?getEntry(TrieSymbolTable table) { if (table != null) { if (table.Equals(cachedKeyEntry)) { return(cachedValueEntry); } else if (entries != null) { return(entries[table]); } } return(null); }
/// <summary> /// Adds an entry if it does not exist /// </summary> /// <param name="table"> which symbol table to add an entry </param> /// <param name="code"> the integer representation of the string value </param> /// <exception cref="SymbolException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void addEntry(TrieSymbolTable table, int code) throws org.maltparser.core.symbol.SymbolException private void addEntry(TrieSymbolTable table, int code) { if (table == null) { throw new SymbolException("Symbol table cannot be found. "); } if (cachedValueEntry == null) { if (code != -1) { cachedValueEntry = code; table.updateValueCounter(code); } else { cachedValueEntry = table.increaseValueCounter(); } cachedKeyEntry = table; } else if (!table.Equals(cachedKeyEntry)) { if (entries == null) { entries = new HashMap <TrieSymbolTable, int>(); } if (!entries.ContainsKey(table)) { if (code != -1) { entries[table] = code; table.updateValueCounter(code); } else { entries[table] = table.increaseValueCounter(); } } } }