public void startCapacity(final ActivityOptionImpl activity, final BufferedWriter out) throws IOException { if (activity.getCapacity() != Integer.MAX_VALUE) { out.write("\t\t\t<capacity"); out.write(" value=\"" + activity.getCapacity() + "\""); out.write(" />\n"); } }
private final void combine(ActivityFacility f,ActivityFacilityImpl f2) { System.out.println(" Combining f_id=" + f.getId() + " into f2_id=" + f2.getId()); Iterator<? extends ActivityOption> a_it = f.getActivityOptions().values().iterator(); while (a_it.hasNext()) { ActivityOptionImpl a = (ActivityOptionImpl) a_it.next(); if (f2.getActivityOptions().get(a.getType()) == null) { ActivityOptionImpl a2 = f2.createAndAddActivityOption(a.getType()); a2.setCapacity(a.getCapacity()); } else { ActivityOptionImpl a2 = (ActivityOptionImpl) f2.getActivityOptions().get(a.getType()); double cap2 = a2.getCapacity(); double cap = a.getCapacity(); if ((cap < Integer.MAX_VALUE) && (cap2 < Integer.MAX_VALUE)) { a2.setCapacity(cap + cap2); } else { a2.setCapacity(Integer.MAX_VALUE); } } SortedSet<OpeningTime> ts = a.getOpeningTimes(); Iterator<OpeningTime> o_it = ts.iterator(); while (o_it.hasNext()) { OpeningTime o = o_it.next(); f2.getActivityOptions().get(a.getType()).addOpeningTime(o); } } if (Integer.parseInt(f2.getId().toString()) > Integer.parseInt(f.getId().toString())) { System.out.println(" => assigning f_id="+f.getId()+" to f2."); throw new RuntimeException("Can't set ids anymore."); } }
ActivityOptionImpl a = (ActivityOptionImpl) a_it.next(); act_cnt++; if (a.getCapacity() != Integer.MAX_VALUE) { if (a.getType().equals("home")) { caps[0] += a.getCapacity(); caps[1] += a.getCapacity(); caps[2] += a.getCapacity(); caps[3] += a.getCapacity(); caps[4] += a.getCapacity();