Difference between revisions of "Handle different time periods"

From Heureka Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
[[Category:System design]]
+
[[Category:System design|Time periods]]
 
[[Category:Developer's guide]]
 
[[Category:Developer's guide]]
 
A <tt>Tree</tt> object contains values for all time periods treatments and growth prognosis has been made for. Those values that may change over time can be accessed both by an Array property and a regular property, such as <tt>DiameterArray</tt> and <tt>Diameter</tt>. With the regular property, the value in the current time period is retrieved; and via the array property the value in any time period can be retreived (the caller is responsible for bounds checking).
 
A <tt>Tree</tt> object contains values for all time periods treatments and growth prognosis has been made for. Those values that may change over time can be accessed both by an Array property and a regular property, such as <tt>DiameterArray</tt> and <tt>Diameter</tt>. With the regular property, the value in the current time period is retrieved; and via the array property the value in any time period can be retreived (the caller is responsible for bounds checking).

Latest revision as of 08:29, 26 May 2010

A Tree object contains values for all time periods treatments and growth prognosis has been made for. Those values that may change over time can be accessed both by an Array property and a regular property, such as DiameterArray and Diameter. With the regular property, the value in the current time period is retrieved; and via the array property the value in any time period can be retreived (the caller is responsible for bounds checking).

Increasing to the complexity is that some properties may change values due to a treatment. Diameter won't change by a treatment, but number of stems will. A property that may have different values before and after treatments also has a residual property (and a residual array property), e.g. Stems and StemsResidual.

Objects of type TreeCollection, PredictionUnit, and TreatmentUnit also contains values that change over time and due to treatments, but the values are stored in separate classes. Methods named such as GetBefore(int period) will get the value in a given period, while a property named Before will get the value in the current time period.

A special note should be made about the TreeCollection. The trees in the collection are sorted, but the sorting is only valid for the current time period. The TreeCollection provides InnerTreeCollections, which allows quick and easy access to all trees of a certain type (such as all saplings); but those collections can only be used in the current time period. For more information, see Handling of tree states

Through the TreatmentUnit, relevant information about time periods can be retrieved:

CurrentPeriod
Current time period (of course, each prediction unit and tree has the same current time period as the treatment unit)
PeriodLength
Period length, in years, from previous time period to current time period (5 if current period is 0)
GetPeriodLength(int period)
Period length in a given period (from the period before the given period to the given period)
Year
Relative year (period 0 => year 0) in current period
GetYear(int period)
Relative year in a given period
FindYear(int year)
Gets the period that corrensponds to the given relative year