SORTIE Java Interface
1
|
This holds all data relating to the tree population. More...
Public Member Functions | |
TreePopulation (GUIManager oManager) throws ModelException | |
Constructor. More... | |
int | getNumberOfSpecies () |
Returns the number of species. More... | |
ArrayList< Tree > | getTrees () |
Gets the list of trees. More... | |
void | clearTreeMapParseSettings () |
Clears any tree map parse settings that may be in place. More... | |
int | getSpeciesCodeFromName (String sName) |
When passed the name of a species, will give back the corresponding species number code. More... | |
void | addTabDelimTreeMapFile (javax.swing.JFrame oWindow, String sFileName) throws ModelException |
Adds the trees from a tab-delimited text tree map file. More... | |
int | getNumberOfSizeClasses () |
Returns the number of size classes. More... | |
Float | getSizeClass (int iIndex) |
Returns the size class at a specific index. More... | |
void | setSpeciesNames (String[] p_sVals) throws ModelException |
Sets the species name list. More... | |
void | changeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Deletes all trees. More... | |
String | getSpeciesNameFromCode (int iSpecies) |
For a given species code, returns its name. More... | |
void | writeBehaviorNodes (BufferedWriter out, TreePopulation oPop) throws ModelException |
TreeBehavior | getTreeBehavior () |
void | validateData (TreePopulation oPop) throws ModelException |
This makes sure all data is valid and can be used to run the model. More... | |
void | writeSpeciesList (BufferedWriter jOut) throws IOException |
Writes the species list. More... | |
void | writeTreeMap (BufferedWriter jOut) throws ModelException |
Writes an XML tree map if there are any trees to write. More... | |
int | getFloatDataCode (String sDataMember, int iSpecies, int iType) throws ModelException |
Gets the data code for accessing a float tree data member. More... | |
int | getIntDataCode (String sDataMember, int iSpecies, int iType) throws ModelException |
Gets the data code for accessing an int tree data member. More... | |
int | getBoolDataCode (String sDataMember, int iSpecies, int iType) throws ModelException |
Gets the data code for accessing a bool tree data member. More... | |
int | getCharDataCode (String sDataMember, int iSpecies, int iType) throws ModelException |
Gets the data code for accessing a float tree data member. More... | |
void | clearTrees () |
Clears all trees. More... | |
boolean | readTreeMapSettings (String sXMLTag, Attributes oAttributes, Object oData) throws ModelException |
Reads tree map settings from XML parsing. More... | |
void | readSpecies (Attributes oAttributes) throws ModelException |
Reads tree species from XML parsing. More... | |
void | readTreeSettings (Attributes oAttributes) throws ModelException |
Reads tree settings from XML parsing. More... | |
void | readTreeParent (Attributes oAttributes) throws ModelException |
Reads tree parent from XML parsing. More... | |
void | changeSpeciesName (String sOldSpecies, String sNewSpecies) throws ModelException |
Changes the name of a species. More... | |
void | doCopySpecies (String sCopyFrom, String sCopyTo) throws ModelException |
Makes one species exactly like another. More... | |
Allometry | getAllometry () |
Gets the allometry object. More... | |
Behavior | getBehaviorByXMLParametersParentTag (String sXMLTag, int iPos) |
Overridden to ignore position. More... | |
Behavior | createBehaviorFromParameterFileTag (String sParameterFileTag) throws ModelException |
Overridden to not create. More... | |
void | doSetup (TreePopulation oPop) throws ModelException |
Overridden to let allometry do setup. More... | |
Public Member Functions inherited from sortie.data.funcgroups.BehaviorTypeBase | |
BehaviorTypeBase (GUIManager oManager, String sName) | |
Constructor. More... | |
boolean | anyBehaviorsEnabled () |
Determines if any of the child behaviors are currently enabled. More... | |
void | validateData (TreePopulation oPop) throws ModelException |
Implements data checking. More... | |
Behavior | createBehaviorFromParameterFileTag (String sParameterFileTag) throws ModelException |
Creates a new behavior from an XML parameter file name tag and inserts it into the child behaviors list. More... | |
void | sortBehaviors () |
Sorts the behaviors by list position. More... | |
boolean | canBehaviorBeDuplicated (String sParameterFileTag) throws ModelException |
Whether or not a behavior of a certain class can be duplicated in a run. More... | |
boolean | doesBehaviorNeedTrees (String sParameterFileTag) throws ModelException |
Whether or not a behavior of a certain class can be duplicated in a run. More... | |
ArrayList< BehaviorInstantiator > | getAllPossibleBehaviors () |
Gets all possible behaviors. More... | |
Behavior | getBehaviorByXMLParametersParentTag (String sXMLTag, int iPos) |
Finds a behavior by its XML parameters parent tag. More... | |
String | getDescriptor (String sParameterFileTag) |
Gets the descriptor for a behavior based on its parameter file tag. More... | |
Grid [] | getEnabledGridObjects () throws ModelException |
Gets the list of grid objects which the currently enabled behaviors would be expected to create - and thus would be available to output, etc. More... | |
ArrayList< Behavior > | getAllInstantiatedBehaviors () |
Get the list of child behaviors currently selected for the run. More... | |
void | writeBehaviorNodes (BufferedWriter out, TreePopulation oPop) throws ModelException |
Writes behavior tags to the parameter file. More... | |
ArrayList< Behavior > | getBehaviorByDisplayName (String sDescriptor) |
Convenience method for getting an instantiated behavior. More... | |
ArrayList< Behavior > | getBehaviorByParameterFileTag (String sParameterFileTag) |
Finds an instantiated behavior by its XML parameter file tag. More... | |
void | changeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Triggered when there is a change in the species list. More... | |
void | copySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException |
Copies one species to another. More... | |
void | endOfParameterFileRead () |
Allows child behaviors to do end-of-parameter-file tasks. More... | |
void | changeOfSpeciesName (String sOldSpecies, String sNewSpecies) throws ModelException |
Performs any necessary tasks associated with changing the name of a species. More... | |
GUIManager | getGUIManager () |
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 | removeBehavior (Behavior oBeh) |
Removes a behavior from the instantiated list. More... | |
String | getName () |
Returns the user-acceptable name for this object. More... | |
void | changeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException |
Allows instantiated behaviors to perform any tasks associated with a change of plot resolution. More... | |
void | doSetup (TreePopulation oPop) throws ModelException |
Does any needed setup once the tree population object has data. More... | |
Static Public Member Functions | |
static int | getNumberOfTypes () |
Get the total number of tree types (life history stages). More... | |
static String | getTypeNameFromCode (int iType) |
For a given type code, returns its name. More... | |
static int | getTypeCodeFromName (String sName) |
For a given type name, returns its code. More... | |
Static Public Member Functions inherited from sortie.data.funcgroups.BehaviorTypeBase | |
static boolean [] | mergeBooleans (boolean[] p_oMergeOne, boolean[] p_oMergeTwo) |
Merges two boolean arrays and returns an array where there is a true in each array bucket where EITHER array is true. More... | |
Public Attributes | |
ArrayList< Tree > | mp_oTrees = new ArrayList<Tree>(0) |
Holds Tree objects to be written to a tree map. More... | |
ArrayList< ArrayList< ArrayList< String > > > | mp_sTreeIntDataMembers |
Tree integer data members. More... | |
Static Public Attributes | |
static final int | SEED = 0 |
Seed tree life history stage - matches definition in C++. More... | |
static final int | SEEDLING = 1 |
Seedling tree life history stage - matches definition in C++. More... | |
static final int | SAPLING = 2 |
Sapling tree life history stage - matches definition in C++. More... | |
static final int | ADULT = 3 |
Adult tree life history stage - matches definition in C++. More... | |
static final int | STUMP = 4 |
Stump tree life history stage - matches definition in C++. More... | |
static final int | SNAG = 5 |
Snag tree life history stage - matches definition in C++. More... | |
static final int | WOODY_DEBRIS = 6 |
Woody debris tree life history stage - matches definition in C++. More... | |
Protected Member Functions | |
int | getCodeForDataMember (ArrayList< String > p_oMemberList, String sDataMember) |
Gets the data member code for a data member label. More... | |
Protected Attributes | |
ArrayList< ArrayList< ArrayList< Integer > > > | mp_iTreeIntTransforms |
Index positions for tree integer data members. More... | |
int [] | mp_iSpeciesTransforms |
When parsing tree maps, this will convert in case the species list is in a different order. More... | |
int | m_iSpeciesCounter |
Counter for tree map species list when parsing tree map files. More... | |
int | m_iCurrentTreeType |
When parsing tree map settings, the current tree type. More... | |
Protected Attributes inherited from sortie.data.funcgroups.BehaviorTypeBase | |
ArrayList< Behavior > | mp_oInstantiatedBehaviors |
List of child behaviors currently selected for the run. More... | |
ArrayList< BehaviorInstantiator > | mp_oAvailableBehaviors |
List of possible behaviors that can be created. More... | |
GUIManager | m_oManager |
GUIManager object. More... | |
String | m_sName |
User-consumable name for this object. More... | |
Private Member Functions | |
void | updateTreeDataMembers () throws ModelException |
Update the tree data members for the currently enabled behaviors. More... | |
Private Attributes | |
ModelVector | mp_sSpeciesNames |
List of species names - ignore XML tags since this data can't use the automated XML read-write system. More... | |
This holds all data relating to the tree population.
It also manages the windows necessary to display and retrieve information about the trees. Copyright: Copyright (c) Charles D. Canham 2003 Company: Cary Institute of Ecosystem Studies
Edit history:
---------------—
December 8, 2011: Wiped the slate clean for version 7 (LEM)
sortie.data.funcgroups.TreePopulation.TreePopulation | ( | GUIManager | oManager | ) | throws ModelException |
Constructor.
oManager | GUIManager object |
void sortie.data.funcgroups.TreePopulation.addTabDelimTreeMapFile | ( | javax.swing.JFrame | oWindow, |
String | sFileName | ||
) | throws ModelException |
Adds the trees from a tab-delimited text tree map file.
sFileName | The file name of the tree map file. |
oWindow | Window to which to display messages |
ModelException | if:
|
void sortie.data.funcgroups.TreePopulation.changeOfSpecies | ( | int | iOldNumSpecies, |
int [] | p_iIndexer, | ||
String [] | p_sNewSpecies | ||
) | throws ModelException |
Deletes all trees.
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. |
void sortie.data.funcgroups.TreePopulation.changeSpeciesName | ( | String | sOldSpecies, |
String | sNewSpecies | ||
) | throws ModelException |
Changes 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 |
sNewSpecies | String New name of the species |
ModelException | if there is a problem. |
void sortie.data.funcgroups.TreePopulation.clearTreeMapParseSettings | ( | ) |
Clears any tree map parse settings that may be in place.
This ensures that grid values do not go to trees.
void sortie.data.funcgroups.TreePopulation.clearTrees | ( | ) |
Clears all trees.
Behavior sortie.data.funcgroups.TreePopulation.createBehaviorFromParameterFileTag | ( | String | sParameterFileTag | ) | throws ModelException |
Overridden to not create.
void sortie.data.funcgroups.TreePopulation.doCopySpecies | ( | String | sCopyFrom, |
String | sCopyTo | ||
) | throws ModelException |
Makes one species exactly like another.
Any difference from the target species is obliterated. Both species names must already exist (i.e. add a new species before making it into a copy of another). This triggers the change through the other GUI objects.
sCopyFrom | String Name of species to copy. |
sCopyTo | String Name of species that is the copy. |
ModelException |
void sortie.data.funcgroups.TreePopulation.doSetup | ( | TreePopulation | oPop | ) | throws ModelException |
Overridden to let allometry do setup.
Allometry sortie.data.funcgroups.TreePopulation.getAllometry | ( | ) |
Gets the allometry object.
Behavior sortie.data.funcgroups.TreePopulation.getBehaviorByXMLParametersParentTag | ( | String | sXMLTag, |
int | iPos | ||
) |
Overridden to ignore position.
int sortie.data.funcgroups.TreePopulation.getBoolDataCode | ( | String | sDataMember, |
int | iSpecies, | ||
int | iType | ||
) | throws ModelException |
Gets the data code for accessing a bool tree data member.
You can use the return code to get the data from a Tree class object. If the data member does not belong to the tree population, it will search enabled behaviors for the data.
int sortie.data.funcgroups.TreePopulation.getCharDataCode | ( | String | sDataMember, |
int | iSpecies, | ||
int | iType | ||
) | throws ModelException |
Gets the data code for accessing a float tree data member.
You can use the return code to get the data from a Tree class object. If the data member does not belong to the tree population, it will search enabled behaviors for the data.
|
protected |
Gets the data member code for a data member label.
If this is not a currently listed data member, it will be added.
p_oMemberList | List of data members. |
sDataMember | Data member name. |
int sortie.data.funcgroups.TreePopulation.getFloatDataCode | ( | String | sDataMember, |
int | iSpecies, | ||
int | iType | ||
) | throws ModelException |
Gets the data code for accessing a float tree data member.
You can use the return code to get the data from a Tree class object. If the data member does not belong to the tree population, it will search enabled behaviors for the data.
int sortie.data.funcgroups.TreePopulation.getIntDataCode | ( | String | sDataMember, |
int | iSpecies, | ||
int | iType | ||
) | throws ModelException |
Gets the data code for accessing an int tree data member.
You can use the return code to get the data from a Tree class object. If the data member does not belong to the tree population, it will search enabled behaviors for the data.
int sortie.data.funcgroups.TreePopulation.getNumberOfSizeClasses | ( | ) |
Returns the number of size classes.
int sortie.data.funcgroups.TreePopulation.getNumberOfSpecies | ( | ) |
Returns the number of species.
|
static |
Get the total number of tree types (life history stages).
Float sortie.data.funcgroups.TreePopulation.getSizeClass | ( | int | iIndex | ) |
Returns the size class at a specific index.
iIndex | Index of size class to return. |
int sortie.data.funcgroups.TreePopulation.getSpeciesCodeFromName | ( | String | sName | ) |
When passed the name of a species, will give back the corresponding species number code.
If there are spaces in the name, they should be replaced with underscores BEFORE being passed.
sName | The name of the species. |
String sortie.data.funcgroups.TreePopulation.getSpeciesNameFromCode | ( | int | iSpecies | ) |
For a given species code, returns its name.
If this name is for display, a replace should be done on underscores to spaces.
iSpecies | The species code. |
TreeBehavior sortie.data.funcgroups.TreePopulation.getTreeBehavior | ( | ) |
ArrayList<Tree> sortie.data.funcgroups.TreePopulation.getTrees | ( | ) |
Gets the list of trees.
|
static |
For a given type name, returns its code.
sName | The type name. |
|
static |
For a given type code, returns its name.
iType | The type code. |
void sortie.data.funcgroups.TreePopulation.readSpecies | ( | Attributes | oAttributes | ) | throws ModelException |
Reads tree species from XML parsing.
oAttributes | The attributes of this object. |
ModelException | if there is a problem reading this data. |
boolean sortie.data.funcgroups.TreePopulation.readTreeMapSettings | ( | String | sXMLTag, |
Attributes | oAttributes, | ||
Object | oData | ||
) | throws ModelException |
Reads tree map settings from XML parsing.
This method is looking for tm_floatCode, tm_intCode, tm_charCode, tm_boolCode, fl, int, ch, and bl. For the last four, they are only set if m_iCurrentSpecies and m_iCurrentTreeType are greater than -1 but will return true in either case. This is so missing values will be ignored without consequence. This depends on grids being read first!
sXMLTag | XML tag of data object whose value is to be set. |
oAttributes | The attributes of this object. |
oData | Data value appropriate to the data type |
ModelException | if there is a problem reading this data. |
void sortie.data.funcgroups.TreePopulation.readTreeParent | ( | Attributes | oAttributes | ) | throws ModelException |
Reads tree parent from XML parsing.
oAttributes | The attributes of this object. |
ModelException | if there is a problem reading this data. |
void sortie.data.funcgroups.TreePopulation.readTreeSettings | ( | Attributes | oAttributes | ) | throws ModelException |
Reads tree settings from XML parsing.
oAttributes | The attributes of this object. |
ModelException | if there is a problem reading this data. |
void sortie.data.funcgroups.TreePopulation.setSpeciesNames | ( | String [] | p_sVals | ) | throws ModelException |
Sets the species name list.
The species vector will be sized to match the array of Strings passed. All spaces in the species names are replaced with underscores.
If there are species currently defined, this calls ChangeOfSpecies() for all objects.
This calls the GUIManager::DoSetup() method so that behavior groups can adjust for the new species list if species were already defined.
This function also declares certain arrays, since this is the first opportunity to know how many species there are.
p_sVals | A String array of species names. |
ModelException | if there is a problem setting the species names. |
|
private |
Update the tree data members for the currently enabled behaviors.
Remove any that no longer apply.
void sortie.data.funcgroups.TreePopulation.validateData | ( | TreePopulation | oPop | ) | throws ModelException |
This makes sure all data is valid and can be used to run the model.
oPop | Not used. |
ModelException | if there are no species defined. |
void sortie.data.funcgroups.TreePopulation.writeBehaviorNodes | ( | BufferedWriter | out, |
TreePopulation | oPop | ||
) | throws ModelException |
void sortie.data.funcgroups.TreePopulation.writeSpeciesList | ( | BufferedWriter | jOut | ) | throws IOException |
Writes the species list.
jOut | The XML file to write to. |
IOException | If anything goes wrong |
void sortie.data.funcgroups.TreePopulation.writeTreeMap | ( | BufferedWriter | jOut | ) | throws ModelException |
Writes an XML tree map if there are any trees to write.
jOut | The XML file to write to. |
ModelException | If anything goes wrong. This could wrap another exception. |
|
static |
Adult tree life history stage - matches definition in C++.
|
protected |
When parsing tree map settings, the current tree type.
|
protected |
Counter for tree map species list when parsing tree map files.
|
protected |
When parsing tree maps, this will convert in case the species list is in a different order.
The array index is the code to convert; the value in the array at that point is the corresponding old species number.
|
protected |
Index positions for tree integer data members.
The current tree map being read may have different data member indexes, and this will help translate to mp_sTreeIntDataMembers. First index is species, second is type. Vector position equals the data member position in the map being read, and vector value is the position in mp_sTreeIntDataMembers of the data member (and thus the tree index).
Holds Tree objects to be written to a tree map.
|
private |
List of species names - ignore XML tags since this data can't use the automated XML read-write system.
ArrayList<ArrayList<ArrayList<String> > > sortie.data.funcgroups.TreePopulation.mp_sTreeIntDataMembers |
Tree integer data members.
First array index is species, second is type. The vector is a set of strings with the data member names. The position of the String in the vector corresponds to the data member code in the tree map.
|
static |
Sapling tree life history stage - matches definition in C++.
|
static |
Seed tree life history stage - matches definition in C++.
|
static |
Seedling tree life history stage - matches definition in C++.
|
static |
Snag tree life history stage - matches definition in C++.
|
static |
Stump tree life history stage - matches definition in C++.
|
static |
Woody debris tree life history stage - matches definition in C++.