MATSIM
KindergartenActivityScoring.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.* *
3  * *
4  * *********************************************************************** *
5  * *
6  * copyright : (C) 2008 by the members listed in the COPYING, *
7  * LICENSE and WARRANTY file. *
8  * email : info at matsim dot org *
9  * *
10  * *********************************************************************** *
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * See also COPYING, LICENSE and WARRANTY file *
17  * *
18  * *********************************************************************** */
19 package tutorial.programming.example21tutorialTUBclass.class2016.scoring;
20 
21 import org.matsim.api.core.v01.Id;
25 
27 
28  private double score;
29 
31  Id<Person> personId;
32  public KindergartenActivityScoring(Id<Person> personId, KindergartenArrivalHandler handler) {
33  this.handler = handler;
34  this.personId = personId;
35  }
36 
37 
38  @Override
39  public void handleActivity(Activity act) {
40  if (act.getType().equals("pt interaction")) return;
41  if (act.getType().startsWith("kindergarten")){
42  if (act.getLinkId().equals(handler.kindergartenLink)){
43  if (handler.arrivedOnLinkByCar.contains(personId)){
44  this.score -= 3000.;
45  handler.arrivedOnLinkByCar.remove(personId);
46  System.out.println(personId + " arrived by car");
47 
48  }
49  }
50  }
51  }
52 
53 
54 
55  /* (non-Javadoc)
56  * @see org.matsim.core.scoring.SumScoringFunction.BasicScoring#getScore()
57  */
58  @Override
59  public double getScore() {
60  // TODO Auto-generated method stub
61  return this.score;
62  }
63 
64 
65  /* (non-Javadoc)
66  * @see org.matsim.core.scoring.SumScoringFunction.BasicScoring#finish()
67  */
68  @Override
69  public void finish() {
70  // TODO Auto-generated method stub
71 
72  }
73 
74  /* (non-Javadoc)
75  * @see org.matsim.core.scoring.SumScoringFunction.ActivityScoring#handleFirstActivity(org.matsim.api.core.v01.population.Activity)
76  */
77  @Override
78  public void handleFirstActivity(Activity act) {
79  // TODO Auto-generated method stub
80 
81  }
82 
83 
84  /* (non-Javadoc)
85  * @see org.matsim.core.scoring.SumScoringFunction.ActivityScoring#handleLastActivity(org.matsim.api.core.v01.population.Activity)
86  */
87  @Override
88  public void handleLastActivity(Activity act) {
89  // TODO Auto-generated method stub
90 
91  }
92 
93 
94 
95 
96 }