javawrapper.WorkerBase Class Reference

This class contains methods common to all objects that contain data. More...

Inheritance diagram for javawrapper.WorkerBase:

javawrapper.Allometry javawrapper.BehaviorTypeBase javawrapper.Plot javawrapper.TreePopulation javawrapper.AnalysisBehaviors javawrapper.DisperseBehaviors javawrapper.DisturbanceBehaviors javawrapper.EpiphyticEstablishmentBehaviors javawrapper.EstablishmentBehaviors javawrapper.GrowthBehaviors javawrapper.LightBehaviors javawrapper.MortalityBehaviors javawrapper.MortalityUtilitiesBehaviors javawrapper.OutputBehaviors javawrapper.PlantingBehaviors javawrapper.SeedPredationBehaviors javawrapper.SnagDynamicsBehaviors javawrapper.StateChangeBehaviors javawrapper.SubstrateBehaviors

List of all members.

Public Member Functions

String GetName ()
 Returns the user-acceptable name for this object.
abstract void DoSetup (TreePopulation oPop) throws ModelException
 Does any needed setup once the tree population object has data.
boolean GetAutoDisplayParameters ()
 Gets whether to auto-display this object's parameters.
String GetHelpID ()
 Gets this object's help ID, if it exists.
Vector< TableDataFormatDataForDisplay (TreePopulation oPop)
 Formats data for display in a set of JTables.
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)
 Whether this piece of data is used and should be written to an XML file.
void EndOfParameterFileRead ()
 Called at the end of the parameter file read process.
void SetVectorValues (ModelVector oData, Float[] p_fValuesToSet, boolean[] p_bAppliesTo)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, Float[] p_fValuesToSet)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, Double[] p_fValuesToSet, boolean[] p_bAppliesTo)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, Double[] p_fValuesToSet)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, Integer[] p_iValuesToSet, boolean[] p_bAppliesTo)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, String[] p_sValuesToSet)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, String[] p_sValuesToSet, boolean[] p_bAppliesTo)
 Sets the values for vector variables.
void SetVectorValues (ModelVector oData, Integer[] p_iValuesToSet)
 Sets the values for vector variables.
void SetVectorValues (ModelVector p_oData, Vector< String > p_oValuesToSet, boolean[] p_bAppliesTo) throws ModelException
 Sets the values for vector variables.
void MakeSureAllPositive (ModelVector oData, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of a vector are positive numbers (greater than zero).
void MakeSureAllPositive (ModelVector oData) throws ModelException
 Makes sure the elements of a vector are positive numbers (greater than zero).
void MakeSureAllNonNegative (ModelVector oData, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of a vector are non-negative numbers (greater than or equal to zero).
void MakeSureAllNonNegative (ModelVector oData) throws ModelException
 Makes sure the elements of a vector are non-negative numbers (greater than or equal to zero).
void MakeSureAllNonZero (ModelVector oData) throws ModelException
 Makes sure the elements of a vector are non-zero.
void MakeSureAllNonZero (ModelVector oData, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of a vector are non-zero numbers.
void MakeSureAllAreBounded (ModelVector oData, boolean[] p_bAppliesTo, float fLowerBound, float fUpperBound) throws ModelException
 Makes sure that all the values in a vector fall between two bounds.
void MakeSureAllPositive (Float[] p_fData, String sName, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of a float array are positive numbers (greater than zero).
void MakeSureAllPositive (Float[] p_fData, String sName) throws ModelException
 Makes sure the elements of a float array are positive numbers (greater than zero).
void MakeSureAllNonNegative (Float[] p_fData, String sName, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of a float array are non-negative numbers (greater than or equal to zero).
void MakeSureAllNonNegative (Float[] p_fData, String sName) throws ModelException
 Makes sure the elements of a float array are non-negative numbers (greater than or equal to zero).
void MakeSureAllPositive (Integer[] p_iData, String sName, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of an integer array are positive numbers (greater than zero).
void MakeSureAllPositive (Integer[] p_iData, String sName) throws ModelException
 Makes sure the elements of an integer array are positive numbers (greater than zero).
void MakeSureAllNonNegative (Integer[] p_iData, String sName, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the elements of an integer array are non-negative numbers (greater than or equal to zero).
void MakeSureAllNonNegative (Integer[] p_iData, String sName) throws ModelException
 Makes sure the elements of an integer array are non-negative numbers (greater than or equal to zero).
void MakeSureGreaterThan (ModelFloat oValue, float fLowerBound) throws ModelException
 Makes sure a value is greater than a certain value.
void MakeSureGreaterThanEqualTo (ModelFloat oValue, float fLowerBound) throws ModelException
 Makes sure a value is greater than or equal to a certain value.
void MakeSureGreaterThan (ModelInt oValue, float fLowerBound) throws ModelException
 Makes sure a value is greater than a certain value.
void MakeSureGreaterThanEqualTo (ModelInt oValue, float fLowerBound) throws ModelException
 Makes sure a value is greater than or equal to a certain value.
void MakeSureLessThan (ModelFloat oValue, float fUpperBound) throws ModelException
 Makes sure a value is less than a certain value.
void MakeSureLessThan (ModelInt oValue, float fUpperBound) throws ModelException
 Makes sure a value is less than a certain value.
void MakeSureLessThanEqualTo (ModelFloat oValue, float fUpperBound) throws ModelException
 Makes sure a value is less than or equal to a certain value.
void MakeSureLessThanEqualTo (ModelInt oValue, float fUpperBound) throws ModelException
 Makes sure a value is less than or equal to a certain value.
void MakeSureNotEqualTo (ModelFloat oValue, float fForbidden) throws ModelException
 Makes sure a value is not equal to another value.
void MakeSureNotEqualTo (ModelInt oValue, float fForbidden) throws ModelException
 Makes sure a value is not equal to another value.
void MakeSureIsBounded (ModelFloat oValue, float fLowerBound, float fUpperBound) throws ModelException
 Makes sure a value falls in an acceptable range.
void MakeSureIsBounded (ModelInt oValue, float fLowerBound, float fUpperBound) throws ModelException
 Makes sure a value falls in an acceptable range.
void MakeSureIsProportion (ModelFloat fValue) throws ModelException
 Makes sure a value is a proportion between 0 and 1 (inclusive).
void MakeSureAllAreProportions (ModelVector oData, boolean[] p_bAppliesTo) throws ModelException
 Makes sure the data in a vector are proportions between 0 and 1 (inclusive).
void MakeSureAllAreProportions (ModelVector oData) throws ModelException
 Makes sure all the data in a vector are proportions between 0 and 1 (inclusive).
void MakeSureRightSize (ModelVector oData, int iLength) throws ModelException
 Makes sure that a vector is of a certain size.
void WriteSpeciesSpecificValue (BufferedWriter jOut, ModelVector p_oData, TreePopulation oPop) throws java.io.IOException, ModelException
 Writes a set of species-specific float values to a parameter file.
void WriteSpeciesSpecificValue (BufferedWriter jOut, ModelVector p_oData, TreePopulation oPop, boolean[] p_bFlags) throws java.io.IOException, ModelException
 Writes a set of species-specific values to a parameter file for a certain subset of species.
void ReadDataFromDisplay (Vector< TableData > p_oData, TreePopulation oPop) throws ModelException
 Reads in data from the parameter display window.
abstract void ValidateData (TreePopulation oPop) throws ModelException
 Override this to implement data checking.
ModelData FindObjectByXMLTag (String sXMLTag)
 Finds an object based on its XML tag.
ModelData FindObjectByDescriptor (String sDescriptor)
 Finds an object based on its descriptor.
boolean SetSingleValueByXMLTag (String sXMLTag, String sXMLParentTag, Attributes oAttributes, Object oData) throws ModelException
 Sets a data object's value.
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.
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.
void ChangeOfSpeciesName (String sOldSpecies, String sNewSpecies) throws ModelException
 Performs any necessary tasks associated with changing the name of a species.
void ChangeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException
 Performs any tasks associated with a change of plot resolution.

Static Public Member Functions

static void WriteVectorValueToFile (BufferedWriter jOut, ModelVector p_oData) throws java.io.IOException
 Writes a vector of values that doesn't have anything to do with species.
static void WriteDataToFile (BufferedWriter ojOut, ModelData oData) throws java.io. IOException
 Writes a piece of data to an XML file.

Protected Member Functions

Object[][] FormatDataForTable (Object[][] p_oExisting, ModelFloat oToFormat)
 Formats and adds a value into an Object array suitable for placing in a JTable.
Object[][] FormatDataForTable (Object[][] p_oExisting, ModelInt oToFormat)
 Formats and adds a value into an Object array suitable for placing in a JTable.
Object[][] FormatDataForTable (Object[][] p_oExisting, ModelString oToFormat)
 Formats and adds a value into an Object array suitable for placing in a JTable.
Object[][] FormatDataForTable (Object[][] p_oExisting, ModelVector oToFormat)
 Formats a vector of values into an object array and adds it to another Object array suitable for placing in a JTable.
Object[][] FormatDataForTable (Object[][] p_oExisting, ModelVector oToFormat, boolean[] p_bWhichSpecies)
 Formats a vector of values into a plain vector suitable for placing in a JTable and adds it to a vector of vectors at the end.
Object[][] AddDataToArray (Object[][] p_oExistingArray, Object[] p_oAddArray)
 Adds an Object array to an existing Object array.
Object[] FormatSpeciesHeaderRow (boolean[] p_bUsed, TreePopulation oPop)
 Creates an object array of strings consisting of species names, suitable for including in the parameter entry table.
Object[] FormatBlankHeaderRow (Object[][] p_oTable)
 Creates a blank header row for a table.
Object[][] FormatDataAsComboBox (Object[][] p_oExisting, ModelEnum oToFormat)
 Adds a value with combo box formatting to an Object array for display in a JTable.
String FormatComboBoxString (ModelEnum oToFormat)
 Formats a combo box string from a ModelEnum.
void AddDataObjectToDisplayArrays (ModelData p_oDataObject, Vector< ModelData > p_oSingles, Vector< Vector< SpeciesSpecific >> p_oSpeciesSpecific, boolean[] p_bAppliesTo)
 Adds a data object to the arrays which will eventually display run parameters in a set of tables.
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.
boolean BoolArraysEqual (boolean[] p_bArrayOne, boolean[] p_bArrayTwo)
 Tests two boolean arrays for equality.
Vector< TableDataFormatTable (Vector< ModelData > p_oSingles, Vector< Vector< SpeciesSpecific >> p_oSpeciesSpecific, TreePopulation oPop)
 Turns vector groups of data objects into a set of tables for display.
void SetSingleValue (ModelData oDataMember, Object oData) throws ModelException
 Sets the value of a single data member.

Protected Attributes

GUIManager m_oManager
 GUIManager object.
String m_sName
 User-consumable name for this object.
String m_sXMLTag
 Highest-level XML tag for this object.
String m_sHelpID = ""
 ID of help topic.
Vector< ModelDatamp_oAllData
 All data for this object.
boolean m_bAutoDisplayParameters
 Whether or not to auto-display this object's parameters.

Package Functions

 WorkerBase (GUIManager oManager, String sName, String sXMLTag)
 Constructor.


Detailed Description

This class contains methods common to all objects that contain 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)
July 19, 2004: Added help ID (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)

Constructor & Destructor Documentation

javawrapper.WorkerBase.WorkerBase ( GUIManager  oManager,
String  sName,
String  sXMLTag 
) [package]

Constructor.

Parameters:
oManager GUIManager object
sName User-consumable name for this object.
sXMLTag Parent XML tag for all of this object's data


Member Function Documentation

String javawrapper.WorkerBase.GetName (  ) 

Returns the user-acceptable name for this object.

Returns:
Name.

abstract void javawrapper.WorkerBase.DoSetup ( TreePopulation  oPop  )  throws ModelException [pure virtual]

boolean javawrapper.WorkerBase.GetAutoDisplayParameters (  ) 

Gets whether to auto-display this object's parameters.

Returns:
Whether to auto-display parameters.

String javawrapper.WorkerBase.GetHelpID (  ) 

Gets this object's help ID, if it exists.

Returns:
The help ID, or "" if there is no help ID.

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

Formats data for display in a set of JTables.

For all required behaviors, their required data objects are placed in a table. Each element in the vector returned is one table to display, stored in a vector. Each single table vector's first element is an Object array with the header row for the table, and the second element is an Object[][] with the table's data. Data labels should be placed in the first array bucket.

This function operates by looking at each behavior. For each behavior which is enabled, its required data objects are added to a data vector. The vector is a vector of vectors where the data objects are grouped together by number of columns they require.

Once the sorted lists are in place, they are transformed to the table format and returned.

Parameters:
oPop TreePopulation object.
Returns:
Vector of vectors suitable for creating a set of JTables, or null if there is no data to display.

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

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

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

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

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

boolean javawrapper.WorkerBase.IsThisDataUsed ( ModelData  oData  ) 

Whether this piece of data is used and should be written to an XML file.

Override this if all data is not to be used.

Parameters:
oData Data to check.
Returns:
Always true.

Reimplemented in javawrapper.BehaviorTypeBase.

void javawrapper.WorkerBase.EndOfParameterFileRead (  ) 

Called at the end of the parameter file read process.

Override this to do anything at that point.

Reimplemented in javawrapper.EpiphyticEstablishmentBehaviors.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
Float[]  p_fValuesToSet,
boolean[]  p_bAppliesTo 
)

Sets the values for vector variables.

This method replaces values in the vector with the values passed, in the order in which they are in the array. Only those vector indexes for which p_bApplies = true at that same index are set.

Parameters:
oData Vector data variable to set.
p_fValuesToSet Array of values to put into the vector.
p_bAppliesTo Array of flags for which values should be set.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
Float[]  p_fValuesToSet 
)

Sets the values for vector variables.

This method replaces values in the vector with the values passed, in the order in which they are in the array.

Parameters:
oData Vector data variable to set.
p_fValuesToSet Array of values to put into the vector.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
Double[]  p_fValuesToSet,
boolean[]  p_bAppliesTo 
)

Sets the values for vector variables.

This method replaces values in the vector with the values passed, in the order in which they are in the array. Only those vector indexes for which p_bApplies = true at that same index are set.

Parameters:
oData Vector data variable to set.
p_fValuesToSet Array of values to put into the vector.
p_bAppliesTo Array of flags for which values should be set.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
Double[]  p_fValuesToSet 
)

Sets the values for vector variables.

This method replaces values in the vector with the values passed, in the order in which they are in the array.

Parameters:
oData Vector data variable to set.
p_fValuesToSet Array of values to put into the vector.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
Integer[]  p_iValuesToSet,
boolean[]  p_bAppliesTo 
)

Sets the values for vector variables.

This method replaces all values in the vector with the values passed, in the order in which they are in the array.

Parameters:
oData Vector data variable to set.
p_iValuesToSet Array of values to put into the vector.
p_bAppliesTo Array of flags for which values should be set.
Todo:
Make this reject the setting of values for non-int vectors.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
String[]  p_sValuesToSet 
)

Sets the values for vector variables.

This method replaces values in the vector with the values passed, in the order in which they are in the array.

Parameters:
oData Vector data variable to set.
p_sValuesToSet Array of values to put into the vector.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
String[]  p_sValuesToSet,
boolean[]  p_bAppliesTo 
)

Sets the values for vector variables.

This method replaces all values in the vector with the values passed, in the order in which they are in the array.

Parameters:
oData Vector data variable to set.
p_sValuesToSet Array of values to put into the vector.
p_bAppliesTo Array of flags for which values should be set.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  oData,
Integer[]  p_iValuesToSet 
)

Sets the values for vector variables.

This method replaces all values in the vector with the values passed, in the order in which they are in the array.

Parameters:
oData Vector data variable to set.
p_iValuesToSet Array of values to put into the vector.

void javawrapper.WorkerBase.SetVectorValues ( ModelVector  p_oData,
Vector< String >  p_oValuesToSet,
boolean[]  p_bAppliesTo 
) throws ModelException

Sets the values for vector variables.

The values in the vector which contains the values being assigned are cast to match the data types in the vector to which the values are being assigned. Only those vector indexes for which p_bApplies = true at that same index are set.

Parameters:
p_oData Vector data variable to set.
p_oValuesToSet Vector of values to put into the vector.
p_bAppliesTo Array of flags for which values should be set.
Exceptions:
ModelException if the values cannot be cast to the correct type and assigned.

void javawrapper.WorkerBase.MakeSureAllPositive ( ModelVector  oData,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of a vector are positive numbers (greater than zero).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
oData The vector to check.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any non-positive number values in the vector.

void javawrapper.WorkerBase.MakeSureAllPositive ( ModelVector  oData  )  throws ModelException

Makes sure the elements of a vector are positive numbers (greater than zero).

Parameters:
oData The vector to check.
Exceptions:
ModelException if there are any non-positive number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonNegative ( ModelVector  oData,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of a vector are non-negative numbers (greater than or equal to zero).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
oData The vector to check.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonNegative ( ModelVector  oData  )  throws ModelException

Makes sure the elements of a vector are non-negative numbers (greater than or equal to zero).

Parameters:
oData The vector to check.
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonZero ( ModelVector  oData  )  throws ModelException

Makes sure the elements of a vector are non-zero.

Parameters:
oData The vector to check.
Exceptions:
ModelException if there are any 0 values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonZero ( ModelVector  oData,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of a vector are non-zero numbers.

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
oData The vector to check.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureAllAreBounded ( ModelVector  oData,
boolean[]  p_bAppliesTo,
float  fLowerBound,
float  fUpperBound 
) throws ModelException

Makes sure that all the values in a vector fall between two bounds.

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
oData ModelVector Vector to check.
p_bAppliesTo boolean[] Set of flags for which values to check.
fLowerBound Float Minimum acceptable value.
fUpperBound Float Maximum acceptable value.
Exceptions:
ModelException If any value falls outside of the range.

void javawrapper.WorkerBase.MakeSureAllPositive ( Float[]  p_fData,
String  sName,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of a float array are positive numbers (greater than zero).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
p_fData The array to check.
sName The name of the vector, to put in the error message.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any non-positive number values in the vector.

void javawrapper.WorkerBase.MakeSureAllPositive ( Float[]  p_fData,
String  sName 
) throws ModelException

Makes sure the elements of a float array are positive numbers (greater than zero).

Parameters:
p_fData The array to check.
sName The name of the vector, to put in the error message.
Exceptions:
ModelException if there are any non-positive number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonNegative ( Float[]  p_fData,
String  sName,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of a float array are non-negative numbers (greater than or equal to zero).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
p_fData The array to check.
sName The name of the vector, to put in the error message.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonNegative ( Float[]  p_fData,
String  sName 
) throws ModelException

Makes sure the elements of a float array are non-negative numbers (greater than or equal to zero).

Parameters:
p_fData The array to check.
sName The name of the vector, to put in the error message.
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureAllPositive ( Integer[]  p_iData,
String  sName,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of an integer array are positive numbers (greater than zero).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
p_iData The array to check.
sName The name of the vector, to put in the error message.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any non-positive number values in the vector.

void javawrapper.WorkerBase.MakeSureAllPositive ( Integer[]  p_iData,
String  sName 
) throws ModelException

Makes sure the elements of an integer array are positive numbers (greater than zero).

Parameters:
p_iData The array to check.
sName The name of the vector, to put in the error message.
Exceptions:
ModelException if there are any non-positive number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonNegative ( Integer[]  p_iData,
String  sName,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the elements of an integer array are non-negative numbers (greater than or equal to zero).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
p_iData The array to check.
sName The name of the vector, to put in the error message.
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureAllNonNegative ( Integer[]  p_iData,
String  sName 
) throws ModelException

Makes sure the elements of an integer array are non-negative numbers (greater than or equal to zero).

Parameters:
p_iData The array to check.
sName The name of the vector, to put in the error message.
Exceptions:
ModelException if there are any negative number values in the vector.

void javawrapper.WorkerBase.MakeSureGreaterThan ( ModelFloat  oValue,
float  fLowerBound 
) throws ModelException

Makes sure a value is greater than a certain value.

Parameters:
oValue The value to check.
fLowerBound The value the test value must be greater than.
Exceptions:
ModelException if the value is not greater than fLowerBound.

void javawrapper.WorkerBase.MakeSureGreaterThanEqualTo ( ModelFloat  oValue,
float  fLowerBound 
) throws ModelException

Makes sure a value is greater than or equal to a certain value.

Parameters:
oValue The value to check.
fLowerBound The value the test value must be greater than or equal to.
Exceptions:
ModelException if the value is not greater than fLowerBound.

void javawrapper.WorkerBase.MakeSureGreaterThan ( ModelInt  oValue,
float  fLowerBound 
) throws ModelException

Makes sure a value is greater than a certain value.

Parameters:
oValue The value to check.
fLowerBound The value the test value must be greater than.
Exceptions:
ModelException if the value is not greater than fLowerBound.

void javawrapper.WorkerBase.MakeSureGreaterThanEqualTo ( ModelInt  oValue,
float  fLowerBound 
) throws ModelException

Makes sure a value is greater than or equal to a certain value.

Parameters:
oValue The value to check.
fLowerBound The value the test value must be greater than or equal to.
Exceptions:
ModelException if the value is not greater than fLowerBound.

void javawrapper.WorkerBase.MakeSureLessThan ( ModelFloat  oValue,
float  fUpperBound 
) throws ModelException

Makes sure a value is less than a certain value.

Parameters:
oValue The value to check.
fUpperBound The value the test value must be less than.
Exceptions:
ModelException if the value is not less than fUpperBound.

void javawrapper.WorkerBase.MakeSureLessThan ( ModelInt  oValue,
float  fUpperBound 
) throws ModelException

Makes sure a value is less than a certain value.

Parameters:
oValue The value to check.
fUpperBound The value the test value must be less than.
Exceptions:
ModelException if the value is not less than fUpperBound.

void javawrapper.WorkerBase.MakeSureLessThanEqualTo ( ModelFloat  oValue,
float  fUpperBound 
) throws ModelException

Makes sure a value is less than or equal to a certain value.

Parameters:
oValue The value to check.
fUpperBound The value the test value must be less than or equal to.
Exceptions:
ModelException if the value is not greater than fUpperBound.

void javawrapper.WorkerBase.MakeSureLessThanEqualTo ( ModelInt  oValue,
float  fUpperBound 
) throws ModelException

Makes sure a value is less than or equal to a certain value.

Parameters:
oValue The value to check.
fUpperBound The value the test value must be less than or equal to.
Exceptions:
ModelException if the value is not greater than fUpperBound.

void javawrapper.WorkerBase.MakeSureNotEqualTo ( ModelFloat  oValue,
float  fForbidden 
) throws ModelException

Makes sure a value is not equal to another value.

Parameters:
oValue The value to check.
fForbidden The value the test value cannot equal.
Exceptions:
ModelException if the value is equal to the specified value, within a very small number.

void javawrapper.WorkerBase.MakeSureNotEqualTo ( ModelInt  oValue,
float  fForbidden 
) throws ModelException

Makes sure a value is not equal to another value.

Parameters:
oValue The value to check.
fForbidden The value the test value cannot equal.
Exceptions:
ModelException if the value is equal to the specified value, within a very small number.

void javawrapper.WorkerBase.MakeSureIsBounded ( ModelFloat  oValue,
float  fLowerBound,
float  fUpperBound 
) throws ModelException

Makes sure a value falls in an acceptable range.

Parameters:
oValue The value to check.
fLowerBound float Minimum acceptable value.
fUpperBound float Maximum acceptable value.
Exceptions:
ModelException If any value falls outside of the range.

void javawrapper.WorkerBase.MakeSureIsBounded ( ModelInt  oValue,
float  fLowerBound,
float  fUpperBound 
) throws ModelException

Makes sure a value falls in an acceptable range.

Parameters:
oValue The value to check.
fLowerBound float Minimum acceptable value.
fUpperBound float Maximum acceptable value.
Exceptions:
ModelException If any value falls outside of the range.

void javawrapper.WorkerBase.MakeSureIsProportion ( ModelFloat  fValue  )  throws ModelException

Makes sure a value is a proportion between 0 and 1 (inclusive).

Parameters:
fValue Value to check.
Exceptions:
ModelException if the value is not a valid proportion.

void javawrapper.WorkerBase.MakeSureAllAreProportions ( ModelVector  oData,
boolean[]  p_bAppliesTo 
) throws ModelException

Makes sure the data in a vector are proportions between 0 and 1 (inclusive).

Only those indexes for which p_bAppliesTo = true at the same index are checked.

Parameters:
oData Vector to check
p_bAppliesTo Set of flags for which values to check
Exceptions:
ModelException if any value in the vector is not a valid proportion.

void javawrapper.WorkerBase.MakeSureAllAreProportions ( ModelVector  oData  )  throws ModelException

Makes sure all the data in a vector are proportions between 0 and 1 (inclusive).

Parameters:
oData Vector to check
Exceptions:
ModelException if any value in the vector is not a valid proportion.

void javawrapper.WorkerBase.MakeSureRightSize ( ModelVector  oData,
int  iLength 
) throws ModelException

Makes sure that a vector is of a certain size.

Parameters:
oData Vector to validate.
iLength Expected length.
Exceptions:
ModelException if the vector is not of the correct length.

void javawrapper.WorkerBase.WriteSpeciesSpecificValue ( BufferedWriter  jOut,
ModelVector  p_oData,
TreePopulation  oPop 
) throws java.io.IOException, ModelException

Writes a set of species-specific float values to a parameter file.

Parameters:
jOut 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

Reimplemented in javawrapper.BehaviorTypeBase.

void javawrapper.WorkerBase.WriteSpeciesSpecificValue ( BufferedWriter  jOut,
ModelVector  p_oData,
TreePopulation  oPop,
boolean[]  p_bFlags 
) throws java.io.IOException, ModelException

Writes a set of species-specific values to a parameter file for a certain subset of species.

If none of the species are enabled, nothing is written.

Parameters:
jOut The file to write to.
p_oData The vector of data pieces. It should be sized to equal the total number of species, even if it doesn't have values for them all. Each piece of data for a species should be at the element index corresponding to the species number.
oPop Tree population object to get species names
p_bFlags An array, sized total number of species; for each species number, whether or not to include data for the species in question.
Exceptions:
java.io.IOException Passes on exceptions from FileWriter
ModelException Passes on from TreePopulation

static void javawrapper.WorkerBase.WriteVectorValueToFile ( BufferedWriter  jOut,
ModelVector  p_oData 
) throws java.io.IOException [static]

Writes a vector of values that doesn't have anything to do with species.

Parameters:
jOut The file to write to.
p_oData The vector of data pieces.
Exceptions:
java.io.IOException Passes on exceptions from FileWriter

static void javawrapper.WorkerBase.WriteDataToFile ( BufferedWriter  ojOut,
ModelData  oData 
) throws java.io. IOException [static]

Writes a piece of data to an XML file.

If the string value is an empty string, nothing is written. This is static because I needed this particular method to be static. But it's a good idea for other methods as well - maybe I should move all of them to a separate static class? Or move this to ModelData?

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

Object [][] javawrapper.WorkerBase.FormatDataForTable ( Object  p_oExisting[][],
ModelFloat  oToFormat 
) [protected]

Formats and adds a value into an Object array suitable for placing in a JTable.

The new array is formed by taking the descriptor and putting it into the first position, and then putting the value in the next position.

Parameters:
p_oExisting The existing Object array to add to.
oToFormat The object to format.
Returns:
Object array suitable for placing in a JTable.

Object [][] javawrapper.WorkerBase.FormatDataForTable ( Object  p_oExisting[][],
ModelInt  oToFormat 
) [protected]

Formats and adds a value into an Object array suitable for placing in a JTable.

The new array is formed by taking the descriptor and putting it into the first position, and then putting the value in the next position.

Parameters:
p_oExisting The existing Object array to add to.
oToFormat The object to format.
Returns:
Object array suitable for placing in a JTable.

Object [][] javawrapper.WorkerBase.FormatDataForTable ( Object  p_oExisting[][],
ModelString  oToFormat 
) [protected]

Formats and adds a value into an Object array suitable for placing in a JTable.

The new array is formed by taking the descriptor and putting it into the first position, and then putting the value in the next position.

Parameters:
p_oExisting The existing Object array to add to.
oToFormat The object to format.
Returns:
Object array suitable for placing in a JTable.

Object [][] javawrapper.WorkerBase.FormatDataForTable ( Object  p_oExisting[][],
ModelVector  oToFormat 
) [protected]

Formats a vector of values into an object array and adds it to another Object array suitable for placing in a JTable.

The descriptor is placed in the first bucket of the new vector and all subsequent values in order after that.

Parameters:
p_oExisting The existing Object array to add to.
oToFormat The object to format.
Returns:
Object array suitable for placing in a JTable.

Object [][] javawrapper.WorkerBase.FormatDataForTable ( Object  p_oExisting[][],
ModelVector  oToFormat,
boolean[]  p_bWhichSpecies 
) [protected]

Formats a vector of values into a plain vector suitable for placing in a JTable and adds it to a vector of vectors at the end.

No headers are created. The descriptor is placed in the first bucket of the new vector and all subsequent values in order after that.

Parameters:
p_oExisting The existing Object array to add to.
oToFormat The object to format.
p_bWhichSpecies Boolean of whether or not each species should be added. If false for a species, the value at that Vector index is not added.
Returns:
Object array suitable for placing in a JTable.

Object [][] javawrapper.WorkerBase.AddDataToArray ( Object  p_oExistingArray[][],
Object[]  p_oAddArray 
) [protected]

Adds an Object array to an existing Object array.

The new array is added at the end. If the existing array is null, it will be created.

Parameters:
p_oExistingArray Object array to add to.
p_oAddArray Array to add.
Returns:
The new Object array.

Object [] javawrapper.WorkerBase.FormatSpeciesHeaderRow ( boolean[]  p_bUsed,
TreePopulation  oPop 
) [protected]

Creates an object array of strings consisting of species names, suitable for including in the parameter entry table.

The species will be in order, skipping over any positions in p_bUsed which are false. The first position in the array is blank.

Parameters:
p_bUsed Array of which species to include, in species number order.
oPop TreePopulation object.
Returns:
Object array of species names, or null if no species are to be used.

Object [] javawrapper.WorkerBase.FormatBlankHeaderRow ( Object  p_oTable[][]  )  [protected]

Creates a blank header row for a table.

It will be sized the same size as the size of the array in the first array position.

Parameters:
p_oTable The table for which to create the blank header row.
Returns:
The blank header row.

Object [][] javawrapper.WorkerBase.FormatDataAsComboBox ( Object  p_oExisting[][],
ModelEnum  oToFormat 
) [protected]

Adds a value with combo box formatting to an Object array for display in a JTable.

The formatting consists of some special characters in a text string that our parameter display code will recognize as setup for a combo box.

Parameters:
p_oExisting Object array to add to.
oToFormat Value to add.
Returns:
Object array with new value added.

String javawrapper.WorkerBase.FormatComboBoxString ( ModelEnum  oToFormat  )  [protected]

Formats a combo box string from a ModelEnum.

The formatting consists of some special characters in a text string that our parameter display code will recognize as setup for a combo box.

Parameters:
oToFormat ModelEnum to format.
Returns:
Formatted string.

void javawrapper.WorkerBase.ReadDataFromDisplay ( Vector< TableData p_oData,
TreePopulation  oPop 
) throws ModelException

Reads in data from the parameter display window.

The format of the incoming data is the same as that which originally went jOut to be displayed in a table - a vector of vectors, with each child vector representing one table with an Object[] array header as the first element and an Object[][] array of data as the second.

Parameters:
p_oData Data to read in.
oPop TreePopulation object.
Exceptions:
ModelException if the data cannot be read into the object.

Reimplemented in javawrapper.Plot.

abstract void javawrapper.WorkerBase.ValidateData ( TreePopulation  oPop  )  throws ModelException [pure virtual]

void javawrapper.WorkerBase.AddDataObjectToDisplayArrays ( ModelData  p_oDataObject,
Vector< ModelData p_oSingles,
Vector< Vector< SpeciesSpecific >>  p_oSpeciesSpecific,
boolean[]  p_bAppliesTo 
) [protected]

Adds a data object to the arrays which will eventually display run parameters in a set of tables.

There are two possible vectors to which to add the data object - one grouping single values, and other grouping groups of species-specific values according to the species they require.

When a new data object is to be added to the list, the first thing to do is see if it's already there. If it is, and it's not species-specific, it's not added again. If it is species-specific, the species to which it applies are merged with the existing list and it is re-grouped if necessary.

Parameters:
p_oDataObject Data object to add
p_oSingles Set of single values
p_oSpeciesSpecific Set of species-specific values
p_bAppliesTo If this is a species-specific value, what it applies to

boolean [] javawrapper.WorkerBase.MergeBooleans ( boolean[]  p_oMergeOne,
boolean[]  p_oMergeTwo 
) [protected]

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_oMergeOne First array to merge.
p_oMergeTwo Second array to merge.
Returns:
Merged array.

boolean javawrapper.WorkerBase.BoolArraysEqual ( boolean[]  p_bArrayOne,
boolean[]  p_bArrayTwo 
) [protected]

Tests two boolean arrays for equality.

Equality is defined as having the same value in each array bucket.

Parameters:
p_bArrayOne First array.
p_bArrayTwo Second array.
Returns:
true if the arrays are equal, false if they are not.

Vector<TableData> javawrapper.WorkerBase.FormatTable ( Vector< ModelData p_oSingles,
Vector< Vector< SpeciesSpecific >>  p_oSpeciesSpecific,
TreePopulation  oPop 
) [protected]

Turns vector groups of data objects into a set of tables for display.

Parameters:
p_oSingles Single values.
p_oSpeciesSpecific Vector of vectors of species-specific values grouped together by what species they apply to.
oPop TreePopulation object.
Returns:
Vector of tables for display.

ModelData javawrapper.WorkerBase.FindObjectByXMLTag ( String  sXMLTag  ) 

Finds an object based on its XML tag.

Parameters:
sXMLTag XML tag for the object.
Returns:
ModelData object corresponding to the XML tag, or null if no such object is found.

ModelData javawrapper.WorkerBase.FindObjectByDescriptor ( String  sDescriptor  ) 

Finds an object based on its descriptor.

Parameters:
sDescriptor Descriptor for the object.
Returns:
ModelData object corresponding to the descriptor, or null if no such object is found.

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

Sets a data object's value.

Override this to add functionality.

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, either a String or a type 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.

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

void javawrapper.WorkerBase.SetSingleValue ( ModelData  oDataMember,
Object  oData 
) throws ModelException [protected]

Sets the value of a single data member.

The value to set is cast to the proper type.

Parameters:
oDataMember Data member to set.
oData Data value to set into data member.
Exceptions:
ModelException if data is of the wrong type.

Reimplemented in javawrapper.SubstrateBehaviors.

boolean javawrapper.WorkerBase.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.

Override this to add functionality.

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 in javawrapper.LightBehaviors, javawrapper.OutputBehaviors, javawrapper.PlantingBehaviors, and javawrapper.TreePopulation.

void javawrapper.WorkerBase.ReadXMLParentTag ( String  sXMLTag,
Attributes  oAttributes 
) throws ModelException

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

Normally this data would be ignored, but this can be overridden if there is special XML to be captured.

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

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

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

Triggered when there is a change in the species list.

This goes through everything in the mp_oAllData array. Any piece of data of type ModelVector which is species-specific is transformed. The ModelVector will be re-sized to match the new number of species. Any species that are the same from the old set to the new have their data transferred to their new array index. Any new species indexes are set to null. Any species which were deleted have their data lost.

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.

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

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

Copies one species to another.

This makes sure all species-specific vectors are updated.

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

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

void javawrapper.WorkerBase.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:
sOldSpecies String Old name of the species, with underscores instead of spaces (like the species names would come from the tree population)
sNewSpecies String New name of the species, with underscores instead of spaces (like the species names would come from the tree population)
Exceptions:
ModelException if there is a problem.

Reimplemented in javawrapper.Allometry, javawrapper.GrowthBehaviors, javawrapper.MortalityBehaviors, and javawrapper.SeedPredationBehaviors.

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

Performs any tasks associated with a change of plot resolution.

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 in javawrapper.DisturbanceBehaviors, javawrapper.OutputBehaviors, and javawrapper.PlantingBehaviors.


Member Data Documentation

GUIManager object.

String javawrapper.WorkerBase.m_sName [protected]

User-consumable name for this object.

Highest-level XML tag for this object.

String javawrapper.WorkerBase.m_sHelpID = "" [protected]

ID of help topic.

All data for this object.

It should be placed in the order in which it should be written in XML.

Whether or not to auto-display this object's parameters.


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

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