javawrapper.PlantingBehaviors Class Reference

Manages planting behaviors and data. More...

Inheritance diagram for javawrapper.PlantingBehaviors:

javawrapper.BehaviorTypeBase javawrapper.WorkerBase

List of all members.

Public Member Functions

 PlantingBehaviors (GUIManager oManager)
 Constructor.
void ReadOldHarvestRegimeFile (String sFileName, Plot oPlot, TreePopulation oPop) throws ModelException
 Reads in an old tab-delimited harvest regime file.
void ValidateData (TreePopulation oPop) throws ModelException
 Validates the data prior to writing it.
void WriteXML (BufferedWriter jOut, TreePopulation oPop) throws ModelException
 Overridden because planting parameters are special.
void DoSetup (TreePopulation oPop) throws javawrapper.ModelException
 Sets up the planting results grid.
Vector< TableDataFormatDataForDisplay (TreePopulation oPop)
 Ensures data is not displayed in parameter window.
boolean SetVectorValueByXMLTag (String sXMLTag, String sXMLParentTag, Vector< String > p_oData, String[] p_sChildXMLTags, boolean[] p_bAppliesTo, Attributes oParentAttributes, Attributes[] p_oAttributes) throws ModelException
 Sets a data vector's value.
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 looks for the following tags:.
void ChangeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException
 Checks planting settings upon change of species.
void CopySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException
 Updates planting events when species are copied.
void ChangeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException
 Removes cells from planting events that are outside the plot.

Static Public Attributes

static final int GRIDDED = 1
 Gridded planting.
static final int RANDOM = 0
 Random planting.

Protected Member Functions

Vector< PlantingDataAddPlantingData (Vector< PlantingData > oList, PlantingData oNewPlanting) throws ModelException
 This adds the data contained in a PlantingData object to a list of planting data.

Protected Attributes

Vector< PlantingDatamp_oPlantings
 Our array of plantings.
ModelVector mp_fInitialDiam10
 List of diam10 values for newly planted trees - one for each species.


Detailed Description

Manages planting behaviors and data.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Institute of Ecosystem Studies

Author:
Lora E. Murphy
Version:
1.0

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)

Constructor & Destructor Documentation

javawrapper.PlantingBehaviors.PlantingBehaviors ( GUIManager  oManager  ) 

Constructor.

Parameters:
oManager GUIManager object.

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


Member Function Documentation

void javawrapper.PlantingBehaviors.ReadOldHarvestRegimeFile ( String  sFileName,
Plot  oPlot,
TreePopulation  oPop 
) throws ModelException

Reads in an old tab-delimited harvest regime file.

Any existing planting data will be replaced with what's in the file.

Parameters:
sFileName Filename of harvest regime file.
oPlot Plot object.
oPop TreePopulation object.
Exceptions:
ModelException Wrapping an IO exception, or if the harvest parameters do not match the currently loaded parameter file.

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

Vector<PlantingData> javawrapper.PlantingBehaviors.AddPlantingData ( Vector< PlantingData oList,
PlantingData  oNewPlanting 
) throws ModelException [protected]

This adds the data contained in a PlantingData object to a list of planting data.

If there is data to be added, it is compared to existing PlantingData objects on the list. If they match except for the grid cell, then the new object's grid cell is added to the existing object and the new object thrown away. If it is truly new data, it is added to the list.

IMPORTANT: This assumes that abundances will be in species order, as they should be if reading a harvest regime file.

Parameters:
oList The list of PlantingData objects to add to.
oNewPlanting The PlantingData object to add.
Returns:
The new list with the data added.
Exceptions:
ModelException Passing through underlying exceptions.

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

void javawrapper.PlantingBehaviors.ValidateData ( TreePopulation  oPop  )  throws ModelException [virtual]

Validates the data prior to writing it.

It causes all PlantingData objects to validate themselves.

Parameters:
oPop TreePopulation object
Exceptions:
ModelException if one of the data objects is not valid.

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

Implements javawrapper.WorkerBase.

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

Overridden because planting parameters are special.

Parameters:
jOut File to write to.
oPop TreePopulation object.
Exceptions:
ModelException if there's a problem writing the file.

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

Reimplemented from javawrapper.BehaviorTypeBase.

void javawrapper.PlantingBehaviors.DoSetup ( TreePopulation  oPop  )  throws javawrapper.ModelException [virtual]

Sets up the planting results grid.

Parameters:
oPop Tree population.
Exceptions:
javawrapper.ModelException If anything goes wrong.

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

Implements javawrapper.WorkerBase.

Vector<TableData> javawrapper.PlantingBehaviors.FormatDataForDisplay ( TreePopulation  oPop  ) 

Ensures data is not displayed in parameter window.

This behavior group has its own window for data entry.

Parameters:
oPop Not used.
Returns:
Null.

Reimplemented from javawrapper.WorkerBase.

boolean javawrapper.PlantingBehaviors.SetVectorValueByXMLTag ( String  sXMLTag,
String  sXMLParentTag,
Vector< String >  p_oData,
String[]  p_sChildXMLTags,
boolean[]  p_bAppliesTo,
Attributes  oParentAttributes,
Attributes[]  p_oAttributes 
) throws ModelException

Sets a data vector's value.

This function looks for the parent tag "pl_amountToPlant".

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.

Reimplemented from javawrapper.WorkerBase.

void javawrapper.PlantingBehaviors.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:

  • pl_applyToCell
  • pl_applyToSpecies
  • pl_plantEvent
Parameters:
sXMLTag The XML tag.
oAttributes The attributes of this object.
Exceptions:
ModelException if there is a problem reading this data.

Reimplemented from javawrapper.WorkerBase.

boolean javawrapper.PlantingBehaviors.SetSingleValueByXMLTag ( String  sXMLTag,
String  sXMLParentTag,
Attributes  oAttributes,
Object  oData 
) throws ModelException

This method looks for the following tags:.

  • pl_timestep
  • pl_spaceType
  • pl_distanceOrDensity
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, or if the cut type or cut type amount values are unrecognized.

Edit history:
------------------
May 24 2004: Created (LEM)

Reimplemented from javawrapper.WorkerBase.

void javawrapper.PlantingBehaviors.ChangeOfSpecies ( int  iOldNumSpecies,
int[]  p_iIndexer,
String[]  p_sNewSpecies 
) throws ModelException

Checks planting settings upon change of species.

This will remove any deleted species.

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 anything goes wrong (not thrown by this function).

Reimplemented from javawrapper.BehaviorTypeBase.

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

Updates planting events when species are copied.

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

Reimplemented from javawrapper.BehaviorTypeBase.

void javawrapper.PlantingBehaviors.ChangeOfPlotResolution ( float  fOldX,
float  fOldY,
float  fNewX,
float  fNewY 
) throws ModelException

Removes cells from planting events that are outside the plot.

Parameters:
fOldX float Old plot X length.
fOldY float Old plot Y length.
fNewX float New plot X length.
fNewY float New plot Y length.
Exceptions:
ModelException if anything goes wrong.

Reimplemented from javawrapper.WorkerBase.


Member Data Documentation

final int javawrapper.PlantingBehaviors.GRIDDED = 1 [static]

Gridded planting.

Matches old code enum value - important!

final int javawrapper.PlantingBehaviors.RANDOM = 0 [static]

Random planting.

Matches old code enum value - important!

Our array of plantings.

Initial value:

 new ModelVector(
      "Avg. diameter at 10 cm for new seedlings",
      "pl_initialDiam10",
      "pl_idVal", 0,
      ModelVector.FLOAT)
List of diam10 values for newly planted trees - one for each species.

Slope of growth response for each species


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

Generated on Tue Apr 19 13:59:44 2011 for SORTIE Java Interface by  doxygen 1.5.6