import SimParam;
import Generator;
// just a cover to simplify doing variables. assumes a total of <50 Params

// Males and Females are just variables here ...



class Population extends SimParam {

BirthRate brate;
DeathRate drate;

Population() {
this(null);
}

Population(DField x) {
super(x,"Population");
}

public void init() {
setChartMax(1000); // reset to chartmax/min
setChartMin(600);
brate = (BirthRate) getParam("BirthRate");
drate = (DeathRate) getParam("DeathRate");
reset();
}

public void reset() {

this.setValue(663);
}

public double calc() {
double p;
p = this.get();

p *= (1+brate.get()/12);
p *= (1-drate.get()/12);

return this.set(p);
}

}

class BirthRate extends SimParam {
NormalDist ndist=null;

BirthRate(DField x) {
super(x,"BirthRate");
}

public void init() {
setChartMax(.070); // reset to chartmax/min
setChartMin(.025);
ndist = new NormalDist();
reset();
}

public void reset() {

this.setValue(.0500);
}

public double calc() {
double rate=.0500;
double variance = .007;
set(ndist.getRand(rate,variance));
return(get());

}

}


class DeathRate extends SimParam {
NormalDist ndist=null;

DeathRate() {
this(null);
}

DeathRate(DField x) {
super(x,"DeathRate");
}

public void init() {
setChartMax(.040); // reset to chartmax/min
setChartMin(.010);
ndist = new NormalDist();
reset();
}

public void reset() {

this.setValue(.02);
}

public double calc() {
double rate = .02;
double variance = .002;
ndist.setMSD(rate,variance);
set(ndist.getRand());
return(get());

}

}


class Migrants extends SimParam {

Migrants(DField x) {
super(x,"Migrants");
}

public void init() {
setChartMax(1000); // reset to chartmax/min
setChartMin(0);
reset();
}

public void reset() {

this.setValue(0);
}

public double calc() {
return get();
}

}