From 86f23485879ded7ab37938c67e49c12b9ad67d21 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Mon, 21 Apr 2014 23:50:42 +0200 Subject: Rename interfaces (-able) --- src/esieequest/Main.java | 4 +- src/esieequest/controller/GameEngine.java | 6 +- .../controller/commands/AleaCommand.java | 6 +- .../controller/commands/BackCommand.java | 6 +- src/esieequest/controller/commands/Command.java | 8 +-- .../controller/commands/CommandInterface.java | 25 ------- src/esieequest/controller/commands/DoCommand.java | 6 +- .../controller/commands/DropCommand.java | 6 +- src/esieequest/controller/commands/Executable.java | 25 +++++++ .../controller/commands/ForwardCommand.java | 6 +- src/esieequest/controller/commands/GoCommand.java | 6 +- .../controller/commands/HelpCommand.java | 6 +- .../controller/commands/InventoryCommand.java | 6 +- .../controller/commands/LoadCommand.java | 6 +- .../controller/commands/LookCommand.java | 6 +- src/esieequest/controller/commands/NewCommand.java | 6 +- .../controller/commands/QuitCommand.java | 6 +- .../controller/commands/SaveCommand.java | 6 +- .../controller/commands/SoundCommand.java | 6 +- .../controller/commands/TakeCommand.java | 6 +- .../controller/commands/TalkCommand.java | 6 +- .../controller/commands/TurnCommand.java | 6 +- src/esieequest/controller/commands/UseCommand.java | 6 +- src/esieequest/model/doors/Door.java | 4 +- src/esieequest/model/doors/LockedDoor.java | 4 +- src/esieequest/model/doors/TrapDoor.java | 4 +- src/esieequest/model/items/Beamer.java | 4 +- src/esieequest/model/items/Item.java | 4 +- src/esieequest/view/View.java | 81 ---------------------- src/esieequest/view/Viewable.java | 81 ++++++++++++++++++++++ src/esieequest/view/app/UserInterface.java | 4 +- src/esieequest/view/text/TextInterface.java | 4 +- src/esieequest/view/web/WebInterface.java | 4 +- 33 files changed, 185 insertions(+), 185 deletions(-) delete mode 100644 src/esieequest/controller/commands/CommandInterface.java create mode 100644 src/esieequest/controller/commands/Executable.java delete mode 100644 src/esieequest/view/View.java create mode 100644 src/esieequest/view/Viewable.java diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java index 4759a6e..974a6be 100755 --- a/src/esieequest/Main.java +++ b/src/esieequest/Main.java @@ -7,7 +7,7 @@ import javax.swing.JApplet; import esieequest.controller.GameEngine; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; import esieequest.view.app.Applet; import esieequest.view.app.Window; import esieequest.view.text.Console; @@ -48,7 +48,7 @@ public class Main extends JApplet { public static void main(final String[] args) { final List arguments = Arrays.asList(args); Game game; - View view; + Viewable view; if (arguments.contains("--file")) { if (arguments.size() < 2) { diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java index df3d34a..fed79d6 100644 --- a/src/esieequest/controller/GameEngine.java +++ b/src/esieequest/controller/GameEngine.java @@ -4,7 +4,7 @@ import esieequest.controller.commands.Command; import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.characters.MovingCharacter; -import esieequest.view.View; +import esieequest.view.Viewable; /** * The game main controller class. @@ -15,7 +15,7 @@ import esieequest.view.View; public class GameEngine { private final Game game; - private final View view; + private final Viewable view; /** * Instantiates a game engine with the given model and view. @@ -25,7 +25,7 @@ public class GameEngine { * @param view * the view */ - public GameEngine(final Game game, final View view) { + public GameEngine(final Game game, final Viewable view) { this.game = game; this.view = view; diff --git a/src/esieequest/controller/commands/AleaCommand.java b/src/esieequest/controller/commands/AleaCommand.java index 2a5f5c4..33f4deb 100644 --- a/src/esieequest/controller/commands/AleaCommand.java +++ b/src/esieequest/controller/commands/AleaCommand.java @@ -4,7 +4,7 @@ import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.doors.TransporterDoor; import esieequest.model.map.Room; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Provides a way to override the random behaviour of TransporterDoor-s for @@ -12,10 +12,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class AleaCommand implements CommandInterface { +public class AleaCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final String forcedRoomName = argument; Room destinationRoom = null; diff --git a/src/esieequest/controller/commands/BackCommand.java b/src/esieequest/controller/commands/BackCommand.java index 8919540..627df59 100644 --- a/src/esieequest/controller/commands/BackCommand.java +++ b/src/esieequest/controller/commands/BackCommand.java @@ -1,17 +1,17 @@ package esieequest.controller.commands; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to go back on his steps and go to his previous location. * * @author Pacien TRAN-GIRARD */ -public class BackCommand implements CommandInterface { +public class BackCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { game.getPlayer().goToPreviousRoom(); view.updateRoom(game.getPlayer().getCurrentRoom()); diff --git a/src/esieequest/controller/commands/Command.java b/src/esieequest/controller/commands/Command.java index 9b032f7..7ab6961 100644 --- a/src/esieequest/controller/commands/Command.java +++ b/src/esieequest/controller/commands/Command.java @@ -6,7 +6,7 @@ import java.util.List; import esieequest.controller.Utils; import esieequest.model.Game; import esieequest.model.Text; -import esieequest.view.View; +import esieequest.view.Viewable; /** * The Command-s the user can use. @@ -47,7 +47,7 @@ public enum Command { // @formatter:on - private CommandInterface command; + private Executable command; /** * Links an enum constant to a CommandInterface. @@ -55,7 +55,7 @@ public enum Command { * @param command * the CommandInterface */ - Command(final CommandInterface command) { + Command(final Executable command) { this.command = command; } @@ -69,7 +69,7 @@ public enum Command { * @param view * the View */ - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { this.command.execute(argument, game, view); } diff --git a/src/esieequest/controller/commands/CommandInterface.java b/src/esieequest/controller/commands/CommandInterface.java deleted file mode 100644 index e3a26f9..0000000 --- a/src/esieequest/controller/commands/CommandInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -package esieequest.controller.commands; - -import esieequest.model.Game; -import esieequest.view.View; - -/** - * The Command interface. - * - * @author Pacien TRAN-GIRARD - */ -public interface CommandInterface { - - /** - * Performs the task corresponding to the Command. - * - * @param argument - * the argument to pass to the Command - * @param game - * the Game model - * @param view - * the View - */ - public void execute(String argument, Game game, View view); - -} diff --git a/src/esieequest/controller/commands/DoCommand.java b/src/esieequest/controller/commands/DoCommand.java index e99c67d..219dba9 100644 --- a/src/esieequest/controller/commands/DoCommand.java +++ b/src/esieequest/controller/commands/DoCommand.java @@ -3,7 +3,7 @@ package esieequest.controller.commands; import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.map.Side; -import esieequest.view.View; +import esieequest.view.Viewable; /** * A shortcut Command that executes a TALK or a TAKE Command accordingly to the @@ -11,10 +11,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class DoCommand implements CommandInterface { +public class DoCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final Side currentSide = game.getPlayer().getCurrentSide(); diff --git a/src/esieequest/controller/commands/DropCommand.java b/src/esieequest/controller/commands/DropCommand.java index 3685c21..8d2b820 100644 --- a/src/esieequest/controller/commands/DropCommand.java +++ b/src/esieequest/controller/commands/DropCommand.java @@ -3,7 +3,7 @@ package esieequest.controller.commands; import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.items.Item; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to drop an Item from his inventory (referred by its name) to @@ -11,10 +11,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class DropCommand implements CommandInterface { +public class DropCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final String itemName = argument; diff --git a/src/esieequest/controller/commands/Executable.java b/src/esieequest/controller/commands/Executable.java new file mode 100644 index 0000000..36ec6be --- /dev/null +++ b/src/esieequest/controller/commands/Executable.java @@ -0,0 +1,25 @@ +package esieequest.controller.commands; + +import esieequest.model.Game; +import esieequest.view.Viewable; + +/** + * The Executable interface. + * + * @author Pacien TRAN-GIRARD + */ +public interface Executable { + + /** + * Performs the task corresponding to the Command. + * + * @param argument + * the argument to pass to the Command + * @param game + * the Game model + * @param view + * the View + */ + public void execute(String argument, Game game, Viewable view); + +} diff --git a/src/esieequest/controller/commands/ForwardCommand.java b/src/esieequest/controller/commands/ForwardCommand.java index f15a4e2..9134fdc 100644 --- a/src/esieequest/controller/commands/ForwardCommand.java +++ b/src/esieequest/controller/commands/ForwardCommand.java @@ -2,7 +2,7 @@ package esieequest.controller.commands; import esieequest.model.Game; import esieequest.model.map.Direction; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to move forward in the Map (in the Room at the Direction he @@ -10,10 +10,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class ForwardCommand implements CommandInterface { +public class ForwardCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final Direction direction = game.getPlayer().getCurrentDirection(); diff --git a/src/esieequest/controller/commands/GoCommand.java b/src/esieequest/controller/commands/GoCommand.java index 61718a1..ccb974b 100644 --- a/src/esieequest/controller/commands/GoCommand.java +++ b/src/esieequest/controller/commands/GoCommand.java @@ -4,7 +4,7 @@ import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.doors.Door; import esieequest.model.map.Direction; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to move from connected Room-s to Room-s by giving the @@ -12,10 +12,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class GoCommand implements CommandInterface { +public class GoCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final Direction direction; diff --git a/src/esieequest/controller/commands/HelpCommand.java b/src/esieequest/controller/commands/HelpCommand.java index 37b99e4..4c4c39f 100644 --- a/src/esieequest/controller/commands/HelpCommand.java +++ b/src/esieequest/controller/commands/HelpCommand.java @@ -1,17 +1,17 @@ package esieequest.controller.commands; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Prints the available commands. * * @author Pacien TRAN-GIRARD */ -public class HelpCommand implements CommandInterface { +public class HelpCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { view.echo(Command.listCommandsNamesString()); diff --git a/src/esieequest/controller/commands/InventoryCommand.java b/src/esieequest/controller/commands/InventoryCommand.java index da37e07..ff7a341 100644 --- a/src/esieequest/controller/commands/InventoryCommand.java +++ b/src/esieequest/controller/commands/InventoryCommand.java @@ -1,17 +1,17 @@ package esieequest.controller.commands; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Prints the list of the items in the Player's inventory. * * @author Pacien TRAN-GIRARD */ -public class InventoryCommand implements CommandInterface { +public class InventoryCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { view.echo(game.getPlayer().listItemsNamesString()); diff --git a/src/esieequest/controller/commands/LoadCommand.java b/src/esieequest/controller/commands/LoadCommand.java index 4a3972b..79ccf60 100644 --- a/src/esieequest/controller/commands/LoadCommand.java +++ b/src/esieequest/controller/commands/LoadCommand.java @@ -1,17 +1,17 @@ package esieequest.controller.commands; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Loads a saved Game. * * @author Pacien TRAN-GIRARD */ -public class LoadCommand implements CommandInterface { +public class LoadCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { // TODO Auto-generated method stub } diff --git a/src/esieequest/controller/commands/LookCommand.java b/src/esieequest/controller/commands/LookCommand.java index d053b25..5006a66 100644 --- a/src/esieequest/controller/commands/LookCommand.java +++ b/src/esieequest/controller/commands/LookCommand.java @@ -6,17 +6,17 @@ import com.google.common.base.Joiner; import esieequest.model.Game; import esieequest.model.Text; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Prints informations about the current location. * * @author Pacien TRAN-GIRARD */ -public class LookCommand implements CommandInterface { +public class LookCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final ArrayList informations = new ArrayList(); diff --git a/src/esieequest/controller/commands/NewCommand.java b/src/esieequest/controller/commands/NewCommand.java index b49d36b..3c23882 100644 --- a/src/esieequest/controller/commands/NewCommand.java +++ b/src/esieequest/controller/commands/NewCommand.java @@ -4,17 +4,17 @@ import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.map.Direction; import esieequest.model.map.Room; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Creates a new game. * * @author Pacien TRAN-GIRARD */ -public class NewCommand implements CommandInterface { +public class NewCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { // TODO: load a new game game.getPlayer().setCurrentDirection(Direction.NORTH); diff --git a/src/esieequest/controller/commands/QuitCommand.java b/src/esieequest/controller/commands/QuitCommand.java index 739bf93..be53589 100644 --- a/src/esieequest/controller/commands/QuitCommand.java +++ b/src/esieequest/controller/commands/QuitCommand.java @@ -2,17 +2,17 @@ package esieequest.controller.commands; import esieequest.model.Game; import esieequest.model.Text; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to quit the game. * * @author Pacien TRAN-GIRARD */ -public class QuitCommand implements CommandInterface { +public class QuitCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { view.echo(Text.QUIT.getText()); view.disable(); diff --git a/src/esieequest/controller/commands/SaveCommand.java b/src/esieequest/controller/commands/SaveCommand.java index 44e83c0..641b329 100644 --- a/src/esieequest/controller/commands/SaveCommand.java +++ b/src/esieequest/controller/commands/SaveCommand.java @@ -1,17 +1,17 @@ package esieequest.controller.commands; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Saves the current Game. * * @author Pacien TRAN-GIRARD */ -public class SaveCommand implements CommandInterface { +public class SaveCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { // TODO Auto-generated method stub } diff --git a/src/esieequest/controller/commands/SoundCommand.java b/src/esieequest/controller/commands/SoundCommand.java index d375173..fbd11d7 100644 --- a/src/esieequest/controller/commands/SoundCommand.java +++ b/src/esieequest/controller/commands/SoundCommand.java @@ -1,17 +1,17 @@ package esieequest.controller.commands; import esieequest.model.Game; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to enable or disable the game's sounds. * * @author Pacien TRAN-GIRARD */ -public class SoundCommand implements CommandInterface { +public class SoundCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { // TODO Auto-generated method stub } diff --git a/src/esieequest/controller/commands/TakeCommand.java b/src/esieequest/controller/commands/TakeCommand.java index 97eb8b7..705fb6e 100644 --- a/src/esieequest/controller/commands/TakeCommand.java +++ b/src/esieequest/controller/commands/TakeCommand.java @@ -5,7 +5,7 @@ import esieequest.model.Text; import esieequest.model.items.Item; import esieequest.model.map.Room; import esieequest.model.map.Side; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the player to take an Item from a Room and transfer it to his @@ -13,10 +13,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class TakeCommand implements CommandInterface { +public class TakeCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { Item item; if (argument != null) { diff --git a/src/esieequest/controller/commands/TalkCommand.java b/src/esieequest/controller/commands/TalkCommand.java index 1637870..b3168ae 100644 --- a/src/esieequest/controller/commands/TalkCommand.java +++ b/src/esieequest/controller/commands/TalkCommand.java @@ -2,17 +2,17 @@ package esieequest.controller.commands; import esieequest.model.Game; import esieequest.model.Text; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the Player to TALK to a Character. * * @author Pacien TRAN-GIRARD */ -public class TalkCommand implements CommandInterface { +public class TalkCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { if (!game.getPlayer().getCurrentSide().hasCharacter()) { view.echo(Text.NO_CHARACTER.getText()); diff --git a/src/esieequest/controller/commands/TurnCommand.java b/src/esieequest/controller/commands/TurnCommand.java index e451263..a03fbab 100644 --- a/src/esieequest/controller/commands/TurnCommand.java +++ b/src/esieequest/controller/commands/TurnCommand.java @@ -4,7 +4,7 @@ import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.map.Direction; import esieequest.model.map.Orientation; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the user to turn on himself, that is to say to point to another @@ -12,10 +12,10 @@ import esieequest.view.View; * * @author Pacien TRAN-GIRARD */ -public class TurnCommand implements CommandInterface { +public class TurnCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { Orientation orientation; diff --git a/src/esieequest/controller/commands/UseCommand.java b/src/esieequest/controller/commands/UseCommand.java index d8b8416..56eaf00 100644 --- a/src/esieequest/controller/commands/UseCommand.java +++ b/src/esieequest/controller/commands/UseCommand.java @@ -3,17 +3,17 @@ package esieequest.controller.commands; import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.items.Item; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Allows the player to use an item located in his inventory. * * @author Pacien TRAN-GIRARD */ -public class UseCommand implements CommandInterface { +public class UseCommand implements Executable { @Override - public void execute(final String argument, final Game game, final View view) { + public void execute(final String argument, final Game game, final Viewable view) { final String itemName = argument; diff --git a/src/esieequest/model/doors/Door.java b/src/esieequest/model/doors/Door.java index 6c1a906..9b67cda 100644 --- a/src/esieequest/model/doors/Door.java +++ b/src/esieequest/model/doors/Door.java @@ -2,7 +2,7 @@ package esieequest.model.doors; import esieequest.model.Game; import esieequest.model.map.Room; -import esieequest.view.View; +import esieequest.view.Viewable; /** * A door that links two rooms. @@ -52,7 +52,7 @@ public class Door { * * @return if the Door was effectively crossed */ - public boolean cross(final Game game, final View view) { + public boolean cross(final Game game, final Viewable view) { game.getPlayer().goToRoom(this.getDestination()); return true; } diff --git a/src/esieequest/model/doors/LockedDoor.java b/src/esieequest/model/doors/LockedDoor.java index 7305011..28c535e 100644 --- a/src/esieequest/model/doors/LockedDoor.java +++ b/src/esieequest/model/doors/LockedDoor.java @@ -5,7 +5,7 @@ import esieequest.model.Player; import esieequest.model.Text; import esieequest.model.items.KeyCard; import esieequest.model.map.Room; -import esieequest.view.View; +import esieequest.view.Viewable; /** * A door that links two rooms and requires a KeyCard to pass through. @@ -47,7 +47,7 @@ public class LockedDoor extends Door { } @Override - public boolean cross(final Game game, final View view) { + public boolean cross(final Game game, final Viewable view) { if (!this.isAuthorised(game.getPlayer())) { view.echo(Text.DOOR_LOCKED.getText()); return false; diff --git a/src/esieequest/model/doors/TrapDoor.java b/src/esieequest/model/doors/TrapDoor.java index c4c6bfa..2db5443 100644 --- a/src/esieequest/model/doors/TrapDoor.java +++ b/src/esieequest/model/doors/TrapDoor.java @@ -2,7 +2,7 @@ package esieequest.model.doors; import esieequest.model.Game; import esieequest.model.map.Room; -import esieequest.view.View; +import esieequest.view.Viewable; /** * A one-way door that links two rooms and prevent the usage of the 'back' @@ -23,7 +23,7 @@ public class TrapDoor extends Door { } @Override - public boolean cross(final Game game, final View view) { + public boolean cross(final Game game, final Viewable view) { game.getPlayer().clearRoomHistory(); return super.cross(game, view); } diff --git a/src/esieequest/model/items/Beamer.java b/src/esieequest/model/items/Beamer.java index 64426cd..61bef94 100644 --- a/src/esieequest/model/items/Beamer.java +++ b/src/esieequest/model/items/Beamer.java @@ -3,7 +3,7 @@ package esieequest.model.items; import esieequest.model.Game; import esieequest.model.Text; import esieequest.model.map.Room; -import esieequest.view.View; +import esieequest.view.Viewable; /** * A beamer is a device that can be charged, and fired. When charged, it @@ -27,7 +27,7 @@ public class Beamer extends Item { } @Override - public void use(final Game game, final View view) { + public void use(final Game game, final Viewable view) { if (this.room == null) { this.room = game.getPlayer().getCurrentRoom(); view.echo(Text.BEAMER_ROOM_MEMORISED.getText() + this.room.hashCode()); diff --git a/src/esieequest/model/items/Item.java b/src/esieequest/model/items/Item.java index 16c614b..c6f872f 100644 --- a/src/esieequest/model/items/Item.java +++ b/src/esieequest/model/items/Item.java @@ -2,7 +2,7 @@ package esieequest.model.items; import esieequest.model.Game; import esieequest.model.Text; -import esieequest.view.View; +import esieequest.view.Viewable; /** * Represents an item with a description and a weight, stored in a room. Can be @@ -69,7 +69,7 @@ public class Item { * @param view * the View */ - public void use(final Game game, final View view) { + public void use(final Game game, final Viewable view) { view.echo(Text.NO_USE.getText()); } diff --git a/src/esieequest/view/View.java b/src/esieequest/view/View.java deleted file mode 100644 index 9b68f00..0000000 --- a/src/esieequest/view/View.java +++ /dev/null @@ -1,81 +0,0 @@ -package esieequest.view; - -import java.util.HashMap; - -import esieequest.controller.GameEngine; -import esieequest.model.events.Quest; -import esieequest.model.items.Item; -import esieequest.model.map.Room; -import esieequest.model.map.Side; - -/** - * The view interface that describes an user interface. - * - * @author Pacien TRAN-GIRARD - */ -public interface View { - - /** - * Sets the controller to use. - * - * @param gameEngine - * the GameEngine controller - */ - public void setController(GameEngine gameEngine); - - /** - * Displays the user interface. - */ - public void show(); - - /** - * Enables the user interface. - */ - public void enable(); - - /** - * Displays a message. - * - * @param message - * the message - */ - public void echo(String message); - - /** - * Disables the user interface. - */ - public void disable(); - - /** - * Updates the view to match the current room. - * - * @param room - * the room to display - */ - public void updateRoom(Room room); - - /** - * Updates the view to match a side of a room. - * - * @param side - * the side of a room - */ - public void updateSide(Side side); - - /** - * Updates the view to match the current quest. - * - * @param quest - * the current quest to display - */ - public void updateQuest(Quest quest); - - /** - * Updates the view to display the items contained in the inventory - * - * @param items - * the items - */ - public void updateInventory(HashMap items); - -} diff --git a/src/esieequest/view/Viewable.java b/src/esieequest/view/Viewable.java new file mode 100644 index 0000000..0d1c9e9 --- /dev/null +++ b/src/esieequest/view/Viewable.java @@ -0,0 +1,81 @@ +package esieequest.view; + +import java.util.HashMap; + +import esieequest.controller.GameEngine; +import esieequest.model.events.Quest; +import esieequest.model.items.Item; +import esieequest.model.map.Room; +import esieequest.model.map.Side; + +/** + * The view interface that describes an user interface. + * + * @author Pacien TRAN-GIRARD + */ +public interface Viewable { + + /** + * Sets the controller to use. + * + * @param gameEngine + * the GameEngine controller + */ + public void setController(GameEngine gameEngine); + + /** + * Displays the user interface. + */ + public void show(); + + /** + * Enables the user interface. + */ + public void enable(); + + /** + * Displays a message. + * + * @param message + * the message + */ + public void echo(String message); + + /** + * Disables the user interface. + */ + public void disable(); + + /** + * Updates the view to match the current room. + * + * @param room + * the room to display + */ + public void updateRoom(Room room); + + /** + * Updates the view to match a side of a room. + * + * @param side + * the side of a room + */ + public void updateSide(Side side); + + /** + * Updates the view to match the current quest. + * + * @param quest + * the current quest to display + */ + public void updateQuest(Quest quest); + + /** + * Updates the view to display the items contained in the inventory + * + * @param items + * the items + */ + public void updateInventory(HashMap items); + +} diff --git a/src/esieequest/view/app/UserInterface.java b/src/esieequest/view/app/UserInterface.java index d6fcdae..cee4353 100644 --- a/src/esieequest/view/app/UserInterface.java +++ b/src/esieequest/view/app/UserInterface.java @@ -24,14 +24,14 @@ import esieequest.model.items.Item; import esieequest.model.map.Orientation; import esieequest.model.map.Room; import esieequest.model.map.Side; -import esieequest.view.View; +import esieequest.view.Viewable; /** * The Swing based graphical user interface. * * @author Pacien TRAN-GIRARD */ -abstract class UserInterface implements View, ActionListener { +abstract class UserInterface implements Viewable, ActionListener { private GameEngine gameEngine; diff --git a/src/esieequest/view/text/TextInterface.java b/src/esieequest/view/text/TextInterface.java index da80f36..98e9a06 100644 --- a/src/esieequest/view/text/TextInterface.java +++ b/src/esieequest/view/text/TextInterface.java @@ -8,14 +8,14 @@ import esieequest.model.events.Quest; import esieequest.model.items.Item; import esieequest.model.map.Room; import esieequest.model.map.Side; -import esieequest.view.View; +import esieequest.view.Viewable; /** * The textual view. * * @author Pacien TRAN-GIRARD */ -abstract class TextInterface implements View { +abstract class TextInterface implements Viewable { private GameEngine gameEngine; diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java index 59075e0..2e2815d 100644 --- a/src/esieequest/view/web/WebInterface.java +++ b/src/esieequest/view/web/WebInterface.java @@ -29,14 +29,14 @@ import esieequest.model.items.Item; import esieequest.model.map.Orientation; import esieequest.model.map.Room; import esieequest.model.map.Side; -import esieequest.view.View; +import esieequest.view.Viewable; /** * The web view. * * @author Pacien TRAN-GIRARD */ -class WebInterface extends Composite implements View { +class WebInterface extends Composite implements Viewable { private GameEngine gameEngine; -- cgit v1.2.3