painted as it should be. so ok? Next, use your classes to fill in everything. So much for scalability, and abstraction, and dao, and services, the format of the input file data
package oop.items; /** * Created by sahakyan on 6/24/2016. */ public class City { private String name; private Factors factors; public City(String name, Factors factors) { this.name = name; this.factors = factors; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Factors getFactors() { return factors; } public void setFactors(Factors factors) { this.factors = factors; } @Override public String toString() { return "City{" + "name='" + name + '\'' + ", factors=" + factors.toString() + '}'; } }
2
package oop.items; import java.util.*; /** * Created by sahakyan on 6/24/2016. */ public class Factors { private int temperature; /** * влажность воздуха */ private int airHumidity; /** * количество осадков */ private Rainfall rainfall; /** * скорость ветра */ private WindSpeed windSpeed; /** * направление ветра */ private WindDirection windDirection; /** * интервал времени */ private Calendar interval; public Factors(int temperature, int airHumidity, Rainfall rainfall, WindSpeed windSpeed, WindDirection windDirection, Calendar interval) { this.temperature = temperature; this.airHumidity = airHumidity; this.rainfall = rainfall; this.windSpeed = windSpeed; this.windDirection = windDirection; this.interval = interval; } public int getTemperature() { return temperature; } public void setTemperature(int temperature) { this.temperature = temperature; } public int getAirHumidity() { return airHumidity; } public void setAirHumidity(int airHumidity) { this.airHumidity = airHumidity; } public Rainfall getRainfall() { return rainfall; } public void setRainfall(Rainfall rainfall) { this.rainfall = rainfall; } public WindSpeed getWindSpeed() { return windSpeed; } public void setWindSpeed(WindSpeed windSpeed) { this.windSpeed = windSpeed; } public WindDirection getWindDirection() { return windDirection; } public void setWindDirection(WindDirection windDirection) { this.windDirection = windDirection; } public Calendar getInterval() { return interval; } public void setInterval(Calendar interval) { this.interval = interval; } @Override public String toString() { return "Factors{" + "temperature=" + temperature + ", airHumidity=" + airHumidity + ", rainfall=" + rainfall.toString() + ", windSpeed=" + windSpeed.toString() + ", windDirection=" + windDirection + ", interval=" + interval.toString() + '}'; } }
3
package oop.items; /** * Created by sahakyan on 6/24/2016. */ public class Rainfall { private int value; private String type; public Rainfall(int value, String type) { this.value = value; this.type = type; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public String toString() { return "Rainfall{" + "value=" + value + ", type='" + type + '\'' + '}'; } }
four
package oop.items; /** * Created by sahakyan on 6/24/2016. */ public enum WindDirection { EAST, WEST, SOUTH, NORTH }
five
package oop.items; /** * Created by sahakyan on 6/24/2016. */ public class WindSpeed { private int value; private String type; public WindSpeed(int value, String type) { this.value = value; this.type = type; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public String toString() { return "WindSpeed{" + "value=" + value + ", type='" + type + '\'' + '}'; } }
6
package oop.services; import oop.dao.*; import oop.items.*; import java.util.*; /** * Created by sahakyan on 6/24/2016. */ public class FactorsService extends AbstractController { private ArrayList<City> cityArrayList = new ArrayList<City>(); public FactorsService() { } public List getAll() { return cityArrayList; } public Object update(Object entity) { return null; } public Object add(Object entity) { return null; } public Object getEntityById(Object id) { return null; } public Object getByName(Object name) { return null; } public boolean remove(Object id) { return false; } public boolean create(Object entity) { return false; } }
7
package oop.dao; import java.util.*; /** * Created by sahakyan on 6/24/2016. */ public abstract class AbstractController<E, K> { public abstract List<E> getAll(); public abstract E update(E entity); public abstract E add(E entity); public abstract E getEntityById(K id); public abstract E getByName(K name); public abstract boolean remove(K id); public abstract boolean create(E entity); }