/*
* @(#)GameInfo.java 2010-10-17
*
* Version information
*
* Copyright notice
*/
package cn.edu.nju.software.configure;
import java.util.ArrayList;
import java.util.TreeMap;
/**
* The basic Information of Game:
* Name,id,installPath, iconPath, actionList.
*
* @version 2010-10-17
* @version 2010-10-17 add attribute installPath
* @author Jinru Hua
*/
public class GameInfo {
private String name;
private int id;
private String installPath;
private String iconPath;
private String classify;
private ArrayList<GameActionInfo> actionList;
private static TreeMap<String, Integer> actionKeyMap;
public static TreeMap<String, Integer> getActionKeyMap() {
return actionKeyMap;
}
public static void setActionKeyMap(TreeMap<String, Integer> actionKeyMap) {
GameInfo.actionKeyMap = actionKeyMap;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public GameInfo() {
id= 0;
name="";
installPath="";
iconPath = "";
actionList = new ArrayList<GameActionInfo>();
}
public GameInfo(int id) {
this();
setId(id);
}
public String getInstallPath() {
return installPath;
}
public void setInstallPath(String installPath) {
this.installPath = installPath;
}
public String getIconPath() {
return iconPath;
}
public void setIconPath(String iconPath) {
this.iconPath = iconPath;
}
//name
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
//id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
//action
public ArrayList<GameActionInfo> getActionList() {
return actionList;
}
public void addAction(GameActionInfo action) {
removeAction(action.getId());
actionList.add(action);
}
public void removeAction(int id) {
for(int i=0;i<actionList.size();i++) {
if(actionList.get(i).getId()==id) {
actionList.remove(i);
}
}
}
public GameActionInfo getAction(int id) {
for(int i=0;i<actionList.size();i++) {
if(actionList.get(i).getId()==id) {
return actionList.get(i);
}
}
return null;
}
}
|