The Capsis training online

Back to the table of contents

Solution 14. Make a graph: N / Time

Try to work with the helping elements before looking at the solution…

Helping elements

What is a Capsis MethodProvider ?

All model classes in Capsis (e.g. TraModel extends GModel) can return an instance (never null) of MethodProvider (here, TraMethodProvider implements MethodProvider)

The MethodProvider of a module is specific to the module and can access every detail in the module data structure (knows TraScene, TraTree, etc.).

It contains methods to calculate values, e.g. stand basal area, stand dominant height… for a given GScene (and optionally for a list of individuals for the individual based models).

These methods are normalized in java interfaces, e.g. GProvider for getG(), HDomProvider for getHDom(), in the capsis.util.methodprovider package and can be detected by tools to check the compatibility with a module.

The TraMethodProvider will be called only for Training projects and its method will always be passed an instance of TraScene (and possibly a list of TraTree instances for the methods accepting a list of individuals)

A possible solution

Code elements to adapt the TraMethodProvider to make Training compatible with DETimeN A possible result in the DETimeN graph after few years of simulation

Back to the table of contents