You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
955 B
30 lines
955 B
package com.crawler.chart;
|
|
|
|
import com.crawler.chart.impl.GenreDistributionChartGenerator;
|
|
import com.crawler.chart.impl.RatingDistributionChartGenerator;
|
|
import com.crawler.chart.impl.YearDistributionChartGenerator;
|
|
import com.crawler.chart.impl.YearRatingChartGenerator;
|
|
import com.crawler.model.Movie;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class ChartManager {
|
|
private List<ChartGenerator> chartGenerators;
|
|
|
|
public ChartManager() {
|
|
chartGenerators = new ArrayList<>();
|
|
}
|
|
|
|
public void addChartGenerator(ChartGenerator generator) {
|
|
chartGenerators.add(generator);
|
|
}
|
|
|
|
public void generateAllCharts(List<Movie> movies) {
|
|
Movie[] movieArray = movies.toArray(new Movie[0]);
|
|
for (ChartGenerator generator : chartGenerators) {
|
|
System.out.println("生成图表: " + generator.getChartName());
|
|
generator.generateChart(movieArray);
|
|
}
|
|
}
|
|
}
|