MATSIM
Public Member Functions | List of all members
org.matsim.facilities.algorithms.FacilitiesSummary Class Reference

Public Member Functions

 FacilitiesSummary ()
 
void run (ActivityFacilities facilities)
 

Detailed Description

Definition at line 30 of file FacilitiesSummary.java.

Constructor & Destructor Documentation

◆ FacilitiesSummary()

org.matsim.facilities.algorithms.FacilitiesSummary.FacilitiesSummary ( )

Definition at line 32 of file FacilitiesSummary.java.

32  {
33  super();
34  }

Member Function Documentation

◆ run()

void org.matsim.facilities.algorithms.FacilitiesSummary.run ( ActivityFacilities  facilities)

Definition at line 36 of file FacilitiesSummary.java.

References org.matsim.facilities.ActivityOptionImpl.getCapacity(), org.matsim.facilities.ActivityFacilities.getFacilities(), and org.matsim.facilities.ActivityOptionImpl.getType().

36  {
37  System.out.println(" running " + this.getClass().getName() + " algorithm...");
38  int f_cnt = 0;
39  int act_cnt = 0;
40 // Coord min_coord = new Coord(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
41 // Coord max_coord = new Coord(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
42  double min_coordX = Double.POSITIVE_INFINITY;
43  double min_coordY = Double.POSITIVE_INFINITY;
44  double max_coordX = Double.NEGATIVE_INFINITY;
45  double max_coordY = Double.NEGATIVE_INFINITY;
46  // home,work,education,shop,leisure
47  int caps[] = {0 , 0, 0, 0, 0};
48  int unlimit_cap_cnt = 0;
49  for (ActivityFacility f : facilities.getFacilities().values()) {
50  f_cnt++;
51  if (f.getCoord().getX() > max_coordX) { max_coordX=f.getCoord().getX(); }
52  if (f.getCoord().getY() > max_coordY) { max_coordY=f.getCoord().getY(); }
53  if (f.getCoord().getX() < min_coordX) { min_coordX=f.getCoord().getX(); }
54  if (f.getCoord().getY() < min_coordY) { min_coordY=f.getCoord().getY(); }
55 
56  Iterator<? extends ActivityOption> a_it = f.getActivityOptions().values().iterator();
57  while (a_it.hasNext()) {
58  ActivityOptionImpl a = (ActivityOptionImpl) a_it.next();
59  act_cnt++;
60  if (a.getCapacity() != Integer.MAX_VALUE) {
61  if (a.getType().equals("home")) {
62  caps[0] += a.getCapacity();
63  }
64  else if (a.getType().equals("work")) {
65  caps[1] += a.getCapacity();
66  }
67  else if (a.getType().equals("education")) {
68  caps[2] += a.getCapacity();
69  }
70  else if (a.getType().equals("shop")) {
71  caps[3] += a.getCapacity();
72  }
73  else if (a.getType().equals("leisure")) {
74  caps[4] += a.getCapacity();
75  }
76  else {
77  throw new RuntimeException("ERROR: in " + this.getClass().getName() +
78  " in run(Facilities facilities):" +
79  " do not know type = " + a.getType());
80  }
81  }
82  else {
83  unlimit_cap_cnt++;
84  }
85  }
86  }
87  System.out.println(" Number of Facilities: " + f_cnt);
88  System.out.println(" Number of Activities: " + act_cnt);
89  System.out.println(" Min Coord: " + min_coordX + " " + min_coordY );
90  System.out.println(" Max Coord: " + max_coordX + " " + max_coordY ) ;
91  System.out.println(" total home cap: " + caps[0]);
92  System.out.println(" total work cap: " + caps[1]);
93  System.out.println(" total education cap: " + caps[2]);
94  System.out.println(" total shop cap: " + caps[3]);
95  System.out.println(" total leisure cap: " + caps[4]);
96  System.out.println(" total acts with unlimited cap: " + unlimit_cap_cnt);
97 
98  System.out.println(" done.");
99  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: