Inheritance diagram for javawrapper::BehaviorTypeBase:
Public Member Functions | |
BehaviorTypeBase (GUIManager oManager, String sName, String sXMLTag) | |
Constructor. | |
boolean[] | GetWhichSpeciesUsed (ModelVector p_oData, TreePopulation oPop) |
Gets which species should have values for a given ModelVector. | |
boolean | AnyBehaviorsEnabled () |
Determines if any of the child behaviors are currently enabled. | |
Behavior | GetBehaviorByXMLTag (String sXMLTag) |
Finds a behavior by its XML tag. | |
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. | |
Behavior[] | GetAllBehaviors () |
Get all Behavior objects for this group. | |
Behavior | GetBehaviorByKey (String sKey) |
Convenience method for getting a behavior. | |
Behavior | GetBehaviorByDisplayName (String sDescriptor) |
Convenience method for getting a behavior. | |
void | WriteSpeciesSpecificValue (BufferedWriter out, ModelVector p_oData, TreePopulation oPop) throws java.io.IOException, ModelException |
Writes a set of species-specific float values to a parameter file. | |
void | WriteXML (BufferedWriter jOut, TreePopulation oPop) throws ModelException |
Writes the XML data to a parameter file for the behaviors owned by this object. | |
boolean | IsThisDataUsed (ModelData oData) |
Determines whether a piece of data is required for any enabled behaviors in the mp_oChildBehaviors list. | |
void | WriteData (BufferedWriter jOut, ModelData oData) throws java.io. IOException |
Writes a piece of data to an XML file. | |
void | SetAsNextEnabled (String sXMLName) throws ModelException |
Sets a chosen behavior as the next enabled behavior. | |
void | ChangeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Triggered when there is a change in the species list. | |
void | CopySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException |
Copies one species to another. | |
Protected Member Functions | |
void | SetUsesBehavior (Integer[] p_iVals, int iType, TreePopulation oPop, String sKey) throws ModelException |
Sets which species for a given type use a particular behavior. | |
Protected Attributes | |
Behavior[] | mp_oChildBehaviors |
List of child behaviors a behavior group is managing. | |
Package Functions | |
void | WriteBehaviorNodes (BufferedWriter out, TreePopulation oPop) throws ModelException |
Writes behavior tags to the parameter file. |
Each object of this class manages a group of similar behavior objects.
This is the behavior level of which the GUIManager is aware. It keeps a known set of these objects around, which can respond to a common set of requests, and relies on them to manage the complexity of the individual behaviors which they own.
Copyright: Copyright (c) 2003 Charles D. Canham
Company: Institute of Ecosystem Studies
javawrapper::BehaviorTypeBase::BehaviorTypeBase | ( | GUIManager | oManager, | |
String | sName, | |||
String | sXMLTag | |||
) | [inline] |
Constructor.
oManager | GUIManager object. | |
sName | Name of this object to display to the user. | |
sXMLTag | Parent XML tag for all of this object's data. |
boolean [] javawrapper::BehaviorTypeBase::GetWhichSpeciesUsed | ( | ModelVector | p_oData, | |
TreePopulation | oPop | |||
) | [inline] |
Gets which species should have values for a given ModelVector.
This polls all behaviors; if a behavior is enabled, and this ModelVector is on its required data list, all species for which it is enabled are set to true.
p_oData | The ModelVector to check. | |
oPop | TreePopulation object. |
boolean javawrapper::BehaviorTypeBase::AnyBehaviorsEnabled | ( | ) | [inline] |
Determines if any of the child behaviors are currently enabled.
Behavior javawrapper::BehaviorTypeBase::GetBehaviorByXMLTag | ( | String | sXMLTag | ) | [inline] |
Finds a behavior by its XML tag.
sXMLTag | String The XML tag for which to find a behavior. |
Reimplemented in javawrapper::DisturbanceBehaviors, javawrapper::EstablishmentBehaviors, javawrapper::LightBehaviors, and javawrapper::MortalityBehaviors.
Grid [] javawrapper::BehaviorTypeBase::GetEnabledGridObjects | ( | ) | throws ModelException [inline] |
Gets the list of grid objects which the currently enabled behaviors would be expected to create - and thus would be available to output, etc.
ModelException | passing through from called methods. |
Behavior [] javawrapper::BehaviorTypeBase::GetAllBehaviors | ( | ) | [inline] |
void javawrapper::BehaviorTypeBase::WriteBehaviorNodes | ( | BufferedWriter | out, | |
TreePopulation | oPop | |||
) | throws ModelException [inline, package] |
Writes behavior tags to the parameter file.
For all enabled behaviors, writes them in order along with their appropriate applyTo tags.
out | File stream to write to. | |
oPop | Tree population object. |
ModelException | if there is a problem writing the file. |
Reimplemented in javawrapper::DisturbanceBehaviors.
void javawrapper::BehaviorTypeBase::SetUsesBehavior | ( | Integer[] | p_iVals, | |
int | iType, | |||
TreePopulation | oPop, | |||
String | sKey | |||
) | throws ModelException [inline, protected] |
Sets which species for a given type use a particular behavior.
This method would normally not be used, as this object manages its own data and would make the decision of which behaviors are enabled and which are not. However, in the case of input of a tab-delimited parameter file, the information must be fed to this class.
p_iVals | Array of use flags, one per species. A 0 value means that the given species doesn't use the behavior, a non-zero value means they do. | |
iType | Tree type to which the species list applies. | |
oPop | Tree population object for species/type validation. |
ModelException | if the type number is invalid, or if not all species are represented. |
sKey | Key string of behavior to be set. |
Behavior javawrapper::BehaviorTypeBase::GetBehaviorByKey | ( | String | sKey | ) | [inline] |
Convenience method for getting a behavior.
sKey | The short key name of the behavior. |
Behavior javawrapper::BehaviorTypeBase::GetBehaviorByDisplayName | ( | String | sDescriptor | ) | [inline] |
Convenience method for getting a behavior.
sDescriptor | The descriptive name of the behavior. |
void javawrapper::BehaviorTypeBase::WriteSpeciesSpecificValue | ( | BufferedWriter | out, | |
ModelVector | p_oData, | |||
TreePopulation | oPop | |||
) | throws java.io.IOException, ModelException [inline] |
Writes a set of species-specific float values to a parameter file.
The data is only written if it is required for a behavior that is enabled; and then only for the species required by any behavior for which it is required.
out | 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 |
Reimplemented from javawrapper::WorkerBase.
void javawrapper::BehaviorTypeBase::WriteXML | ( | BufferedWriter | jOut, | |
TreePopulation | oPop | |||
) | throws ModelException [inline] |
Writes the XML data to a parameter file for the behaviors owned by this object.
Overridden so that only the data enabled by behaviors is written.
jOut | File stream to write to. | |
oPop | TreePopulation object. |
ModelException | if there is a problem writing the file or validating the data. |
Reimplemented from javawrapper::WorkerBase.
Reimplemented in javawrapper::DisturbanceBehaviors, javawrapper::LightBehaviors, javawrapper::OutputBehaviors, and javawrapper::PlantingBehaviors.
boolean javawrapper::BehaviorTypeBase::IsThisDataUsed | ( | ModelData | oData | ) | [inline] |
Determines whether a piece of data is required for any enabled behaviors in the mp_oChildBehaviors list.
oData | Piece of data to check. |
Reimplemented from javawrapper::WorkerBase.
void javawrapper::BehaviorTypeBase::WriteData | ( | BufferedWriter | jOut, | |
ModelData | oData | |||
) | throws java.io. IOException [inline] |
Writes a piece of data to an XML file.
jOut | The file to write to. | |
oData | The data being written. |
java.io.IOException | Passes on exceptions from FileWriter |
void javawrapper::BehaviorTypeBase::SetAsNextEnabled | ( | String | sXMLName | ) | throws ModelException [inline] |
Sets a chosen behavior as the next enabled behavior.
The behaviors are listed in the order in which they appear in the run. This finds the behavior passed, and moves it in the list until it is immediately after the last enabled behavior. Then the behavior in question is set to enabled. This is meant to be used while loading a parameter file, so the behavior name used is that which is in the parameter file.
Created: 09-11-06, LEM
sXMLName | String The name of the behavior, from the parameter file, to make the next enabled. |
ModelException | if the behavior is already enabled, or not enabled yet in the list of enabled behaviors. This is mainly an alert, because it is a symptom of something else going wrong. |
void javawrapper::BehaviorTypeBase::ChangeOfSpecies | ( | int | iOldNumSpecies, | |
int[] | p_iIndexer, | |||
String[] | p_sNewSpecies | |||
) | throws ModelException [inline] |
Triggered when there is a change in the species list.
This goes through all behaviors and updates their assignments.
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. |
Reimplemented from javawrapper::WorkerBase.
Reimplemented in javawrapper::DisturbanceBehaviors, javawrapper::OutputBehaviors, and javawrapper::PlantingBehaviors.
void javawrapper::BehaviorTypeBase::CopySpecies | ( | int | iSpeciesCopyFrom, | |
int | iSpeciesCopyTo | |||
) | throws ModelException [inline] |
Copies one species to another.
This makes sure behavior assignments are the same.
iSpeciesCopyFrom | int Species to copy. | |
iSpeciesCopyTo | int Species that is the copy. |
ModelException | if there is a problem. |
Reimplemented from javawrapper::WorkerBase.
Reimplemented in javawrapper::DisturbanceBehaviors, javawrapper::GrowthBehaviors, javawrapper::MortalityBehaviors, javawrapper::OutputBehaviors, and javawrapper::PlantingBehaviors.
Behavior [] javawrapper::BehaviorTypeBase::mp_oChildBehaviors [protected] |
List of child behaviors a behavior group is managing.
They are kept in the order in which they are arranged for the run. Notice that this array is not created in this class. Also note that you can't count on the order remaining constant, so to work with behaviors, use a GetBehaviorBy* method.