summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/compiler.xml9
-rw-r--r--.idea/gradle.xml18
-rw-r--r--.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml9
-rw-r--r--.idea/libraries/Gradle__com_google_guava_guava_11_0_2.xml11
-rw-r--r--.idea/libraries/Gradle__commons_codec_commons_codec_1_3.xml11
-rw-r--r--.idea/libraries/Gradle__commons_logging_commons_logging_1_1_1.xml11
-rw-r--r--.idea/libraries/Gradle__junit_junit_4_12.xml11
-rw-r--r--.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_0_alpha4.xml9
-rw-r--r--.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_0_beta1.xml9
-rw-r--r--.idea/libraries/Gradle__org_codehaus_groovy_groovy_all_2_3_11.xml11
-rw-r--r--.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml11
-rw-r--r--.idea/libraries/Gradle__org_json_json_20090211.xml9
-rw-r--r--.idea/libraries/Gradle__org_jsoup_jsoup_1_10_3.xml11
-rw-r--r--.idea/misc.xml6
-rw-r--r--.idea/modules.xml10
-rw-r--r--.idea/modules/dsb-api.iml13
-rw-r--r--.idea/modules/dsb-api_main.iml23
-rw-r--r--.idea/modules/dsb-api_test.iml27
-rw-r--r--.idea/uiDesigner.xml124
-rw-r--r--GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed.apkbin0 -> 3426687 bytes
-rw-r--r--GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed[1]_source_from_JADX.zipbin0 -> 4157766 bytes
-rw-r--r--build.gradle20
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 54706 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties6
-rw-r--r--gradlew172
-rw-r--r--gradlew.bat84
-rw-r--r--settings.gradle2
-rw-r--r--src/main/java/de/romjaki/dsbclient/DSBClient.java144
-rw-r--r--src/main/java/de/romjaki/dsbclient/TimetableEntry.java95
-rw-r--r--src/main/java/de/romjaki/dsbclient/UnUtil.java75
-rw-r--r--src/test/java/Testing.java14
31 files changed, 955 insertions, 0 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..f3e8e28
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <bytecodeTargetLevel>
+ <module name="dsb-api_main" target="1.8" />
+ <module name="dsb-api_test" target="1.8" />
+ </bytecodeTargetLevel>
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..05e5219
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="gradleJvm" value="1.8" />
+ <option name="modules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ </set>
+ </option>
+ <option name="useAutoImport" value="true" />
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml
new file mode 100644
index 0000000..63b7b35
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml
@@ -0,0 +1,9 @@
+<component name="libraryTable">
+ <library name="Gradle: com.google.code.findbugs:jsr305:1.3.9">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/1.3.9/40719ea6961c0cb6afaeb6a921eaa1f6afd4cfdf/jsr305-1.3.9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_guava_guava_11_0_2.xml b/.idea/libraries/Gradle__com_google_guava_guava_11_0_2.xml
new file mode 100644
index 0000000..9cd90cb
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_guava_guava_11_0_2.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: com.google.guava:guava:11.0.2">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/11.0.2/35a3c69e19d72743cac83778aecbee68680f63eb/guava-11.0.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/11.0.2/81936ae99fc48e75e182250dca50b8a5266f16c4/guava-11.0.2-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__commons_codec_commons_codec_1_3.xml b/.idea/libraries/Gradle__commons_codec_commons_codec_1_3.xml
new file mode 100644
index 0000000..a07b00a
--- /dev/null
+++ b/.idea/libraries/Gradle__commons_codec_commons_codec_1_3.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: commons-codec:commons-codec:1.3">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.3/fd32786786e2adb664d5ecc965da47629dca14ba/commons-codec-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.3/ee264b5d7a0f939d5999398c7f1ade031db3fcec/commons-codec-1.3-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__commons_logging_commons_logging_1_1_1.xml b/.idea/libraries/Gradle__commons_logging_commons_logging_1_1_1.xml
new file mode 100644
index 0000000..b9fb751
--- /dev/null
+++ b/.idea/libraries/Gradle__commons_logging_commons_logging_1_1_1.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: commons-logging:commons-logging:1.1.1">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/5043bfebc3db072ed80fbd362e7caf00e885d8ae/commons-logging-1.1.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/f3f156cbff0e0fb0d64bfce31a352cce4a33bc19/commons-logging-1.1.1-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__junit_junit_4_12.xml b/.idea/libraries/Gradle__junit_junit_4_12.xml
new file mode 100644
index 0000000..04c10dd
--- /dev/null
+++ b/.idea/libraries/Gradle__junit_junit_4_12.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: junit:junit:4.12">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/a6c32b40bf3d76eca54e3c601e5d1470c86fcdfa/junit-4.12-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_0_alpha4.xml b/.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_0_alpha4.xml
new file mode 100644
index 0000000..aa27d7d
--- /dev/null
+++ b/.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_0_alpha4.xml
@@ -0,0 +1,9 @@
+<component name="libraryTable">
+ <library name="Gradle: org.apache.httpcomponents:httpclient:4.0-alpha4">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.0-alpha4/277e129e635f21fe78089b00fd0a325d10849aff/httpclient-4.0-alpha4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_0_beta1.xml b/.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_0_beta1.xml
new file mode 100644
index 0000000..6b106cd
--- /dev/null
+++ b/.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_0_beta1.xml
@@ -0,0 +1,9 @@
+<component name="libraryTable">
+ <library name="Gradle: org.apache.httpcomponents:httpcore:4.0-beta1">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.0-beta1/c642a5f7c20539840957584b1af2ad798cd1ba52/httpcore-4.0-beta1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_codehaus_groovy_groovy_all_2_3_11.xml b/.idea/libraries/Gradle__org_codehaus_groovy_groovy_all_2_3_11.xml
new file mode 100644
index 0000000..b484437
--- /dev/null
+++ b/.idea/libraries/Gradle__org_codehaus_groovy_groovy_all_2_3_11.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: org.codehaus.groovy:groovy-all:2.3.11">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.3.11/f6b34997d04c1538ce451d3955298f46fdb4dbd4/groovy-all-2.3.11.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.3.11/fdf089bfd5d0b7e86100ac599741f65732fc21d5/groovy-all-2.3.11-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
new file mode 100644
index 0000000..8262f72
--- /dev/null
+++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: org.hamcrest:hamcrest-core:1.3">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_json_json_20090211.xml b/.idea/libraries/Gradle__org_json_json_20090211.xml
new file mode 100644
index 0000000..920bb5c
--- /dev/null
+++ b/.idea/libraries/Gradle__org_json_json_20090211.xml
@@ -0,0 +1,9 @@
+<component name="libraryTable">
+ <library name="Gradle: org.json:json:20090211">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.json/json/20090211/c183aa3a2a6250293808bba12262c8920ce5a51c/json-20090211.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jsoup_jsoup_1_10_3.xml b/.idea/libraries/Gradle__org_jsoup_jsoup_1_10_3.xml
new file mode 100644
index 0000000..16ff9be
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jsoup_jsoup_1_10_3.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+ <library name="Gradle: org.jsoup:jsoup:1.10.3">
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jsoup/jsoup/1.10.3/b842f960942503cf1abbcc8c173a7f2c19d43726/jsoup-1.10.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jsoup/jsoup/1.10.3/89116c309401a6457942135ee47be41ea0eb1ab7/jsoup-1.10.3-sources.jar!/" />
+ </SOURCES>
+ </library>
+</component> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..905dc43
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/dsb-api.iml" filepath="$PROJECT_DIR$/.idea/modules/dsb-api.iml" />
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/dsb-api_main.iml" filepath="$PROJECT_DIR$/.idea/modules/dsb-api_main.iml" group="dsb-api" />
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/dsb-api_test.iml" filepath="$PROJECT_DIR$/.idea/modules/dsb-api_test.iml" group="dsb-api" />
+ </modules>
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/modules/dsb-api.iml b/.idea/modules/dsb-api.iml
new file mode 100644
index 0000000..30c79ad
--- /dev/null
+++ b/.idea/modules/dsb-api.iml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id="dsb-api" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="roman" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../..">
+ <excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
+ <excludeFolder url="file://$MODULE_DIR$/../../build" />
+ <excludeFolder url="file://$MODULE_DIR$/../../out" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module> \ No newline at end of file
diff --git a/.idea/modules/dsb-api_main.iml b/.idea/modules/dsb-api_main.iml
new file mode 100644
index 0000000..a25d64a
--- /dev/null
+++ b/.idea/modules/dsb-api_main.iml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id="dsb-api:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="roman" external.system.module.type="sourceSet" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+ <output url="file://$MODULE_DIR$/../../out/production/classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../src/main">
+ <sourceFolder url="file://$MODULE_DIR$/../../src/main/groovy" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Gradle: org.codehaus.groovy:groovy-all:2.3.11" level="project" />
+ <orderEntry type="library" name="Gradle: com.google.guava:guava:11.0.2" level="project" />
+ <orderEntry type="library" name="Gradle: org.jsoup:jsoup:1.10.3" level="project" />
+ <orderEntry type="library" name="Gradle: org.json:json:20090211" level="project" />
+ <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.0-alpha4" level="project" />
+ <orderEntry type="library" name="Gradle: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.0-beta1" level="project" />
+ <orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.1.1" level="project" />
+ <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.3" level="project" />
+ </component>
+</module> \ No newline at end of file
diff --git a/.idea/modules/dsb-api_test.iml b/.idea/modules/dsb-api_test.iml
new file mode 100644
index 0000000..107825c
--- /dev/null
+++ b/.idea/modules/dsb-api_test.iml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id="dsb-api:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="roman" external.system.module.type="sourceSet" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+ <output-test url="file://$MODULE_DIR$/../../out/test/classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$/../../src/test">
+ <sourceFolder url="file://$MODULE_DIR$/../../src/test/groovy" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="dsb-api_main" />
+ <orderEntry type="library" name="Gradle: org.codehaus.groovy:groovy-all:2.3.11" level="project" />
+ <orderEntry type="library" name="Gradle: com.google.guava:guava:11.0.2" level="project" />
+ <orderEntry type="library" name="Gradle: org.jsoup:jsoup:1.10.3" level="project" />
+ <orderEntry type="library" name="Gradle: org.json:json:20090211" level="project" />
+ <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.0-alpha4" level="project" />
+ <orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" />
+ <orderEntry type="library" name="Gradle: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.0-beta1" level="project" />
+ <orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.1.1" level="project" />
+ <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.3" level="project" />
+ <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
+ </component>
+ <component name="TestModuleProperties" production-module="dsb-api_main" />
+</module> \ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+</project> \ No newline at end of file
diff --git a/GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed.apk b/GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed.apk
new file mode 100644
index 0000000..311d9ff
--- /dev/null
+++ b/GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed.apk
Binary files differ
diff --git a/GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed[1]_source_from_JADX.zip b/GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed[1]_source_from_JADX.zip
new file mode 100644
index 0000000..6d64b78
--- /dev/null
+++ b/GRB.Vertretungsplan.v.2.6.b.9.crk.ADS.Removed[1]_source_from_JADX.zip
Binary files differ
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..a33374b
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,20 @@
+group 'roman'
+version '1.0-SNAPSHOT'
+
+apply plugin: 'groovy'
+apply plugin: 'java'
+
+sourceCompatibility = 1.8
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ compile 'org.codehaus.groovy:groovy-all:2.3.11'
+ compile group: 'com.google.guava', name: 'guava', version: '11.0.2'
+ compile group: 'org.jsoup', name: 'jsoup', version: '1.10.3'
+ compile group: 'org.json', name: 'json', version: '20090211'
+ compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.0-alpha4'
+ testCompile group: 'junit', name: 'junit', version: '4.12'
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..218ff24
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..cc4694f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Sep 25 19:47:36 CEST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..3d5bd6b
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name = 'dsb-api'
+
diff --git a/src/main/java/de/romjaki/dsbclient/DSBClient.java b/src/main/java/de/romjaki/dsbclient/DSBClient.java
new file mode 100644
index 0000000..01927cd
--- /dev/null
+++ b/src/main/java/de/romjaki/dsbclient/DSBClient.java
@@ -0,0 +1,144 @@
+package de.romjaki.dsbclient;
+
+import com.google.common.collect.Iterables;
+import org.apache.http.HttpException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+public class DSBClient {
+ private static final String BASE_URL = "https://iphone.dsbcontrol.de/iPhoneService.svc/DSB/";
+ private static final String AUTH_URL = BASE_URL + "AuthID/";
+ private static final String DATA_URL = BASE_URL + "timetables/";
+ private static final DateFormat dateformat = new SimpleDateFormat("d.M.Y H:m");
+ private final String user;
+ private final String pass;
+ private String authid;
+ private DefaultHttpClient client = new DefaultHttpClient();
+ private Map<Long, List<TimetableEntry>> cache;
+
+ private DSBClient(String user, String pass) {
+ this.user = user;
+ this.pass = pass;
+ }
+
+ public static DSBClient buildBlocking(String user, String pass) throws HttpException, IOException, URISyntaxException, JSONException, ParseException {
+ DSBClient client = new DSBClient(user, pass);
+ client.login();
+ client.receiveData();
+ return client;
+ }
+
+ public static DSBClient buildAsync(String user, String pass, Consumer<Exception> exceptionCallback) {
+ DSBClient client = new DSBClient(user, pass);
+ Thread t = new Thread(() -> {
+ try {
+ client.login();
+ client.receiveData();
+ } catch (Exception e) {
+ exceptionCallback.accept(e);
+ }
+ });
+ return client;
+ }
+
+ private void login() throws IOException, HttpException, URISyntaxException {
+ HttpGet get = new HttpGet(AUTH_URL + user + "/" + pass);
+
+ HttpResponse response = client.execute(get);
+
+ authid = EntityUtils.toString(response.getEntity()).replace("\"", "");
+ }
+
+ private void receiveData() throws URISyntaxException, IOException, HttpException, JSONException, ParseException {
+ HttpGet get = new HttpGet(DATA_URL + authid);
+
+ HttpResponse response = client.execute(get);
+
+ String str = EntityUtils.toString(response.getEntity());
+ JSONArray data = new JSONArray(str);
+ cache = new HashMap<>();
+ for (int i = 0; i < data.length(); i++) {
+ JSONObject o = data.getJSONObject(i);
+ boolean isHtml = o.getBoolean("ishtml");
+ Date timetabledate = dateformat.parse(o.getString("timetabledate"));
+ String timetableurl = o.getString("timetableurl");
+ long millis = UnUtil.sanitizeDate(UnUtil.calendarByDate(timetabledate, Locale.GERMANY)).getTimeInMillis();
+ List<TimetableEntry> arrL = cache.computeIfAbsent(millis, ignored -> new ArrayList<>());
+ arrL.addAll(parseEntry(isHtml, timetableurl));
+ }
+ }
+
+
+ private List<TimetableEntry> parseEntry(boolean isHtml, String timetableurl) throws URISyntaxException, IOException, HttpException {
+ if (!isHtml) return Collections.emptyList();
+ HttpGet get = new HttpGet(timetableurl);
+ HttpResponse response = client.execute(get);
+ Document document = Jsoup.parse(EntityUtils.toString(response.getEntity()));
+ Elements rows = document.getElementsByTag("tr").not(":not(:has(th))");
+ List<TimetableEntry> entries = new ArrayList<>(rows.size());
+ for (Element row : rows) {
+ entries.add(parseElement(row));
+ }
+ return entries;
+ }
+
+ private TimetableEntry parseElement(Element row) {
+ TimetableEntry entry = new TimetableEntry();
+ entry.setKlasse(row.child(1).text());
+ entry.setStunde(row.child(3).text());
+ entry.setVertreter(row.child(4).text());
+ entry.setFach(row.child(5).text());
+ entry.setRaum(row.child(8).text());
+ entry.setArt(row.child(9).text());
+ entry.setText(row.child(11).text());
+ if (entry.getFach() == null) {
+ entry.setFach(row.child(6).text());
+ }
+ if (entry.getRaum() == null) {
+ entry.setRaum(row.child(7).text());
+ }
+ if (entry.getKlasse() == null) {
+ entry.setKlasse(row.child(10).text());
+ }
+ return entry;
+ }
+
+ public List<TimetableEntry> byTeacher(String teacher) {
+ return filter(timetableEntry -> timetableEntry.getVertreter().equalsIgnoreCase(teacher));
+ }
+
+ public List<TimetableEntry> byDate(Date date) {
+ return cache.get(UnUtil.sanitizeDate(UnUtil.calendarByDate(date, Locale.GERMANY)).getTimeInMillis());
+ }
+
+ public List<TimetableEntry> byClass(String klasse) {
+ return filter(timetableEntry -> timetableEntry.getKlasse().contains(klasse) || klasse.contains(timetableEntry.getKlasse()));
+ }
+
+
+ public List<TimetableEntry> filter(Predicate<TimetableEntry> predicate) {
+ return StreamSupport.stream(Iterables.concat(cache.values()).spliterator(), false)
+ .filter(predicate)
+ .collect(Collectors.toList());
+ }
+}
diff --git a/src/main/java/de/romjaki/dsbclient/TimetableEntry.java b/src/main/java/de/romjaki/dsbclient/TimetableEntry.java
new file mode 100644
index 0000000..a888cfc
--- /dev/null
+++ b/src/main/java/de/romjaki/dsbclient/TimetableEntry.java
@@ -0,0 +1,95 @@
+package de.romjaki.dsbclient;
+
+public class TimetableEntry {
+ private String klasse;
+ private String stunde;
+ private String vertreter;
+ private String fach;
+ private String raum;
+ private String art;
+ private String text;
+
+ public String getKlasse() {
+ return klasse;
+ }
+
+ public void setKlasse(String klasse) {
+ klasse = klasse.trim();
+ if (klasse.isEmpty()) {
+ klasse = null;
+ }
+ this.klasse = klasse;
+ }
+
+ public String getStunde() {
+ return stunde;
+ }
+
+ public void setStunde(String stunde) {
+ stunde = stunde.trim();
+ if (stunde.isEmpty()) {
+ stunde = null;
+ }
+ this.stunde = stunde;
+ }
+
+ public String getVertreter() {
+ return vertreter;
+ }
+
+ public void setVertreter(String vertreter) {
+ vertreter = vertreter.trim();
+ if (vertreter.isEmpty()) {
+ vertreter = null;
+ }
+ this.vertreter = vertreter;
+ }
+
+ public String getFach() {
+ return fach;
+ }
+
+ public void setFach(String fach) {
+ fach = fach.trim();
+ if (fach.isEmpty()) {
+ fach = null;
+ }
+ this.fach = fach;
+ }
+
+ public String getRaum() {
+ return raum;
+ }
+
+ public void setRaum(String raum) {
+ raum = raum.trim();
+ if (raum.isEmpty()) {
+ raum = null;
+ }
+ this.raum = raum;
+ }
+
+ public String getArt() {
+ return art;
+ }
+
+ public void setArt(String art) {
+ art = art.trim();
+ if (art.isEmpty()) {
+ art = null;
+ }
+ this.art = art;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ text = text.trim();
+ if (text.isEmpty()) {
+ text = null;
+ }
+ this.text = text;
+ }
+}
diff --git a/src/main/java/de/romjaki/dsbclient/UnUtil.java b/src/main/java/de/romjaki/dsbclient/UnUtil.java
new file mode 100644
index 0000000..2c3af02
--- /dev/null
+++ b/src/main/java/de/romjaki/dsbclient/UnUtil.java
@@ -0,0 +1,75 @@
+package de.romjaki.dsbclient;
+
+
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.message.BasicNameValuePair;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.*;
+
+import static java.util.Calendar.*;
+
+public class UnUtil {
+
+ private UnUtil() {
+ UnUtil.singleton(UnUtil.class);
+ }
+
+ public static Calendar calendarByDate(Date date, Locale germany) {
+ Calendar calendar = Calendar.getInstance(Locale.GERMANY);
+ calendar.setTime(date);
+ return calendar;
+ }
+
+ public static Calendar sanitizeDate(Calendar temp) {
+ Calendar calendar = Calendar.getInstance(temp.getTimeZone());
+
+ calendar.set(
+ temp.get(YEAR),
+ temp.get(MONTH),
+ temp.get(DAY_OF_MONTH),
+ 0, 0, 0);
+ return calendar;
+ }
+
+ public static void singleton(Class<UnUtil> utilClass) throws IllegalStateException {
+ throw new IllegalStateException("No " + utilClass.getCanonicalName() + " class instances for you :P");
+ }
+
+ public static String httpGet(String urlString, Map<String, List<String>> headers) throws IOException {
+ return performGeneralHttpRequest("GET", urlString, headers);
+ }
+
+ public static String performGeneralHttpRequest(String method, String urlString, Map<String, List<String>> headers) throws IOException {
+ URL url = new URL(urlString);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod(method);
+ conn.getRequestProperties().putAll(headers);
+
+ conn.setDoInput(true);
+ conn.setDoOutput(true);
+ conn.setUseCaches(false);
+
+ InputStream stream = conn.getInputStream();
+ return readFully(stream);
+ }
+
+ public static UrlEncodedFormEntity createFormEntity(Map<String, String> params) {
+ List<NameValuePair> nameValuePairs = new ArrayList<>();
+ params.forEach((name, val) -> nameValuePairs.add(new BasicNameValuePair(name, val)));
+ try {
+ return new UrlEncodedFormEntity(nameValuePairs, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return null;
+ }
+ }
+
+ public static String readFully(InputStream stream) {
+ return new Scanner(stream).useDelimiter("\\A").next();
+ }
+}
diff --git a/src/test/java/Testing.java b/src/test/java/Testing.java
new file mode 100644
index 0000000..b404e8d
--- /dev/null
+++ b/src/test/java/Testing.java
@@ -0,0 +1,14 @@
+import de.romjaki.dsbclient.DSBClient;
+import org.apache.http.HttpException;
+import org.json.JSONException;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.text.ParseException;
+
+public class Testing {
+ public static void main(String[] args) throws URISyntaxException, IOException, HttpException, JSONException, ParseException {
+ DSBClient client = DSBClient.buildBlocking("166162", "Riedberg2014");
+
+ }
+}