diff options
21 files changed, 211 insertions, 64 deletions
diff --git a/api/src/main/java/market/guess/api/GuessMarketContext.java b/api/src/main/java/market/guess/api/GuessMarketContext.java index f010e1c..d959de6 100644 --- a/api/src/main/java/market/guess/api/GuessMarketContext.java +++ b/api/src/main/java/market/guess/api/GuessMarketContext.java | |||
| @@ -13,7 +13,7 @@ public interface GuessMarketContext { | |||
| 13 | 13 | ||
| 14 | EventDetailDTO getEvent(String eventKey); | 14 | EventDetailDTO getEvent(String eventKey); |
| 15 | 15 | ||
| 16 | PurchaseReceiptDTO buyShares(String userName, String eventKey, String optionKey, long quantity) | 16 | PurchaseReceiptDTO buyShares(String userName, String eventKey, String optionKey, int quantity) |
| 17 | throws GuessMarketException; | 17 | throws GuessMarketException; |
| 18 | 18 | ||
| 19 | EventDetailDTO closeEvent(String userName, String eventKey, String winningOptionKey) | 19 | EventDetailDTO closeEvent(String userName, String eventKey, String winningOptionKey) |
diff --git a/service/src/main/java/market/guess/service/LocalGuessMarketContext.java b/service/src/main/java/market/guess/service/LocalGuessMarketContext.java index 67e263f..16ee1b8 100644 --- a/service/src/main/java/market/guess/service/LocalGuessMarketContext.java +++ b/service/src/main/java/market/guess/service/LocalGuessMarketContext.java | |||
| @@ -10,19 +10,33 @@ import market.guess.api.LoadResultDTO; | |||
| 10 | import market.guess.api.PurchaseReceiptDTO; | 10 | import market.guess.api.PurchaseReceiptDTO; |
| 11 | import market.guess.exception.GuessMarketException; | 11 | import market.guess.exception.GuessMarketException; |
| 12 | import market.guess.service.domain.Event; | 12 | import market.guess.service.domain.Event; |
| 13 | import market.guess.service.infrastructure.provider.Loader; | ||
| 13 | import market.guess.service.repository.EventRepository; | 14 | import market.guess.service.repository.EventRepository; |
| 15 | import market.guess.service.repository.UserRepository; | ||
| 14 | 16 | ||
| 15 | public final class LocalGuessMarketContext implements GuessMarketContext { | 17 | public final class LocalGuessMarketContext implements GuessMarketContext { |
| 16 | private final EventRepository eventRepository; | 18 | private final EventRepository eventRepository; |
| 19 | private final UserRepository userRepository; | ||
| 17 | 20 | ||
| 18 | public LocalGuessMarketContext(EventRepository eventRepository) { | 21 | private final TradingOperation tradingOperation; |
| 22 | |||
| 23 | private final Loader provider; | ||
| 24 | |||
| 25 | public LocalGuessMarketContext( | ||
| 26 | Loader provider, | ||
| 27 | EventRepository eventRepository, | ||
| 28 | UserRepository userRepository, | ||
| 29 | TradingOperation tradingOperation) { | ||
| 19 | super(); | 30 | super(); |
| 31 | this.provider = provider; | ||
| 20 | this.eventRepository = eventRepository; | 32 | this.eventRepository = eventRepository; |
| 33 | this.userRepository = userRepository; | ||
| 34 | this.tradingOperation = tradingOperation; | ||
| 21 | } | 35 | } |
| 22 | 36 | ||
| 23 | @Override | 37 | @Override |
| 24 | public LoadResultDTO loadEvents(Path path) { | 38 | public LoadResultDTO loadEvents(Path path) { |
| 25 | throw new UnsupportedOperationException("Unimplemented method 'loadEvents'"); | 39 | return provider.load(path); |
| 26 | } | 40 | } |
| 27 | 41 | ||
| 28 | @Override | 42 | @Override |
| @@ -42,15 +56,19 @@ public final class LocalGuessMarketContext implements GuessMarketContext { | |||
| 42 | 56 | ||
| 43 | @Override | 57 | @Override |
| 44 | public PurchaseReceiptDTO buyShares( | 58 | public PurchaseReceiptDTO buyShares( |
| 45 | String userName, String eventKey, String optionKey, long quantity) | 59 | String userName, String eventKey, String optionKey, int quantity) |
| 46 | throws GuessMarketException { | 60 | throws GuessMarketException { |
| 47 | throw new UnsupportedOperationException("Unimplemented method 'buyShares'"); | 61 | var event = eventRepository.getEvent(eventKey); |
| 62 | var option = event.getOption(optionKey); | ||
| 63 | var user = userRepository.getUser(userName); | ||
| 64 | var trade = tradingOperation.buy(event, user, option, quantity); | ||
| 65 | return new PurchaseReceiptDTO(); | ||
| 48 | } | 66 | } |
| 49 | 67 | ||
| 50 | @Override | 68 | @Override |
| 51 | public EventDetailDTO closeEvent(String userName, String eventKey, String winningOptionKey) | 69 | public EventDetailDTO closeEvent(String userName, String eventKey, String winningOptionKey) |
| 52 | throws GuessMarketException { | 70 | throws GuessMarketException { |
| 53 | throw new UnsupportedOperationException("Unimplemented method 'closeEvent'"); | 71 | throw new UnsupportedOperationException("Unimplemented method 'account'"); |
| 54 | } | 72 | } |
| 55 | 73 | ||
| 56 | @Override | 74 | @Override |
diff --git a/service/src/main/java/market/guess/service/TradingOperation.java b/service/src/main/java/market/guess/service/TradingOperation.java new file mode 100644 index 0000000..c8153c2 --- /dev/null +++ b/service/src/main/java/market/guess/service/TradingOperation.java | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | package market.guess.service; | ||
| 2 | |||
| 3 | import market.guess.service.domain.Event; | ||
| 4 | import market.guess.service.domain.Option; | ||
| 5 | import market.guess.service.domain.Settlement; | ||
| 6 | import market.guess.service.domain.Trade; | ||
| 7 | import market.guess.service.domain.User; | ||
| 8 | |||
| 9 | public interface TradingOperation { | ||
| 10 | Trade buy(Event event, User user, Option Option, int quantity); | ||
| 11 | |||
| 12 | Settlement settle(Event event, String winningOption); | ||
| 13 | } | ||
diff --git a/service/src/main/java/market/guess/service/TradingOperationImpl.java b/service/src/main/java/market/guess/service/TradingOperationImpl.java new file mode 100644 index 0000000..f6c9aa1 --- /dev/null +++ b/service/src/main/java/market/guess/service/TradingOperationImpl.java | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | package market.guess.service; | ||
| 2 | |||
| 3 | import market.guess.service.domain.Event; | ||
| 4 | import market.guess.service.domain.Option; | ||
| 5 | import market.guess.service.domain.Settlement; | ||
| 6 | import market.guess.service.domain.Trade; | ||
| 7 | import market.guess.service.domain.User; | ||
| 8 | |||
| 9 | public final class TradingOperationImpl implements TradingOperation { | ||
| 10 | |||
| 11 | @Override | ||
| 12 | public Trade buy(Event event, User user, Option Option, int quantity) { | ||
| 13 | // TODO Auto-generated method stub | ||
| 14 | throw new UnsupportedOperationException("Unimplemented method 'buy'"); | ||
| 15 | } | ||
| 16 | |||
| 17 | @Override | ||
| 18 | public Settlement settle(Event event, String winningOption) { | ||
| 19 | // TODO Auto-generated method stub | ||
| 20 | throw new UnsupportedOperationException("Unimplemented method 'settle'"); | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/service/src/main/java/market/guess/service/domain/Event.java b/service/src/main/java/market/guess/service/domain/Event.java index 2d7ac39..cef0840 100644 --- a/service/src/main/java/market/guess/service/domain/Event.java +++ b/service/src/main/java/market/guess/service/domain/Event.java | |||
| @@ -165,4 +165,11 @@ public final class Event { | |||
| 165 | getOptionsNames(), | 165 | getOptionsNames(), |
| 166 | account.getBalance().toPlainString()); | 166 | account.getBalance().toPlainString()); |
| 167 | } | 167 | } |
| 168 | |||
| 169 | public Option getOption(String optionKey) { | ||
| 170 | return options.stream() | ||
| 171 | .filter(option -> option.getKey().equalsIgnoreCase(optionKey)) | ||
| 172 | .findFirst() | ||
| 173 | .orElseThrow(() -> new IllegalArgumentException("No such option.")); | ||
| 174 | } | ||
| 168 | } | 175 | } |
diff --git a/service/src/main/java/market/guess/service/domain/Settlement.java b/service/src/main/java/market/guess/service/domain/Settlement.java new file mode 100644 index 0000000..cfc61f5 --- /dev/null +++ b/service/src/main/java/market/guess/service/domain/Settlement.java | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | package market.guess.service.domain; | ||
| 2 | |||
| 3 | import java.math.BigDecimal; | ||
| 4 | |||
| 5 | public record Settlement( | ||
| 6 | String winningOption, BigDecimal commission, BigDecimal paidOutToHolders) {} | ||
diff --git a/service/src/main/java/market/guess/service/infrastructure/provider/XMLLoader.java b/service/src/main/java/market/guess/service/infrastructure/provider/XMLLoader.java new file mode 100644 index 0000000..443cd87 --- /dev/null +++ b/service/src/main/java/market/guess/service/infrastructure/provider/XMLLoader.java | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | package market.guess.service.infrastructure.provider; | ||
| 2 | |||
| 3 | import java.nio.file.Path; | ||
| 4 | import market.guess.api.LoadResultDTO; | ||
| 5 | |||
| 6 | public final class XMLLoader implements Loader { | ||
| 7 | |||
| 8 | @Override | ||
| 9 | public LoadResultDTO load(Path path) { | ||
| 10 | // TODO Auto-generated method stub | ||
| 11 | throw new UnsupportedOperationException("Unimplemented method 'load'"); | ||
| 12 | } | ||
| 13 | } | ||
diff --git a/service/src/main/java/market/guess/service/repository/InMemoryEventRepository.java b/service/src/main/java/market/guess/service/repository/InMemoryEventRepository.java new file mode 100644 index 0000000..dad1055 --- /dev/null +++ b/service/src/main/java/market/guess/service/repository/InMemoryEventRepository.java | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | package market.guess.service.repository; | ||
| 2 | |||
| 3 | import java.util.List; | ||
| 4 | import market.guess.service.domain.Event; | ||
| 5 | |||
| 6 | public final class InMemoryEventRepository implements EventRepository { | ||
| 7 | |||
| 8 | @Override | ||
| 9 | public Event getEvent(String id) { | ||
| 10 | // TODO Auto-generated method stub | ||
| 11 | throw new UnsupportedOperationException("Unimplemented method 'getEvent'"); | ||
| 12 | } | ||
| 13 | |||
| 14 | @Override | ||
| 15 | public List<Event> getAllEvents() { | ||
| 16 | // TODO Auto-generated method stub | ||
| 17 | throw new UnsupportedOperationException("Unimplemented method 'getAllEvents'"); | ||
| 18 | } | ||
| 19 | } | ||
diff --git a/service/src/main/java/market/guess/service/repository/InMemoryUserRepository.java b/service/src/main/java/market/guess/service/repository/InMemoryUserRepository.java new file mode 100644 index 0000000..e71c94c --- /dev/null +++ b/service/src/main/java/market/guess/service/repository/InMemoryUserRepository.java | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | package market.guess.service.repository; | ||
| 2 | |||
| 3 | |||
| 4 | import market.guess.service.domain.User; | ||
| 5 | |||
| 6 | public final class InMemoryUserRepository implements UserRepository { | ||
| 7 | |||
| 8 | @Override | ||
| 9 | public User getUser(String name) { | ||
| 10 | // TODO Auto-generated method stub | ||
| 11 | throw new UnsupportedOperationException("Unimplemented method 'getUser'"); | ||
| 12 | } | ||
| 13 | } | ||
diff --git a/ui-console/.classpath b/ui-console/.classpath index cfc0f9a..47b6ad0 100644 --- a/ui-console/.classpath +++ b/ui-console/.classpath | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | </attributes> | 7 | </attributes> |
| 8 | </classpathentry> | 8 | </classpathentry> |
| 9 | <classpathentry kind="src" path="/guess-market-api"/> | 9 | <classpathentry kind="src" path="/guess-market-api"/> |
| 10 | <classpathentry kind="src" path="/guess-market-service"/> | ||
| 10 | <classpathentry kind="lib" path="../lib/pico/picocontainer-2.15.2.jar"/> | 11 | <classpathentry kind="lib" path="../lib/pico/picocontainer-2.15.2.jar"/> |
| 11 | <classpathentry kind="lib" path="../lib/junit/junit-platform-console-standalone-6.1.1.jar"/> | 12 | <classpathentry kind="lib" path="../lib/junit/junit-platform-console-standalone-6.1.1.jar"/> |
| 12 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | 13 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
diff --git a/ui-console/.project b/ui-console/.project index d620a57..ca461d9 100644 --- a/ui-console/.project +++ b/ui-console/.project | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | <comment></comment> | 4 | <comment></comment> |
| 5 | <projects> | 5 | <projects> |
| 6 | <project>guess-market-api</project> | 6 | <project>guess-market-api</project> |
| 7 | <project>guess-market-service</project> | ||
| 7 | </projects> | 8 | </projects> |
| 8 | <buildSpec> | 9 | <buildSpec> |
| 9 | <buildCommand> | 10 | <buildCommand> |
diff --git a/ui-console/src/main/java/market/guess/ui/console/App.java b/ui-console/src/main/java/market/guess/ui/console/App.java index 5158478..ccffc06 100644 --- a/ui-console/src/main/java/market/guess/ui/console/App.java +++ b/ui-console/src/main/java/market/guess/ui/console/App.java | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | package market.guess.ui.console; | 1 | package market.guess.ui.console; |
| 2 | 2 | ||
| 3 | import market.guess.api.GuessMarketContext; | ||
| 4 | import market.guess.service.LocalGuessMarketContext; | ||
| 5 | import market.guess.service.TradingOperation; | ||
| 6 | import market.guess.service.TradingOperationImpl; | ||
| 7 | import market.guess.service.infrastructure.provider.Loader; | ||
| 8 | import market.guess.service.infrastructure.provider.XMLLoader; | ||
| 9 | import market.guess.service.repository.EventRepository; | ||
| 10 | import market.guess.service.repository.InMemoryEventRepository; | ||
| 11 | import market.guess.service.repository.InMemoryUserRepository; | ||
| 12 | import market.guess.service.repository.UserRepository; | ||
| 13 | import market.guess.ui.console.command.LoadFileMenuCommand; | ||
| 3 | import org.picocontainer.DefaultPicoContainer; | 14 | import org.picocontainer.DefaultPicoContainer; |
| 4 | import org.picocontainer.behaviors.Caching; | 15 | import org.picocontainer.behaviors.Caching; |
| 5 | 16 | ||
| @@ -7,25 +18,19 @@ public class App { | |||
| 7 | public static void main() { | 18 | public static void main() { |
| 8 | var pico = new DefaultPicoContainer(new Caching()); | 19 | var pico = new DefaultPicoContainer(new Caching()); |
| 9 | 20 | ||
| 10 | pico.addComponent(ConsoleInputProviderFactory.class); | 21 | pico.addComponent(EventRepository.class, InMemoryEventRepository.class); |
| 11 | pico.addComponent(ConsoleOutputProviderFactory.class); | 22 | pico.addComponent(UserRepository.class, InMemoryUserRepository.class); |
| 23 | |||
| 24 | pico.addComponent(TradingOperation.class, TradingOperationImpl.class); | ||
| 25 | pico.addComponent(Loader.class, XMLLoader.class); | ||
| 26 | pico.addComponent(GuessMarketContext.class, LocalGuessMarketContext.class); | ||
| 27 | |||
| 28 | pico.addComponent(LoadFileMenuCommand.class); | ||
| 29 | |||
| 30 | pico.addComponent(InputProvider.class, ConsoleInputProvider.class); | ||
| 31 | pico.addComponent(OutputProvider.class, ConsoleOutputProvider.class); | ||
| 12 | pico.addComponent(Menu.class); | 32 | pico.addComponent(Menu.class); |
| 13 | 33 | ||
| 14 | pico.start(); | 34 | pico.start(); |
| 15 | // var context = new LocalGuessMarketContext(); | ||
| 16 | // var factory = new ConsoleInputProviderFactory(); | ||
| 17 | // var oFactory = new ConsoleOutputProviderFactory(); | ||
| 18 | // | ||
| 19 | // context.LoadAsync(); | ||
| 20 | // printMenu(oFactory.create()); | ||
| 21 | // | ||
| 22 | // try (var provider = factory.create()) { | ||
| 23 | // var input = provider.nextInt(); | ||
| 24 | // while (input != 0) { | ||
| 25 | // input = provider.nextInt(); | ||
| 26 | // } | ||
| 27 | // } catch (Exception ex) { | ||
| 28 | // ex.printStackTrace(); | ||
| 29 | // | ||
| 30 | } | 35 | } |
| 31 | } | 36 | } |
diff --git a/ui-console/src/main/java/market/guess/ui/console/ConsoleInputProviderFactory.java b/ui-console/src/main/java/market/guess/ui/console/ConsoleInputProviderFactory.java deleted file mode 100644 index a7433b7..0000000 --- a/ui-console/src/main/java/market/guess/ui/console/ConsoleInputProviderFactory.java +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | package market.guess.ui.console; | ||
| 2 | |||
| 3 | public class ConsoleInputProviderFactory implements InputProviderFactory { | ||
| 4 | |||
| 5 | @Override | ||
| 6 | public InputProvider create() { | ||
| 7 | return new ConsoleInputProvider(); | ||
| 8 | } | ||
| 9 | } | ||
diff --git a/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProvider.java b/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProvider.java index 84017ac..3009d95 100644 --- a/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProvider.java +++ b/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProvider.java | |||
| @@ -11,4 +11,9 @@ public class ConsoleOutputProvider implements OutputProvider { | |||
| 11 | public void println(Object object) { | 11 | public void println(Object object) { |
| 12 | IO.println(object); | 12 | IO.println(object); |
| 13 | } | 13 | } |
| 14 | |||
| 15 | @Override | ||
| 16 | public void newLine() { | ||
| 17 | IO.println(""); | ||
| 18 | } | ||
| 14 | } | 19 | } |
diff --git a/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProviderFactory.java b/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProviderFactory.java deleted file mode 100644 index 3665df3..0000000 --- a/ui-console/src/main/java/market/guess/ui/console/ConsoleOutputProviderFactory.java +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | package market.guess.ui.console; | ||
| 2 | |||
| 3 | public class ConsoleOutputProviderFactory implements OutputProviderFactory { | ||
| 4 | |||
| 5 | @Override | ||
| 6 | public OutputProvider create() { | ||
| 7 | return new ConsoleOutputProvider(); | ||
| 8 | } | ||
| 9 | } | ||
diff --git a/ui-console/src/main/java/market/guess/ui/console/InputProviderFactory.java b/ui-console/src/main/java/market/guess/ui/console/InputProviderFactory.java deleted file mode 100644 index dcbb1c6..0000000 --- a/ui-console/src/main/java/market/guess/ui/console/InputProviderFactory.java +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | package market.guess.ui.console; | ||
| 2 | |||
| 3 | public interface InputProviderFactory { | ||
| 4 | InputProvider create(); | ||
| 5 | } | ||
diff --git a/ui-console/src/main/java/market/guess/ui/console/Menu.java b/ui-console/src/main/java/market/guess/ui/console/Menu.java index 81dade0..1f3f2be 100644 --- a/ui-console/src/main/java/market/guess/ui/console/Menu.java +++ b/ui-console/src/main/java/market/guess/ui/console/Menu.java | |||
| @@ -1,17 +1,24 @@ | |||
| 1 | package market.guess.ui.console; | 1 | package market.guess.ui.console; |
| 2 | 2 | ||
| 3 | import java.util.List; | ||
| 4 | import market.guess.ui.console.command.MenuCommand; | ||
| 3 | import org.picocontainer.Startable; | 5 | import org.picocontainer.Startable; |
| 4 | 6 | ||
| 5 | public class Menu implements Startable { | 7 | public final class Menu implements Startable { |
| 6 | private final OutputProvider outputProvider; | 8 | private final OutputProvider out; |
| 9 | private final InputProvider in; | ||
| 10 | private final List<MenuCommand> commands; | ||
| 7 | 11 | ||
| 8 | public Menu(OutputProviderFactory factory) { | 12 | public Menu( |
| 9 | this.outputProvider = factory.create(); | 13 | List<MenuCommand> commands, OutputProvider outputProvider, InputProvider inputProvider) { |
| 14 | this.commands = commands; | ||
| 15 | this.out = outputProvider; | ||
| 16 | this.in = inputProvider; | ||
| 10 | } | 17 | } |
| 11 | 18 | ||
| 12 | @Override | 19 | @Override |
| 13 | public void start() { | 20 | public void start() { |
| 14 | printMenu(outputProvider); | 21 | printMenu(); |
| 15 | } | 22 | } |
| 16 | 23 | ||
| 17 | @Override | 24 | @Override |
| @@ -19,13 +26,10 @@ public class Menu implements Startable { | |||
| 19 | // Do nothing. | 26 | // Do nothing. |
| 20 | } | 27 | } |
| 21 | 28 | ||
| 22 | private static void printMenu(OutputProvider provider) { | 29 | private void printMenu() { |
| 23 | provider.println("[1] Load Marketplace"); | 30 | out.newLine(); |
| 24 | provider.println("[2] Save Marketplace"); | 31 | for (var command : commands) { |
| 25 | provider.println("[3] Show All Events"); | 32 | out.println(" %d -- %s".formatted(command.getIndex(), command.getName())); |
| 26 | provider.println("[4] Event Info"); | 33 | } |
| 27 | provider.println("[5] Participate In Event"); | ||
| 28 | provider.println("[6] Close Event"); | ||
| 29 | provider.println("[7] Exit"); | ||
| 30 | } | 34 | } |
| 31 | } | 35 | } |
diff --git a/ui-console/src/main/java/market/guess/ui/console/OutputProvider.java b/ui-console/src/main/java/market/guess/ui/console/OutputProvider.java index 57ff001..e49bec5 100644 --- a/ui-console/src/main/java/market/guess/ui/console/OutputProvider.java +++ b/ui-console/src/main/java/market/guess/ui/console/OutputProvider.java | |||
| @@ -3,5 +3,7 @@ package market.guess.ui.console; | |||
| 3 | public interface OutputProvider { | 3 | public interface OutputProvider { |
| 4 | void print(Object object); | 4 | void print(Object object); |
| 5 | 5 | ||
| 6 | void newLine(); | ||
| 7 | |||
| 6 | void println(Object object); | 8 | void println(Object object); |
| 7 | } | 9 | } |
diff --git a/ui-console/src/main/java/market/guess/ui/console/OutputProviderFactory.java b/ui-console/src/main/java/market/guess/ui/console/OutputProviderFactory.java deleted file mode 100644 index 6d6601f..0000000 --- a/ui-console/src/main/java/market/guess/ui/console/OutputProviderFactory.java +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | package market.guess.ui.console; | ||
| 2 | |||
| 3 | public interface OutputProviderFactory { | ||
| 4 | OutputProvider create(); | ||
| 5 | } | ||
diff --git a/ui-console/src/main/java/market/guess/ui/console/command/LoadFileMenuCommand.java b/ui-console/src/main/java/market/guess/ui/console/command/LoadFileMenuCommand.java new file mode 100644 index 0000000..eddc68f --- /dev/null +++ b/ui-console/src/main/java/market/guess/ui/console/command/LoadFileMenuCommand.java | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | package market.guess.ui.console.command; | ||
| 2 | |||
| 3 | import market.guess.api.GuessMarketContext; | ||
| 4 | import market.guess.ui.console.OutputProvider; | ||
| 5 | |||
| 6 | public final class LoadFileMenuCommand implements MenuCommand { | ||
| 7 | private final GuessMarketContext context; | ||
| 8 | private final OutputProvider out; | ||
| 9 | |||
| 10 | public LoadFileMenuCommand(GuessMarketContext context, OutputProvider out) { | ||
| 11 | this.context = context; | ||
| 12 | this.out = out; | ||
| 13 | } | ||
| 14 | |||
| 15 | @Override | ||
| 16 | public int getIndex() { | ||
| 17 | return 1; | ||
| 18 | } | ||
| 19 | |||
| 20 | @Override | ||
| 21 | public String getName() { | ||
| 22 | return "Load events from file"; | ||
| 23 | } | ||
| 24 | |||
| 25 | @Override | ||
| 26 | public boolean allowed() { | ||
| 27 | return true; | ||
| 28 | } | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public void execute() { | ||
| 32 | // TODO Auto-generated method stub | ||
| 33 | throw new UnsupportedOperationException("Unimplemented method 'execute'"); | ||
| 34 | } | ||
| 35 | } | ||
diff --git a/ui-console/src/main/java/market/guess/ui/console/command/MenuCommand.java b/ui-console/src/main/java/market/guess/ui/console/command/MenuCommand.java new file mode 100644 index 0000000..8a28dfe --- /dev/null +++ b/ui-console/src/main/java/market/guess/ui/console/command/MenuCommand.java | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | package market.guess.ui.console.command; | ||
| 2 | |||
| 3 | public interface MenuCommand { | ||
| 4 | int getIndex(); | ||
| 5 | |||
| 6 | String getName(); | ||
| 7 | |||
| 8 | boolean allowed(); | ||
| 9 | |||
| 10 | void execute(); | ||
| 11 | } | ||