Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor member funtions populationPool #1444

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libOPHD/Population/PopulationPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* Sets a pointer to a Population object.
*
*
* \note PopulationPool expects a valid object and does no checking
* for invalid states.
*/
Expand All @@ -19,13 +19,13 @@ void PopulationPool::population(Population* pop)
}


int PopulationPool::availableWorkers()
int PopulationPool::availableWorkers() const
{
return mPopulation->getPopulations().worker - workersEmployed();
}


int PopulationPool::availableScientists()
int PopulationPool::availableScientists() const
{
return mPopulation->getPopulations().scientist - scientistsEmployed();
}
Expand Down Expand Up @@ -67,7 +67,7 @@ void PopulationPool::clear()
/**
* Amount of Scientists employed as Workers.
*/
int PopulationPool::scientistsAsWorkers()
int PopulationPool::scientistsAsWorkers() const
{
return mScientistsAsWorkers;
}
Expand All @@ -76,7 +76,7 @@ int PopulationPool::scientistsAsWorkers()
/**
* Amount of Scientists currently employed.
*/
int PopulationPool::scientistsEmployed()
int PopulationPool::scientistsEmployed() const
{
return mScientistsUsed;
}
Expand All @@ -85,7 +85,7 @@ int PopulationPool::scientistsEmployed()
/**
* Amount of Workers currently employed.
*/
int PopulationPool::workersEmployed()
int PopulationPool::workersEmployed() const
{
return mWorkersUsed;
}
Expand All @@ -94,7 +94,7 @@ int PopulationPool::workersEmployed()
/**
* Amount of population currently employed.
*/
int PopulationPool::populationEmployed()
int PopulationPool::populationEmployed() const
{
return scientistsEmployed() + scientistsAsWorkers() + workersEmployed();
}
Expand Down
12 changes: 6 additions & 6 deletions libOPHD/Population/PopulationPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ class PopulationPool
public:
void population(Population* pop);

int availableWorkers();
int availableScientists();
int availableWorkers() const;
int availableScientists() const;

bool usePopulation(PopulationRequirements populationRequirements);

void clear();

int scientistsAsWorkers();
int scientistsEmployed();
int workersEmployed();
int populationEmployed();
int scientistsAsWorkers() const;
int scientistsEmployed() const;
int workersEmployed() const;
int populationEmployed() const;

int size() const;

Expand Down