public double getPeak(Sensor sensor) {
    String sensorName = sensor.getSensorName();

    if (session.hasStream(sensorName)) {
      return session.getStream(sensorName).getPeak();
    } else {
      return 0;
    }
  }
  public List<Measurement> getMeasurements(Sensor sensor) {
    String name = sensor.getSensorName();

    if (session.hasStream(name)) {
      MeasurementStream stream = session.getStream(name);
      return stream.getMeasurements();
    } else {
      return newArrayList();
    }
  }
  private MeasurementStream prepareStream(SensorEvent event) {
    String sensorName = event.getSensorName();

    if (!session.hasStream(sensorName)) {
      MeasurementStream stream = event.stream();
      tracker.addStream(stream);
    }

    MeasurementStream stream = session.getStream(sensorName);
    if (stream.isVisible()) {
      stream.markAs(MeasurementStream.Visibility.VISIBLE_RECONNECTED);
    }

    return stream;
  }
 public MeasurementStream getMeasurementStream(String sensorName) {
   return session.getStream(sensorName);
 }