Skip to content

Commit

Permalink
Merge branch 'actiTopp1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
timhilgert committed Oct 17, 2019
2 parents c5c0f8b + 26c4794 commit ea3688c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/main/java/edu/kit/ifv/mobitopp/actitopp/ActitoppPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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)
{
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand Down Expand Up @@ -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;
}

}
3 changes: 3 additions & 0 deletions src/main/java/edu/kit/ifv/mobitopp/actitopp/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ea3688c

Please sign in to comment.