21 package org.matsim.core.population.io;
23 import java.util.List;
24 import java.util.concurrent.BlockingQueue;
34 import org.xml.sax.Attributes;
43 class ParallelPopulationReaderMatsimV4Runner
extends PopulationReaderMatsimV4 implements
Runnable {
45 private final BlockingQueue<List<Tag>> queue;
47 public ParallelPopulationReaderMatsimV4Runner(
48 final CoordinateTransformation coordinateTransformation,
49 final Scenario scenario,
50 final BlockingQueue<List<Tag>> queue) {
51 super(coordinateTransformation , scenario);
66 for (Tag tag : tags) {
67 if (tag instanceof PersonTag) {
68 this.currperson = ((PersonTag) tag).person;
69 }
else if (tag instanceof StartTag) {
71 if (PERSON.equals(tag.name)) {
72 startPerson(((StartTag) tag).atts);
76 this.
startTag(tag.name, ((StartTag) tag).atts, tag.context);
78 }
else if (tag instanceof EndTag) {
84 if (PERSON.equals(tag.name)) {
85 this.currperson = null;
89 this.endTag(tag.name, ((EndTag) tag).content, tag.context);
91 }
else if (tag instanceof EndProcessingTag) {
95 }
catch (InterruptedException e) {
101 private void startPerson(
final Attributes atts) {
102 String ageString = atts.getValue(
"age");
105 if (ageString != null) age = Integer.parseInt(ageString);
106 PersonUtils.setAge(this.currperson, age);
107 PersonUtils.setSex(this.currperson, atts.getValue(
"sex"));
108 PersonUtils.setLicence(this.currperson, atts.getValue(
"license"));
109 PersonUtils.setCarAvail(this.currperson, atts.getValue(
"car_avail"));
110 String employed = atts.getValue(
"employed");
111 if (employed == null) {
112 PersonUtils.setEmployed(this.currperson, null);
114 PersonUtils.setEmployed(this.currperson,
"yes".equals(employed));
abstract void startTag(String name, Attributes atts, Stack< String > context)