From ce6c1c33c9ee5237213260b397c39fbda93d9e7f Mon Sep 17 00:00:00 2001 From: Haug Michael <mh306@hdm-stuttgart.de> Date: Mon, 18 Jun 2018 00:39:02 +0200 Subject: [PATCH] changed output style/format of the timestamps --- .../de/hdm_stuttgart/mi/sd1/weather/Forecast.java | 5 ++--- .../mi/sd1/weather/model/CopyToFile.java | 1 - .../mi/sd1/weather/model/FormatOutput.java | 1 + .../mi/sd1/weather/model/WeatherOutput.java | 15 ++++++++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/Forecast.java b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/Forecast.java index e3f3c18..ab3d578 100755 --- a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/Forecast.java +++ b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/Forecast.java @@ -24,13 +24,12 @@ public class Forecast { -/* - CopyToFile.CopyURLToFile("weatherCache\\" + SearchingAndComparing.GetID() + ".json"); + CopyToFile.CopyURLToFile("weatherCache\\" + SearchingAndComparing.GetID() + ".json"); CopyToFile.CopyFileToWeather(); WeatherOutput.PrintWeather(); -*/ + } } diff --git a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/CopyToFile.java b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/CopyToFile.java index 7f7099c..470ca38 100755 --- a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/CopyToFile.java +++ b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/CopyToFile.java @@ -28,7 +28,6 @@ public class CopyToFile { } } filePath = pathname; - //return pathname; } diff --git a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/FormatOutput.java b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/FormatOutput.java index 8b58913..5f81a32 100644 --- a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/FormatOutput.java +++ b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/FormatOutput.java @@ -49,4 +49,5 @@ public class FormatOutput { return coordsLon + ", " + coordsLat; } + } diff --git a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/WeatherOutput.java b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/WeatherOutput.java index 94b110f..829557b 100755 --- a/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/WeatherOutput.java +++ b/src/main/java/de/hdm_stuttgart/mi/sd1/weather/model/WeatherOutput.java @@ -7,7 +7,7 @@ public class WeatherOutput { Weather weatherObject = CopyToFile.CopyFileToWeather(); /** - * method to print the temperature + * method to print the temperature * and the sky condition of current day + 5 * in 3 hour segments * @param i timestamps for weatherdata @@ -15,14 +15,19 @@ public class WeatherOutput { for (int i = 0; i < weatherObject.getList().length - 1; i++) { - System.out.print(weatherObject.getList()[i].getDtTxt() + ": "); // output nicht wie bei Goik - double timeStamp = weatherObject.getList()[i].getDt(); + if ((weatherObject.getList()[i].getDtTxt().substring(11, 13).equals("00")) || i == 0 ) { + System.out.println(weatherObject.getList()[i].getDtTxt().substring(0, 10)); + } + System.out.print(weatherObject.getList()[i].getDtTxt().substring(11, 13) + " Uhr: "); + // System.out.print(weatherObject.getList()[i].getDtTxt() + ": "); // output nicht wie bei Goik + + /* double timeStamp = weatherObject.getList()[i].getDt(); timeStamp = timeStamp; System.out.println(timeStamp); - // January 1, 1970 00:00:00.000 GMT + // January 1, 1970 00:00:00.000 GMT */ Main MainWeatherData = weatherObject.getList()[i].getMain(); - System.out.print(Math.round(MainWeatherData.getTemp()) + "°C"); + System.out.print(Math.round(MainWeatherData.getTemp()) + "°C,"); Clouds SkyCondition = weatherObject.getList()[i].getClouds(); int SkyPercent = SkyCondition.getAll(); -- GitLab