public static Automaton fromFsmTools(String filename) {
        
        Automaton retMe = new Automaton();
        try {
            
            BufferedReader reader = new BufferedReader(new FileReader(filename));
            String line;
            
            Map<String,State> string2State = new HashMap<String,State>();
            State initial = null;
            
            Set<String> acceptStates = new HashSet<String>();
            
            while ((line = reader.readLine()) != null) {
                
                StringTokenizer tokenizer = new StringTokenizer(line);
                if (tokenizer.countTokens() == 3) {
                    String sourceString = tokenizer.nextToken();
                    String destString = tokenizer.nextToken();
                    String transString = tokenizer.nextToken();
                    
                    State sourceState = string2State.get(sourceString);
                    if (sourceState == null) {
                        sourceState = new State();
                        string2State.put(sourceString, sourceState);
                    }
                    
                    State destState = string2State.get(destString);
                    if (destState == null) {
                        destState = new State();
                        string2State.put(destString, destState);
                    }
                    
                    char transChar = Transition.reverseCharString(transString);
                    
                    sourceState.addTransition(new Transition(transChar, destState));
                    
                    if (initial == null) {
                        initial = sourceState;
                        retMe.initial = initial;
                    }
                   
                } else if (tokenizer.countTokens() == 1) {
                    
                    // collect accept states
                    String accept = tokenizer.nextToken();
                    acceptStates.add(accept);
                }
            }
            
            // set accept flag for accept states
            for (String acceptString : acceptStates) {
                State acceptState = string2State.get(acceptString);
                if (acceptState == null) {
                    throw new RuntimeException("SNH");
                }
                acceptState.accept = true;
            }
            
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException();
        }
        
        
        return retMe;
    }