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::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
 Gets the list of grid objects which the currently enabled behaviors would be expected to create - and thus would be available to output, etc.
Grid[] GetAllGridObjects ()
 Returns all grid objects, whether they are used or not.
Behavior[] GetAllBehaviors ()
 Get all Behavior objects for this group.
void WriteGridXML (BufferedWriter jOut) throws ModelException
 Writes grid maps for any grid that has values.
void ClearGridMapValues ()
 Clears all grid map values for this behavior's grids.
Behavior GetBehaviorByKey (String sKey)
 Convenience method for getting a behavior.
Behavior GetBehaviorByDisplayName (String sDescriptor)
 Convenience method for getting a behavior.
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 is looking for ma_floatCode, ma_intCode, ma_charCode, ma_boolCode, fl, int, ch, and bl.
boolean SetVectorValueByXMLTag (String sXMLTag, String sXMLParentTag, Vector 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 grid maps.
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.

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.
Grid[] mp_oGrids
 List of grid objects associated with these behaviors - notice this array is not created in this class.
int m_iGridParseIndex
 When parsing grid maps, this is the index of the current map (or -1 if the current map is not owned by this behavior).
int m_iPackageIndex
 When parsing packages, this is the index of the current package (or -1 if the current map is not owned by this behavior).
int m_iCurrentXCell
 When parsing grid maps, the current X grid cell.
int m_iCurrentYCell
 When parsing grid maps, the current Y grid cell.

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)


Constructor & Destructor Documentation

javawrapper::BehaviorTypeBase::BehaviorTypeBase GUIManager  oManager,
String  sName,
String  sXMLTag
[inline]
 

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::AnyBehaviorsEnabled  )  [inline]
 

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)

void javawrapper::BehaviorTypeBase::ClearGridMapValues  )  [inline]
 

Clears all grid map values for this behavior's grids.


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

Behavior [] javawrapper::BehaviorTypeBase::GetAllBehaviors  )  [inline]
 

Get all Behavior objects for this group.

Returns:
The array of Behavior objects.

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

Grid [] javawrapper::BehaviorTypeBase::GetAllGridObjects  )  [inline]
 

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)

Behavior javawrapper::BehaviorTypeBase::GetBehaviorByDisplayName String  sDescriptor  )  [inline]
 

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)

Behavior javawrapper::BehaviorTypeBase::GetBehaviorByKey String  sKey  )  [inline]
 

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::GetBehaviorByXMLTag String  sXMLTag  )  [inline]
 

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::EstablishmentBehaviors, 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.

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)

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.

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::IsThisDataUsed ModelData  oData  )  [inline]
 

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::ReadXMLParentTag String  sXMLTag,
Attributes  oAttributes
throws ModelException [inline]
 

Accepts an XML parent tag (empty, no data) from the parser.

This is looking for grid data.

Parameters:
sXMLTag The XML tag.
oAttributes The attributes of this object.
Exceptions:
ModelException if there is a problem reading this 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::SetSingleValueByXMLTag String  sXMLTag,
String  sXMLParentTag,
Attributes  oAttributes,
Object  oData
throws ModelException [inline]
 

This method is looking for ma_floatCode, ma_intCode, ma_charCode, ma_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.

Parameters:
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
Returns:
true if the value was set successfully; false if the value could not be found. (This would not be an error, because I need a way to cycle through the objects until one of the objects comes up with a match.)
Exceptions:
ModelException if the value could not be assigned to the data object.

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.

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.

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)

boolean javawrapper::BehaviorTypeBase::SetVectorValueByXMLTag String  sXMLTag,
String  sXMLParentTag,
Vector  p_oData,
String[]  p_sChildXMLTags,
boolean[]  p_bAppliesTo,
Attributes  oParentAttributes,
Attributes[]  p_oAttributes
throws ModelException [inline]
 

Override this function in order to be able to handle grid maps.

Parameters:
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.
Returns:
true if the value was set successfully; false if the value could not be found. (This would not be an error, because I need a way to cycle through the objects until one of the objects comes up with a match.) If a match to a data object is made via XML tag, but the found object is not a ModelVector, this returns false.
Exceptions:
ModelException if the value could not be assigned to the data object.

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

Reimplemented from javawrapper::WorkerBase.

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

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.

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)

void javawrapper::BehaviorTypeBase::WriteData BufferedWriter  jOut,
ModelData  oData
throws java.io. IOException [inline]
 

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)

Reimplemented from javawrapper::WorkerBase.

void javawrapper::BehaviorTypeBase::WriteGridXML BufferedWriter  jOut  )  throws ModelException [inline]
 

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)

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.

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 [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.

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.


Member Data Documentation

Behavior [] javawrapper::BehaviorTypeBase::mp_oChildBehaviors [protected]
 

List of child behaviors a behavior group is managing.

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 Mon Mar 27 15:15:31 2006 for SORTIE Java Interface by  doxygen 1.4.6-NO