ALMaSS Rabbit ODdox  1.1
The rabbit model description following ODdox protocol
Rabbit_Young Class Reference

The rabbit young class. All special young behaviour is described here. More...

#include <Rabbit.h>

Inheritance diagram for Rabbit_Young:
Rabbit_Base TAnimal TALMaSSObject Rabbit_Juvenile

Public Member Functions

 Rabbit_Young (int p_x, int p_y, int p_x2, int p_y2, Rabbit_Female *a_mum, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
 Rabbit_Young constructor. More...
 
virtual ~Rabbit_Young (void)
 Rabbit_Young destructor. More...
 
TTypeOfRabbitState st_Develop (void)
 Development state for young. More...
 
TTypeOfRabbitState st_BecomeJuvenile (void)
 Young maturation. More...
 
virtual void BeingStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in.
More...
 
virtual void Step (void)
 The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'. More...
 
virtual void EndStep (void)
 The EndStep is the last 'part' of the timestep that an animal can behave in. More...
 
virtual bool ShouldMature (void)
 Tests for maturation to the next stage. More...
 
- Public Member Functions inherited from Rabbit_Base
TTypeOfRabbitState GetCurrentRState ()
 
void SetAge (int a_age)
 Set age method. More...
 
RabbitObjectTypes GetRabbitType (void)
 Get rabbit type. More...
 
int GetAge (void)
 Get age method. More...
 
void SetweightAge (int a_age)
 Set age method. More...
 
int GetweightAge (void)
 Get age method. More...
 
Rabbit_WarrenGetWarren (void)
 Get warren pointer. More...
 
void SetWarren (Rabbit_Warren *a_warren)
 Set the warren pointer. More...
 
bool GetHasBurrow (void)
 Get burrow status. More...
 
void SetHasBurrow (bool a_status)
 Set/unset burrow status. More...
 
void SetDigging (int a_days)
 Set number of days to dig. More...
 
int GetDigging ()
 Get number of days to dig. More...
 
APoint GetBornLocation ()
 Get location of birth. More...
 
 Rabbit_Base (int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
 Rabbit constructor. More...
 
virtual ~Rabbit_Base (void)
 Rabbit destructor. More...
 
virtual void BeginStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
void OnFed (void)
 Signals food arrived today. More...
 
void OnMumDead (void)
 Signals death of mum. More...
 
void OnEvicted (void)
 Signals mum has a new litter to look after. More...
 
virtual Rabbit_AdultGetMate (void)
 Get mate pointer. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

virtual void st_Dying (void)
 Young dying state. More...
 
- Protected Member Functions inherited from Rabbit_Base
virtual void Explore (void)
 Exploration method. More...
 
bool MortalityTest (double a_prop)
 A simple probability based test. More...
 
bool WalkTo (int a_x, int a_y)
 Walks to a location from current location. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
virtual void GeneralEndocrineDisruptor (double)
 Handles internal effects of endocrine distrupter pesticide exposure.
More...
 
virtual void GeneralOrganoPhosphate (double)
 Handles internal effects of organophosphate pesticide exposure. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Additional Inherited Members

- Public Attributes inherited from Rabbit_Base
RabbitObjectTypes m_RabbitType
 The rabbits type. More...
 
- Static Public Attributes inherited from Rabbit_Base
static double m_dispersalmortperm = cfg_dispersalmortperm.value()
 The extra dispersal mortality per m travelled. More...
 
static double m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value()
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 
- Protected Attributes inherited from Rabbit_Base
int m_Age
 The rabbit's age. More...
 
TTypeOfRabbitState m_CurrentRState
 Variable to record current behavioural state. More...
 
Rabbit_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
double m_MyMortChance
 
bool m_haveBurrow
 Flag to record burrow status. More...
 
Rabbit_Warrenm_myWarren
 True if currently mated. More...
 
Rabbit_Femalem_Mum
 Pointer to mum. More...
 
bool m_FedToday
 Flag for been fed today. More...
 
double m_weight
 The weight in g. More...
 
int m_weightAge
 A physiological age parameter, this is the growth age based on an optimal curve (if optimal conditions it will be the same as m_age) More...
 
int m_digging
 Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries to make one. More...
 
APoint m_born_location
 The x,y location at birth. More...
 
double m_pesticide_burden
 State variable used to hold the current body-burden of pesticide. More...
 
bool m_pesticideInfluenced1
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth).
More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Detailed Description

The rabbit young class. All special young behaviour is described here.

Definition at line 319 of file Rabbit.h.

Constructor & Destructor Documentation

◆ Rabbit_Young()

Rabbit_Young::Rabbit_Young ( int  p_x,
int  p_y,
int  p_x2,
int  p_y2,
Rabbit_Female a_mum,
Landscape p_L,
Rabbit_Population_Manager p_NPM,
Rabbit_Warren a_warren 
)

Rabbit_Young constructor.

Definition at line 232 of file Rabbit.cpp.

232  : Rabbit_Base(p_x, p_y, p_x2, p_y2, p_L, p_NPM, a_warren)
233 {
234  m_Age=0;
235  m_weightAge = 0;
236  m_weight = 0;
239  m_Mum = a_mum;
240  m_FedToday = true;
241 }

References cfg_young_base_mort, Rabbit_Base::m_Age, Rabbit_Base::m_FedToday, Rabbit_Base::m_Mum, Rabbit_Base::m_MyMortChance, Rabbit_Base::m_RabbitType, Rabbit_Base::m_weight, Rabbit_Base::m_weightAge, rob_Young, and CfgFloat::value().

◆ ~Rabbit_Young()

Rabbit_Young::~Rabbit_Young ( void  )
virtual

Rabbit_Young destructor.

Definition at line 244 of file Rabbit.cpp.

245 {
246  ; // Nothing to do
247 }

Member Function Documentation

◆ BeingStep()

void Rabbit_Young::BeingStep ( void  )
virtual

The BeginStep is the first 'part' of the timestep that an animal can behave in.

Resets the feeding flag at the beginning of the day. Call the base class BeginStep

Definition at line 305 of file Rabbit.cpp.

306 {
312  m_FedToday = false;
313 }

References Rabbit_Base::BeginStep(), and Rabbit_Base::m_FedToday.

◆ EndStep()

void Rabbit_Young::EndStep ( void  )
virtual

The EndStep is the last 'part' of the timestep that an animal can behave in.

Reimplemented from Rabbit_Base.

Reimplemented in Rabbit_Juvenile.

Definition at line 347 of file Rabbit.cpp.

348 {
349  /*
350  * Controls death by starvation if under solid food age, currently set at 3 weeks. If this happens then a message is sent to mum if she still exists.
351 
352  */
353  if ((m_FedToday == false) && (m_Age <= 21))
354  {
356  if (m_Mum != NULL) m_Mum->OnYoungDeath( this );
357  }
358 
359 }

References Rabbit_Base::m_Age, Rabbit_Base::m_CurrentRState, Rabbit_Base::m_FedToday, Rabbit_Base::m_Mum, Rabbit_Female::OnYoungDeath(), and toRabbits_Die.

◆ ShouldMature()

bool Rabbit_Young::ShouldMature ( void  )
virtual

Tests for maturation to the next stage.

Weaning is really controlled by the female who will evict an old litter when a new one comes along. But if the breeding season is over this will not occur and we need to wean the young a bit later.

Reimplemented in Rabbit_Juvenile.

Definition at line 362 of file Rabbit.cpp.

363 {
368  if (m_Age>=30) return true;
369  return false;
370 }

References Rabbit_Base::m_Age.

Referenced by st_Develop().

◆ st_BecomeJuvenile()

TTypeOfRabbitState Rabbit_Young::st_BecomeJuvenile ( void  )

Young maturation.

Creates a new Rabbit_Juvenile object and passes the data from the young to it, then signals young object removal.

Definition at line 283 of file Rabbit.cpp.

284 {
288  struct_Rabbit sR;
290  sR.m_L = m_OurLandscape;
291  sR.m_age = m_Age;
293  sR.m_x = m_Location_x;
294  sR.m_y = m_Location_y;
295  sR.m_x2 = m_born_location.m_x;
296  sR.m_y2 = m_born_location.m_y;
297  sR.m_Warren = m_myWarren;
298  sR.m_rabbit = this;
299  if (m_Mum != NULL ) m_Mum->Weaned(this);
301  return toRabbits_Remove; // Used to remove the object without causing other system effects
302 }

References Rabbit_Population_Manager::CreateObjects(), struct_Rabbit::m_age, Rabbit_Base::m_Age, Rabbit_Base::m_born_location, struct_Rabbit::m_L, TAnimal::m_Location_x, TAnimal::m_Location_y, Rabbit_Base::m_Mum, Rabbit_Base::m_myWarren, struct_Rabbit::m_NPM, TAnimal::m_OurLandscape, Rabbit_Base::m_OurPopulationManager, struct_Rabbit::m_rabbit, struct_Rabbit::m_Warren, struct_Rabbit::m_weightage, Rabbit_Base::m_weightAge, struct_Rabbit::m_x, struct_Rabbit::m_x2, struct_Rabbit::m_y, struct_Rabbit::m_y2, rob_Juvenile, toRabbits_Remove, and Rabbit_Female::Weaned().

Referenced by Step().

◆ st_Develop()

TTypeOfRabbitState Rabbit_Young::st_Develop ( void  )

Development state for young.

Returns
new rabbit state toRabbits_Develop, toRabbits_Mature or toRabbits_Die

Ages the rabbit, then carries out a mortality test, evaluates whether the rabbit should wean, and if neither then returns toRabbits_Explore. The rabbit must also grow. Here we decide whether it grows based on the weather conditions. If inclement we assume no growth, if OK then maximal growth is assumed.

Definition at line 262 of file Rabbit.cpp.

263 {
271  m_Age++;
273  {
274  return toRabbits_Die; // m_MyMortChance% chance of death
275  }
276  if (ShouldMature()) return toRabbits_Weaning;
279  return toRabbits_Develop;
280 }

References Rabbit_Population_Manager::GetForageDay(), Rabbit_Population_Manager::GetGrowth(), Rabbit_Base::m_Age, Rabbit_Base::m_MyMortChance, Rabbit_Base::m_OurPopulationManager, Rabbit_Base::m_weight, Rabbit_Base::m_weightAge, Rabbit_Base::MortalityTest(), ShouldMature(), toRabbits_Develop, toRabbits_Die, and toRabbits_Weaning.

Referenced by Step().

◆ st_Dying()

void Rabbit_Young::st_Dying ( void  )
protectedvirtual

Young dying state.

Reimplemented from Rabbit_Base.

Reimplemented in Rabbit_Juvenile.

Definition at line 250 of file Rabbit.cpp.

251 {
252  /*
253  * Only differs from base states by the need to tell the mother that they are dead (if she exists).
254  */
255  if (m_Mum!=NULL) m_Mum->OnYoungDeath(this);
256  m_CurrentStateNo = -1; // this will kill the animal object and free up space
257  m_StepDone = true;
258 }

References TALMaSSObject::m_CurrentStateNo, Rabbit_Base::m_Mum, TALMaSSObject::m_StepDone, and Rabbit_Female::OnYoungDeath().

Referenced by Step().

◆ Step()

void Rabbit_Young::Step ( void  )
virtual

The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'.

Reimplemented from Rabbit_Base.

Reimplemented in Rabbit_Juvenile.

Definition at line 316 of file Rabbit.cpp.

317 {
318  if (m_StepDone || m_CurrentStateNo == -1) return;
319  switch (m_CurrentRState)
320  {
321  case toRabbits_InitialState: // Initial state always starts with develop
323  break;
324  case toRabbits_Develop:
325  m_CurrentRState=st_Develop(); // Will return movement or die
326  m_StepDone=true;
327  break;
328  case toRabbits_Weaning:
329  m_CurrentRState=st_BecomeJuvenile(); // Will return develop
330  m_StepDone=true;
331  break;
332  case toRabbits_Die:
333  st_Dying(); // No return value - no behaviour after this
334  m_StepDone=true;
335  break;
336  case toRabbits_Remove:
337  m_CurrentStateNo = -1;
338  m_StepDone=true;
339  break;
340  default:
341  m_OurLandscape->Warn("Rabbit_Young::Step()","unknown state - default");
342  exit(1);
343  }
344 }

References Rabbit_Base::m_CurrentRState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, st_BecomeJuvenile(), st_Develop(), st_Dying(), toRabbits_Develop, toRabbits_Die, toRabbits_InitialState, toRabbits_Remove, toRabbits_Weaning, and Landscape::Warn().


The documentation for this class was generated from the following files:
struct_Rabbit::m_y
int m_y
y-coord
Definition: Rabbit_Population_Manager.h:64
Rabbit_Base::BeginStep
virtual void BeginStep(void)
The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per...
Definition: Rabbit.cpp:182
Rabbit_Female::OnYoungDeath
void OnYoungDeath(Rabbit_Young *a_young)
Message on death of a young.
Definition: Rabbit.cpp:1293
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: populationmanager.h:229
Rabbit_Young::st_BecomeJuvenile
TTypeOfRabbitState st_BecomeJuvenile(void)
Young maturation.
Definition: Rabbit.cpp:283
Rabbit_Base::m_MyMortChance
double m_MyMortChance
Definition: Rabbit.h:183
Rabbit_Base::m_Age
int m_Age
The rabbit's age.
Definition: Rabbit.h:177
Rabbit_Base::Rabbit_Base
Rabbit_Base(int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
Rabbit constructor.
Definition: Rabbit.cpp:161
struct_Rabbit
Used for creation of a new Rabbit object.
Definition: Rabbit_Population_Manager.h:58
Rabbit_Base::m_weight
double m_weight
The weight in g.
Definition: Rabbit.h:195
Rabbit_Base::m_Mum
Rabbit_Female * m_Mum
Pointer to mum.
Definition: Rabbit.h:191
toRabbits_Remove
Definition: Rabbit.h:95
struct_Rabbit::m_age
int m_age
The rabbit age.
Definition: Rabbit_Population_Manager.h:74
struct_Rabbit::m_NPM
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
Definition: Rabbit_Population_Manager.h:72
rob_Young
Definition: Rabbit.h:70
struct_Rabbit::m_rabbit
Rabbit_Young * m_rabbit
A pointer to a rabbit base - useful for extra information.
Definition: Rabbit_Population_Manager.h:78
Rabbit_Population_Manager::CreateObjects
void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit *a_data, int a_number)
Method for creating a new individual Rabbit.
Definition: Rabbit_Population_Manager.cpp:250
TAnimal::m_Location_y
int m_Location_y
Definition: populationmanager.h:228
struct_Rabbit::m_L
Landscape * m_L
Landscape pointer.
Definition: Rabbit_Population_Manager.h:70
Rabbit_Population_Manager::GetGrowth
double GetGrowth(int a_age)
Get method for the rabbit growth with age.
Definition: Rabbit_Population_Manager.h:116
Rabbit_Base::m_RabbitType
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
struct_Rabbit::m_x2
int m_x2
x-coord of birth
Definition: Rabbit_Population_Manager.h:66
Rabbit_Base::m_born_location
APoint m_born_location
The x,y location at birth.
Definition: Rabbit.h:201
Rabbit_Base::m_myWarren
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
cfg_young_base_mort
static CfgFloat cfg_young_base_mort("RABBIT_YOUNGBASEMORT", CFG_CUSTOM, 0.038)
Input variable. The daily base level for young mortality before any modifiers are applied.
struct_Rabbit::m_Warren
Rabbit_Warren * m_Warren
A pointer to the current warren.
Definition: Rabbit_Population_Manager.h:80
Rabbit_Young::st_Develop
TTypeOfRabbitState st_Develop(void)
Development state for young.
Definition: Rabbit.cpp:262
Rabbit_Base::m_weightAge
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: populationmanager.h:118
struct_Rabbit::m_weightage
int m_weightage
The rabbit age in terms of weight.
Definition: Rabbit_Population_Manager.h:76
toRabbits_Weaning
Definition: Rabbit.h:91
CfgFloat::value
double value(void)
Definition: configurator.h:118
Rabbit_Base::m_CurrentRState
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
Rabbit_Female::Weaned
void Weaned(Rabbit_Young *a_young)
Message on weaning of a young.
Definition: Rabbit.cpp:1317
toRabbits_Die
Definition: Rabbit.h:96
Rabbit_Base::MortalityTest
bool MortalityTest(double a_prop)
A simple probability based test.
Definition: Rabbit.cpp:194
Rabbit_Young::st_Dying
virtual void st_Dying(void)
Young dying state.
Definition: Rabbit.cpp:250
toRabbits_Develop
Definition: Rabbit.h:85
Rabbit_Young::ShouldMature
virtual bool ShouldMature(void)
Tests for maturation to the next stage.
Definition: Rabbit.cpp:362
rob_Juvenile
Definition: Rabbit.h:71
toRabbits_InitialState
Definition: Rabbit.h:84
Rabbit_Base::m_OurPopulationManager
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: populationmanager.h:116
Rabbit_Base::m_FedToday
bool m_FedToday
Flag for been fed today.
Definition: Rabbit.h:193
Rabbit_Population_Manager::GetForageDay
bool GetForageDay()
Get method for the forage day flag.
Definition: Rabbit_Population_Manager.h:123
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
struct_Rabbit::m_y2
int m_y2
y-coord of birth
Definition: Rabbit_Population_Manager.h:68
TAnimal::m_Location_x
int m_Location_x
Definition: populationmanager.h:225
struct_Rabbit::m_x
int m_x
x-coord
Definition: Rabbit_Population_Manager.h:62