Skip to content

[dev-0.8.0] enable option flags reference class issues #85

@efletcherPIFSC

Description

@efletcherPIFSC

Importing options data from agepro_json_model to agepro_inp_model, or creating new instances of any agepro model class creates unattended side effects for Reference class options_flag_container

As a consequence, a option class with non-default values will be flagged as FALSE, not the intended design.

Reproduce

Note

Using dev-0.8.0 branch @ 474474c

  1. load ageproR
  2. Create a new agepro_inp_model class with default values.
inpfile <- agepro_inp_model$new()
  1. Load in Uku_Example Input File (Or Example 4 from AGEPRO-GUI Examples). For this example, load in test-example4.inp from the inst subfolder of the working directory.
inpfile$read_inp("inst/Exampe_UKU.inp")
  1. Use inpfile$perc, inpfile$bounds, inpfile$retroadjust, inpfile$refpoint, and inpfile$scale to print out their values.
    • Options for PERC, BOUNDS, and REFPOINT should have enabled (TRUE). retroadjust and scale is FALSE until a non-default value is set to its values.
  2. Create a new agepro_json_model class with the following
jsonfile <- agepro_json_model$new(2019, 2026, 1, 32, 1000, 4, 3)
  1. json$perc, jsonfile$bounds, jsonfile$retroadjust, jsonfile$refpoint, and jsonfile$scale will print out their values and FALSE options flag. inpfile$perc, inpfile$bounds, inpfile$retroadjust, inpfile$refpoint, and inpfile$scale will print out their values and FALSE options flag.

Solution

6/24 Edit Instantiate object flag references at the agepro_model level and then appending a new parameter (option_flag) when initializing the Option Classes (percentile_summary, max_bounds, reference_points, scaliing_factors, and retrospective_adjustments). Object_flag references will be tied to the instance of agepro_class and passed to the specific option class.


initialize the options_flag_container class so new instances of classes will share the reference.

Reference: https://r6.r-lib.org/articles/Introduction.html#fields-containing-reference-objects

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions