SORTIE Java Interface
1
|
Corresponds to the clDisturbance class. More...
Public Member Functions | |
Harvest (GUIManager oManager, BehaviorTypeBase oParent, String sDescriptor, String sParFileTag, String sXMLRootString) throws ModelException | |
Constructor. | |
void | validateData (TreePopulation oPop) throws ModelException |
Validates the data prior to writing it. | |
int | getNumberHarvestEvents () |
Gets number of harvest events. | |
HarvestData | getHarvestEvent (int iIndex) |
Gets a particular harvest event. | |
void | clearHarvestEvents () |
Clears harvest events. | |
void | addHarvestEvent (HarvestData oHarvest) |
Adds a harvest event. | |
void | writeXML (BufferedWriter jOut, TreePopulation oPop) throws ModelException |
Writes the harvest data for the parameter file. | |
void | readXMLParentTag (String sXMLTag, Attributes oAttributes) throws ModelException |
Accepts an XML parent tag (empty, no data) from the parser. | |
boolean | setSingleValueByXMLTag (String sXMLTag, String sXMLParentTag, Attributes oAttributes, Object oData) throws ModelException |
This method looks for the following tags: | |
void | changeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Checks episodic disturbance settings upon change of species. | |
boolean | setVectorValueByXMLTag (String sXMLTag, String sXMLParentTag, Vector< String > p_oData, String[] p_sChildXMLTags, boolean[] p_bAppliesTo, org.xml.sax.Attributes oParentAttributes, org.xml.sax.Attributes[] p_oAttributes) throws ModelException |
Reads seedling mortality rate parameters for harvest and episodic mortality. | |
void | copySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException |
Updates parameters when species are copied. | |
void | changeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException |
Removes cells from harvest events that are outside the plot. | |
void | checkForGridCellResolutionChange () throws ModelException |
Checks for a user-triggered harvest grid resolution change. | |
![]() | |
GUIManager | getGUIManager () |
Behavior (GUIManager oManager, BehaviorTypeBase oParent, String sDescriptor, String sParFileTag, String sXMLRootString, String sHelpFileString) | |
Constructor. | |
int | getNumberOfDataObjects () |
Gets the number of managed data objects. | |
ModelData | getDataObject (int iInd) |
Gets the managed data object at a particular index. | |
void | validate () throws ModelException |
Behavior performs an internal check to make sure its settings are consistent and logical. | |
void | setListPosition (int iListPosition) |
Sets the behavior list position. | |
int | getListPosition () |
Gets the behavior list position. | |
String | getXMLParametersRoot () |
Gets the XML parameter root string. | |
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. | |
String | getParameterFileBehaviorName () |
Gets the parameter file name for this behavior. | |
double | getVersion () |
Gets behavior's parameter file version. | |
double | getMinimumVersion () |
Gets behavior's parameter file minimum version. | |
String | getDescriptor () |
Gets the descriptor string. | |
void | setDescriptor (String s) |
Sets the descriptor string. | |
int | getNumberOfCombos () |
Gets the number of species/type combos to which this behavior applies. | |
int | getNumberOfGrids () |
Gets the number of grids to which this behavior applies. | |
void | deleteSpeciesTypeCombo (int iIndex) throws ModelException |
Deletes the SpeciesTypeCombo at the given index. | |
void | clearSpeciesTypeCombos () |
Empties the species/type combo list. | |
SpeciesTypeCombo | getSpeciesTypeCombo (int iIndex) throws ModelException |
Returns the SpeciesTypeCombo at the given index of the species/type combo list. | |
Grid | getGrid (int iIndex) throws ModelException |
Returns the Grid at the given index of the grid applies to list. | |
ModelData | getRequiredData (int iIndex) |
Returns the required data object at a given index. | |
int | getNumberOfRequiredDataObjects () |
Gets the number of required data objects for this behavior. | |
void | addSpeciesTypeCombo (SpeciesTypeCombo oCombo) throws ModelException |
Adds a new species/type combo to the list to which this behavior applies. | |
void | addGrid (Grid oGrid) |
Adds a new Grid to the list to which this behavior applies. | |
void | addRequiredData (ModelData oData) |
Adds a piece of required data to the list. | |
boolean[] | getWhichSpeciesUsed (TreePopulation oPop) |
Returns which species to which this behavior is applied. | |
boolean | setVectorValueByXMLTag (String sXMLTag, String sXMLParentTag, Vector< String > p_oData, String[] p_sChildXMLTags, boolean[] p_bAppliesTo, Attributes oParentAttributes, Attributes[] p_oAttributes) throws ModelException |
Sets a data vector's value. | |
void | setVectorValues (ModelVector oData, Float[] p_fValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, Float[] p_fValuesToSet) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, Double[] p_fValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, Double[] p_fValuesToSet) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, Integer[] p_iValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, String[] p_sValuesToSet) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, String[] p_sValuesToSet, boolean[] p_bAppliesTo) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector oData, Integer[] p_iValuesToSet) |
Sets the values for vector variables. | |
void | setVectorValues (ModelVector p_oData, Vector< String > p_oValuesToSet, boolean[] p_bAppliesTo) throws ModelException |
Sets the values for vector variables. | |
boolean | setSingleValueByXMLTag (String sXMLTag, String sXMLParentTag, Attributes oAttributes, Object oData) throws ModelException |
Sets a data object's value. | |
ModelData | findObjectByXMLTag (String sXMLTag) |
Finds an object based on its XML tag. | |
void | copySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException |
Copies one species to another. | |
void | writeXML (BufferedWriter jOut, TreePopulation oPop) throws ModelException |
Writes the XML data to a parameter file for the behaviors owned by this object. | |
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. | |
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. | |
void | readXMLParentTag (String sXMLTag, Attributes oAttributes) throws ModelException |
Accepts an XML parent tag (empty, no data) from the parser. | |
void | changeOfSpeciesName (String sOldSpecies, String sNewSpecies) |
Performs any necessary tasks associated with changing the name of a species. | |
void | changeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Triggered when there is a change in the species list. | |
boolean | getAutoDisplayParameters () |
Gets whether to auto-display this object's parameters. | |
ModelData | findObjectByDescriptor (String sDescriptor) |
Finds an object based on its descriptor. | |
void | writeBehaviorNode (BufferedWriter out, TreePopulation oPop) throws ModelException |
Writes behavior tags to the parameter file. | |
BehaviorParameterDisplay | formatDataForDisplay (TreePopulation oPop) |
Formats data for display in a set of JTables. | |
void | readDataFromDisplay (Vector< TableData > p_oData, TreePopulation oPop) throws ModelException |
Reads in data from the parameter display window. | |
boolean | canBeDuplicated () |
Whether or not this behavior can be duplicated in the run. | |
boolean | canBeEditedAutomatically () |
Whether or not this behavior can be edited with the automatic parameter retrieval and editing tools. | |
void | endOfParameterFileRead () |
Called at the end of the parameter file read process. | |
void | changeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException |
Performs any tasks associated with a change of plot resolution. | |
Static Public Member Functions | |
static Vector< HarvestData > | addHarvestData (Vector< HarvestData > oList, HarvestData oNewHarvest) throws ModelException |
This adds the data contained in a HarvestData object to a list of harvest data. | |
static Vector< HarvestData > | compactHarvestList (Vector< HarvestData > oList) throws ModelException |
Takes a list of HarvestData objects where each is one single species, and replaces it with a list of HarvestData objects for multiple species for any whose data match. | |
![]() | |
static void | writeDataToFile (BufferedWriter ojOut, ModelData oData) throws java.io. IOException |
Writes a piece of data to an XML file. | |
static Object[] | formatBlankHeaderRow (Object[][] p_oTable) |
Creates a blank header row for a table. | |
static Object[][] | formatDataAsComboBox (Object[][] p_oExisting, ModelEnum oToFormat) |
Adds a value with combo box formatting to an Object array for display in a JTable. | |
static String | formatComboBoxString (ModelEnum oToFormat) |
Formats a combo box string from a ModelEnum. | |
static void | addDataObjectToDisplayArrays (ModelData p_oDataObject, Vector< ModelData > p_oSingles, Vector< Vector< SpeciesSpecific >> p_oSpeciesSpecific, boolean[] p_bAppliesTo) |
Adds a data object to the arrays which will eventually display run parameters in a set of tables. | |
static Object[][] | addDataToArray (Object[][] p_oExistingArray, Object[] p_oAddArray) |
Adds an Object array to an existing Object array. | |
static Object[][] | formatDataForTable (Object[][] p_oExisting, ModelFloat oToFormat) |
Formats and adds a value into an Object array suitable for placing in a JTable. | |
static Object[][] | formatDataForTable (Object[][] p_oExisting, ModelInt oToFormat) |
Formats and adds a value into an Object array suitable for placing in a JTable. | |
static Object[][] | formatDataForTable (Object[][] p_oExisting, ModelString oToFormat) |
Formats and adds a value into an Object array suitable for placing in a JTable. | |
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. | |
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. | |
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. | |
Protected Attributes | |
Vector< HarvestData > | mp_oHarvestCuts = new Vector<HarvestData>(0) |
Our list of harvest cuts, held as HarvestData objects. | |
float | m_iCutRangeLowerBound = -1 |
Placeholder for reading cut ranges from an XML file. | |
float | m_iCutRangeUpperBound = -1 |
Placeholder for reading cut ranges from an XML file. | |
float | m_iCutRangeAmount = -1 |
Placeholder for reading cut ranges from an XML file. | |
String | m_sPriorityName = "" |
Placeholder for reading priorities from an XML file. | |
float | m_fPriorityMin = -1 |
Placeholder for reading priorities from an XML file. | |
float | m_fPriorityMax = -1 |
Placeholder for reading priorities from an XML file. | |
int | m_iPriorityType = -1 |
Placeholder for reading priorities from an XML file. | |
![]() | |
GUIManager | m_oManager |
GUIManager object. | |
BehaviorTypeBase | m_oParent |
Parent manager. | |
Vector< ModelData > | mp_oAllData = new Vector<ModelData>() |
All data for this object. | |
Vector< SpeciesTypeCombo > | mp_oTreesAppliesTo = new Vector<SpeciesTypeCombo>(0) |
A set of SpeciesTypeCombo objects to which this behavior is applied - or none if it is not applied to trees. | |
Vector< String > | mp_oGridsAppliesTo = new Vector<String>(0) |
A set of strings with the name of Grids to which this behavior is applied - or none if it is not applied to grids. | |
Vector< DataMember > | mp_oNewTreeDataMembers = new Vector<DataMember>(0) |
The new tree data members that this behavior adds, above and beyond the basic tree population data members. | |
boolean | m_bCanEditAutomatically = true |
Whether or not this behavior can be edited automatically (true) or must be edited with its own dialog (false) | |
boolean | m_bCanBeDuplicated = true |
Whether or not this behavior can have multiple copies in a run or not. | |
boolean | m_bAutoDisplayParameters = true |
Whether or not to auto-display this object's parameters. | |
String | m_sDescriptor = "" |
This is what will be displayed as the name of a given behavior in the GUI. | |
String | m_sParFileTag = "" |
String which is used to identify this behavior in the parameter file. | |
String | m_sXMLRootString = "" |
XML tag to surround this behavior's data. | |
String | m_sHelpFileString = "" |
Help file topic identifier string. | |
boolean[] | mp_bCanApplyToTreeType |
For each tree type, whether or not this behavior can be applied to it. | |
double | m_fVersion = 1.0 |
Version of this behavior. | |
double | m_fMinVersion = 1.0 |
Minimum version of this behavior. | |
int | m_iListPosition = -1 |
This behavior's position in the behavior list. | |
Private Member Functions | |
void | gridSetup (String[] p_sSpeciesNames) throws ModelException |
Sets up the grid objects. | |
Additional Inherited Members | |
![]() | |
boolean | m_bMustHaveTrees = true |
If true, and a tree has no species/type combos, it automatically becomes disabled. | |
![]() | |
void | setSingleValue (ModelData oDataMember, Object oData) throws ModelException |
Sets the value of a single data member. | |
BehaviorParameterDisplay | formatTable (Vector< ModelData > p_oSingles, Vector< Vector< SpeciesSpecific >> p_oSpeciesSpecific, TreePopulation oPop) |
Turns vector groups of data objects into a set of tables for display. | |
![]() | |
static boolean | boolArraysEqual (boolean[] p_bArrayOne, boolean[] p_bArrayTwo) |
Tests two boolean arrays for equality. | |
Corresponds to the clDisturbance class.
sortie.data.funcgroups.disturbance.Harvest.Harvest | ( | GUIManager | oManager, |
BehaviorTypeBase | oParent, | ||
String | sDescriptor, | ||
String | sParFileTag, | ||
String | sXMLRootString | ||
) | throws ModelException |
Constructor.
oManager | GUIManager object |
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. |
ModelException | Won't throw. |
|
static |
This adds the data contained in a HarvestData object to a list of harvest data.
A HarvestData object is first checked to make sure there are any cut ranges defined; if not, nothing happens. If there is data to be added, it is compared to existing HarvestData objects on the list. If they match except for the grid cell, then the new object's grid cell is added to the existing object and the new object thrown away. If it is truly new data, it is added to the list.
IMPORTANT: It is assumed that the harvest data list is all single-species cuts. This makes this method not very generalized.
oList | The list of HarvestData objects to add to. |
oNewHarvest | The HarvestData object to add. |
ModelException | Passing through underlying exceptions. |
void sortie.data.funcgroups.disturbance.Harvest.addHarvestEvent | ( | HarvestData | oHarvest | ) |
Adds a harvest event.
oHarvest | Harvest event to add. |
void sortie.data.funcgroups.disturbance.Harvest.changeOfPlotResolution | ( | float | fOldX, |
float | fOldY, | ||
float | fNewX, | ||
float | fNewY | ||
) | throws ModelException |
Removes cells from harvest events that are outside the plot.
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.disturbance.Harvest.changeOfSpecies | ( | int | iOldNumSpecies, |
int[] | p_iIndexer, | ||
String[] | p_sNewSpecies | ||
) | throws ModelException |
Checks episodic disturbance settings upon change of species.
This will remove any deleted species.
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 anything goes wrong. Not thrown by this function. |
void sortie.data.funcgroups.disturbance.Harvest.checkForGridCellResolutionChange | ( | ) | throws ModelException |
Checks for a user-triggered harvest grid resolution change.
ModelException | Passed through from called functions. |
void sortie.data.funcgroups.disturbance.Harvest.clearHarvestEvents | ( | ) |
Clears harvest events.
|
static |
Takes a list of HarvestData objects where each is one single species, and replaces it with a list of HarvestData objects for multiple species for any whose data match.
oList | The list to compact. |
ModelException | Passing through underlying exceptions |
void sortie.data.funcgroups.disturbance.Harvest.copySpecies | ( | int | iSpeciesCopyFrom, |
int | iSpeciesCopyTo | ||
) | throws ModelException |
Updates parameters when species are copied.
This updates harvest settings.
iSpeciesCopyFrom | int Species to copy. |
iSpeciesCopyTo | int Species that is the copy. |
ModelException | if there is a problem. |
HarvestData sortie.data.funcgroups.disturbance.Harvest.getHarvestEvent | ( | int | iIndex | ) |
Gets a particular harvest event.
iIndex | Index of desired harvest event. |
int sortie.data.funcgroups.disturbance.Harvest.getNumberHarvestEvents | ( | ) |
Gets number of harvest events.
|
private |
Sets up the grid objects.
p_sSpeciesNames | Array of species names. |
ModelException | passthrough only. |
void sortie.data.funcgroups.disturbance.Harvest.readXMLParentTag | ( | String | sXMLTag, |
Attributes | oAttributes | ||
) | throws ModelException |
Accepts an XML parent tag (empty, no data) from the parser.
This method watches for the following tags:
sXMLTag | The XML tag. |
oAttributes | The attributes of this object. |
ModelException | if there is a problem reading this data. |
boolean sortie.data.funcgroups.disturbance.Harvest.setSingleValueByXMLTag | ( | String | sXMLTag, |
String | sXMLParentTag, | ||
Attributes | oAttributes, | ||
Object | oData | ||
) | throws ModelException |
This method looks for the following tags:
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 appropriate to the data type |
ModelException | if the value could not be assigned to the data object, or if the cut type or cut type amount values are unrecognized. |
boolean sortie.data.funcgroups.disturbance.Harvest.setVectorValueByXMLTag | ( | String | sXMLTag, |
String | sXMLParentTag, | ||
Vector< String > | p_oData, | ||
String[] | p_sChildXMLTags, | ||
boolean[] | p_bAppliesTo, | ||
org.xml.sax.Attributes | oParentAttributes, | ||
org.xml.sax.Attributes[] | p_oAttributes | ||
) | throws ModelException |
Reads seedling mortality rate parameters for harvest and episodic mortality.
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. |
|
virtual |
Validates the data prior to writing it.
This will also double check grid cell size and update disturbance events as appropriate in case cell size has been changed. This causes all HarvestData objects to validate themselves.
oPop | TreePopulation object |
ModelException | if one of the data objects is not valid. |
Implements sortie.data.funcgroups.Behavior.
void sortie.data.funcgroups.disturbance.Harvest.writeXML | ( | BufferedWriter | jOut, |
TreePopulation | oPop | ||
) | throws ModelException |
Writes the harvest data for the parameter file.
Does nothing if there is no harvest data.
jOut | FileWriter File to write to. |
oPop | Tree population object. |
ModelException | if there are unrecognized harvest cut types (should never happen). |
|
protected |
Placeholder for reading priorities from an XML file.
This is for max value.
|
protected |
Placeholder for reading priorities from an XML file.
This is for min value.
|
protected |
Placeholder for reading cut ranges from an XML file.
This one is for range cut amount
|
protected |
Placeholder for reading cut ranges from an XML file.
This one is for DBH range lower bound
|
protected |
Placeholder for reading cut ranges from an XML file.
This one is for DBH range upper bound
|
protected |
Placeholder for reading priorities from an XML file.
This is for data type.
|
protected |
Placeholder for reading priorities from an XML file.
This is for name.
|
protected |
Our list of harvest cuts, held as HarvestData objects.