import SimParam;
import SKPop;
class HouseHolds extends SimParam {
Population pop;
HHMax hhMaxp;
HHNorm hhnormp;
Land vland;
MinLandHH minLand;
Migrants migs;
HouseHolds(DField x) {
super(x,"HouseHolds");
}
public void init() {
setChartMax(150); // reset to chartmax/min
setChartMin(100);
pop = (Population) getParam("Population");
hhMaxp = (HHMax) getParam("HHMax");
vland = (Land) getParam("Land");
minLand = (MinLandHH) getParam("MinLandHH");
migs = (Migrants) getParam("Migrants");
hhnormp = (HHNorm) getParam("HHNorm");
reset();
}
public void reset() {
this.setValue(105);
}
public double calc() {
double p;
if (( p = pop.get() / this.get()) > hhnormp.get()) {
if (vland.get() / this.get() > minLand.get()) {
this.inc();
} else {
while (pop.get() / this.get() > hhMaxp.get()) {
migs.inc();
pop.dec();
}
}
}
return this.get();
}
}
class HHPop extends SimParam {
Population pop;
HouseHolds hh;
HHPop(DField x) {
super(x,"HHPop");
}
public void init() {
setChartMax(7); // reset to chartmax/min
setChartMin(5);
pop = (Population) getParam("Population");
hh = (HouseHolds) getParam("HouseHolds");
reset();
}
public void reset() {
this.setValue(6);
}
public double calc() {
return pop.get()/hh.get();
}
}
class HHMax extends SimParam {
HHMax(DField x) {
super(x,"HHMax");
}
public void init() {
setChartMax(8); // reset to chartmax/min
setChartMin(4);
this.setValue(6.4);
reset();
}
public void reset() {
}
public double calc() {
return get();
}
}
class HHNorm extends SimParam {
HHNorm(DField x) {
super(x,"HHNorm");
}
public void init() {
setChartMax(8); // reset to chartmax/min
setChartMin(4);
this.setValue(5.7);
reset();
}
public void reset() {
}
public double calc() {
return get();
}
}
class Land extends SimParam {
Land(DField x) {
super(x,"Land");
}
public void init() {
setChartMax(13000); // reset to chartmax/min
setChartMin(10000);
this.setValue(12000);
reset();
}
public void reset() {
}
public double calc() {
return get();
}
}
class MinLandHH extends SimParam {
Year year;
boolean done=false;
MinLandHH(DField x) {
super(x,"MinLandHH");
}
public void init() {
setChartMax(300); // reset to chartmax/min
setChartMin(50);
year = (Year) getParam("Year");
reset();
}
public void reset() {
this.setValue(90); // -numCycle);
done = false;
}
public double calc() {
if (!done && year.get() > 1965) {
set(get()*.9);
done = true;
}
set(get());
return get();
}
}