Public Member Functions | |
TreePopulation (GUIManager oManager) | |
Constructor. | |
int | GetNumberOfSpecies () |
Returns the number of species. | |
Vector< Tree > | GetTrees () |
Gets the list of trees. | |
int | GetSpeciesCodeFromName (String sName) |
When passed the name of a species, will give back the corresponding species number code. | |
void | AddTabDelimTreeMapFile (javax.swing.JFrame oWindow, String sFileName) throws ModelException |
Adds the trees from a tab-delimited text tree map file. | |
int | GetNumberOfSizeClasses () |
Returns the number of size classes. | |
Float | GetSizeClass (int iIndex) |
Returns the size class at a specific index. | |
void | SetInitialSeedlingSize (float fVal) throws ModelException |
Sets the value of the diameter at 10 cm for new seedlings. | |
void | SetSizeClasses (Float[] p_fVals) throws ModelException |
Sets the size classes. | |
void | SetMinimumAdultDbh (Float[] p_fVals) throws ModelException |
Sets the minimum adult dbhs. | |
void | SetSpeciesNames (String[] p_sVals) throws ModelException |
Sets the species name list. | |
void | DoSetup (TreePopulation oPop) |
Performs setup. | |
void | ChangeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Overridden from WorkerBase to take care of other arrays. | |
void | SetInitialDensities (int iSizeClass, Float[] p_fVals) throws ModelException |
Sets the initial densities for a given species. | |
String | GetSpeciesNameFromCode (int iSpecies) |
For a given species code, returns its name. | |
float | GetNewSeedlingDiam10 () |
Gets the new seedling diameter at 10 cm value, in cm. | |
void | WriteXML (BufferedWriter out, TreePopulation oPop) throws ModelException |
Writes the settings to XML for the parameter file for the tree population. | |
void | ValidateData (TreePopulation oPop) throws ModelException |
This makes sure all data is valid and can be used to run the model. | |
boolean | SetVectorValueByXMLTag (String sXMLTag, String sXMLParentTag, Vector< String > p_oData, String[] p_sChildXMLTags, boolean[] p_bAppliesTo, Attributes oParentAttributes, Attributes[] p_oAttributes) throws ModelException |
Override this function in order to be able to handle initial densities and species names. | |
int | GetFloatDataCode (String sDataMember, int iSpecies, int iType) |
Gets the data code for accessing a float tree data member. | |
void | ReadXMLParentTag (String sXMLTag, Attributes oAttributes) throws ModelException |
Accepts an XML parent tag (empty, no data) from the parser. | |
void | ClearTrees () |
Clears all trees. | |
boolean | SetSingleValueByXMLTag (String sXMLTag, String sXMLParentTag, Attributes oAttributes, Object oData) throws ModelException |
This method is looking for tm_floatCode, tm_intCode, tm_charCode, tm_boolCode, fl, int, ch, and bl. | |
void | ChangeSpeciesName (String sOldSpecies, String sNewSpecies) throws ModelException |
Changes the name of a species. | |
void | DoCopySpecies (String sCopyFrom, String sCopyTo) throws ModelException |
Makes one species exactly like another. | |
Static Public Member Functions | |
static int | GetNumberOfTypes () |
Get the total number of tree types (life history stages). | |
static String | GetTypeNameFromCode (int iType) |
For a given type code, returns its name. | |
static int | GetTypeCodeFromName (String sName) |
For a given type name, returns its code. | |
Static Public Attributes | |
static final int | SEED = 0 |
Seed tree life history stage - matches definition in C++. | |
static final int | SEEDLING = 1 |
Seedling tree life history stage - matches definition in C++. | |
static final int | SAPLING = 2 |
Sapling tree life history stage - matches definition in C++. | |
static final int | ADULT = 3 |
Adult tree life history stage - matches definition in C++. | |
static final int | STUMP = 4 |
Stump tree life history stage - matches definition in C++. | |
static final int | SNAG = 5 |
Snag tree life history stage - matches definition in C++. | |
static final int | WOODY_DEBRIS = 6 |
Woody debris tree life history stage - matches definition in C++. | |
Protected Member Functions | |
int | GetCodeForDataMember (Vector< String > p_oMemberList, String sDataMember) |
Gets the data member code for a data member label. | |
Protected Attributes | |
ModelVector | mp_fSeedlingClass1Density |
Species-specific - initial densities for seedling height class 1. | |
ModelVector | mp_fSeedlingClass2Density |
Species-specific - initial densities for seedling height class 2. | |
ModelVector | mp_fSeedlingClass3Density |
Species-specific - initial densities for seedling height class 3. | |
Vector< Tree > | mp_oTrees = new Vector<Tree>(0) |
Holds Tree objects to be written to a tree map. | |
Vector< Vector< Vector< String > > > | mp_sTreeIntDataMembers |
Tree integer data members. | |
Vector< Vector< Vector< String > > > | mp_sTreeFloatDataMembers |
Tree float data members. | |
Vector< Vector< Vector< String > > > | mp_sTreeCharDataMembers |
Tree char data members. | |
Vector< Vector< Vector< String > > > | mp_sTreeBoolDataMembers |
Tree bool data members. | |
Vector< Vector< Vector < Integer > > > | mp_iTreeIntTransforms |
Index positions for tree integer data members. | |
Vector< Vector< Vector < Integer > > > | mp_iTreeFloatTransforms |
Index positions for tree float data members. | |
Vector< Vector< Vector < Integer > > > | mp_iTreeCharTransforms |
Index positions for tree char data members. | |
Vector< Vector< Vector < Integer > > > | mp_iTreeBoolTransforms |
Index positions for tree bool data members. | |
ModelFloat | m_fInitialSeedlingSize |
ModelFloat | m_fSeedlingHeightClass1 |
<Initial seedling diam10. | |
ModelFloat | m_fSeedlingHeightClass2 |
Upper limit of seedling 2 initial densities height class, in cm. | |
ModelString | m_sTextTreeMap |
Filename for text tree map, if present. | |
int[] | mp_iSpeciesTransforms |
When parsing tree maps, this will convert in case the species list is in a different order. | |
int | m_iSpeciesCounter |
Counter for tree map species list when parsing tree map files. | |
int | m_iCurrentTreeType |
When parsing tree map settings, the current tree type. | |
int | m_iCurrentSpecies |
When parsing tree map settings, the current tree species. | |
Private Member Functions | |
void | WriteTreeMap (BufferedWriter jOut) throws ModelException |
Writes an XML tree map if there are any trees to write. | |
Private Attributes | |
ModelVector | mp_sSpeciesNames |
List of species names - ignore XML tags since this data can't use the automated XML read-write system. | |
ModelVector | mp_fSizeClasses |
Size class list - the values in this are floats which represent the upper dbh limit of a class. | |
ModelVector | mp_fInitialDensities |
Species-specific - contains the initial density for each class. | |
ModelVector | mp_fMinAdultDbh |
Species-specific - the minimum adult dbh value. | |
ModelVector | mp_fMaxSeedlingHeight |
Species-specific - the maximum seedling height value. |
It also manages the windows necessary to display and retrieve information about the trees. Copyright: Copyright (c) Charles D. Canham 2003 Company: Institute of Ecosystem Studies
javawrapper.TreePopulation.TreePopulation | ( | GUIManager | oManager | ) |
int javawrapper.TreePopulation.GetNumberOfSpecies | ( | ) |
Returns the number of species.
Vector<Tree> javawrapper.TreePopulation.GetTrees | ( | ) |
static int javawrapper.TreePopulation.GetNumberOfTypes | ( | ) | [static] |
Get the total number of tree types (life history stages).
int javawrapper.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. |
void javawrapper.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:
|
int javawrapper.TreePopulation.GetNumberOfSizeClasses | ( | ) |
Returns the number of size classes.
Float javawrapper.TreePopulation.GetSizeClass | ( | int | iIndex | ) |
Returns the size class at a specific index.
iIndex | Index of size class to return. |
void javawrapper.TreePopulation.SetInitialSeedlingSize | ( | float | fVal | ) | throws ModelException |
Sets the value of the diameter at 10 cm for new seedlings.
fVal | Diameter at 10 cm, in cm. |
ModelException | if value passed is less than or equal to 0. |
void javawrapper.TreePopulation.SetSizeClasses | ( | Float[] | p_fVals | ) | throws ModelException |
Sets the size classes.
The size class vector will be sized to match the array of Floats passed. The values in the array represent the upper dbh limits of each size class. A value of 0 is assumed to be for seedlings.
p_fVals | A Float array of size class values. |
ModelException | if any size class value is less than 0. |
void javawrapper.TreePopulation.SetMinimumAdultDbh | ( | Float[] | p_fVals | ) | throws ModelException |
Sets the minimum adult dbhs.
There must be one for each species.
p_fVals | A Float array of values. |
ModelException | if any value is less than 0. |
void javawrapper.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. |
void javawrapper.TreePopulation.DoSetup | ( | TreePopulation | oPop | ) | [virtual] |
Performs setup.
Causes the max seedling height to default to 1.35 for all species.
oPop | TreePopulation This. |
Implements javawrapper.WorkerBase.
void javawrapper.TreePopulation.ChangeOfSpecies | ( | int | iOldNumSpecies, | |
int[] | p_iIndexer, | |||
String[] | p_sNewSpecies | |||
) | throws ModelException |
Overridden from WorkerBase to take care of other arrays.
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. |
Reimplemented from javawrapper.WorkerBase.
void javawrapper.TreePopulation.SetInitialDensities | ( | int | iSizeClass, | |
Float[] | p_fVals | |||
) | throws ModelException |
Sets the initial densities for a given species.
Any species number greater than zero is assumed to be valid.
iSizeClass | size class number | |
p_fVals | set of initial densities for each species |
ModelException | if the size class number is less than 0 or greater than the number of size classes defined. |
String javawrapper.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. |
static String javawrapper.TreePopulation.GetTypeNameFromCode | ( | int | iType | ) | [static] |
For a given type code, returns its name.
iType | The type code. |
static int javawrapper.TreePopulation.GetTypeCodeFromName | ( | String | sName | ) | [static] |
For a given type name, returns its code.
sName | The type name. |
float javawrapper.TreePopulation.GetNewSeedlingDiam10 | ( | ) |
Gets the new seedling diameter at 10 cm value, in cm.
void javawrapper.TreePopulation.WriteXML | ( | BufferedWriter | out, | |
TreePopulation | oPop | |||
) | throws ModelException |
Writes the settings to XML for the parameter file for the tree population.
out | Out stream for the file. | |
oPop | TreePopulation object. |
ModelException | If something goes wrong with the writing. |
Reimplemented from javawrapper.WorkerBase.
void javawrapper.TreePopulation.ValidateData | ( | TreePopulation | oPop | ) | throws ModelException [virtual] |
This makes sure all data is valid and can be used to run the model.
ModelException | in any of the following cases:
|
oPop | Not used. |
Implements javawrapper.WorkerBase.
void javawrapper.TreePopulation.WriteTreeMap | ( | BufferedWriter | jOut | ) | throws ModelException [private] |
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. |
boolean javawrapper.TreePopulation.SetVectorValueByXMLTag | ( | String | sXMLTag, | |
String | sXMLParentTag, | |||
Vector< String > | p_oData, | |||
String[] | p_sChildXMLTags, | |||
boolean[] | p_bAppliesTo, | |||
Attributes | oParentAttributes, | |||
Attributes[] | p_oAttributes | |||
) | throws ModelException |
Override this function in order to be able to handle initial densities and species names.
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. |
Reimplemented from javawrapper.WorkerBase.
int javawrapper.TreePopulation.GetCodeForDataMember | ( | Vector< String > | p_oMemberList, | |
String | sDataMember | |||
) | [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 javawrapper.TreePopulation.GetFloatDataCode | ( | String | sDataMember, | |
int | iSpecies, | |||
int | iType | |||
) |
void javawrapper.TreePopulation.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. |
Reimplemented from javawrapper.WorkerBase.
void javawrapper.TreePopulation.ClearTrees | ( | ) |
Clears all trees.
boolean javawrapper.TreePopulation.SetSingleValueByXMLTag | ( | String | sXMLTag, | |
String | sXMLParentTag, | |||
Attributes | oAttributes, | |||
Object | oData | |||
) | throws ModelException |
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. Thus grid values with these tags will be ignored.
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. |
Reimplemented from javawrapper.WorkerBase.
void javawrapper.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 javawrapper.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 |
final int javawrapper.TreePopulation.SEED = 0 [static] |
Seed tree life history stage - matches definition in C++.
final int javawrapper.TreePopulation.SEEDLING = 1 [static] |
Seedling tree life history stage - matches definition in C++.
final int javawrapper.TreePopulation.SAPLING = 2 [static] |
Sapling tree life history stage - matches definition in C++.
final int javawrapper.TreePopulation.ADULT = 3 [static] |
Adult tree life history stage - matches definition in C++.
final int javawrapper.TreePopulation.STUMP = 4 [static] |
Stump tree life history stage - matches definition in C++.
final int javawrapper.TreePopulation.SNAG = 5 [static] |
Snag tree life history stage - matches definition in C++.
final int javawrapper.TreePopulation.WOODY_DEBRIS = 6 [static] |
Woody debris tree life history stage - matches definition in C++.
Initial value:
new ModelVector("Species names", "", "", 0, ModelVector.STRING)
Initial value:
new ModelVector("Size classes", "", "", 0, ModelVector.FLOAT)
The lower limit of a class is the upper limit of the size class below it. A size class with an upper limit of 0 is for seedlings. Ignore XML tags since this data can't use the automated XML read-write system.
Initial value:
new ModelVector( "Initial Densities", "", "", 0, ModelVector.FLOAT)
Each vector bucket contains another vector with the values for each species for that size class. Ignore XML tags since this data can't use the automated XML read-write system.
Initial value:
new ModelVector("Minimum Adult DBH", "tr_minAdultDBH", "tr_madVal", 0, ModelVector.FLOAT, true)
Initial value:
new ModelVector( "Max Seedling Height (meters)", "tr_maxSeedlingHeight", "tr_mshVal", 0, ModelVector.FLOAT, true)
Initial value:
new ModelVector( "Initial Density (#/ha) - Seedling Height Class 1", "tr_seedlingHeight1Density", "tr_sh1dVal", 0, ModelVector.FLOAT, true)
Initial value:
new ModelVector( "Initial Density (#/ha) - Seedling Height Class 2", "tr_seedlingHeight2Density", "tr_sh2dVal", 0, ModelVector.FLOAT, true)
Initial value:
new ModelVector( "Initial Density (#/ha) - Seedling Height Class 3", "tr_seedlingHeight3Density", "tr_sh3dVal", 0, ModelVector.FLOAT, true)
Vector<Tree> javawrapper.TreePopulation.mp_oTrees = new Vector<Tree>(0) [protected] |
Holds Tree objects to be written to a tree map.
Vector<Vector<Vector<String> > > javawrapper.TreePopulation.mp_sTreeIntDataMembers [protected] |
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.
Vector<Vector<Vector<String> > > javawrapper.TreePopulation.mp_sTreeFloatDataMembers [protected] |
Tree float 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.
Vector<Vector<Vector<String> > > javawrapper.TreePopulation.mp_sTreeCharDataMembers [protected] |
Tree char 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.
Vector<Vector<Vector<String> > > javawrapper.TreePopulation.mp_sTreeBoolDataMembers [protected] |
Tree bool 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.
Vector<Vector<Vector<Integer> > > javawrapper.TreePopulation.mp_iTreeIntTransforms [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).
Vector<Vector<Vector<Integer> > > javawrapper.TreePopulation.mp_iTreeFloatTransforms [protected] |
Index positions for tree float data members.
The current tree map being read may have different data member indexes, and this will help translate to mp_sTreeFloatDataMembers. 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_sTreeFloatDataMembers of the data member (and thus the tree index).
Vector<Vector<Vector<Integer> > > javawrapper.TreePopulation.mp_iTreeCharTransforms [protected] |
Index positions for tree char data members.
The current tree map being read may have different data member indexes, and this will help translate to mp_sTreeCharDataMembers. 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_sTreeCharDataMembers of the data member (and thus the tree index).
Vector<Vector<Vector<Integer> > > javawrapper.TreePopulation.mp_iTreeBoolTransforms [protected] |
Index positions for tree bool data members.
The current tree map being read may have different data member indexes, and this will help translate to mp_sTreeBoolDataMembers. 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_sTreeBoolDataMembers of the data member (and thus the tree index).
Initial value:
new ModelFloat( "New Seedling Diameter at 10 cm", "tr_seedDiam10Cm")
Initial value:
new ModelFloat(0, "Seedling Height Class 1 Upper Bound, in cm", "tr_seedlingHeightClass1")
Upper limit of seedling 1 initial densities height class, in cm
Initial value:
new ModelFloat(0, "Seedling Height Class 2 Upper Bound, in cm", "tr_seedlingHeightClass2")
ModelString javawrapper.TreePopulation.m_sTextTreeMap [protected] |
Initial value:
new ModelString("", "Tree Map To Add As Text", "tr_treemapFile")
int [] javawrapper.TreePopulation.mp_iSpeciesTransforms [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.
int javawrapper.TreePopulation.m_iSpeciesCounter [protected] |
Counter for tree map species list when parsing tree map files.
int javawrapper.TreePopulation.m_iCurrentTreeType [protected] |
When parsing tree map settings, the current tree type.
int javawrapper.TreePopulation.m_iCurrentSpecies [protected] |
When parsing tree map settings, the current tree species.