diff --git a/src/Date.java b/src/Date.java new file mode 100644 index 0000000..cb7aa94 --- /dev/null +++ b/src/Date.java @@ -0,0 +1,85 @@ +import javafx.scene.input.DataFormat; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.GregorianCalendar; +import java.util.Scanner; + +public class Date { + private int index = 0; + ArrayList list = new ArrayList<>(); + ArrayList listnew = new ArrayList<>(); + public String nextDate; + + + public void getdata() { + + GregorianCalendar now = new GregorianCalendar(); + DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); // 14.04.2012 + String datum = df.format(now.getTime()); + + URL url = null; + try { + url = new URL("https://www.steyr.at/system/web/kalender.aspx?vdatum=" + datum + "&bdatum=12.10.2019&typ=&typid=0&typids=225781950&detailonr=0&menuonr=225781812"); + Scanner scanner = new Scanner(new InputStreamReader(url.openStream())); + + int n = 0; + while (scanner.hasNext()) { + String temp = scanner.next(); + addList(temp); + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + Filter(); + } + + private void addList(String temp) { + list.add(index, temp); + } + + public void printList() { + for (int n = 0; n < listnew.size(); n++) { + System.out.println(listnew.get(n)); + } + } + + private void Filter() { + String temp = "href=\"/system/web/kalender.aspx?detailonr=225781954-6&menuonr=225781812\">Hausabfall"; + int counter = 0; + + for (int n = 0; n < list.size(); n++) { + if (list.get(n).equals(temp)) { + counter++; + + if (counter == 4) { + + int zaehler = 0; + + for (int v = n; v < list.size(); v++) { + listnew.add(zaehler, list.get(v)); + zaehler++; + } + + String string = "004-034556"; + String[] parts = string.split("-"); + String part1 = parts[0]; // 004 + String part2 = parts[1]; // 034556 + + for (int q = 0; q < listnew.size(); q++) { + + } + + } + } + } + } + +} diff --git a/src/main.java b/src/main.java index a276226..8b091b6 100644 --- a/src/main.java +++ b/src/main.java @@ -1,7 +1,14 @@ public class main { public static void main(String[] args) { + + Date D=new Date(); + D.getdata(); + D.printList(); + /* Thread mythread = new Thread(() -> new Webserver().startserver()); mythread.start(); - System.out.println("thread started"); + + + System.out.println("thread started");*/ } }