Skip to content

Refactor: Consolidate validSpeciesParams and species_params S3 constructor#432

Open
gustavdelius wants to merge 3 commits into
masterfrom
consolidate-species-validation
Open

Refactor: Consolidate validSpeciesParams and species_params S3 constructor#432
gustavdelius wants to merge 3 commits into
masterfrom
consolidate-species-validation

Conversation

@gustavdelius

Copy link
Copy Markdown
Member

This PR consolidates the species parameter validation and default-filling logic directly into the S3 constructors of the species_params and given_species_params classes.

Summary of Changes

  1. S3 Constructor Consolidation:
    • Moved validation logic (duplication checks, misspelling checks, backwards compatibility size parameters fallback, length-to-weight auto-conversions, parameter consistency warnings and corrections) from validGivenSpeciesParams() to given_species_params.data.frame().
    • Moved defaults-filling logic (e.g. w_max, alpha, interaction_resource, etc.) from validSpeciesParams() to species_params.data.frame().
  2. Method Forwarding:
    • Updated species_params.species_params and given_species_params.given_species_params methods to forward to their data.frame S3 constructors, ensuring validation and defaults are always filled in regardless of the starting class.
  3. Deprecation Wrappers:
    • Refactored validSpeciesParams() and validGivenSpeciesParams() to simply return species_params(species_params) and given_species_params(species_params), respectively, serving as lightweight wrappers for S3 constructors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant