See

<project-file type=“source”/>

<content> #include “simpathogen.h”

SimPathogen::SimPathogen(SimID id, float mutationrate) {

  ID = id;
  MutationRate = mutationrate;

}

SimPathogen::~SimPathogen() {

  for (int i = 0; i < Stages.size(); i++)
delete Stages[i];

}

void SimPathogen::addStage(SimInfectionStage *s) {

  if (s != NULL)
Stages.push_back(s);

}

void SimPathogen::setInitialStage(SimInfectionStage *stage, float prob) {

  if (stage == NULL || prob <= 0) return;
  int i, n=InitialStages.size();
  for (i = 0; i < n && InitialStages[i] != stage; i++);
  if (i < n)
InitialStageProbabilities[i] = prob;
  else {
InitialStages.push_back(stage);
InitialStageProbabilities.push_back(prob);
  }

}

SimPathogen * SimPathogen::mutate(float time) const {

  return NULL;

}

void SimPathogen::enterProcess(SimProcess *) { }

void SimPathogen::leaveProcess(SimProcess *) { }

SimInfectionStage::SimInfectionStage(SimID Id, float inf, float f, SimDistribution *excess) {

  ID = Id;
  Infectivity = inf;
  Fatality = f;
  ExcessDeath = excess; 

}

SimInfectionStage::~SimInfectionStage() {

  for (int i=0; i<Links.size(); i++)
delete Links[i];

}

float SimInfectionStage::deathTime(float CurrentTime) const {

  float t = SIM_INFINITY;
  if (ExcessDeath != NULL)
t = ExcessDeath->draw();
  return CurrentTime + t;

}

void SimInfectionStage::jumpTo(SimInfectionStage *s, float prob, SimDistribution *t) {

  Links.push_back(new SimStageLink(s, prob, t));

}

SimStageLink::SimStageLink(SimInfectionStage *s, float prob, SimDistribution *t) {

  Stage = s;
  TimeInterval = t;
  Probability = prob;

}

SimStageLink::~SimStageLink() {

  if (TimeInterval != NULL) delete TimeInterval;

}

float SimStageLink::duration () const {

  if (TimeInterval != NULL)
    return TimeInterval->draw();
  return SIM_INFINITY;

} </content> <use name=“simpathogen.h”/>