Handle different time periods

From Heureka Wiki
Revision as of 10:47, 19 May 2010 by Fkl (talk | contribs) (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�?�')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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:

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. 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:

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 periodlängd i en specifik period (från period innan till den givna perioden)

Year Relativt år (period 0 = år 0), i aktuell period GetYear(int period) Relativt år i en specifik period FindYear(int year) Returnerar den period som motsvarar givet relativt år.