private void dgvTable_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewCell cell = (sender as DataGridView)[e.ColumnIndex, e.RowIndex];

            switch (e.ColumnIndex)
            {
            case (int)ColumnsName.Place: checkPlace(cell); break;

            case (int)ColumnsName.Token: checkToken(cell); break;

            case (int)ColumnsName.Pre_Transition: checkPreTransition(cell); break;

            case (int)ColumnsName.Pre_Weight: checkPreWeight(cell); break;

            case (int)ColumnsName.Post_Transition: checkPostTransition(cell); break;

            case (int)ColumnsName.Post_Weight: checkPostTransition(cell); break;

            default: break;
            }


            if (getDgvTableValue(e.RowIndex, (int)ColumnsName.Place) != -1 &&
                getDgvTableValue(e.RowIndex, (int)ColumnsName.Token) != -1)
            {
                ROWDATA rowData = getDgvTableRowData(e.RowIndex);

                if (m_PlaceTable.ContainsKey(rowData.placeName))
                {
                    if (rowData.preTransition.Key != 0 && rowData.preTransition.Value != 0)
                    {
                        if (m_PlaceTable[rowData.placeName].PreTransitions.ContainsKey(rowData.preTransition.Key))
                        {
                            m_PlaceTable[rowData.placeName].PreTransitions[rowData.preTransition.Key] = Convert.ToInt32(rowData.preTransition.Value);
                        }
                        else
                        {
                            m_PlaceTable[rowData.placeName].PreTransitions.Add(rowData.preTransition.Key, Convert.ToInt32(rowData.preTransition.Value));
                        }
                    }

                    if (rowData.postTransition.Key != 0 && rowData.postTransition.Value != 0)
                    {
                        if (m_PlaceTable[rowData.placeName].PostTransitions.ContainsKey(rowData.postTransition.Key))
                        {
                            m_PlaceTable[rowData.placeName].PostTransitions[rowData.postTransition.Key] = Convert.ToInt32(rowData.postTransition.Value);
                        }
                        else
                        {
                            m_PlaceTable[rowData.placeName].PostTransitions.Add(rowData.postTransition.Key, Convert.ToInt32(rowData.postTransition.Value));
                        }
                    }
                }
                else
                {
                    m_PlaceTable.Add(rowData.placeName, new Place(rowData.placeName, rowData.initialTokenNum,
                                                                  rowData.preTransition, rowData.postTransition));
                }
            }
        }
        private void removeDataFromTable(int rowIndex)
        {
            ROWDATA rowData = getDgvTableRowData(rowIndex);

            if (m_PlaceTable.ContainsKey(rowData.placeName))
            {
                if (m_PlaceTable[rowData.placeName].PreTransitions.ContainsKey(rowData.preTransition.Key))
                {
                    m_PlaceTable[rowData.placeName].PreTransitions.Remove(rowData.preTransition.Key);
                }
                if (m_PlaceTable[rowData.placeName].PostTransitions.ContainsKey(rowData.postTransition.Key))
                {
                    m_PlaceTable[rowData.placeName].PostTransitions.Remove(rowData.postTransition.Key);
                }

                if (m_PlaceTable[rowData.placeName].PreTransitions.Count == 0 &&
                    m_PlaceTable[rowData.placeName].PostTransitions.Count == 0)
                {
                    m_PlaceTable.Remove(rowData.placeName);
                }
            }
        }