|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectScenario
public class Scenario
Contains the information of an MMS file. This is the main object of manipulation for the GUIs.
Field Summary | |
---|---|
private java.lang.String |
m_boardHeight
|
private java.lang.String |
m_boardWidth
|
(package private) int |
M_CANCEL
|
private java.lang.String |
m_desc
|
private java.lang.String |
m_error
|
private java.lang.String |
m_factions
|
private java.util.Vector<Faction> |
m_factionVector
|
private java.lang.String |
m_fName
Attributes |
private boolean |
m_isNew
|
private java.lang.String |
m_mapHeight
|
private java.lang.String |
m_maps
|
private java.lang.String |
m_mapWidth
|
(package private) int |
M_MAX_FILE_CHARS
|
private java.lang.String |
m_name
|
(package private) int |
M_NO
Constants |
private java.lang.String |
m_version
|
(package private) int |
M_YES
|
Constructor Summary | |
---|---|
Scenario()
Default constructor |
|
Scenario(java.lang.String fName,
boolean isNew)
Constructor with filename (or scenario name, if new) and new indicator |
Method Summary | |
---|---|
void |
addFaction(Faction newFaction)
Add the given faction to the faction vector |
void |
buildFactionListDisplay(javax.swing.JList factionList,
java.lang.String factionFilter)
Builds a list of Faction information in the given list |
void |
buildFactionNameComboBox(javax.swing.JComboBox cbNames,
boolean addAllText,
boolean clearCombo)
Builds a combo box of Faction names; sets selected to first item |
void |
buildFactionVector(java.lang.String factionList)
Build the faction vector of Faction objects given the list of factions |
java.lang.String |
getAttribute(java.lang.String attrib)
Returns the desired attribute |
java.lang.String |
getAttributeValue(java.lang.String attrib)
returns the desired attribute value (i.e. |
java.lang.String |
getError()
|
Faction |
getFactionByName(java.lang.String lName)
Returns the Faction given the exact name |
Faction |
getFactionByProperty(java.lang.String lProp)
Returns the Faction given a full property string |
java.lang.String |
getFileName()
|
private void |
initAttributes(boolean isNew)
Called from the constructors and initializes all the attributes |
void |
removeFaction(Faction delFaction)
Removes the given faction from the faction vector |
void |
replaceFaction(Faction oldFaction,
Faction newFaction)
Replace an existing faction with a new faction |
boolean |
save()
Saves the scenario to disk. |
void |
setAsNew()
Set Scenario as a new scenario, while maintaining most attributes |
void |
setAttribute(java.lang.String attrib,
java.lang.String val)
Set the desired attribute |
void |
setAttributeFromParam(java.lang.String mmsParam,
java.lang.String mmsLine)
Given the parameter name and the string for the parameter, set the correct attribute |
int |
setAttributesFromFile()
Called after object is constructed to set (or re-set) the attributes from the file |
void |
setFactionAttribute(java.lang.String mmsParam,
java.lang.String mmsLine)
Given the parameter name and the string for the parameter, set the correct Faction attribute |
void |
setFileName(java.lang.String fName)
Set Scenario filename |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final int M_NO
final int M_YES
final int M_CANCEL
final int M_MAX_FILE_CHARS
private java.lang.String m_fName
private boolean m_isNew
private java.lang.String m_error
private java.lang.String m_version
private java.lang.String m_name
private java.lang.String m_desc
private java.lang.String m_boardWidth
private java.lang.String m_boardHeight
private java.lang.String m_mapWidth
private java.lang.String m_mapHeight
private java.lang.String m_maps
private java.lang.String m_factions
private java.util.Vector<Faction> m_factionVector
Constructor Detail |
---|
public Scenario()
public Scenario(java.lang.String fName, boolean isNew)
fName
- Filename (full path) if isNew = false; scenario name if isNew = trueisNew
- False if scenario exists on disk; true if new scenarioMethod Detail |
---|
private void initAttributes(boolean isNew)
isNew
- True if new scenario (not on harddisk); false if file existspublic int setAttributesFromFile()
public void setAttributeFromParam(java.lang.String mmsParam, java.lang.String mmsLine)
mmsParam
- Parameter that the line is for (e.g. BoardWidth)mmsLine
- The line for the attribute (e.g. BoardWidth=1)public void buildFactionVector(java.lang.String factionList)
factionList
- List of factions (e.g. Factions=Rangers,Scouts)public void setFactionAttribute(java.lang.String mmsParam, java.lang.String mmsLine)
mmsParam
- Parameter that the line is for (e.g. Unit_Rangers_1)mmsLine
- The line for the attribute (e.g. Unit_Rangers_1=Stone Rhino SERO,Capt Black,3,3)public java.lang.String getAttribute(java.lang.String attrib)
attrib
- Attribute parameter name
public void setAttribute(java.lang.String attrib, java.lang.String val)
attrib
- Attribute parameter name (e.g. Version)val
- Attribute value (e.g. 1)public java.lang.String getAttributeValue(java.lang.String attrib)
attrib
- Attribute parameter name
public void buildFactionListDisplay(javax.swing.JList factionList, java.lang.String factionFilter)
factionList
- List object to hold Faction informationfactionFilter
- Name by which to filter; blank or "All" will add allpublic void buildFactionNameComboBox(javax.swing.JComboBox cbNames, boolean addAllText, boolean clearCombo)
cbNames
- Combo to be builtaddAllText
- True will add text "All" to beginning of listclearCombo
- True will clear list, firstpublic Faction getFactionByName(java.lang.String lName)
public Faction getFactionByProperty(java.lang.String lProp)
public void replaceFaction(Faction oldFaction, Faction newFaction)
oldFaction
- Old Faction to be replacednewFaction
- New Faction to take the old one's placepublic void addFaction(Faction newFaction)
newFaction
- New Faction object to add to the Faction listpublic void removeFaction(Faction delFaction)
delFaction
- Faction object to be deleted from Faction listpublic java.lang.String getFileName()
public void setFileName(java.lang.String fName)
fName
- Filename (full path) for the Scenariopublic java.lang.String getError()
public boolean save()
public void setAsNew()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |