private void BTNCreateTable_Click(object sender, EventArgs e) { //Table Name is Present if (TXTTableNameInput.Text != "") { randomTable insert; if (tableLL.getFirst() == null) //TableLL is empty { insert = new randomTable(0); } else { insert = new randomTable(tableLL.getLast().getID() + 1); } insert.setTitle(TXTTableNameInput.Text); tableLL.addTable(insert); TableListBox.Items.Add(TXTTableNameInput.Text); populateTablesDropdown(); TableListBox.SelectedIndex = tableLL.getNumOfTables() - 1; TXTTableNameInput.Clear(); } //Table Name Missing - Error else { MessageBox.Show("Please Enter a Name for Your Table First!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void deSerializeDataStructures(serializationWrapper wrapper) { //Loads objects into dateLL for (int x = 0; x < wrapper.dateHolder.Count; x++) { dateLL.addEntry(wrapper.dateHolder[x]); } //Loads objects into characterLL for (int x = 0; x < wrapper.charStatHolder.Count; x++) { characterLL.addEntry(wrapper.charStatHolder[x]); } //Loads objects into tableLL for (int tableCycle = 0; tableCycle < wrapper.tableHolder.Count; tableCycle++) { tableSerialization insertFrom = wrapper.tableHolder[tableCycle]; randomTable insertTable = new randomTable(insertFrom.tableID); insertTable.setTitle(insertFrom.title); for (int entriesCycle = 0; entriesCycle < insertFrom.entriesList.Count; entriesCycle++) { tableEntry insertEntry = new tableEntry(insertFrom.entriesList[entriesCycle], insertFrom.weightsList[entriesCycle]); insertTable.addEntry(insertEntry); } tableLL.addTable(insertTable); } }
/* public int getLastID() { return lastID; }*/ //Add table to tableIndex linked list. Must increment tableID in event public Boolean addTable(randomTable newTable) { tableIndex.AddLast(newTable); //lastID++; return true; }
//Retrieve table with specified ID from index public randomTable retrieveTable(int targetID) { /* if (activeTable.getID() == targetID) { return activeTable; }*/ LinkedListNode<randomTable> current = tableIndex.First; while (current != null) { if (current.Value.getID() == targetID) { activeTable = current.Value; break; } current = current.Next; } return activeTable; }
public randomTable getNext() { activeTable = retrieveTable(activeTable.getID()); return activeTable; }
public randomTable getLast() { activeTable = tableIndex.Last.Value; return activeTable; }
public randomTable getFirst() { if (tableIndex.Count() == 0) { return null; } else { activeTable = tableIndex.First.Value; return activeTable; } }