Skip to content
Snippets Groups Projects
Commit 80315e5a authored by Marco Sciacovelli's avatar Marco Sciacovelli
Browse files

Comitted changes

parent bea56a47
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,15 @@ import java.util.HashMap;
import java.util.stream.Collectors;
public class Event {
<<<<<<< Updated upstream
public static final String TYPE = "events";
public String id;
public HashMap<String, String> names;
=======
private static final String TYPE = "events";
public String id;
public HashMap<String,String> names;
>>>>>>> Stashed changes
public String description;
public String url;
public int duration;
......@@ -19,6 +25,7 @@ public class Event {
public String startDate;
public String endDate;
public String[] categories;
<<<<<<< Updated upstream
public GeoShape[] geometries;
public Event() {
......@@ -27,9 +34,25 @@ public class Event {
public Event(String id, HashMap<String, String> names, String description, String url, int duration, boolean isFree,
String startDate, String endDate, String[] categories, GeoShape[] geometries) {
=======
public GeoShape geometries;
public Event(String id,
HashMap<String, String> names,
String description,
String url,
int duration,
boolean isFree,
String startDate,
String endDate,
String[] categories,
GeoShape geometries
) {
>>>>>>> Stashed changes
this.id = id;
this.names = names;
this.description = description;
this.duration = duration;
this.url = url;
this.duration = duration;
this.isFree = isFree;
......@@ -37,6 +60,25 @@ public class Event {
this.endDate = endDate;
this.categories = categories;
this.geometries = geometries;
<<<<<<< Updated upstream
=======
}
public GeoShape getGeometries() {
return geometries;
}
public void setGeometries(GeoShape geometries) {
this.geometries = geometries;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
>>>>>>> Stashed changes
}
public static ArrayList<Event> getEventsFromJSON(String json) {
......
......@@ -4,6 +4,7 @@ import java.util.List;
public class GeoShape {
<<<<<<< Updated upstream
public String type;
public final List<List<Double>> coordinates = new ArrayList<>();
......@@ -11,6 +12,13 @@ public class GeoShape {
this.type = type;
this.coordinates.add(Arrays.asList(coordinates1));
this.coordinates.add(Arrays.asList(coordinates2));
=======
private static final String TYPE = "geoShapes";
private double[] coordinates;
public GeoShape(double[] coordinates) {
this.coordinates = coordinates;
>>>>>>> Stashed changes
}
public GeoShape() {
......@@ -18,10 +26,14 @@ public class GeoShape {
@Override
public String toString() {
<<<<<<< Updated upstream
return "GeoShape{" +
"type='" + type + '\'' +
", coordinates=" + coordinates +
'}';
=======
return "GeoShape of coordinates: " + Arrays.toString(coordinates);
>>>>>>> Stashed changes
}
}
......@@ -54,8 +54,17 @@ public class Main {
.add(Json.createArrayBuilder().add(11.309296).add(46.861944).add(1342).build()).build())
.build()).build())
.build();
<<<<<<< Updated upstream
return writing.toString();
}
=======
System.out.println(writing);
//Task 4
GeoShape geoShape = new GeoShape(new double[]{1000d,223d,121d});
Jsonb jsonb = JsonbBuilder.create();
System.out.println(jsonb.toJson(geoShape));
>>>>>>> Stashed changes
public static String Task4(){
GeoShape geoShape = new GeoShape("geoShapes", new Double[] { 1000d, 223d, 121d },
......
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import java.util.HashMap;
public class Task5 {
public static void main(String[] args) {
GeoShape[] geometries = new GeoShape[] {
new GeoShape("geoShapes", new Double[] { 1000d, 223d, 121d }, new Double[] { 1000d, 223d, 121d }) };
HashMap<String, String> names = new HashMap<>();
names.put("deu", "Braunsbergbühne Lana: The Orchestra");
names.put("ita", "Comedia: The orchestra");
Event event = new Event("ACE69C22C9DD41E6B74123BF64725F12", names, "", "", 120, false,
"2077-11-17T00: 00: 00.000Z", "2077-11-17T00: 00: 00.000Z",
new String[] { "odh:theatre-cinema-and-performances", "schema:TheaterEvent" }, geometries);
Jsonb json = JsonbBuilder.create();
String result = json.toJson(event);
System.out.println(result);
}
}
<<<<<<< Updated upstream
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import java.util.HashMap;
public class Task5 {
public static void main(String[] args) {
GeoShape[] geometries = new GeoShape[] {
new GeoShape("geoShapes", new Double[] { 1000d, 223d, 121d }, new Double[] { 1000d, 223d, 121d }) };
HashMap<String, String> names = new HashMap<>();
names.put("deu", "Braunsbergbühne Lana: The Orchestra");
names.put("ita", "Comedia: The orchestra");
Event event = new Event("ACE69C22C9DD41E6B74123BF64725F12", names, "", "", 120, false,
"2077-11-17T00: 00: 00.000Z", "2077-11-17T00: 00: 00.000Z",
new String[] { "odh:theatre-cinema-and-performances", "schema:TheaterEvent" }, geometries);
Jsonb json = JsonbBuilder.create();
String result = json.toJson(event);
System.out.println(result);
}
}
=======
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import java.util.HashMap;
public class Task5 {
public static void main(String[] args) {
HashMap<String,String> names = new HashMap<>();
double[] coordinates1 = {11.309652, 46.863848, 1298};
double[] coordinates2 = {11.309296, 46.861944, 1342};
String[] categories = {"odh:theatre-cinema-and-performances", "schema:TheaterEvent"};
double[][] coordinates = {coordinates1, coordinates2};
GeoShape geometries = new GeoShape(coordinates1);
names.put("deu","Braunsbergbühne Lana: The Orchestra");
names.put("ita","Comedia: The orchestra");
Event event = new Event("ACE69C22C9DD41E6B74123BF64725F12", names, "", "", 120, false, "2077-11-17T00: 00: 00.000Z", "2077-11-17T00: 00: 00.000Z", categories, geometries);
Jsonb json = JsonbBuilder.create();
String result = json.toJson(event);
//TODO change coordinates to double[][]
System.out.println(result);
}
}
>>>>>>> Stashed changes
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Task7 {
public static void main(String[] args) {
Set<Event> events = new HashSet<>();
GeoShape[] geometries = new GeoShape[] {
new GeoShape("geoShapes", new Double[] { 1000d, 223d, 121d }, new Double[] { 1000d, 223d, 121d }) };
HashMap<String, String> names = new HashMap<>();
names.put("deu", "Braunsbergbühne Lana: The Orchestra");
names.put("ita", "Comedia: The orchestra");
Event event = new Event("ACE69C22C9DD41E6B74123BF64725F12", names, "", "", 120, false,
"2077-11-17T00: 00: 00.000Z", "2077-11-17T00: 00: 00.000Z",
new String[] { "odh:theatre-cinema-and-performances", "schema:TheaterEvent" }, geometries);
for (int i = 0; i < 10; i++) {
events.add(event);
}
Jsonb jsonb = JsonbBuilder.create();
String result = jsonb.toJson(events);
System.out.println(result);
}
}
<<<<<<< Updated upstream
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Task7 {
public static void main(String[] args) {
Set<Event> events = new HashSet<>();
GeoShape[] geometries = new GeoShape[] {
new GeoShape("geoShapes", new Double[] { 1000d, 223d, 121d }, new Double[] { 1000d, 223d, 121d }) };
HashMap<String, String> names = new HashMap<>();
names.put("deu", "Braunsbergbühne Lana: The Orchestra");
names.put("ita", "Comedia: The orchestra");
Event event = new Event("ACE69C22C9DD41E6B74123BF64725F12", names, "", "", 120, false,
"2077-11-17T00: 00: 00.000Z", "2077-11-17T00: 00: 00.000Z",
new String[] { "odh:theatre-cinema-and-performances", "schema:TheaterEvent" }, geometries);
for (int i = 0; i < 10; i++) {
events.add(event);
}
Jsonb jsonb = JsonbBuilder.create();
String result = jsonb.toJson(events);
System.out.println(result);
}
}
=======
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Task7 {
public static void main(String[] args) {
Set<Event> events = new HashSet<Event>();
HashMap<String,String> names = new HashMap<>();
double[] coordinates1 = {11.309652, 46.863848, 1298};
double[] coordinates2 = {11.309296, 46.861944, 1342};
String[] categories = {"odh:theatre-cinema-and-performances", "schema:TheaterEvent"};
double[][] coordinates = {coordinates1, coordinates2};
GeoShape geometries = new GeoShape(coordinates1);
names.put("deu","Braunsbergbühne Lana: The Orchestra");
names.put("ita","Comedia: The orchestra");
Event event = new Event("ACE69C22C9DD41E6B74123BF64725F12", names, "", "", 120, false, "2077-11-17T00: 00: 00.000Z", "2077-11-17T00: 00: 00.000Z", categories, geometries);
for (int i = 0; i < 10; i++) {
events.add(event);
}
Jsonb jsonb = JsonbBuilder.create();
String result = jsonb.toJson(events);
System.out.println(result);
}
}
>>>>>>> Stashed changes
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment