javawrapper.BehaviorTypeBase Class Reference

This class functions as an organizer for model-level behaviors. More...

Inheritance diagram for javawrapper.BehaviorTypeBase:

javawrapper.WorkerBase javawrapper.AnalysisBehaviors javawrapper.DisperseBehaviors javawrapper.DisturbanceBehaviors javawrapper.EstablishmentBehaviors javawrapper.GrowthBehaviors javawrapper.LightBehaviors javawrapper.MortalityBehaviors javawrapper.OutputBehaviors javawrapper.PlantingBehaviors javawrapper.RemoveDeadBehaviors javawrapper.SeedPredationBehaviors javawrapper.SnagDynamicsBehaviors javawrapper.SubstrateBehaviors

List of all members.

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
 List of grid objects associated with these behaviors - notice this array is not created in this class.
Behavior[] GetAllBehaviors ()
 Returns all grid objects, whether they are used or not.
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
 Writes grid maps for any grid that has values.

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.


Detailed Description

This class functions as an organizer for model-level behaviors.

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

Author:
Lora E. Murphy
Version:
1.0

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
January 23, 2007: Added ChangeOfSpecies for updating behavior assignments (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)

Constructor & Destructor Documentation

javawrapper.BehaviorTypeBase.BehaviorTypeBase ( GUIManager  oManager,
String  sName,
String  sXMLTag 
)

Constructor.

Parameters:
oManager GUIManager object.
sName Name of this object to display to the user.
sXMLTag Parent XML tag for all of this object's data.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)


Member Function Documentation

boolean [] javawrapper.BehaviorTypeBase.GetWhichSpeciesUsed ( ModelVector  p_oData,
TreePopulation  oPop 
)

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.

Parameters:
p_oData The ModelVector to check.
oPop TreePopulation object.
Returns:
A list of flags, one per species, that indicate for each whether p_oData should have a value for that species.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

boolean javawrapper.BehaviorTypeBase.AnyBehaviorsEnabled (  ) 

Determines if any of the child behaviors are currently enabled.

Returns:
True if there are any child behaviors enabled.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Behavior javawrapper.BehaviorTypeBase.GetBehaviorByXMLTag ( String  sXMLTag  ) 

Finds a behavior by its XML tag.

Parameters:
sXMLTag String The XML tag for which to find a behavior.
Returns:
Behavior Behavior for the XML tag, or NULL if none of the behaviors has that tag.

Reimplemented in javawrapper.DisturbanceBehaviors, javawrapper.EstablishmentBehaviors, javawrapper.LightBehaviors, and javawrapper.MortalityBehaviors.

Grid [] javawrapper.BehaviorTypeBase.GetEnabledGridObjects (  )  throws ModelException

List of grid objects associated with these behaviors - notice this array is not created in this class.

When parsing grid maps, this is the index of the current map (or -1 if the current map is not owned by this behavior). When parsing packages, this is the index of the current package (or -1 if the current map is not owned by this behavior). When parsing grid maps, the current X grid cellWhen parsing grid maps, the current Y grid cell Gets the list of grid objects which the currently enabled behaviors would be expected to create - and thus would be available to output, etc.

Returns:
The list of grids enabled, or null if none are enabled.
Exceptions:
ModelException passing through from called methods.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Behavior [] javawrapper.BehaviorTypeBase.GetAllBehaviors (  ) 

Returns all grid objects, whether they are used or not.

Returns:
All grid objects for a behavior grouping, or null if there are none.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM) Get all Behavior objects for this group.
Returns:
The array of Behavior objects.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper.BehaviorTypeBase.WriteBehaviorNodes ( BufferedWriter  out,
TreePopulation  oPop 
) throws ModelException [package]

Writes behavior tags to the parameter file.

For all enabled behaviors, writes them in order along with their appropriate applyTo tags.

Parameters:
out File stream to write to.
oPop Tree population object.
Exceptions:
ModelException if there is a problem writing the file.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Reimplemented in javawrapper.DisturbanceBehaviors.

void javawrapper.BehaviorTypeBase.SetUsesBehavior ( Integer[]  p_iVals,
int  iType,
TreePopulation  oPop,
String  sKey 
) throws ModelException [protected]

Writes grid maps for any grid that has values.

If there are no grids, or if there are no grid map values in any grid, nothing is written.

Parameters:
jOut File to write to.
Exceptions:
ModelException if there is a problem writing to the file.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM) Clears all grid map values for this behavior's grids.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM) 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.

Parameters:
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.
Exceptions:
ModelException if the type number is invalid, or if not all species are represented.
Parameters:
sKey Key string of behavior to be set.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Behavior javawrapper.BehaviorTypeBase.GetBehaviorByKey ( String  sKey  ) 

Convenience method for getting a behavior.

Parameters:
sKey The short key name of the behavior.
Returns:
The behavior if found, null if not.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Behavior javawrapper.BehaviorTypeBase.GetBehaviorByDisplayName ( String  sDescriptor  ) 

Convenience method for getting a behavior.

Parameters:
sDescriptor The descriptive name of the behavior.
Returns:
The behavior if found, null if not.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper.BehaviorTypeBase.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.

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.

Parameters:
out The file to write to.
p_oData The vector of data pieces.
oPop Tree population object to get species names
Exceptions:
java.io.IOException Passes on exceptions from FileWriter
ModelException Passes on from TreePopulation

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Reimplemented from javawrapper.WorkerBase.

void javawrapper.BehaviorTypeBase.WriteXML ( BufferedWriter  jOut,
TreePopulation  oPop 
) throws ModelException

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.

Parameters:
jOut File stream to write to.
oPop TreePopulation object.
Exceptions:
ModelException if there is a problem writing the file or validating the data.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Reimplemented from javawrapper.WorkerBase.

Reimplemented in javawrapper.DisturbanceBehaviors, javawrapper.LightBehaviors, javawrapper.OutputBehaviors, and javawrapper.PlantingBehaviors.

boolean javawrapper.BehaviorTypeBase.IsThisDataUsed ( ModelData  oData  ) 

Determines whether a piece of data is required for any enabled behaviors in the mp_oChildBehaviors list.

Parameters:
oData Piece of data to check.
Returns:
True if an enabled behavior requires it; false otherwise.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

Reimplemented from javawrapper.WorkerBase.

void javawrapper.BehaviorTypeBase.WriteData ( BufferedWriter  jOut,
ModelData  oData 
) throws java.io. IOException

Writes a piece of data to an XML file.

Parameters:
jOut The file to write to.
oData The data being written.
Exceptions:
java.io.IOException Passes on exceptions from FileWriter

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper.BehaviorTypeBase.SetAsNextEnabled ( String  sXMLName  )  throws ModelException

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

Parameters:
sXMLName String The name of the behavior, from the parameter file, to make the next enabled.
Exceptions:
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

Triggered when there is a change in the species list.

This goes through all behaviors and updates their assignments.

Parameters:
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.
Exceptions:
ModelException if there's a problem.

Edit history:
------------------
January 23, 2007: Created (LEM)

Reimplemented from javawrapper.WorkerBase.

Reimplemented in javawrapper.DisturbanceBehaviors, javawrapper.OutputBehaviors, and javawrapper.PlantingBehaviors.

void javawrapper.BehaviorTypeBase.CopySpecies ( int  iSpeciesCopyFrom,
int  iSpeciesCopyTo 
) throws ModelException

Copies one species to another.

This makes sure behavior assignments are the same.

Parameters:
iSpeciesCopyFrom int Species to copy.
iSpeciesCopyTo int Species that is the copy.
Exceptions:
ModelException if there is a problem.

Reimplemented from javawrapper.WorkerBase.

Reimplemented in javawrapper.DisturbanceBehaviors, javawrapper.GrowthBehaviors, javawrapper.MortalityBehaviors, javawrapper.OutputBehaviors, javawrapper.PlantingBehaviors, and javawrapper.SeedPredationBehaviors.


Member Data Documentation

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.


The documentation for this class was generated from the following file:

Generated on Wed Oct 28 14:01:19 2009 for SORTIE Java Interface by  doxygen 1.5.6