@Test @Category(UnitTest.class) public void testFormatElapsedTime() { MrsPyramidService testInstance = new MrsPyramidService(); assertEquals(testInstance.formatElapsedTime(7200d), "2h"); assertEquals(testInstance.formatElapsedTime(60d), "1m"); assertEquals(testInstance.formatElapsedTime(1d), "1s"); assertEquals(testInstance.formatElapsedTime(86400d), "1d"); assertEquals(testInstance.formatElapsedTime(90000d), "1d:1h"); assertEquals(testInstance.formatElapsedTime(90060d), "1d:1h:1m"); assertEquals(testInstance.formatElapsedTime(90061d), "1d:1h:1m:1s"); assertEquals(testInstance.formatElapsedTime(14000d), "3h:53m:20s"); assertEquals(testInstance.formatElapsedTime(0d), "0s"); assertEquals(testInstance.formatElapsedTime(null), "0s"); }
public String formatElapsedTime(Double elapsedTime) { List<String> output = new ArrayList<>(); int secPerMinute = 60; int minPerHour = 60; int hourPerDay = 24; if (elapsedTime == null) { elapsedTime = 0d; } if (elapsedTime == 0) { return ("0s"); } double seconds = elapsedTime % secPerMinute; if (seconds > 0) { output.add(0, (int) seconds + "s"); } elapsedTime = Math.floor(elapsedTime / secPerMinute); double minutes = elapsedTime % minPerHour; if (minutes > 0) { output.add(0, (int) minutes + "m"); } elapsedTime = Math.floor(elapsedTime / minPerHour); double hours = elapsedTime % hourPerDay; if (hours > 0) { output.add(0, (int) hours + "h"); } double days = Math.floor(elapsedTime / hourPerDay); if (days > 0) { output.add(0, (int) days + "d"); } return StringUtils.join(output, ":"); }
MrsPyramidService { public String formatElapsedTime(Double elapsedTime) { List<String> output = new ArrayList<>(); int secPerMinute = 60; int minPerHour = 60; int hourPerDay = 24; if (elapsedTime == null) { elapsedTime = 0d; } if (elapsedTime == 0) { return ("0s"); } double seconds = elapsedTime % secPerMinute; if (seconds > 0) { output.add(0, (int) seconds + "s"); } elapsedTime = Math.floor(elapsedTime / secPerMinute); double minutes = elapsedTime % minPerHour; if (minutes > 0) { output.add(0, (int) minutes + "m"); } elapsedTime = Math.floor(elapsedTime / minPerHour); double hours = elapsedTime % hourPerDay; if (hours > 0) { output.add(0, (int) hours + "h"); } double days = Math.floor(elapsedTime / hourPerDay); if (days > 0) { output.add(0, (int) days + "d"); } return StringUtils.join(output, ":"); } }
MrsPyramidService { public String formatElapsedTime(Double elapsedTime) { List<String> output = new ArrayList<>(); int secPerMinute = 60; int minPerHour = 60; int hourPerDay = 24; if (elapsedTime == null) { elapsedTime = 0d; } if (elapsedTime == 0) { return ("0s"); } double seconds = elapsedTime % secPerMinute; if (seconds > 0) { output.add(0, (int) seconds + "s"); } elapsedTime = Math.floor(elapsedTime / secPerMinute); double minutes = elapsedTime % minPerHour; if (minutes > 0) { output.add(0, (int) minutes + "m"); } elapsedTime = Math.floor(elapsedTime / minPerHour); double hours = elapsedTime % hourPerDay; if (hours > 0) { output.add(0, (int) hours + "h"); } double days = Math.floor(elapsedTime / hourPerDay); if (days > 0) { output.add(0, (int) days + "d"); } return StringUtils.join(output, ":"); } MrsPyramidService(); }
MrsPyramidService { public String formatElapsedTime(Double elapsedTime) { List<String> output = new ArrayList<>(); int secPerMinute = 60; int minPerHour = 60; int hourPerDay = 24; if (elapsedTime == null) { elapsedTime = 0d; } if (elapsedTime == 0) { return ("0s"); } double seconds = elapsedTime % secPerMinute; if (seconds > 0) { output.add(0, (int) seconds + "s"); } elapsedTime = Math.floor(elapsedTime / secPerMinute); double minutes = elapsedTime % minPerHour; if (minutes > 0) { output.add(0, (int) minutes + "m"); } elapsedTime = Math.floor(elapsedTime / minPerHour); double hours = elapsedTime % hourPerDay; if (hours > 0) { output.add(0, (int) hours + "h"); } double days = Math.floor(elapsedTime / hourPerDay); if (days > 0) { output.add(0, (int) days + "d"); } return StringUtils.join(output, ":"); } MrsPyramidService(); JobManager getJobManager(); ColorScale getColorScaleFromName(String colorScaleName); ColorScale getColorScaleFromJSON(String colorScaleJSON); List<String> getColorScales(); MrGeoRaster createColorScaleSwatch(String name, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height, double min, double max); boolean isZoomLevelValid(String pyramid, ProviderProperties providerProperties, int zoomLevel); ImageRenderer getImageRenderer(String format); MrGeoRaster applyColorScaleToImage(String format, MrGeoRaster result, ColorScale cs,
    ImageRenderer renderer, double[] extrema); ImageResponseWriter getImageResponseWriter(String format); byte[] getEmptyTile(int width, int height, String format); String getContentType(String format); String getMetadata(String imgName); MrsPyramid getPyramid(String name,
    ProviderProperties providerProperties); String formatValue(Double value, String units); String formatElapsedTime(Double elapsedTime); }
MrsPyramidService { public String formatElapsedTime(Double elapsedTime) { List<String> output = new ArrayList<>(); int secPerMinute = 60; int minPerHour = 60; int hourPerDay = 24; if (elapsedTime == null) { elapsedTime = 0d; } if (elapsedTime == 0) { return ("0s"); } double seconds = elapsedTime % secPerMinute; if (seconds > 0) { output.add(0, (int) seconds + "s"); } elapsedTime = Math.floor(elapsedTime / secPerMinute); double minutes = elapsedTime % minPerHour; if (minutes > 0) { output.add(0, (int) minutes + "m"); } elapsedTime = Math.floor(elapsedTime / minPerHour); double hours = elapsedTime % hourPerDay; if (hours > 0) { output.add(0, (int) hours + "h"); } double days = Math.floor(elapsedTime / hourPerDay); if (days > 0) { output.add(0, (int) days + "d"); } return StringUtils.join(output, ":"); } MrsPyramidService(); JobManager getJobManager(); ColorScale getColorScaleFromName(String colorScaleName); ColorScale getColorScaleFromJSON(String colorScaleJSON); List<String> getColorScales(); MrGeoRaster createColorScaleSwatch(String name, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height, double min, double max); boolean isZoomLevelValid(String pyramid, ProviderProperties providerProperties, int zoomLevel); ImageRenderer getImageRenderer(String format); MrGeoRaster applyColorScaleToImage(String format, MrGeoRaster result, ColorScale cs,
    ImageRenderer renderer, double[] extrema); ImageResponseWriter getImageResponseWriter(String format); byte[] getEmptyTile(int width, int height, String format); String getContentType(String format); String getMetadata(String imgName); MrsPyramid getPyramid(String name,
    ProviderProperties providerProperties); String formatValue(Double value, String units); String formatElapsedTime(Double elapsedTime);  }