private AutomataTable recursiveTableCreation(AutomataTable table, List <AutomataCell> cellsStack, List <Letter> alphabet)
        {
            if (cellsStack.Count == 0)
            {
                return(table);
            }

            foreach (AutomataCell cell in cellsStack.ToList())
            {
                cellsStack.Remove(cell);

                AutomataRow  row               = new AutomataRow();
                AutomataCell initialCell       = new AutomataCell(null);
                List <State> initialCellStates = new List <State>();

                foreach (State state in cell.statesInCell)
                {
                    initialCellStates.AddRange(getEClosureStates(state, new List <State>()));
                }

                foreach (State state in initialCellStates)
                {
                    initialCell.AddStateToCell(state);
                }

                row.cells.Add(initialCell);

                foreach (Letter letter in alphabet)
                {
                    if (letter.data == '_')
                    {
                        continue;
                    }

                    AutomataCell dataCell = this.createCellForLetter(initialCell, letter);

                    row.cells.Add(dataCell);

                    this.insertCellToStack(table, cellsStack, dataCell, row);
                }

                table.rows.Add(row);

                recursiveTableCreation(table, cellsStack, alphabet);
            }

            return(table);
        }
        private AutomataCell createCellForLetter(AutomataCell initialCell, Letter letter)
        {
            AutomataCell dataCell       = new AutomataCell(letter);
            List <State> possibleStates = new List <State>();

            this.instantiatePossibleStates(initialCell, letter, possibleStates);

            possibleStates = possibleStates.Distinct().OrderBy(_ => _.data).ToList();

            List <State> statesWithEClosures = new List <State>();

            foreach (State state1 in possibleStates)
            {
                statesWithEClosures.AddRange(getEClosureStates(state1, new List <State>()));
            }

            foreach (State state1 in statesWithEClosures)
            {
                dataCell.AddStateToCell(state1);
            }

            return(dataCell);
        }