/** * Handles the last point of a time series. We always store the first an the last point as supporting points actualPoints[Last] == serializedPoints[Last] * * @param ddcThreshold the ddc threshold * @param startDate the start date * @param point the current point * @param points the protocol buffer point * @param currentTimestamp the current time stamp */ private static void handleLastPoint(int ddcThreshold, long startDate, MetricProtocolBuffers.Point.Builder point, MetricProtocolBuffers.Points.Builder points, long currentTimestamp) { long calcPoint = calculateTimeStamp(startDate, points.getPList(), ddcThreshold); //Calc offset long deltaToLastTimestamp = currentTimestamp - calcPoint; //everything okay if (deltaToLastTimestamp >= 0) { setTimeStamp(point, deltaToLastTimestamp); points.addP(point); } else { //we have to rearrange the points as we are already behind the actual end timestamp rearrangePoints(startDate, currentTimestamp, deltaToLastTimestamp, ddcThreshold, points, point); } }
setBPTimeStamp(point, timeStamp); } else { setTimeStamp(point, timeStamp);