ALMaSS Partridge ODdox  1.1
The partridge model description following ODdox protocol
ForIterator Class Reference

Iterator class for wrap around landscape
More...

#include <Partridge_Covey.h>

Public Member Functions

int * GetList (void)
 Get pointer to list of points
More...
 
int GetLimit (void)
 Get how many points
More...
 
 ForIterator (int a_min_incl, int a_max_excl, int a_step_size, int a_norm_min_incl, int a_norm_max_excl)
 Constructor
More...
 
 ~ForIterator (void)
 Destructor
More...
 

Private Attributes

int * m_list
 List of points
More...
 
int m_limit
 How many points
More...
 

Detailed Description

Iterator class for wrap around landscape

Definition at line 48 of file Partridge_Covey.h.

Constructor & Destructor Documentation

◆ ForIterator()

ForIterator::ForIterator ( int  a_min_incl,
int  a_max_excl,
int  a_step_size,
int  a_norm_min_incl,
int  a_norm_max_excl 
)

Constructor

Definition at line 2256 of file Partridge_Covey.cpp.

2256  {
2257  // a_min_incl or a_max_excl are goint to be <0 or > a_norm_max_excl
2258  if ( a_step_size > 1 )
2259  m_limit = ( a_max_excl - a_min_incl ) / a_step_size;
2260  else
2261  m_limit = a_max_excl - a_min_incl;
2262  m_list = new int[ m_limit ];
2263  if ( !m_list ) assert( false );
2264 
2265  int i, index = 0;
2266  // this only use if a_min_incl < a_norm_min_incl (0)
2267  for ( i = a_min_incl; i < a_norm_min_incl && index < m_limit; i += a_step_size ) {
2268  m_list[ index++ ] = i + a_norm_max_excl;
2269  }
2270  // a_norm_max_excl is typically the landscape width
2271  // a_norm_min_incl is typically 0
2272 
2273  // This loops is for the normal co-ords
2274  for ( ; i < a_norm_max_excl && index < m_limit; i += a_step_size ) {
2275  m_list[ index++ ] = i;
2276  }
2277  // if we have exceeded the upper bound then this is used
2278  for ( ; i < a_max_excl && index < m_limit; i += a_step_size ) {
2279  m_list[ index++ ] = i - a_norm_max_excl;
2280  }
2281 }

References m_limit, and m_list.

◆ ~ForIterator()

ForIterator::~ForIterator ( void  )

Destructor

Definition at line 2284 of file Partridge_Covey.cpp.

2284  {
2285  delete m_list;
2286 }

References m_list.

Member Function Documentation

◆ GetLimit()

int ForIterator::GetLimit ( void  )
inline

Get how many points

Definition at line 61 of file Partridge_Covey.h.

61  {
62  return m_limit;
63  }

References m_limit.

Referenced by Partridge_Covey::HabitatEvaluateSlow(), and Partridge_Covey::NestFindSlow().

◆ GetList()

int* ForIterator::GetList ( void  )
inline

Get pointer to list of points

Definition at line 56 of file Partridge_Covey.h.

56  {
57  return m_list;
58  }

References m_list.

Referenced by Partridge_Covey::HabitatEvaluateSlow(), and Partridge_Covey::NestFindSlow().

Member Data Documentation

◆ m_limit

int ForIterator::m_limit
private

How many points

Definition at line 52 of file Partridge_Covey.h.

Referenced by ForIterator(), and GetLimit().

◆ m_list

int* ForIterator::m_list
private

List of points

Definition at line 50 of file Partridge_Covey.h.

Referenced by ForIterator(), GetList(), and ~ForIterator().


The documentation for this class was generated from the following files:
ForIterator::m_list
int * m_list
List of points
Definition: Partridge_Covey.h:50
ForIterator::m_limit
int m_limit
How many points
Definition: Partridge_Covey.h:52