21 package org.matsim.counts;
23 import it.unimi.dsi.fastutil.ints.Int2DoubleMap;
24 import org.apache.logging.log4j.LogManager;
25 import org.apache.logging.log4j.Logger;
31 import java.util.HashMap;
32 import java.util.OptionalDouble;
43 private static final Logger
log = LogManager.getLogger(
Counts.class);
61 log.warn(
"Unsupported counts interval '" + this.volume.
getInterval() +
"' for analysis functionality. " +
62 "Interval should be able to aggregate hourly, otherwise counts will be empty");
78 throw new RuntimeException(
"counts start at 1, not at 0. If you have a use case where you need to go below one, " 79 +
"let us know and we think about it, but so far we had numerous debugging sessions because someone inserted counts at 0.");
88 log.warn(
"Unsupported counts '" + this.volume.
getInterval() +
"' for setting values. Resolution must be hourly.");
93 public final void setCsId(
final String cs_id) {
109 for (Int2DoubleMap.Entry e :
this.volume) {
110 if (e.getDoubleValue() > max) {
111 max = e.getDoubleValue();
115 return hour >= 0 ?
new Volume(hour + 1, max) : null;
122 return v.isPresent() ?
new Volume(h, v.getAsDouble()) : null;
129 HashMap<Integer, Volume> res =
new HashMap<>();
130 for (Int2DoubleMap.Entry e : volume) {
133 res.put(h,
new Volume(h, e.getDoubleValue()));
153 return "[Loc_id=" + this.location.
getId() +
"]" +
155 "[nof_volumes=" + this.volume.
size() +
"]";
Measurable createVolume()
final Volume getMaxVolume()
final Volume getVolume(final int h)
void setStationName(String stationName)
static final String ANY_MODE
final String getCsLabel()
boolean hasMeasurableForMode(String measurableType, String mode)
void setCoord(final Coord coord)
final Volume createVolume(final int h, final double val)
Count(MeasurementLocation< T > v)
final void setCsId(final String cs_id)
boolean supportsHourlyAggregate()
void setAtHour(int hour, double value)
final HashMap< Integer, Volume > getVolumes()
OptionalDouble aggregateAtHour(int hour)
final MeasurementLocation< T > location
void setCoordinates(Coord coordinates)