001    package org.maltparser.parser.transition;
002    
003    import java.util.HashMap;
004    
005    import org.maltparser.core.exception.MaltChainedException;
006    import org.maltparser.core.symbol.Table;
007    import org.maltparser.core.symbol.TableHandler;
008    /**
009    *
010    * @author Johan Hall
011    * @since 1.1
012    **/
013    public class TransitionTableHandler implements TableHandler{
014            private final HashMap<String, TransitionTable> transitionTables;
015    
016            public TransitionTableHandler() {
017                    transitionTables = new HashMap<String, TransitionTable>();
018            }
019            
020            public Table addSymbolTable(String tableName) throws MaltChainedException {
021                    TransitionTable table = transitionTables.get(tableName);
022                    if (table == null) {
023                            table = new TransitionTable(tableName);
024                            transitionTables.put(tableName, table);
025                    }
026                    return table;
027            }
028    
029            public Table getSymbolTable(String tableName) throws MaltChainedException {
030                    return transitionTables.get(tableName);
031            }
032    }