SORTIE Java Interface  1
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
sortie.data.funcgroups.Grid Class Reference

This class represents grids in the core model. More...

Public Member Functions

 Grid (String sGridName, DataMember[] p_oMembers, DataMember[] p_oPackageMembers, float fXCellLength, float fYCellLength)
 Constructor. More...
 
boolean getIsEdited ()
 Get whether or not the grid has been edited. More...
 
int getFloatCode (String sCodeName)
 Gets the code for a float data member. More...
 
int getIntCode (String sCodeName)
 Gets the code for an int data member. More...
 
int getBoolCode (String sCodeName)
 Gets the code for a bool data member. More...
 
int getCharCode (String sCodeName)
 Gets the code for a char data member. More...
 
int getFloatPackageCode (String sCodeName)
 Gets the code for a float package data member. More...
 
int getIntPackageCode (String sCodeName)
 Gets the code for an int package data member. More...
 
int getBoolPackageCode (String sCodeName)
 Gets the code for a bool package data member. More...
 
int getCharPackageCode (String sCodeName)
 Gets the code for a char package data member. More...
 
void setGridFloatCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a float data member. More...
 
void setGridIntCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for an int data member. More...
 
void setGridCharCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a char data member. More...
 
void setGridBoolCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a bool data member. More...
 
void setGridPackageFloatCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a package float data member. More...
 
void setGridPackageIntCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a package integer data member. More...
 
void setGridPackageCharCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a package char data member. More...
 
void setGridPackageBoolCode (String sDataMember, int iIndex) throws ModelException
 Sets the XML grid map code for a package bool data member. More...
 
void setGridValue (int iX, int iY, int iCode, Integer iValue, Plot oPlot) throws ModelException
 Sets a grid map integer value. More...
 
void setGridValue (int iX, int iY, int iCode, Float fValue, Plot oPlot) throws ModelException
 Sets a grid map float value. More...
 
void setGridValue (int iX, int iY, int iCode, String sValue, Plot oPlot) throws ModelException
 Sets a grid map char value. More...
 
void setGridValue (int iX, int iY, int iCode, Boolean bValue, Plot oPlot) throws ModelException
 Sets a grid map bool value. More...
 
void setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, Integer iValue, Plot oPlot) throws ModelException
 Sets a grid map package integer value. More...
 
void setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, Float fValue, Plot oPlot) throws ModelException
 Sets a grid map package float value. More...
 
void setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, String sValue, Plot oPlot) throws ModelException
 Sets a grid map package char value. More...
 
void setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, Boolean bValue, Plot oPlot) throws ModelException
 Sets a grid map package bool value. More...
 
String getName ()
 Gets the grid's name. More...
 
void setGridName (String sGridName)
 Sets the grid's name. More...
 
float getXCellLength ()
 Gets the X cell length for this grid. More...
 
float getYCellLength ()
 Gets the Y cell length for this grid. More...
 
void setXCellLength (float fXCellLength) throws ModelException
 Sets the length of cells in the X direction. More...
 
void setYCellLength (float fYCellLength) throws ModelException
 Sets the length of cells in the Y direction. More...
 
void clearMapValues ()
 Erases all current grid map values without touching any other settings. More...
 
DataMember [] getDataMembers ()
 Gets the list of data members. More...
 
void setDataMembers (DataMember[] p_oMembers, DataMember[] p_oPackageMembers) throws ModelException
 Sets the list of data members. More...
 
DataMember [] getPackageDataMembers ()
 Gets the list of package data members. More...
 
void writeXML (BufferedWriter oOut, Plot oPlot) throws ModelException
 Writes the grid's XML grid map to a file. More...
 
boolean isEdited ()
 Whether this grid has been edited. More...
 

Public Attributes

DataMember [] mp_oDataMembers
 This is a list of the data members in a grid and thus available for saving in detailed output files etc. More...
 
String [] mp_sIntDataMembers
 Code names of int data members. More...
 
ArrayList< GridValuemp_oGridVals = new ArrayList<GridValue>(0)
 Holds GridValue objects to be written to a grid map. More...
 

Protected Member Functions

PackageGridValue getPackageGridValue (GridValue oCell, int iPackageIndex) throws ModelException
 Finds a requested package for a grid cell, or creates a new one if it does not already exist. More...
 
GridValue getGridValue (int iX, int iY, Plot oPlot) throws ModelException
 Finds a requested grid cell, or creates a new one if it does not already exist. More...
 

Protected Attributes

String m_sGridName
 This is the grid's name - it should match the one in the code. More...
 
float m_fLengthXCells
 Length of cells in the X direction - optional. More...
 
boolean m_bEdited = false
 Whether or not this grid has been edited. More...
 
ArrayList< Integer > mp_iGridIntTransforms
 Index position for integer data members. More...
 

Private Member Functions

void organizeDataMembers (DataMember[] p_oMembers, DataMember[] p_oPackageMembers)
 This function takes arrays of data members and assigns them into the data member name list arrays. More...
 

Detailed Description

This class represents grids in the core model.

Objects of this class control data saving for grids.

This will keep track of a custom cell length in the X and Y directions. It is possible to change this at any time, but results could be disastrous if there is existing grid map data; it will not be updated to reflect the change.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Cary 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)
August 11, 2011: made a notification of changes to the parent object (LEM)

Constructor & Destructor Documentation

◆ Grid()

sortie.data.funcgroups.Grid.Grid ( String  sGridName,
DataMember []  p_oMembers,
DataMember []  p_oPackageMembers,
float  fXCellLength,
float  fYCellLength 
)

Constructor.

Parameters
p_oMembersThe data members for this grid.
p_oPackageMembersThe package data members for this grid, or NULL if there are no package data members.
sGridNameThe name of the grid. This should match the name of the grid in the code.
fXCellLengthLength of cells in the X direction, in m
fYCellLengthLength of cells in the Y direction, in m

Member Function Documentation

◆ clearMapValues()

void sortie.data.funcgroups.Grid.clearMapValues ( )

Erases all current grid map values without touching any other settings.

◆ getBoolCode()

int sortie.data.funcgroups.Grid.getBoolCode ( String  sCodeName)

Gets the code for a bool data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getBoolPackageCode()

int sortie.data.funcgroups.Grid.getBoolPackageCode ( String  sCodeName)

Gets the code for a bool package data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getCharCode()

int sortie.data.funcgroups.Grid.getCharCode ( String  sCodeName)

Gets the code for a char data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getCharPackageCode()

int sortie.data.funcgroups.Grid.getCharPackageCode ( String  sCodeName)

Gets the code for a char package data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getDataMembers()

DataMember [] sortie.data.funcgroups.Grid.getDataMembers ( )

Gets the list of data members.

Returns
The list of data members.

◆ getFloatCode()

int sortie.data.funcgroups.Grid.getFloatCode ( String  sCodeName)

Gets the code for a float data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getFloatPackageCode()

int sortie.data.funcgroups.Grid.getFloatPackageCode ( String  sCodeName)

Gets the code for a float package data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getGridValue()

GridValue sortie.data.funcgroups.Grid.getGridValue ( int  iX,
int  iY,
Plot  oPlot 
) throws ModelException
protected

Finds a requested grid cell, or creates a new one if it does not already exist.

Parameters
iXX grid coordinate.
iYY grid coordinate.
oPlotPlot object.
Returns
GridValue object.
Exceptions
ModelExceptionif the coordinates are invalid.

◆ getIntCode()

int sortie.data.funcgroups.Grid.getIntCode ( String  sCodeName)

Gets the code for an int data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getIntPackageCode()

int sortie.data.funcgroups.Grid.getIntPackageCode ( String  sCodeName)

Gets the code for an int package data member.

Parameters
sCodeNameString Code name (NOT display name) of data member.
Returns
int Code, or -1 if the name is not recognized.

◆ getIsEdited()

boolean sortie.data.funcgroups.Grid.getIsEdited ( )

Get whether or not the grid has been edited.

Returns
Whether or not the grid has been edited.

◆ getName()

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

Gets the grid's name.

Returns
The name.

◆ getPackageDataMembers()

DataMember [] sortie.data.funcgroups.Grid.getPackageDataMembers ( )

Gets the list of package data members.

Returns
The list of package data members, or NULL if there are no separate package data members.

◆ getPackageGridValue()

PackageGridValue sortie.data.funcgroups.Grid.getPackageGridValue ( GridValue  oCell,
int  iPackageIndex 
) throws ModelException
protected

Finds a requested package for a grid cell, or creates a new one if it does not already exist.

Parameters
oCellCell for which to get the package.
iPackageIndexIndex of the package to get in the package list of the cell, starting at 0.
Returns
PackageGridValue object.
Exceptions
ModelExceptionif the coordinates are invalid, or if the package index is higher than 1 + the number of packages already in the cell.

◆ getXCellLength()

float sortie.data.funcgroups.Grid.getXCellLength ( )

Gets the X cell length for this grid.

Returns
X cell length, in meters.

◆ getYCellLength()

float sortie.data.funcgroups.Grid.getYCellLength ( )

Gets the Y cell length for this grid.

Returns
Y cell length, in meters.

◆ isEdited()

boolean sortie.data.funcgroups.Grid.isEdited ( )

Whether this grid has been edited.

Returns
the m_bEdited

◆ organizeDataMembers()

void sortie.data.funcgroups.Grid.organizeDataMembers ( DataMember []  p_oMembers,
DataMember []  p_oPackageMembers 
)
private

This function takes arrays of data members and assigns them into the data member name list arrays.

Parameters
p_oMembersThe data members for this grid.
p_oPackageMembersThe package data members for this grid, or NULL if there are no package data members.

◆ setDataMembers()

void sortie.data.funcgroups.Grid.setDataMembers ( DataMember []  p_oMembers,
DataMember []  p_oPackageMembers 
) throws ModelException

Sets the list of data members.

This ensures that maps are updated appropriately.

Parameters
p_oMembersThe list of data members to set. Can be null.
p_oPackageMembersThe list of package members to set. Can be null.

◆ setGridBoolCode()

void sortie.data.funcgroups.Grid.setGridBoolCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a bool data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridCharCode()

void sortie.data.funcgroups.Grid.setGridCharCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a char data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridFloatCode()

void sortie.data.funcgroups.Grid.setGridFloatCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a float data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridIntCode()

void sortie.data.funcgroups.Grid.setGridIntCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for an int data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridName()

void sortie.data.funcgroups.Grid.setGridName ( String  sGridName)

Sets the grid's name.

Parameters
sGridNameThe name.

◆ setGridPackageBoolCode()

void sortie.data.funcgroups.Grid.setGridPackageBoolCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a package bool data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridPackageCharCode()

void sortie.data.funcgroups.Grid.setGridPackageCharCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a package char data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridPackageFloatCode()

void sortie.data.funcgroups.Grid.setGridPackageFloatCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a package float data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridPackageIntCode()

void sortie.data.funcgroups.Grid.setGridPackageIntCode ( String  sDataMember,
int  iIndex 
) throws ModelException

Sets the XML grid map code for a package integer data member.

Parameters
sDataMemberData member code name.
iIndexCode number.
Exceptions
ModelExceptionif the data member isn't recognized.

◆ setGridPackageValue() [1/4]

void sortie.data.funcgroups.Grid.setGridPackageValue ( int  iX,
int  iY,
int  iPackageIndex,
int  iCode,
Integer  iValue,
Plot  oPlot 
) throws ModelException

Sets a grid map package integer value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iPackageIndexPackage index number.
iCodeIndex at which to set the value.
iValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridPackageValue() [2/4]

void sortie.data.funcgroups.Grid.setGridPackageValue ( int  iX,
int  iY,
int  iPackageIndex,
int  iCode,
Float  fValue,
Plot  oPlot 
) throws ModelException

Sets a grid map package float value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iPackageIndexPackage index number.
iCodeIndex at which to set the value.
fValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridPackageValue() [3/4]

void sortie.data.funcgroups.Grid.setGridPackageValue ( int  iX,
int  iY,
int  iPackageIndex,
int  iCode,
String  sValue,
Plot  oPlot 
) throws ModelException

Sets a grid map package char value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iPackageIndexPackage index number.
iCodeIndex at which to set the value.
sValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridPackageValue() [4/4]

void sortie.data.funcgroups.Grid.setGridPackageValue ( int  iX,
int  iY,
int  iPackageIndex,
int  iCode,
Boolean  bValue,
Plot  oPlot 
) throws ModelException

Sets a grid map package bool value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iPackageIndexPackage index number.
iCodeIndex at which to set the value.
bValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridValue() [1/4]

void sortie.data.funcgroups.Grid.setGridValue ( int  iX,
int  iY,
int  iCode,
Integer  iValue,
Plot  oPlot 
) throws ModelException

Sets a grid map integer value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iCodeIndex at which to set the value.
iValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridValue() [2/4]

void sortie.data.funcgroups.Grid.setGridValue ( int  iX,
int  iY,
int  iCode,
Float  fValue,
Plot  oPlot 
) throws ModelException

Sets a grid map float value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iCodeIndex at which to set the value.
fValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridValue() [3/4]

void sortie.data.funcgroups.Grid.setGridValue ( int  iX,
int  iY,
int  iCode,
String  sValue,
Plot  oPlot 
) throws ModelException

Sets a grid map char value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iCodeIndex at which to set the value.
sValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setGridValue() [4/4]

void sortie.data.funcgroups.Grid.setGridValue ( int  iX,
int  iY,
int  iCode,
Boolean  bValue,
Plot  oPlot 
) throws ModelException

Sets a grid map bool value.

This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.

Parameters
iXX grid cell coordinate.
iYY grid cell coordinate.
iCodeIndex at which to set the value.
bValueValue to set.
oPlotPlot object.
Exceptions
ModelException

◆ setXCellLength()

void sortie.data.funcgroups.Grid.setXCellLength ( float  fXCellLength) throws ModelException

Sets the length of cells in the X direction.

If the length of Y is 0, it will be set to the same value.

Parameters
fXCellLengthLength of cells in the X direction, in meters.
Exceptions
ModelExceptionIf the value is negative.

◆ setYCellLength()

void sortie.data.funcgroups.Grid.setYCellLength ( float  fYCellLength) throws ModelException

Sets the length of cells in the Y direction.

If the length of X is 0, it will be set to the same value.

Parameters
fYCellLengthLength of cells in the Y direction, in meters.
Exceptions
ModelExceptionIf the value is negative.

◆ writeXML()

void sortie.data.funcgroups.Grid.writeXML ( BufferedWriter  oOut,
Plot  oPlot 
) throws ModelException

Writes the grid's XML grid map to a file.

If there are no grid map values, this will not write anything.

Parameters
oOutFile stream to write to.
oPlotPlot object.
Exceptions
ModelExceptionif there is something wrong with the file.

Member Data Documentation

◆ m_bEdited

boolean sortie.data.funcgroups.Grid.m_bEdited = false
protected

Whether or not this grid has been edited.

◆ m_fLengthXCells

float sortie.data.funcgroups.Grid.m_fLengthXCells
protected

Length of cells in the X direction - optional.

◆ m_sGridName

String sortie.data.funcgroups.Grid.m_sGridName
protected

This is the grid's name - it should match the one in the code.

◆ mp_iGridIntTransforms

ArrayList<Integer> sortie.data.funcgroups.Grid.mp_iGridIntTransforms
protected

Index position for integer data members.

Vector position equals the data member position in the map being read, and vector value is the index for GridValue.

◆ mp_oDataMembers

DataMember [] sortie.data.funcgroups.Grid.mp_oDataMembers

This is a list of the data members in a grid and thus available for saving in detailed output files etc.

◆ mp_oGridVals

ArrayList<GridValue> sortie.data.funcgroups.Grid.mp_oGridVals = new ArrayList<GridValue>(0)

Holds GridValue objects to be written to a grid map.

◆ mp_sIntDataMembers

String [] sortie.data.funcgroups.Grid.mp_sIntDataMembers

Code names of int data members.


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