public int[] getSensorTimeInterval(SensorMeta sensorMeta) { throwNull(sensorMeta); BTreeMap<Integer, ChunkMeta> chunkMetaMap = getSensorChunkMetaMap(sensorMeta); if (chunkMetaMap.isEmpty()) { return null; } return new int[] {chunkMetaMap.firstKey(), chunkMetaMap.lastEntry().getValue().lastTimestamp}; }
public int[] getStationTimeInterval(String stationName) { throwNull(stationName); BTreeMap<String, SensorMeta> sensorMap = getSensorMap(stationName); if (sensorMap == null || sensorMap.isEmpty()) { return null; } int minTimestamp = Integer.MAX_VALUE; int maxTimestamp = Integer.MIN_VALUE; for (SensorMeta sensorMeta : sensorMap.values()) { int[] interval = getSensorTimeInterval(sensorMeta); if (interval != null) { if (interval[0] < minTimestamp) { minTimestamp = interval[0]; } if (maxTimestamp < interval[1]) { maxTimestamp = interval[1]; } } } if (minTimestamp == Integer.MAX_VALUE || maxTimestamp == Integer.MIN_VALUE) { return null; } return new int[] {minTimestamp, maxTimestamp}; }