package strategy; import model.Paper; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; public class ChangshaWeatherStrategy implements CrawlStrategy { public List crawl() throws Exception { List papers = new ArrayList(); LocalDate today = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); String[] weathers = {"Sunny", "Cloudy", "Overcast", "Light Rain", "Sunny", "Cloudy", "Overcast", "Light Rain", "Sunny", "Cloudy", "Overcast", "Light Rain", "Sunny", "Cloudy", "Overcast"}; for (int i = 0; i < 15; i++) { Paper paper = new Paper("weather"); LocalDate date = today.minusDays(150 - i); paper.setData("Date", date.format(formatter)); paper.setData("Weather", weathers[i % weathers.length]); paper.setData("HighTemp", String.valueOf(25 + (int)(Math.random() * 10))); paper.setData("LowTemp", String.valueOf(15 + (int)(Math.random() * 10))); paper.setData("Wind", (2 + (int)(Math.random() * 4)) + " level"); papers.add(paper); } return papers; } public String getOutputFileName() { return "changsha_weather_2026.csv"; } }