SORTIE Java Interface  1
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
sortie.data.funcgroups.BehaviorTypeBase Class Referenceabstract

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

Inheritance diagram for sortie.data.funcgroups.BehaviorTypeBase:
sortie.data.funcgroups.AnalysisBehaviors sortie.data.funcgroups.DisperseBehaviors sortie.data.funcgroups.DisturbanceBehaviors sortie.data.funcgroups.EpiphyticEstablishmentBehaviors sortie.data.funcgroups.EstablishmentBehaviors sortie.data.funcgroups.GrowthBehaviors sortie.data.funcgroups.LightBehaviors sortie.data.funcgroups.ManagementBehaviors sortie.data.funcgroups.MortalityBehaviors sortie.data.funcgroups.MortalityUtilitiesBehaviors sortie.data.funcgroups.OutputBehaviors sortie.data.funcgroups.PlantingBehaviors sortie.data.funcgroups.PlotBehaviors sortie.data.funcgroups.SeedPredationBehaviors sortie.data.funcgroups.SnagDynamicsBehaviors sortie.data.funcgroups.StateChangeBehaviors sortie.data.funcgroups.SubstrateBehaviors sortie.data.funcgroups.TreePopulation

Public Member Functions

 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< BehaviorInstantiatorgetAllPossibleBehaviors ()
 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< BehaviorgetAllInstantiatedBehaviors ()
 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< BehaviorgetBehaviorByDisplayName (String sDescriptor)
 Convenience method for getting an instantiated behavior. More...
 
ArrayList< BehaviorgetBehaviorByParameterFileTag (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 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...
 

Protected Attributes

ArrayList< Behaviormp_oInstantiatedBehaviors
 List of child behaviors currently selected for the run. More...
 
ArrayList< BehaviorInstantiatormp_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...
 

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) 2011 Charles D. Canham Company: Cary Institute of Ecosystem Studies

Author
Lora E. Murphy
Version
1.0


Edit history:
---------------—
December 8, 2011: Wiped the slate clean for version 7 (LEM)

Constructor & Destructor Documentation

◆ BehaviorTypeBase()

sortie.data.funcgroups.BehaviorTypeBase.BehaviorTypeBase ( GUIManager  oManager,
String  sName 
)

Constructor.

Parameters
oManagerGUIManager object.
sNameName of this object to display to the user.

Member Function Documentation

◆ anyBehaviorsEnabled()

boolean sortie.data.funcgroups.BehaviorTypeBase.anyBehaviorsEnabled ( )

Determines if any of the child behaviors are currently enabled.

Returns
True if there are any child behaviors enabled.

◆ canBehaviorBeDuplicated()

boolean sortie.data.funcgroups.BehaviorTypeBase.canBehaviorBeDuplicated ( String  sParameterFileTag) throws ModelException

Whether or not a behavior of a certain class can be duplicated in a run.

Parameters
sParameterFileTagParameter file tag of behavior to create.
Returns
Whether or not a behavior of a certain class can be duplicated in a run.

◆ changeOfPlotResolution()

void sortie.data.funcgroups.BehaviorTypeBase.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.

Parameters
fOldXfloat Old plot X length.
fOldYfloat Old plot Y length.
fNewXfloat New plot X length.
fNewYfloat New plot Y length.
Exceptions
ModelExceptionif anything goes wrong.

◆ changeOfSpecies()

void sortie.data.funcgroups.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
iOldNumSpeciessays how many species there used to be.
p_iIndexeris 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_sNewSpeciesThe new species list.
Exceptions
ModelExceptionif there's a problem.

◆ changeOfSpeciesName()

void sortie.data.funcgroups.BehaviorTypeBase.changeOfSpeciesName ( String  sOldSpecies,
String  sNewSpecies 
) throws ModelException

Performs any necessary tasks associated with changing 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.

Parameters
sOldSpeciesString Old name of the species, with underscores instead of spaces (like the species names would come from the tree population)
sNewSpeciesString New name of the species, with underscores instead of spaces (like the species names would come from the tree population)
Exceptions
ModelExceptionif there is a problem.

◆ copySpecies()

void sortie.data.funcgroups.BehaviorTypeBase.copySpecies ( int  iSpeciesCopyFrom,
int  iSpeciesCopyTo 
) throws ModelException

Copies one species to another.

This makes sure behavior assignments are the same.

Parameters
iSpeciesCopyFromint Species to copy.
iSpeciesCopyToint Species that is the copy.
Exceptions
ModelExceptionif there is a problem.

◆ createBehaviorFromParameterFileTag()

Behavior sortie.data.funcgroups.BehaviorTypeBase.createBehaviorFromParameterFileTag ( String  sParameterFileTag) throws ModelException

Creates a new behavior from an XML parameter file name tag and inserts it into the child behaviors list.

Parameters
sParameterFileTagParameter file tag of behavior to create.
Returns
Behavior Behavior for the XML tag, or NULL if none of the behaviors has that tag.

◆ doesBehaviorNeedTrees()

boolean sortie.data.funcgroups.BehaviorTypeBase.doesBehaviorNeedTrees ( String  sParameterFileTag) throws ModelException

Whether or not a behavior of a certain class can be duplicated in a run.

Parameters
sParameterFileTagParameter file tag of behavior to create.
Returns
Whether or not a behavior of a certain class can be duplicated in a run.

◆ doSetup()

void sortie.data.funcgroups.BehaviorTypeBase.doSetup ( TreePopulation  oPop) throws ModelException

Does any needed setup once the tree population object has data.

This will be called once the tree population has its data.

Parameters
oPopTreePopulation object.
Exceptions
ModelExceptionif there are problems with setup.

◆ endOfParameterFileRead()

void sortie.data.funcgroups.BehaviorTypeBase.endOfParameterFileRead ( )

Allows child behaviors to do end-of-parameter-file tasks.

◆ getAllInstantiatedBehaviors()

ArrayList<Behavior> sortie.data.funcgroups.BehaviorTypeBase.getAllInstantiatedBehaviors ( )

Get the list of child behaviors currently selected for the run.

Returns
The array of Behavior objects.

◆ getAllPossibleBehaviors()

ArrayList<BehaviorInstantiator> sortie.data.funcgroups.BehaviorTypeBase.getAllPossibleBehaviors ( )

Gets all possible behaviors.

Returns
All behaviors. Empty list if there are none.

◆ getBehaviorByDisplayName()

ArrayList<Behavior> sortie.data.funcgroups.BehaviorTypeBase.getBehaviorByDisplayName ( String  sDescriptor)

Convenience method for getting an instantiated behavior.

If there is more than one, all will be returned.

Parameters
sDescriptorThe descriptive name of the behavior.
Returns
ArrayList of behaviors, or an empty list if none found.

◆ getBehaviorByParameterFileTag()

ArrayList<Behavior> sortie.data.funcgroups.BehaviorTypeBase.getBehaviorByParameterFileTag ( String  sParameterFileTag)

Finds an instantiated behavior by its XML parameter file tag.

If there is more than one, all will be returned.

Parameters
sParameterFileTagString The XML tag for which to find a behavior.
Returns
ArrayList of behaviors for the XML tag, or an empty list if none of the behaviors has that tag.

◆ getBehaviorByXMLParametersParentTag()

Behavior sortie.data.funcgroups.BehaviorTypeBase.getBehaviorByXMLParametersParentTag ( String  sXMLTag,
int  iPos 
)

Finds a behavior by its XML parameters parent tag.

Parameters
sXMLTagString The XML tag for which to find a behavior.
iPosList position of the behavior.
Returns
Behavior Behavior for the XML tag, or NULL if none of the behaviors has that tag.

◆ getDescriptor()

String sortie.data.funcgroups.BehaviorTypeBase.getDescriptor ( String  sParameterFileTag)

Gets the descriptor for a behavior based on its parameter file tag.

The behavior does not have to be instantiated.

Parameters
sParameterFileTagParameter file tag.
Returns
User-friendly descriptor.

◆ getEnabledGridObjects()

Grid [] sortie.data.funcgroups.BehaviorTypeBase.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.

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

◆ getGUIManager()

GUIManager sortie.data.funcgroups.BehaviorTypeBase.getGUIManager ( )
Returns
the GUIManager

◆ getName()

String sortie.data.funcgroups.BehaviorTypeBase.getName ( )

Returns the user-acceptable name for this object.

Returns
Name.

◆ mergeBooleans()

static boolean [] sortie.data.funcgroups.BehaviorTypeBase.mergeBooleans ( boolean []  p_oMergeOne,
boolean []  p_oMergeTwo 
)
static

Merges two boolean arrays and returns an array where there is a true in each array bucket where EITHER array is true.

If either array is null, the other array is returned. This will not make sure the arrays are the same length.

Parameters
p_oMergeOneFirst array to merge.
p_oMergeTwoSecond array to merge.
Returns
Merged array.

◆ removeBehavior()

void sortie.data.funcgroups.BehaviorTypeBase.removeBehavior ( Behavior  oBeh)

Removes a behavior from the instantiated list.

Parameters
oBehBehavior to remove.

◆ sortBehaviors()

void sortie.data.funcgroups.BehaviorTypeBase.sortBehaviors ( )

Sorts the behaviors by list position.

◆ validateData()

void sortie.data.funcgroups.BehaviorTypeBase.validateData ( TreePopulation  oPop) throws ModelException

Implements data checking.

This will be called after data has been set.

Parameters
oPopTreePopulation object.
Exceptions
ModelExceptionif data doesn't pass validation.

◆ writeBehaviorNodes()

void sortie.data.funcgroups.BehaviorTypeBase.writeBehaviorNodes ( BufferedWriter  out,
TreePopulation  oPop 
) throws ModelException

Writes behavior tags to the parameter file.

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

Parameters
outFile stream to write to.
oPopTree population object.
Exceptions
ModelExceptionif there is a problem writing the file.

◆ writeXML()

void sortie.data.funcgroups.BehaviorTypeBase.writeXML ( BufferedWriter  jOut,
TreePopulation  oPop 
) throws ModelException

Writes the XML data to a parameter file for the behaviors owned by this object.

Parameters
jOutFile stream to write to.
oPopTreePopulation object.
Exceptions
ModelExceptionif there is a problem writing the file or validating the data.

Member Data Documentation

◆ m_oManager

GUIManager sortie.data.funcgroups.BehaviorTypeBase.m_oManager
protected

GUIManager object.

◆ m_sName

String sortie.data.funcgroups.BehaviorTypeBase.m_sName
protected

User-consumable name for this object.

◆ mp_oAvailableBehaviors

ArrayList<BehaviorInstantiator> sortie.data.funcgroups.BehaviorTypeBase.mp_oAvailableBehaviors
protected

List of possible behaviors that can be created.

◆ mp_oInstantiatedBehaviors

ArrayList<Behavior> sortie.data.funcgroups.BehaviorTypeBase.mp_oInstantiatedBehaviors
protected

List of child behaviors currently selected for the run.

They are kept in the order in which they are arranged for the run.


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