@Test public void removeLastInvalidSensorDataValues() throws Exception { final SensorData invalidData = new SensorData(); invalidData.put(SensorType.UNKNOWN, new float[] { 1f, 2f, 3f, Constants.NONE }); final SensorsDataResponse dataResponse = new SensorsDataResponse(invalidData, new ArrayList<>(0)); dataResponse.removeLastInvalidSensorDataValues(); final float[] updatedData = dataResponse.getSensorData().get(SensorType.UNKNOWN); assertEquals(3f, updatedData[updatedData.length -1]); assertEquals(invalidData.get(SensorType.UNKNOWN), updatedData); }
public void removeLastInvalidSensorDataValues() { for (final Map.Entry<SensorType, float[]> entry : sensorData.entrySet()) { final float[] origValues = entry.getValue(); final int length = origValues.length; if (length >= 1 && origValues[length - 1] == Constants.NONE) { entry.setValue(Arrays.copyOf(origValues, length - 1)); } } }
SensorsDataResponse extends ApiResponse { public void removeLastInvalidSensorDataValues() { for (final Map.Entry<SensorType, float[]> entry : sensorData.entrySet()) { final float[] origValues = entry.getValue(); final int length = origValues.length; if (length >= 1 && origValues[length - 1] == Constants.NONE) { entry.setValue(Arrays.copyOf(origValues, length - 1)); } } } }
SensorsDataResponse extends ApiResponse { public void removeLastInvalidSensorDataValues() { for (final Map.Entry<SensorType, float[]> entry : sensorData.entrySet()) { final float[] origValues = entry.getValue(); final int length = origValues.length; if (length >= 1 && origValues[length - 1] == Constants.NONE) { entry.setValue(Arrays.copyOf(origValues, length - 1)); } } } SensorsDataResponse();  SensorsDataResponse(final SensorData sensorData, final List<X> timestamps); }
SensorsDataResponse extends ApiResponse { public void removeLastInvalidSensorDataValues() { for (final Map.Entry<SensorType, float[]> entry : sensorData.entrySet()) { final float[] origValues = entry.getValue(); final int length = origValues.length; if (length >= 1 && origValues[length - 1] == Constants.NONE) { entry.setValue(Arrays.copyOf(origValues, length - 1)); } } } SensorsDataResponse();  SensorsDataResponse(final SensorData sensorData, final List<X> timestamps); @Override String toString(); SensorData getSensorData(); List<X> getTimestamps(); void removeLastInvalidSensorDataValues(); }
SensorsDataResponse extends ApiResponse { public void removeLastInvalidSensorDataValues() { for (final Map.Entry<SensorType, float[]> entry : sensorData.entrySet()) { final float[] origValues = entry.getValue(); final int length = origValues.length; if (length >= 1 && origValues[length - 1] == Constants.NONE) { entry.setValue(Arrays.copyOf(origValues, length - 1)); } } } SensorsDataResponse();  SensorsDataResponse(final SensorData sensorData, final List<X> timestamps); @Override String toString(); SensorData getSensorData(); List<X> getTimestamps(); void removeLastInvalidSensorDataValues();  }