Difference between revisions of "Handle different time periods"

From Heureka Wiki
Jump to navigation Jump to search
(Created page with '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 A�?�')
 
Line 9: Line 9:
 
Through the <tt>TreatmentUnit</tt>, relevant information about time periods can be retrieved:
 
Through the <tt>TreatmentUnit</tt>, relevant information about time periods can be retrieved:
  
innehåller också värden som förändras över tiden, men dessa lagras i separata klasser. På samma sätt här finns både metoder och properties för att hämta värdet i aktuell period eller i en specifik period, samt före och efter åtgärd.
+
;<tt>CurrentPeriod</tt>: Current time period (of course, each prediction unit and tree has the same current time period as the treatment unit)
Periodlängden är vanligtvis fem år men kan faktiskt variera så det går inte att förutsätta femårsperioder. Relevant information om perioder kan hämtas via TreatmentUnit:
+
;<tt>PeriodLength</tt>: Period length, in years, from previous time period to current time period (5 if current period is 0)
;CurrentPeriod: Current time period (of course, each prediction unit and tree has the same current time period as the treatment unit)
+
;<tt>GetPeriodLength(int period)</tt>: Period length in a given period (from the period before the given period to the given period)
;PeriodLength: Period length, in years, from previous time period to current time period (5 if current period is 0)
+
;<tt>Year</tt>: Relative year (period 0 => year 0) in current period
;GetPeriodLength(int period): Period length in a given period (from the period before periodlängd i en specifik period (från period innan till den givna perioden)
+
;<tt>GetYear(int period)</tt>: Relative year in a given period
Year Relativt år (period 0 = år 0), i aktuell period
+
;<tt>FindYear(int year)</tt>: Gets the period that corrensponds to the given relative year
GetYear(int period) Relativt år i en specifik period
 
FindYear(int year) Returnerar den period som motsvarar givet relativt år.
 

Revision as of 11:13, 19 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.

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