Time is simulated by a simple loop in the controller. The currentTime always begins at 0 and each loop adds a whole number to the currentTime counter. The configuration allows to define the duration of a period. For instance, if you want to configure a single full loop to consist of 12 counts to simulate monthly events in a year, you set the timeUnitLength property to 12 currentTime counts. This way the timeUnitsSinceStart at currentTime counter 48, after 48 loops, is 48 / 12 = 4, simulating the passing of 4 years since the start of your Larve experiment.
public void start()
{
long nrOfLoops = timeUnitLength * endTime;
log.info("Start Clock (timeUnitLength="+timeUnitLength +
", endTime="+endTime+",nrOfLoops="+nrOfLoops+")");
for(currentTime = 0; currentTime < nrOfLoops; currentTime++){
if(currentTime % timeUnitLength == 0){
log.info("timeUnitsSinceStart: "+getTimeUnitsSinceStart());
}
}
}
public long getTimeUnitsSinceStart()
{
long timeUnitsSinceStart = (currentTime / timeUnitLength) + 1;// offset 0
return timeUnitsSinceStart;
}
Age is deduced from timeOfBirth at currentTime.
The initial age distribution can be configured by providing an age distribution table.
The following example is in the expected csv format derived from the US Census 2011 gender table Population by Age and Gender.
Age,Total,Total(%),Male,Male(%),Female,Female(%)
0 to 100,306110,100.0,150643,100.0,155,466,100.0
0 to 5,21265,6.9,10869,7.2,10396,6.7
5 to 9,20870,6.8,10667,7.1,10203,6.6
10 to 14,20020,6.5,10237,6.8,9783,6.3
15 to 19,20886,6.8,10691,7.1,10196,6.6
20 to 24,21525,7.0,10960,7.3,10565,6.8
25 to 29,21382,7.0,10917,7.2,10464,6.7
30 to 34,20202,6.6,10067,6.7,10135,6.5
35 to 39,19255,6.3,9542,6.3,9713,6.2
40 to 44,20587,6.7,10172,6.8,10415,6.7
45 to 49,21989,7.2,10800,7.2,11189,7.2
50 to 54,21965,7.2,10695,7.1,11270,7.2
55 to 59,19554,6.4,9499,6.3,10055,6.5
60 to 64,17430,5.7,8447,5.6,8983,5.8
65 to 69,12160,4.0,5600,3.7,6561,4.2
70 to 74,9254,3.0,4242,2.8,5012,3.2
75 to 79,7088,2.3,3065,2.0,4023,2.6
80 to 84,5719,1.9,2370,1.6,3349,2.2
85 to 100,4957,1.6,1804,1.2,3153,2.0
TBD: support standard format, formalize the age format more strictly.
Java 1.6
Eclipse IDE Juno 4.2
Core:
IoC container
Jakarta Commons Logging API (JCL) (spring-core) (replace binding by SLF4J, use Log4J)
AOP (use Aspects (AspectJ))
Test-Driven Dev (TDD) (use JUnit)
MVC framework
ORM (use Hibernate)
OXM (Object/XML Mapping)
Maven
JDBC