Commit 17de6ba7 authored by j.hoerdt's avatar j.hoerdt
Browse files

removed some code and adjusted visibilities

parent 058dcc2a
......@@ -61,9 +61,11 @@ public class DayUploader {
return get_csv_files(Util.reader_of_uri(csv_folder_uri), csv_folder_uri);
}
/*
private static Stream<String> get_csv_files(String csv_folder_uri, String downloaded_index_html) throws Exception {
return get_csv_files(new BufferedReader(new FileReader(downloaded_index_html)), csv_folder_uri);
}
*/
public static void upload_daily_folder(String daily_folder_uri) throws Exception {
upload_from_csv_uris(get_csv_files(daily_folder_uri));
......
......@@ -122,7 +122,8 @@ public class Main {
}
private static void print_result(Result result) {
result.forEachRemaining(record -> System.out.println(record));
}
// private static void print_result(Result result) {
// result.forEachRemaining(record -> System.out.println(record));
// }
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ import java.util.regex.*;
public class Sensor {
public Map<String, Object> properties = new HashMap<String, Object>();
private Map<String, Object> properties = new HashMap<String, Object>();
public Query get_creation_query() {
BiFunction<String, String, String> string_if_exists = (dependency, merge_string) -> (properties.get(dependency) != null ? merge_string : "");
......@@ -57,7 +57,7 @@ public class Sensor {
return template.withParameters(properties);
}
public static BufferedReader read_online_file(String uri, int bytes) throws IOException {
private static BufferedReader read_online_file(String uri, int bytes) throws IOException {
URLConnection csv_connection = URI.create(uri).toURL().openConnection();
// only download first bytes bytes of each csv file which should be more than enough for two lines
......@@ -65,7 +65,7 @@ public class Sensor {
return new BufferedReader(new InputStreamReader(csv_connection.getInputStream()));
}
public static Predicate<String> contains_indoor_string = Pattern.compile(".+indoor.csv").asMatchPredicate();
private static Predicate<String> contains_indoor_string = Pattern.compile(".+indoor.csv").asMatchPredicate();
public static Sensor fromCSV(String file_uri) throws Exception {
Map<String, String> data_as_strings;
......@@ -107,7 +107,7 @@ public class Sensor {
}
}
public static Map<String, String> read_one_csv_line(BufferedReader csv_reader) throws IOException {
private static Map<String, String> read_one_csv_line(BufferedReader csv_reader) throws IOException {
Iterator<String> header = Arrays.asList(csv_reader.readLine().split(";")).iterator();
Iterator<String> data = Arrays.asList(csv_reader.readLine().split(";")).iterator();
Map<String, String> result = new HashMap<String, String>();
......@@ -119,8 +119,10 @@ public class Sensor {
return result;
}
/*
public static void main(String[] args) {
System.out.println(contains_indoor_string.test("2020-04-23_dht22_sensor_42841.csv"));
System.out.println(contains_indoor_string.test("2020-04-13_bme280_sensor_39365_indoor.csv"));
}
*/
}
\ No newline at end of file
......@@ -60,7 +60,9 @@ public class Util {
Files.writeString(Path.of(fname), line + '\n', StandardOpenOption.APPEND);
}
/*
public static void main(String[] args) throws MalformedURLException, IOException {
Util.reader_of_uri("http://archive.sensor.community/2020-03-28/").lines().forEach(System.out::println);
}
*/
}
\ No newline at end of file
......@@ -111,10 +111,12 @@ public class ReverseGeocoder {
return "accept-language=en&zoom=" + zoom + "&lat=" + latitude + "&lon=" + longitude;
}
/*
public static void main(String[] args) throws Exception {
System.setProperty("http.agent", "Please/0.5");
ReverseGeocoder.osm_instance().reverse_geocode(13.52, 14.94);
ReverseGeocoder.osm_instance().reverse_geocode(37.21, 14.54);
ReverseGeocoder.osm_instance().reverse_geocode(13.37, 13.37);
}
*/
}
\ No newline at end of file
......@@ -7,8 +7,6 @@ import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import internship.Util;
/**
* This class offers functions to search html pages for links
*/
......@@ -48,17 +46,9 @@ public class DirectoryIndexer {
return get_subpaths_of_html(html, page_uri).filter(is_daily_folder);
}
public static Stream<String> get_csv_files_recursively_from_html(BufferedReader html, String page_uri) throws MalformedURLException, IOException {
return get_daily_folders_in_html(html, page_uri).flatMap(folder -> {
try {
return get_csv_files_in_html(Util.reader_of_uri(folder), folder);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
/*
public static void main(String[] args) throws MalformedURLException, IOException {
DirectoryIndexer.get_csv_files_recursively_from_html(new BufferedReader(new FileReader("../Index of _.html")), "http://archive.sensor.community/").forEach(System.out::println);
}
*/
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment