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.

19 lines
484 B

import java.util.ArrayList;
import java.util.List;
public class StrategyFactory11 {
private final List<CrawlStrategy11> strategyList = new ArrayList<>();
public void registerStrategy(CrawlStrategy11 strategy) {
strategyList.add(strategy);
}
public CrawlStrategy11 getMatchStrategy(String url) {
for (CrawlStrategy11 s : strategyList) {
if (s.supports(url)) {
return s;
}
}
return null;
}
}