You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
859 B

package model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Holds a table object that stores current games
*/
public class MatchTable {
private HashMap<TableKey, List> matchTable;
public MatchTable() {
this.matchTable = new HashMap<TableKey, List>();
}
public void addEntry(ArrayList newEntry) {
//create a key from the ip and port
TableKey entryKey = new TableKey((String) newEntry.get(0), (Integer) newEntry.get(1));
//get the rest of the entry and use it as the value
List entryItems = new ArrayList();
for(int i = 2; i<newEntry.size(); i++) {
entryItems.add(newEntry.get(i));
}
this.matchTable.put(entryKey, entryItems);
}
public HashMap<TableKey, List> getMatchTable() {
return matchTable;
}
}