diff --git a/project/command/202506050328-杜雨萌-期末实验报告.docx b/project/command/202506050328-杜雨萌-期末实验报告.docx new file mode 100644 index 0000000..bc92b59 Binary files /dev/null and b/project/command/202506050328-杜雨萌-期末实验报告.docx differ diff --git a/project/command/ChangshaWeatherStrategy.class b/project/command/ChangshaWeatherStrategy.class new file mode 100644 index 0000000..fa64d8f Binary files /dev/null and b/project/command/ChangshaWeatherStrategy.class differ diff --git a/project/command/Command.class b/project/command/Command.class new file mode 100644 index 0000000..275d561 Binary files /dev/null and b/project/command/Command.class differ diff --git a/project/command/Command.java b/project/command/Command.java new file mode 100644 index 0000000..8e872d0 --- /dev/null +++ b/project/command/Command.java @@ -0,0 +1,9 @@ + +package command; + +import controller.CrawlerController; + +public interface Command { + void execute(CrawlerController controller) throws Exception; +} + diff --git a/project/command/ConsoleView.class b/project/command/ConsoleView.class new file mode 100644 index 0000000..0607d16 Binary files /dev/null and b/project/command/ConsoleView.class differ diff --git a/project/command/CrawlCommand.java b/project/command/CrawlCommand.java new file mode 100644 index 0000000..c73e781 --- /dev/null +++ b/project/command/CrawlCommand.java @@ -0,0 +1,17 @@ + +package command; + +import controller.CrawlerController; + +public class CrawlCommand implements Command { + private int platform; + + public CrawlCommand(int platform) { + this.platform = platform; + } + + public void execute(CrawlerController controller) throws Exception { + controller.crawl(platform); + } +} + diff --git a/project/command/ExitCommand.java b/project/command/ExitCommand.java new file mode 100644 index 0000000..d198bc4 --- /dev/null +++ b/project/command/ExitCommand.java @@ -0,0 +1,11 @@ + +package command; + +import controller.CrawlerController; + +public class ExitCommand implements Command { + public void execute(CrawlerController controller) { + controller.exit(); + } +} + diff --git a/project/command/HelpCommand.java b/project/command/HelpCommand.java new file mode 100644 index 0000000..7342ebb --- /dev/null +++ b/project/command/HelpCommand.java @@ -0,0 +1,11 @@ + +package command; + +import controller.CrawlerController; + +public class HelpCommand implements Command { + public void execute(CrawlerController controller) { + controller.showHelp(); + } +} + diff --git a/project/command/ListCommand.java b/project/command/ListCommand.java new file mode 100644 index 0000000..6b1c202 --- /dev/null +++ b/project/command/ListCommand.java @@ -0,0 +1,11 @@ + +package command; + +import controller.CrawlerController; + +public class ListCommand implements Command { + public void execute(CrawlerController controller) { + controller.listData(); + } +} + diff --git a/project/command/compile.bat b/project/command/compile.bat new file mode 100644 index 0000000..a46f6c1 --- /dev/null +++ b/project/command/compile.bat @@ -0,0 +1,24 @@ + +@echo off +chcp 65001 >nul +echo 正在编译项目... + +javac -encoding UTF-8 -cp ".;lib/*" ^ + exception/*.java ^ + model/*.java ^ + view/*.java ^ + strategy/*.java ^ + repository/*.java ^ + command/*.java ^ + controller/*.java ^ + main.java + +if %ERRORLEVEL% EQU 0 ( + echo 编译成功! + echo. + echo 运行程序请使用: run.bat +) else ( + echo 编译失败! + pause +) +