Skip to content

Commit

Permalink
simplify if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Feb 7, 2024
1 parent 8094c72 commit ccf93fc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/main/java/org/matsim/prepare/population/AssignIncome.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,16 @@ public void run(Person person) {
double rndDouble = rnd.nextDouble();

if (rndDouble <= 0.1) income = 826.;
else if (rndDouble > 0.1 && rndDouble <= 0.2) income = 1142.;
else if (rndDouble > 0.2 && rndDouble <= 0.3) income = 1399.;
else if (rndDouble > 0.3 && rndDouble <= 0.4) income = 1630.;
else if (rndDouble > 0.4 && rndDouble <= 0.5) income = 1847.;
else if (rndDouble > 0.5 && rndDouble <= 0.6) income = 2070.;
else if (rndDouble > 0.6 && rndDouble <= 0.7) income = 2332.;
else if (rndDouble > 0.7 && rndDouble <= 0.8) income = 2659.;
else if (rndDouble > 0.8 && rndDouble <= 0.9) income = 3156.;
else if (rndDouble > 0.9) income = 4329.;
else if (rndDouble <= 0.2) income = 1142.;
else if (rndDouble <= 0.3) income = 1399.;
else if (rndDouble <= 0.4) income = 1630.;
else if (rndDouble <= 0.5) income = 1847.;
else if (rndDouble <= 0.6) income = 2070.;
else if (rndDouble <= 0.7) income = 2332.;
else if (rndDouble <= 0.8) income = 2659.;
else if (rndDouble <= 0.9) income = 3156.;
else {
throw new RuntimeException("Aborting..." + rndDouble);
income = 4329.;
}

PersonUtils.setIncome(person, income);
Expand Down

0 comments on commit ccf93fc

Please sign in to comment.