package com.zerohighdef.geoffrey.Models; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.util.LinkedList; import java.util.List; public class GeoffreyMarket extends GeoffreyLocation{ private LinkedList shops; public GeoffreyMarket(JsonObject locationJSON) { super(locationJSON); this.shops = new LinkedList<>(); for (JsonElement json : locationJSON.get("shops").getAsJsonArray()) { this.shops.add(new GeoffreyLocation(json.getAsJsonObject())); } } public GeoffreyMarket(int xCoord, int zCoord, String locationName, List owners, String dimension, LinkedList shops) { super(xCoord, zCoord, locationName, owners, dimension); this.shops = shops; } @Override public String getInfoString() { StringBuilder infoString = new StringBuilder(); infoString.append(super.getInfoString()); infoString.append("\nShops:"); for (GeoffreyLocation shop: shops) { infoString.append("\n"); infoString.append(shop.getFormattedLocationString()); } return infoString.toString(); } }