SORTIE Java Interface
1
|
Represents a single behavior in the core. More...
Classes | |
enum | setupType |
How this behavior's setup interface is handled. More... | |
Public Member Functions | |
GUIManager | getGUIManager () |
Behavior (GUIManager oManager, BehaviorTypeBase oParent, String sDescriptor, String sParFileTag, String sXMLRootString, String sHelpFileString) | |
Constructor. More... | |
abstract void | validateData (TreePopulation oPop) throws ModelException |
Override this to implement data checking. More... | |
void | callSetupDialog (JDialog jParent, MainWindow oMain) |
Override this to call a specific setup dialog for this behavior. More... | |
int | getNumberOfDataObjects () |
Gets the number of managed data objects. More... | |
ModelData | getDataObject (int iInd) |
Gets the managed data object at a particular index. More... | |
void | validate () throws ModelException |
Behavior performs an internal check to make sure its settings are consistent and logical. More... | |
void | setListPosition (int iListPosition) throws ModelException |
Sets the behavior list position. More... | |
int | getListPosition () |
Gets the behavior list position. More... | |
String | getXMLParametersRoot () |
Gets the XML parameter root string. More... | |
int | getNumberNewDataMembers () |
DataMember | getNewTreeDataMember (int iIndex) throws ModelException |
void | setCanApplyTo (int iType, boolean bCanApply) |
Sets whether this behavior can apply to a given tree type. More... | |
String | getParameterFileBehaviorName () |
Gets the parameter file name for this behavior. More... | |
double | getVersion () |
Gets behavior's parameter file version. More... | |
double | getMinimumVersion () |
Gets behavior's parameter file minimum version. More... | |
String | getDescriptor () |
Gets the descriptor string. More... | |
String | getHelpFileString () |
Gets the help file UD. More... | |
void | setDescriptor (String s) |
Sets the descriptor string. More... | |
int | getNumberOfCombos () |
Gets the number of species/type combos to which this behavior applies. More... | |
int | getNumberOfGrids () |
Gets the number of grids to which this behavior applies. More... | |
void | deleteSpeciesTypeCombo (int iIndex) throws ModelException |
Deletes the SpeciesTypeCombo at the given index. More... | |
void | deleteSpeciesTypeCombo (SpeciesTypeCombo oCombo) throws ModelException |
Deletes a SpeciesTypeCombo. More... | |
void | clearSpeciesTypeCombos () |
Empties the species/type combo list. More... | |
SpeciesTypeCombo | getSpeciesTypeCombo (int iIndex) throws ModelException |
Returns the SpeciesTypeCombo at the given index of the species/type combo list. More... | |
Grid | getGrid (int iIndex) throws ModelException |
Returns the Grid at the given index of the grid applies to list. More... | |
ModelData | getRequiredData (int iIndex) |
Returns the required data object at a given index. More... | |
int | getNumberOfRequiredDataObjects () |
Gets the number of required data objects for this behavior. More... | |
void | addSpeciesTypeCombo (SpeciesTypeCombo oCombo) throws ModelException |
Adds a new species/type combo to the list to which this behavior applies. More... | |
void | addGrid (Grid oGrid, boolean bReplace) |
Adds a new Grid to the list to which this behavior applies. More... | |
void | addRequiredData (ModelData oData) |
Adds a piece of required data to the list. More... | |
boolean [] | getWhichSpeciesUsed (TreePopulation oPop) |
Returns which species to which this behavior is applied. More... | |
boolean | setVectorValueByXMLTag (String sXMLTag, String sXMLParentTag, ArrayList< String > p_oData, String[] p_sChildXMLTags, boolean[] p_bAppliesTo, Attributes oParentAttributes, Attributes[] p_oAttributes) throws ModelException |
Sets a data vector's value. More... | |
boolean | setSingleValueByXMLTag (String sXMLTag, String sXMLParentTag, Attributes oAttributes, Object oData) throws ModelException |
Sets a data object's value. More... | |
ModelData | findObjectByXMLTag (String sXMLTag) |
Finds an object based on its XML tag. More... | |
void | copySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException |
Copies one species to another. More... | |
void | writeXML (BufferedWriter jOut, TreePopulation oPop) throws ModelException |
Writes the XML data to a parameter file for the behaviors owned by this object. More... | |
void | writeSpeciesSpecificValue (BufferedWriter jOut, ModelVector p_oData, TreePopulation oPop) throws java.io.IOException, ModelException |
Writes a set of species-specific float values to a parameter file. More... | |
void | writeSpeciesSpecificValue (BufferedWriter jOut, ModelVector p_oData, TreePopulation oPop, boolean[] p_bFlags) throws java.io.IOException, ModelException |
Writes a set of species-specific values to a parameter file for a certain subset of species. More... | |
void | readXMLParentTag (String sXMLTag, Attributes oAttributes) throws ModelException |
Accepts an XML parent tag (empty, no data) from the parser. More... | |
void | changeOfSpeciesName (String sOldSpecies, String sNewSpecies) |
Performs any necessary tasks associated with changing the name of a species. More... | |
void | changeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Triggered when there is a change in the species list. More... | |
boolean | getMustHaveTrees () |
Gets whether this behavior must have trees. More... | |
ModelData | findObjectByDescriptor (String sDescriptor) |
Finds an object based on its descriptor. More... | |
void | writeBehaviorNode (BufferedWriter out, TreePopulation oPop) throws ModelException |
Writes behavior tags to the parameter file. More... | |
ArrayList< BehaviorParameterDisplay > | formatDataForDisplay (TreePopulation oPop) |
Formats data for display in a set of JTables. More... | |
String | getAppliedToForDisplay (TreePopulation oPop) |
Get which species/types this behavior applies to, in a display-friendly format truncated to 250 chars. More... | |
void | readDataFromDisplay (ArrayList< BehaviorParameterDisplay > oData, TreePopulation oPop) throws ModelException |
Reads in data from the parameter display window. More... | |
boolean | canBeDuplicated () |
Whether or not this behavior can be duplicated in the run. More... | |
void | endOfParameterFileRead () |
Called at the end of the parameter file read process. More... | |
void | changeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException |
Performs any tasks associated with a change of plot resolution. More... | |
setupType | getSetupType () |
void | writeParametersToTextFile (FileWriter jOut, TreePopulation oPop) throws IOException |
Writes the parameters for the behavior to file, using the same system as the basic parameter display and entry system. More... | |
Static Public Member Functions | |
static void | setVectorValues (ModelVector oData, Float[] p_fValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, Float[] p_fValuesToSet) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, Double[] p_fValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, Double[] p_fValuesToSet) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, Integer[] p_iValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, String[] p_sValuesToSet) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, String[] p_sValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector oData, Integer[] p_iValuesToSet) |
Sets the values for vector variables. More... | |
static void | setVectorValues (ModelVector p_oData, ArrayList< String > p_oValuesToSet, boolean[] p_bAppliesTo) throws ModelException |
Sets the values for vector variables. More... | |
static void | writeDataToFile (BufferedWriter ojOut, ModelData oData) throws java.io. IOException |
Writes a piece of data to an XML file. More... | |
static Object [] | formatBlankHeaderRow (Object[][] p_oTable) |
Creates a blank header row for a table. More... | |
static Object [][] | formatDataAsComboBox (Object[][] p_oExisting, ModelEnum oToFormat) |
Adds a value with combo box formatting to an Object array for display in a JTable. More... | |
static String | formatComboBoxString (ModelEnum oToFormat) |
Formats a combo box string from a ModelEnum. More... | |
static void | addDataObjectToDisplayArrays (ModelData p_oDataObject, ArrayList< ModelData > p_oSingles, ArrayList< ArrayList< SpeciesSpecific >> p_oSpeciesSpecific, boolean[] p_bAppliesTo) |
Adds a data object to the arrays which will eventually display run parameters in a set of tables. More... | |
static Object [][] | addDataToArray (Object[][] p_oExistingArray, Object[] p_oAddArray) |
Adds an Object array to an existing Object array. More... | |
static Object [][] | formatDataForTable (Object[][] p_oExisting, ModelFloat oToFormat) |
Formats and adds a value into an Object array suitable for placing in a JTable. More... | |
static Object [][] | formatDataForTable (Object[][] p_oExisting, ModelInt oToFormat) |
Formats and adds a value into an Object array suitable for placing in a JTable. More... | |
static Object [][] | formatDataForTable (Object[][] p_oExisting, ModelString oToFormat) |
Formats and adds a value into an Object array suitable for placing in a JTable. More... | |
static Object [][] | formatDataForTable (Object[][] p_oExisting, ModelVector oToFormat) |
Formats a vector of values into an object array and adds it to another Object array suitable for placing in a JTable. More... | |
static Object [][] | formatDataForTable (Object[][] p_oExisting, ModelVector oToFormat, boolean[] p_bWhichSpecies) |
Formats a vector of values into a plain vector suitable for placing in a JTable and adds it to a vector of vectors at the end. More... | |
static Object [] | formatSpeciesHeaderRow (boolean[] p_bUsed, TreePopulation oPop) |
Creates an object array of strings consisting of species names, suitable for including in the parameter entry table. More... | |
static void | ensureSize (ArrayList<?> list, int size) |
Ensure an ArrayList is at least a specific size. More... | |
Public Attributes | |
boolean | m_bMustHaveTrees = true |
If true, and a tree has no species/type combos, it automatically becomes disabled. More... | |
Protected Member Functions | |
void | setSingleValue (ModelData oDataMember, Object oData) throws ModelException |
Sets the value of a single data member. More... | |
BehaviorParameterDisplay | formatTable (ArrayList< ModelData > p_oSingles, ArrayList< ArrayList< SpeciesSpecific >> p_oSpeciesSpecific, TreePopulation oPop) |
Turns vector groups of data objects into a set of tables for display. More... | |
Static Protected Member Functions | |
static boolean | boolArraysEqual (boolean[] p_bArrayOne, boolean[] p_bArrayTwo) |
Tests two boolean arrays for equality. More... | |
Protected Attributes | |
GUIManager | m_oManager |
GUIManager object. More... | |
BehaviorTypeBase | m_oParent |
Parent manager. More... | |
ArrayList< ModelData > | mp_oAllData = new ArrayList<ModelData>() |
All data for this object. More... | |
ArrayList< SpeciesTypeCombo > | mp_oTreesAppliesTo = new ArrayList<SpeciesTypeCombo>(0) |
A set of SpeciesTypeCombo objects to which this behavior is applied - or none if it is not applied to trees. More... | |
ArrayList< Integer > | mp_iGridsAppliesTo = new ArrayList<Integer>(0) |
A set of hashcodes of the Grids to which this behavior is applied - or none if it is not applied to grids. More... | |
ArrayList< DataMember > | mp_oNewTreeDataMembers = new ArrayList<DataMember>(0) |
The new tree data members that this behavior adds, above and beyond the basic tree population data members. More... | |
boolean | m_bCanBeDuplicated = true |
Whether or not this behavior can have multiple copies in a run or not. More... | |
String | m_sDescriptor = "" |
This is what will be displayed as the name of a given behavior in the GUI. More... | |
String | m_sParFileTag = "" |
String which is used to identify this behavior in the parameter file. More... | |
String | m_sXMLRootString = "" |
XML tag to surround this behavior's data. More... | |
String | m_sHelpFileString = "" |
Help file topic identifier string. More... | |
boolean [] | mp_bCanApplyToTreeType |
For each tree type, whether or not this behavior can be applied to it. More... | |
double | m_fVersion = 1.0 |
Version of this behavior. More... | |
double | m_fMinVersion = 1.0 |
Minimum version of this behavior. More... | |
int | m_iListPosition = -1 |
This behavior's position in the behavior list. More... | |
setupType | m_iBehaviorSetupType |
Represents a single behavior in the core.
There is a one-to-one relationship between behaviors in the core model and objects of this class.
Behaviors can count on the tree population information being available when they are instantiated.
Copyright: Copyright (c) 2011 Company: Cary Institute of Ecosystem Studies
Edit history:
---------------—
December 8, 2011: Wiped the slate clean for version 7 (LEM)
sortie.data.funcgroups.Behavior.Behavior | ( | GUIManager | oManager, |
BehaviorTypeBase | oParent, | ||
String | sDescriptor, | ||
String | sParFileTag, | ||
String | sXMLRootString, | ||
String | sHelpFileString | ||
) |
Constructor.
oManager | GUI manager. |
oParent | Parent managing object. |
sDescriptor | The name of the behavior for the user. |
sParFileTag | String which is used to identify this behavior in the parameter file. |
sXMLRootString | XML tag to surround this behavior's data. |
sHelpFileString | String matching this behavior's topic in the help |
|
static |
Adds a data object to the arrays which will eventually display run parameters in a set of tables.
There are two possible vectors to which to add the data object - one grouping single values, and other grouping groups of species-specific values according to the species they require.
When a new data object is to be added to the list, the first thing to do is see if it's already there. If it is, and it's not species-specific, it's not added again. If it is species-specific, the species to which it applies are merged with the existing list and it is re-grouped if necessary.
p_oDataObject | Data object to add |
p_oSingles | Set of single values |
p_oSpeciesSpecific | Set of species-specific values |
p_bAppliesTo | If this is a species-specific value, what it applies to |
|
static |
Adds an Object array to an existing Object array.
The new array is added at the end. If the existing array is null, it will be created.
p_oExistingArray | Object array to add to. |
p_oAddArray | Array to add. |
void sortie.data.funcgroups.Behavior.addGrid | ( | Grid | oGrid, |
boolean | bReplace | ||
) |
Adds a new Grid to the list to which this behavior applies.
If this exact grid object is already added, nothing is done. Calling this method does NOT automatically cause the behavior to become enabled, because grids are more of an inherent property of behaviors. For this reason, a Behavior should always be notified of its Grids whether or not it is enabled.
oGrid | Grid to add. |
bReplace | If true, this grid replaces any existing grids with this name. If false, if it has the same name as another grid object, the first grid is used and this grid is dropped. |
void sortie.data.funcgroups.Behavior.addRequiredData | ( | ModelData | oData | ) |
Adds a piece of required data to the list.
oData | Data to add. |
void sortie.data.funcgroups.Behavior.addSpeciesTypeCombo | ( | SpeciesTypeCombo | oCombo | ) | throws ModelException |
Adds a new species/type combo to the list to which this behavior applies.
If this particular species/type combo is already on the list, it's not added again. Calling this causes this behavior to become enabled.
oCombo | The new species/type combo. |
ModelException | if the tree type in the combo cannot be applied to this behavior according to mp_bCanApplyToTreeType. |
|
staticprotected |
Tests two boolean arrays for equality.
Equality is defined as having the same value in each array bucket.
p_bArrayOne | First array. |
p_bArrayTwo | Second array. |
void sortie.data.funcgroups.Behavior.callSetupDialog | ( | JDialog | jParent, |
MainWindow | oMain | ||
) |
Override this to call a specific setup dialog for this behavior.
Otherwise the default is called.
boolean sortie.data.funcgroups.Behavior.canBeDuplicated | ( | ) |
Whether or not this behavior can be duplicated in the run.
void sortie.data.funcgroups.Behavior.changeOfPlotResolution | ( | float | fOldX, |
float | fOldY, | ||
float | fNewX, | ||
float | fNewY | ||
) | throws ModelException |
Performs any tasks associated with a change of plot resolution.
fOldX | float Old plot X length. |
fOldY | float Old plot Y length. |
fNewX | float New plot X length. |
fNewY | float New plot Y length. |
ModelException | if anything goes wrong. |
void sortie.data.funcgroups.Behavior.changeOfSpecies | ( | int | iOldNumSpecies, |
int [] | p_iIndexer, | ||
String [] | p_sNewSpecies | ||
) | throws ModelException |
Triggered when there is a change in the species list.
This goes through everything in the mp_oAllData array. Any piece of data of type ModelVector which is species-specific is transformed. The ModelVector will be re-sized to match the new number of species. Any species that are the same from the old set to the new have their data transferred to their new array index. Any new species indexes are set to null. Any species which were deleted have their data lost.
iOldNumSpecies | says how many species there used to be. |
p_iIndexer | is an array, sized to the new number of species. For each bucket (representing the index number of a species on the new list), the value is either the index of that same species in the old species list, or -1 if the species is new. |
p_sNewSpecies | The new species list. |
ModelException | if there's a problem. |
void sortie.data.funcgroups.Behavior.changeOfSpeciesName | ( | String | sOldSpecies, |
String | sNewSpecies | ||
) |
Performs any necessary tasks associated with changing the name of a species.
Everything about the species remains the same except for the name. This is an easier process than actually changing the species list.
sOldSpecies | String Old name of the species, with underscores instead of spaces (like the species names would come from the tree population) |
sNewSpecies | String New name of the species, with underscores instead of spaces (like the species names would come from the tree population) |
ModelException | if there is a problem. |
void sortie.data.funcgroups.Behavior.clearSpeciesTypeCombos | ( | ) |
Empties the species/type combo list.
void sortie.data.funcgroups.Behavior.copySpecies | ( | int | iSpeciesCopyFrom, |
int | iSpeciesCopyTo | ||
) | throws ModelException |
Copies one species to another.
This makes sure all species-specific vectors are updated and that behavior assignments are the same.
iSpeciesCopyFrom | int Species to copy. |
iSpeciesCopyTo | int Species that is the copy. |
ModelException | if there is a problem. |
void sortie.data.funcgroups.Behavior.deleteSpeciesTypeCombo | ( | int | iIndex | ) | throws ModelException |
Deletes the SpeciesTypeCombo at the given index.
If this removes the last combo, and the behavior has its m_bMustHaveTrees flag set to true, this sets m_bIsEnabled to false.
iIndex | The index number of the SpeciesTypeCombo. |
ModelException | if the index number is invalid. |
void sortie.data.funcgroups.Behavior.deleteSpeciesTypeCombo | ( | SpeciesTypeCombo | oCombo | ) | throws ModelException |
Deletes a SpeciesTypeCombo.
This is a safe way to do it - if the combo doesn't exist, this quietly exits.
oCombo | The SpeciesTypeCombo object to delete. |
ModelException | if the index number is invalid. |
void sortie.data.funcgroups.Behavior.endOfParameterFileRead | ( | ) |
Called at the end of the parameter file read process.
Override this to do anything at that point.
|
static |
Ensure an ArrayList is at least a specific size.
list | |
size |
ModelData sortie.data.funcgroups.Behavior.findObjectByDescriptor | ( | String | sDescriptor | ) |
Finds an object based on its descriptor.
sDescriptor | Descriptor for the object. |
ModelData sortie.data.funcgroups.Behavior.findObjectByXMLTag | ( | String | sXMLTag | ) |
Finds an object based on its XML tag.
sXMLTag | XML tag for the object. |
|
static |
Creates a blank header row for a table.
It will be sized the same size as the size of the array in the first array position.
p_oTable | The table for which to create the blank header row. |
|
static |
Formats a combo box string from a ModelEnum.
The formatting consists of some special characters in a text string that our parameter display code will recognize as setup for a combo box.
oToFormat | ModelEnum to format. |
|
static |
Adds a value with combo box formatting to an Object array for display in a JTable.
The formatting consists of some special characters in a text string that our parameter display code will recognize as setup for a combo box.
p_oExisting | Object array to add to. |
oToFormat | Value to add. |
ArrayList<BehaviorParameterDisplay> sortie.data.funcgroups.Behavior.formatDataForDisplay | ( | TreePopulation | oPop | ) |
Formats data for display in a set of JTables.
Each element in the ArrrayList of BehaviorParameterDisplay returned is one table to display. Each single table vector's first element is an Object array with the header row for the table, and the second element is an Object[][] with the table's data. Data labels should be placed in the first array bucket.
Once the sorted lists are in place, they are transformed to the table format and returned.
One BehaviorParameterDisplay object is the default, but more than one can be returned if desired. They will appear like separate behavior displays.
oPop | TreePopulation object. |
|
static |
Formats and adds a value into an Object array suitable for placing in a JTable.
The new array is formed by taking the descriptor and putting it into the first position, and then putting the value in the next position.
p_oExisting | The existing Object array to add to. |
oToFormat | The object to format. |
|
static |
Formats and adds a value into an Object array suitable for placing in a JTable.
The new array is formed by taking the descriptor and putting it into the first position, and then putting the value in the next position.
p_oExisting | The existing Object array to add to. |
oToFormat | The object to format. |
|
static |
Formats and adds a value into an Object array suitable for placing in a JTable.
The new array is formed by taking the descriptor and putting it into the first position, and then putting the value in the next position.
p_oExisting | The existing Object array to add to. |
oToFormat | The object to format. |
|
static |
Formats a vector of values into an object array and adds it to another Object array suitable for placing in a JTable.
The descriptor is placed in the first bucket of the new vector and all subsequent values in order after that.
p_oExisting | The existing Object array to add to. |
oToFormat | The object to format. |
|
static |
Formats a vector of values into a plain vector suitable for placing in a JTable and adds it to a vector of vectors at the end.
No headers are created. The descriptor is placed in the first bucket of the new vector and all subsequent values in order after that.
p_oExisting | The existing Object array to add to. |
oToFormat | The object to format. |
p_bWhichSpecies | Boolean of whether or not each species should be added. If false for a species, the value at that Vector index is not added. |
|
static |
Creates an object array of strings consisting of species names, suitable for including in the parameter entry table.
The species will be in order, skipping over any positions in p_bUsed which are false. The first position in the array is blank.
p_bUsed | Array of which species to include, in species number order. |
oPop | TreePopulation object. |
|
protected |
Turns vector groups of data objects into a set of tables for display.
p_oSingles | Single values. |
p_oSpeciesSpecific | Vector of vectors of species-specific values grouped together by what species they apply to. |
oPop | TreePopulation object. |
String sortie.data.funcgroups.Behavior.getAppliedToForDisplay | ( | TreePopulation | oPop | ) |
Get which species/types this behavior applies to, in a display-friendly format truncated to 250 chars.
oPop | Tree population. |
ModelData sortie.data.funcgroups.Behavior.getDataObject | ( | int | iInd | ) |
Gets the managed data object at a particular index.
iInd | The index of the desired managed data object. |
String sortie.data.funcgroups.Behavior.getDescriptor | ( | ) |
Gets the descriptor string.
Grid sortie.data.funcgroups.Behavior.getGrid | ( | int | iIndex | ) | throws ModelException |
GUIManager sortie.data.funcgroups.Behavior.getGUIManager | ( | ) |
String sortie.data.funcgroups.Behavior.getHelpFileString | ( | ) |
Gets the help file UD.
int sortie.data.funcgroups.Behavior.getListPosition | ( | ) |
Gets the behavior list position.
double sortie.data.funcgroups.Behavior.getMinimumVersion | ( | ) |
Gets behavior's parameter file minimum version.
boolean sortie.data.funcgroups.Behavior.getMustHaveTrees | ( | ) |
Gets whether this behavior must have trees.
DataMember sortie.data.funcgroups.Behavior.getNewTreeDataMember | ( | int | iIndex | ) | throws ModelException |
int sortie.data.funcgroups.Behavior.getNumberNewDataMembers | ( | ) |
int sortie.data.funcgroups.Behavior.getNumberOfCombos | ( | ) |
Gets the number of species/type combos to which this behavior applies.
int sortie.data.funcgroups.Behavior.getNumberOfDataObjects | ( | ) |
Gets the number of managed data objects.
int sortie.data.funcgroups.Behavior.getNumberOfGrids | ( | ) |
Gets the number of grids to which this behavior applies.
int sortie.data.funcgroups.Behavior.getNumberOfRequiredDataObjects | ( | ) |
Gets the number of required data objects for this behavior.
String sortie.data.funcgroups.Behavior.getParameterFileBehaviorName | ( | ) |
Gets the parameter file name for this behavior.
ModelData sortie.data.funcgroups.Behavior.getRequiredData | ( | int | iIndex | ) |
Returns the required data object at a given index.
iIndex | Index. |
setupType sortie.data.funcgroups.Behavior.getSetupType | ( | ) |
SpeciesTypeCombo sortie.data.funcgroups.Behavior.getSpeciesTypeCombo | ( | int | iIndex | ) | throws ModelException |
Returns the SpeciesTypeCombo at the given index of the species/type combo list.
iIndex | Index of combo desired. |
ModelException | if the index is not valid. |
double sortie.data.funcgroups.Behavior.getVersion | ( | ) |
Gets behavior's parameter file version.
boolean [] sortie.data.funcgroups.Behavior.getWhichSpeciesUsed | ( | TreePopulation | oPop | ) |
Returns which species to which this behavior is applied.
If multiple tree types are applied, a species is considered applied to if any, not all, of the types goes with that species.
oPop | Tree population. |
String sortie.data.funcgroups.Behavior.getXMLParametersRoot | ( | ) |
Gets the XML parameter root string.
void sortie.data.funcgroups.Behavior.readDataFromDisplay | ( | ArrayList< BehaviorParameterDisplay > | oData, |
TreePopulation | oPop | ||
) | throws ModelException |
Reads in data from the parameter display window.
The format of the incoming data is the same as that which originally went out to be displayed in a table.
oData | Data to read in. |
oPop | TreePopulation object. |
ModelException | if the data cannot be read into the object. |
void sortie.data.funcgroups.Behavior.readXMLParentTag | ( | String | sXMLTag, |
Attributes | oAttributes | ||
) | throws ModelException |
Accepts an XML parent tag (empty, no data) from the parser.
Normally this data would be ignored, but this can be overridden if there is special XML to be captured.
sXMLTag | The XML tag. |
oAttributes | The attributes of this object. |
ModelException | if there is a problem reading this data. |
void sortie.data.funcgroups.Behavior.setCanApplyTo | ( | int | iType, |
boolean | bCanApply | ||
) |
Sets whether this behavior can apply to a given tree type.
iType | Tree type. |
bCanApply | True if this can be applied to a tree type; false if not. |
void sortie.data.funcgroups.Behavior.setDescriptor | ( | String | s | ) |
Sets the descriptor string.
s | New descriptor string. |
void sortie.data.funcgroups.Behavior.setListPosition | ( | int | iListPosition | ) | throws ModelException |
Sets the behavior list position.
iListPosition | List position. |
|
protected |
Sets the value of a single data member.
The value to set is cast to the proper type.
oDataMember | Data member to set. |
oData | Data value to set into data member. |
ModelException | if data is of the wrong type. |
boolean sortie.data.funcgroups.Behavior.setSingleValueByXMLTag | ( | String | sXMLTag, |
String | sXMLParentTag, | ||
Attributes | oAttributes, | ||
Object | oData | ||
) | throws ModelException |
Sets a data object's value.
Override this to add functionality.
sXMLTag | XML tag of data object whose value is to be set. |
sXMLParentTag | The immediate parent tag that sXMLTag is within. |
oAttributes | Attributes of the object. Ignored, but may be needed by overriding objects. |
oData | Data value, either a String or a type appropriate to the data type |
ModelException | if the value could not be assigned to the data object. |
boolean sortie.data.funcgroups.Behavior.setVectorValueByXMLTag | ( | String | sXMLTag, |
String | sXMLParentTag, | ||
ArrayList< String > | p_oData, | ||
String [] | p_sChildXMLTags, | ||
boolean [] | p_bAppliesTo, | ||
Attributes | oParentAttributes, | ||
Attributes [] | p_oAttributes | ||
) | throws ModelException |
Sets a data vector's value.
Override this to add functionality.
sXMLTag | Parent XML tag of data vector whose value is to be set. |
sXMLParentTag | The immediate parent tag that sXMLTag is within. |
p_oData | Vector of data values appropriate to the data type |
p_sChildXMLTags | The XML tags of the child elements |
p_bAppliesTo | Array of booleans saying which of the vector values should be set. This is important in the case of species-specifics - the vector index is the species number but not all species are set. |
oParentAttributes | Attributes of parent tag. May be useful when overridding this for unusual tags. |
p_oAttributes | Attributes passed from parser. This may be needed when overriding this function. Basic species-specific values are already handled by this function. |
ModelException | if the value could not be assigned to the data object. |
|
static |
Sets the values for vector variables.
This method replaces values in the vector with the values passed, in the order in which they are in the array. Only those vector indexes for which p_bApplies = true at that same index are set.
oData | Vector data variable to set. |
p_fValuesToSet | Array of values to put into the vector. |
p_bAppliesTo | Array of flags for which values should be set. |
|
static |
Sets the values for vector variables.
This method replaces values in the vector with the values passed, in the order in which they are in the array.
oData | Vector data variable to set. |
p_fValuesToSet | Array of values to put into the vector. |
|
static |
Sets the values for vector variables.
This method replaces values in the vector with the values passed, in the order in which they are in the array. Only those vector indexes for which p_bApplies = true at that same index are set.
oData | Vector data variable to set. |
p_fValuesToSet | Array of values to put into the vector. |
p_bAppliesTo | Array of flags for which values should be set. |
|
static |
Sets the values for vector variables.
This method replaces values in the vector with the values passed, in the order in which they are in the array.
oData | Vector data variable to set. |
p_fValuesToSet | Array of values to put into the vector. |
|
static |
Sets the values for vector variables.
This method replaces all values in the vector with the values passed, in the order in which they are in the array.
oData | Vector data variable to set. |
p_iValuesToSet | Array of values to put into the vector. |
p_bAppliesTo | Array of flags for which values should be set. |
|
static |
Sets the values for vector variables.
This method replaces values in the vector with the values passed, in the order in which they are in the array.
oData | Vector data variable to set. |
p_sValuesToSet | Array of values to put into the vector. |
|
static |
Sets the values for vector variables.
This method replaces all values in the vector with the values passed, in the order in which they are in the array.
oData | Vector data variable to set. |
p_sValuesToSet | Array of values to put into the vector. |
p_bAppliesTo | Array of flags for which values should be set. |
|
static |
Sets the values for vector variables.
This method replaces all values in the vector with the values passed, in the order in which they are in the array.
oData | Vector data variable to set. |
p_iValuesToSet | Array of values to put into the vector. |
|
static |
Sets the values for vector variables.
The values in the vector which contains the values being assigned are cast to match the data types in the vector to which the values are being assigned. Only those vector indexes for which p_bApplies = true at that same index are set.
p_oData | Vector data variable to set. |
p_oValuesToSet | Vector of values to put into the vector. |
p_bAppliesTo | Array of flags for which values should be set. |
ModelException | if the values cannot be cast to the correct type and assigned. |
void sortie.data.funcgroups.Behavior.validate | ( | ) | throws ModelException |
Behavior performs an internal check to make sure its settings are consistent and logical.
If m_bMustHaveTrees is set to true, it is enabled, and it has no trees, it throws an error.
ModelException | if the above condition is true. |
|
abstract |
Override this to implement data checking.
This will be called after data has been set.
oPop | TreePopulation object. |
ModelException | if data doesn't pass validation. |
void sortie.data.funcgroups.Behavior.writeBehaviorNode | ( | BufferedWriter | out, |
TreePopulation | oPop | ||
) | throws ModelException |
Writes behavior tags to the parameter file.
out | File stream to write to. |
oPop | Tree population object. |
ModelException | if there is a problem writing the file. |
|
static |
Writes a piece of data to an XML file.
If the string value is an empty string, nothing is written. This is static because I needed this particular method to be static. But it's a good idea for other methods as well - maybe I should move all of them to a separate static class? Or move this to ModelData?
ojOut | The file to write to. |
oData | The data being written. |
java.io.IOException | Passes on exceptions from FileWriter |
void sortie.data.funcgroups.Behavior.writeParametersToTextFile | ( | FileWriter | jOut, |
TreePopulation | oPop | ||
) | throws IOException |
Writes the parameters for the behavior to file, using the same system as the basic parameter display and entry system.
Override this if the behavior has specialized parameters.
The file passed has been opened and should be appended to and then left unclosed.
jOut | File to write to. |
oPop | TreePopulation object. |
void sortie.data.funcgroups.Behavior.writeSpeciesSpecificValue | ( | BufferedWriter | jOut, |
ModelVector | p_oData, | ||
TreePopulation | oPop | ||
) | throws java.io.IOException, ModelException |
Writes a set of species-specific float values to a parameter file.
jOut | The file to write to. |
p_oData | The vector of data pieces. |
oPop | Tree population object to get species names |
java.io.IOException | Passes on exceptions from FileWriter |
ModelException | Passes on from TreePopulation |
void sortie.data.funcgroups.Behavior.writeSpeciesSpecificValue | ( | BufferedWriter | jOut, |
ModelVector | p_oData, | ||
TreePopulation | oPop, | ||
boolean [] | p_bFlags | ||
) | throws java.io.IOException, ModelException |
Writes a set of species-specific values to a parameter file for a certain subset of species.
If none of the species are enabled, nothing is written.
jOut | The file to write to. |
p_oData | The vector of data pieces. It should be sized to equal the total number of species, even if it doesn't have values for them all. Each piece of data for a species should be at the element index corresponding to the species number. |
oPop | Tree population object to get species names |
p_bFlags | An array, sized total number of species; for each species number, whether or not to include data for the species in question. |
java.io.IOException | Passes on exceptions from FileWriter |
ModelException | Passes on from TreePopulation |
void sortie.data.funcgroups.Behavior.writeXML | ( | BufferedWriter | jOut, |
TreePopulation | oPop | ||
) | throws ModelException |
Writes the XML data to a parameter file for the behaviors owned by this object.
jOut | File stream to write to. |
oPop | TreePopulation object. |
ModelException | if there is a problem writing the file or validating the data. |
|
protected |
Whether or not this behavior can have multiple copies in a run or not.
boolean sortie.data.funcgroups.Behavior.m_bMustHaveTrees = true |
If true, and a tree has no species/type combos, it automatically becomes disabled.
Otherwise, enablement/disablement must be done explicity.
|
protected |
Minimum version of this behavior.
|
protected |
Version of this behavior.
|
protected |
|
protected |
This behavior's position in the behavior list.
|
protected |
GUIManager object.
|
protected |
Parent manager.
|
protected |
This is what will be displayed as the name of a given behavior in the GUI.
Shouldn't be too long - max 5 words or so
|
protected |
Help file topic identifier string.
|
protected |
String which is used to identify this behavior in the parameter file.
|
protected |
XML tag to surround this behavior's data.
|
protected |
For each tree type, whether or not this behavior can be applied to it.
This defaults to true for seedlings, saplings, adults, and snags, and false for all others.
|
protected |
A set of hashcodes of the Grids to which this behavior is applied - or none if it is not applied to grids.
|
protected |
All data for this object.
It should be placed in the order in which it should be written in XML.
|
protected |
The new tree data members that this behavior adds, above and beyond the basic tree population data members.
This is a vector of DataMember objects.
|
protected |
A set of SpeciesTypeCombo objects to which this behavior is applied - or none if it is not applied to trees.