|
| static final Logger | log = LogManager.getLogger(PersonWriter.class) |
| |
Definition at line 22 of file PersonWriter.java.
◆ writePerson()
| void org.matsim.analysis.PersonWriter.writePerson |
( |
Person |
p, |
|
|
List< String > |
attributes, |
|
|
CSVPrinter |
csvPrinter |
|
) |
| throws IOException |
|
private |
Definition at line 57 of file PersonWriter.java.
References org.matsim.api.core.v01.population.Activity.getCoord(), org.matsim.api.core.v01.population.Activity.getType(), org.matsim.api.core.v01.Coord.getX(), and org.matsim.api.core.v01.Coord.getY().
58 if (p.getSelectedPlan() == null) {
59 log.error(
"Found person without a selected plan: " + p.getId().toString() +
" will not be added to output_persons.csv");
62 List<String> line =
new ArrayList<>();
63 line.add(p.getId().toString());
64 line.add(p.getSelectedPlan().getScore() == null ?
"null" : p.getSelectedPlan().getScore().toString());
68 if (!p.getSelectedPlan().getPlanElements().isEmpty()) {
69 Activity firstAct = (Activity) p.getSelectedPlan().getPlanElements().get(0);
70 if (firstAct.getCoord() != null) {
71 x = Double.toString(firstAct.getCoord().getX());
72 y = Double.toString(firstAct.getCoord().getY());
74 actType = firstAct.getType();
79 for (String attribute : attributes) {
80 Object value = p.getAttributes().getAttribute(attribute);
81 String result = value != null ? String.valueOf(value) :
"";
84 csvPrinter.printRecord(line);
◆ prepareHeader()
| String [] org.matsim.analysis.PersonWriter.prepareHeader |
( |
List< String > |
attributes | ) |
|
|
private |
Definition at line 87 of file PersonWriter.java.
88 List<String> header =
new ArrayList<>();
90 header.add(
"executed_score");
91 header.add(
"first_act_x");
92 header.add(
"first_act_y");
93 header.add(
"first_act_type");
94 header.addAll(attributes);
95 return header.toArray(String[]::
new);
◆ prepareAttributes()
| List<String> org.matsim.analysis.PersonWriter.prepareAttributes |
( |
| ) |
|
|
private |
Definition at line 98 of file PersonWriter.java.
100 .flatMap(p -> p.getAttributes().getAsMap().keySet().stream()).distinct()
101 .collect(Collectors.toList());
102 attributes.remove(
"vehicles");
Map< Id< Person >,? extends Person > getPersons()
Population getPopulation()
◆ log
| final Logger org.matsim.analysis.PersonWriter.log = LogManager.getLogger(PersonWriter.class) |
|
staticprivate |
The documentation for this class was generated from the following file: