From 26c4794a8a8488ce5775011426d0408f86ebed03 Mon Sep 17 00:00:00 2001 From: Tim Hilgert Date: Thu, 17 Oct 2019 11:35:11 +0200 Subject: [PATCH] enable possibility to disable working activities on personal basis --- .../ifv/mobitopp/actitopp/ActitoppPerson.java | 31 +++++++++++++++++-- .../ifv/mobitopp/actitopp/Coordinator.java | 3 ++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/kit/ifv/mobitopp/actitopp/ActitoppPerson.java b/src/main/java/edu/kit/ifv/mobitopp/actitopp/ActitoppPerson.java index 3b6f0d2..7694957 100644 --- a/src/main/java/edu/kit/ifv/mobitopp/actitopp/ActitoppPerson.java +++ b/src/main/java/edu/kit/ifv/mobitopp/actitopp/ActitoppPerson.java @@ -30,6 +30,8 @@ public class ActitoppPerson private int gender; private int employment; + private boolean isAllowedToWork = true; + // commuting distance are 0 by default, i.e. not available or person is not commuting private double commutingdistance_work = 0.0; private double commutingdistance_education = 0.0; @@ -600,6 +602,9 @@ public String toString() { message.append("\n - gender : "); message.append(getGender()); + message.append("\n - is allowed to work : "); + message.append(isAllowedToWork()); + message.append("\n - commuting distance work : "); message.append(getCommutingdistance_work()); @@ -715,7 +720,7 @@ public void addJointActivityforConsideration(HActivity act){ //make sure the activity is joint assert JointStatus.JOINTELEMENTS.contains(act.getJointStatus()) : "no jointAct!"; - // check if there is already an activitx at the same time + // check if there is already an activity at the same time boolean activityconflict = false; for (HActivity tmpact : jointActivitiesforConsideration) { @@ -740,7 +745,7 @@ public void addJointActivityforConsideration(HActivity act){ } /** - * determined if a person is anyway employed (full time, part time or in vocational program) + * determines if a person is anyway employed (full time, part time or in vocational program) * * @return */ @@ -751,7 +756,7 @@ public boolean personisAnywayEmployed() } /** - * determined if a person is in school or student + * determines if a person is in school or student * * @return */ @@ -786,5 +791,25 @@ public boolean isPersonWorkorSchoolCommuterAndMainToursAreScheduled() } return false; } + + /** + * determines if a person is allowed to work + * this may be disabled for minors to totally block them from having working activities + * + * @return + */ + public boolean isAllowedToWork() { + return isAllowedToWork; + } + + /** + * sets if a person is allowed to work + * this may be disabled for minors to totally block them from having working activities + * + * @param isAllowedToWork + */ + public void setAllowedToWork(boolean isAllowedToWork) { + this.isAllowedToWork = isAllowedToWork; + } } diff --git a/src/main/java/edu/kit/ifv/mobitopp/actitopp/Coordinator.java b/src/main/java/edu/kit/ifv/mobitopp/actitopp/Coordinator.java index 8bcbc4f..4ec87e2 100644 --- a/src/main/java/edu/kit/ifv/mobitopp/actitopp/Coordinator.java +++ b/src/main/java/edu/kit/ifv/mobitopp/actitopp/Coordinator.java @@ -244,6 +244,9 @@ private void executeStep1(String id, String variablenname) // save result double decision = Double.parseDouble(step.getAlternativeChosen()); + // set anztage_w to 0 if person is not allowed to work (this may be configured for minors) + if (variablenname == "anztage_w" && !person.isAllowedToWork()) decision=0; + person.addAttributetoMap(variablenname, decision); if(debugloggers!= null && debugloggers.existsLogger(id))