From db373254f918ef75062698757e6cd6e13e26289f Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 18 May 2014 17:53:00 +0200 Subject: Format code (100 chars line) --- .../controller/commands/BackCommand.java | 4 +- src/esieequest/controller/commands/Command.java | 3 +- .../controller/commands/DropCommand.java | 4 +- src/esieequest/controller/commands/GoCommand.java | 3 +- .../controller/commands/InventoryCommand.java | 3 +- .../controller/commands/LoadCommand.java | 10 +++- .../controller/commands/LookCommand.java | 4 +- src/esieequest/controller/commands/NewCommand.java | 4 +- .../controller/commands/TakeCommand.java | 7 ++- .../controller/commands/TurnCommand.java | 3 +- src/esieequest/controller/utils/EnumUtils.java | 9 ++- src/esieequest/controller/utils/ListUtils.java | 3 +- src/esieequest/model/Game.java | 4 +- src/esieequest/model/Player.java | 9 ++- .../model/characters/MovingCharacter.java | 3 +- src/esieequest/model/items/Inventory.java | 7 ++- src/esieequest/model/map/Room.java | 11 +++- src/esieequest/view/Viewable.java | 3 +- src/esieequest/view/app/UserInterface.java | 20 ++++--- src/esieequest/view/text/TextInterface.java | 3 +- src/esieequest/view/web/WebInterface.java | 17 ++++-- src/org/json/simple/JSONArray.java | 3 +- src/org/json/simple/JSONObject.java | 3 +- src/org/json/simple/JSONValue.java | 4 +- src/org/json/simple/parser/JSONParser.java | 39 ++++++++----- src/org/json/simple/parser/ParseException.java | 9 ++- src/org/json/simple/parser/Yylex.java | 68 ++++++++++++++++++---- src/rejava/io/StringReader.java | 3 +- 28 files changed, 189 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/esieequest/controller/commands/BackCommand.java b/src/esieequest/controller/commands/BackCommand.java index 847d396..d7ed8a3 100644 --- a/src/esieequest/controller/commands/BackCommand.java +++ b/src/esieequest/controller/commands/BackCommand.java @@ -15,7 +15,9 @@ public class BackCommand implements Executable { game.getPlayer().goToPreviousRoom(); - view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer() + .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer() + .canGoBack()); } diff --git a/src/esieequest/controller/commands/Command.java b/src/esieequest/controller/commands/Command.java index ca8909c..0879bef 100644 --- a/src/esieequest/controller/commands/Command.java +++ b/src/esieequest/controller/commands/Command.java @@ -94,7 +94,8 @@ public enum Command { * @return a String listing all the names of the Command-s */ public static String listCommandsNamesString() { - return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.toString(), null, Text.HELP_SUFFIX.toString()); + return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.toString(), + null, Text.HELP_SUFFIX.toString()); } } diff --git a/src/esieequest/controller/commands/DropCommand.java b/src/esieequest/controller/commands/DropCommand.java index ee71b1e..dbdf03c 100644 --- a/src/esieequest/controller/commands/DropCommand.java +++ b/src/esieequest/controller/commands/DropCommand.java @@ -31,7 +31,9 @@ public class DropCommand implements Executable { final Item item = game.getPlayer().getInventory().takeItem(itemName); game.getPlayer().getCurrentSide().getInventory().putItem(item); - view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer() + .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer() + .canGoBack()); view.updateInventory(game.getPlayer().getInventory()); } diff --git a/src/esieequest/controller/commands/GoCommand.java b/src/esieequest/controller/commands/GoCommand.java index 136379f..1078d49 100644 --- a/src/esieequest/controller/commands/GoCommand.java +++ b/src/esieequest/controller/commands/GoCommand.java @@ -39,7 +39,8 @@ public class GoCommand implements Executable { return; } - view.updateLocation(game.getPlayer().getCurrentRoom(), direction, game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), direction, game.getPlayer() + .getCurrentSide(), game.getPlayer().canGoBack()); // handle challenge mode if (game.getPlayer().walk()) { diff --git a/src/esieequest/controller/commands/InventoryCommand.java b/src/esieequest/controller/commands/InventoryCommand.java index a6ce080..27936ce 100644 --- a/src/esieequest/controller/commands/InventoryCommand.java +++ b/src/esieequest/controller/commands/InventoryCommand.java @@ -13,7 +13,8 @@ public class InventoryCommand implements Executable { @Override public void execute(final String argument, final Game game, final Viewable view) { - view.echo(game.getPlayer().getInventory().listItemsNamesString() + game.getPlayer().getInventory().getWeightString()); + view.echo(game.getPlayer().getInventory().listItemsNamesString() + + game.getPlayer().getInventory().getWeightString()); } diff --git a/src/esieequest/controller/commands/LoadCommand.java b/src/esieequest/controller/commands/LoadCommand.java index 8a69544..896d85b 100644 --- a/src/esieequest/controller/commands/LoadCommand.java +++ b/src/esieequest/controller/commands/LoadCommand.java @@ -24,7 +24,8 @@ public class LoadCommand implements Executable { try { datas = (JSONObject) JSONValue.parseWithException(jsonString); } catch (final ParseException e) { - view.echo(Text.PARSING_ERROR_PREFIX.toString() + e.getMessage() + Text.PARSING_ERROR_SUFFIX.toString()); + view.echo(Text.PARSING_ERROR_PREFIX.toString() + e.getMessage() + + Text.PARSING_ERROR_SUFFIX.toString()); return; } @@ -32,14 +33,17 @@ public class LoadCommand implements Executable { game.newGame(false, false); game.deserialise(datas); } catch (final Exception e) { - view.echo(Text.DESERIALISING_ERROR_PREFIX.toString() + e.getMessage() + Text.DESERIALISING_ERROR_SUFFIX.toString()); + view.echo(Text.DESERIALISING_ERROR_PREFIX.toString() + e.getMessage() + + Text.DESERIALISING_ERROR_SUFFIX.toString()); e.printStackTrace(); return; } // view.updateQuest(); // view.updateInventory(game.getPlayer().getItems()); - view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer() + .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer() + .canGoBack()); } diff --git a/src/esieequest/controller/commands/LookCommand.java b/src/esieequest/controller/commands/LookCommand.java index ece4ddc..305934f 100644 --- a/src/esieequest/controller/commands/LookCommand.java +++ b/src/esieequest/controller/commands/LookCommand.java @@ -21,7 +21,9 @@ public class LookCommand implements Executable { final ArrayList informations = new ArrayList(); informations.add(game.getPlayer().getCurrentRoom().getInformations()); - informations.add(Text.DIRECTION_PREFIX + game.getPlayer().getCurrentDirection().name().toLowerCase() + Text.DIRECTION_SUFFIX); + informations.add(Text.DIRECTION_PREFIX + + game.getPlayer().getCurrentDirection().name().toLowerCase() + + Text.DIRECTION_SUFFIX); view.echo(Joiner.on(Text.NEW_LINE.toString()).join(informations)); diff --git a/src/esieequest/controller/commands/NewCommand.java b/src/esieequest/controller/commands/NewCommand.java index e0e45ab..3f0b4b9 100644 --- a/src/esieequest/controller/commands/NewCommand.java +++ b/src/esieequest/controller/commands/NewCommand.java @@ -24,7 +24,9 @@ public class NewCommand implements Executable { view.enable(); - view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer() + .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer() + .canGoBack()); view.echo(Text.WELCOME.toString()); } diff --git a/src/esieequest/controller/commands/TakeCommand.java b/src/esieequest/controller/commands/TakeCommand.java index b92f4e5..9f70f98 100644 --- a/src/esieequest/controller/commands/TakeCommand.java +++ b/src/esieequest/controller/commands/TakeCommand.java @@ -38,7 +38,8 @@ public class TakeCommand implements Executable { // handle inventory weight limit final int maximumWeight = game.getPlayer().getInventoryWeightLimit(); - final int futureWeight = game.getPlayer().getInventory().getTotalWeight() + item.getWeight(); + final int futureWeight = game.getPlayer().getInventory().getTotalWeight() + + item.getWeight(); if (futureWeight > maximumWeight) { view.echo(Text.INVENTORY_FULL.toString()); return; @@ -47,7 +48,9 @@ public class TakeCommand implements Executable { game.getPlayer().getCurrentRoom().removeItem(item); game.getPlayer().getInventory().putItem(item); - view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer() + .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer() + .canGoBack()); view.updateInventory(game.getPlayer().getInventory()); } diff --git a/src/esieequest/controller/commands/TurnCommand.java b/src/esieequest/controller/commands/TurnCommand.java index f985087..722221f 100644 --- a/src/esieequest/controller/commands/TurnCommand.java +++ b/src/esieequest/controller/commands/TurnCommand.java @@ -30,7 +30,8 @@ public class TurnCommand implements Executable { final Direction newDirection = currentDirection.rotate(orientation); game.getPlayer().setCurrentDirection(newDirection); - view.updateLocation(game.getPlayer().getCurrentRoom(), newDirection, game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); + view.updateLocation(game.getPlayer().getCurrentRoom(), newDirection, game.getPlayer() + .getCurrentSide(), game.getPlayer().canGoBack()); } diff --git a/src/esieequest/controller/utils/EnumUtils.java b/src/esieequest/controller/utils/EnumUtils.java index 03a7150..b07708c 100644 --- a/src/esieequest/controller/utils/EnumUtils.java +++ b/src/esieequest/controller/utils/EnumUtils.java @@ -109,7 +109,8 @@ public class EnumUtils { * * @return the JSONArray of all the objects */ - public static & SerialisableObject> JSONArray serialiseEnumObjects(final E[] serialisableEnumObjects) { + public static & SerialisableObject> JSONArray serialiseEnumObjects( + final E[] serialisableEnumObjects) { final JSONArray jsonArray = new JSONArray(); @@ -138,7 +139,8 @@ public class EnumUtils { * @param jsonArray * the JSONArray */ - public static > void deserialiseEnumObjects(final Class enumType, final JSONArray jsonArray) { + public static > void deserialiseEnumObjects(final Class enumType, + final JSONArray jsonArray) { if (jsonArray == null) { return; @@ -149,7 +151,8 @@ public class EnumUtils { final JSONObject jsonObject = (JSONObject) object; final String key = (String) jsonObject.get(EnumUtils.KEY_LABEL); - final SerialisableObject serialisableObject = (SerialisableObject) EnumUtils.valueOf(enumType, key); + final SerialisableObject serialisableObject = (SerialisableObject) EnumUtils.valueOf( + enumType, key); serialisableObject.deserialise((JSONObject) jsonObject.get(EnumUtils.VALUE_LABEL)); } diff --git a/src/esieequest/controller/utils/ListUtils.java b/src/esieequest/controller/utils/ListUtils.java index c904390..1d0f9ec 100644 --- a/src/esieequest/controller/utils/ListUtils.java +++ b/src/esieequest/controller/utils/ListUtils.java @@ -27,7 +27,8 @@ public class ListUtils { * the suffix * @return the converted String */ - public static String listToString(final List list, final String prefix, final String empty, final String suffix) { + public static String listToString(final List list, final String prefix, + final String empty, final String suffix) { final StringBuilder str = new StringBuilder(prefix); if (list.isEmpty()) { diff --git a/src/esieequest/model/Game.java b/src/esieequest/model/Game.java index 94f0a59..5f0150d 100644 --- a/src/esieequest/model/Game.java +++ b/src/esieequest/model/Game.java @@ -69,7 +69,9 @@ public class Game implements SerialisableObject { Room.createAllSides(); this.connectRooms(); - this.setPlayer(new Player(Game.DEFAULT_QUEST, Game.DEFAULT_ROOM, Game.DEFAULT_DIRECTION, Game.DEFAULT_INVENTORY_LIMIT, challengeMode ? Game.CHALLENGE_STEPS_LIMIT : Game.DEFAULT_STEPS_LIMIT)); + this.setPlayer(new Player(Game.DEFAULT_QUEST, Game.DEFAULT_ROOM, Game.DEFAULT_DIRECTION, + Game.DEFAULT_INVENTORY_LIMIT, challengeMode ? Game.CHALLENGE_STEPS_LIMIT + : Game.DEFAULT_STEPS_LIMIT)); if (populate) { this.addItems(); diff --git a/src/esieequest/model/Player.java b/src/esieequest/model/Player.java index 23e3a54..e9c3c7f 100644 --- a/src/esieequest/model/Player.java +++ b/src/esieequest/model/Player.java @@ -70,7 +70,8 @@ public class Player implements SerialisableObject { * @param nbStepsLimit * the maximum number of steps */ - public Player(final Quest currentQuest, final Room currentRoom, final Direction currentDirection, final int carryWeightLimit, final int nbStepsLimit) { + public Player(final Quest currentQuest, final Room currentRoom, + final Direction currentDirection, final int carryWeightLimit, final int nbStepsLimit) { this.currentQuest = currentQuest; this.currentRoom = currentRoom; this.previousRooms = new Stack<>(); @@ -140,7 +141,8 @@ public class Player implements SerialisableObject { o.put(Player.CURRENT_QUEST_LABEL, this.currentQuest.name()); o.put(Player.CURRENT_ROOM_LABEL, this.currentRoom.name()); - o.put(Player.PREVIOUS_ROOMS_LABEL, EnumUtils.nameAll(this.previousRooms.toArray(new Room[0]))); + o.put(Player.PREVIOUS_ROOMS_LABEL, EnumUtils.nameAll(this.previousRooms + .toArray(new Room[0]))); o.put(Player.CURRENT_DIRECTION_LABEL, this.currentDirection.name()); @@ -162,7 +164,8 @@ public class Player implements SerialisableObject { this.previousRooms.clear(); final Object previousRoomsObject = o.get(Player.PREVIOUS_ROOMS_LABEL); if (previousRoomsObject != null) { - this.previousRooms.addAll(EnumUtils.valuesOf(Room.class, ((JSONArray) previousRoomsObject).toArray(new String[0]))); + this.previousRooms.addAll(EnumUtils.valuesOf(Room.class, + ((JSONArray) previousRoomsObject).toArray(new String[0]))); } this.currentDirection = Direction.valueOf((String) o.get(Player.CURRENT_DIRECTION_LABEL)); diff --git a/src/esieequest/model/characters/MovingCharacter.java b/src/esieequest/model/characters/MovingCharacter.java index 4ac73e4..b12c4ce 100644 --- a/src/esieequest/model/characters/MovingCharacter.java +++ b/src/esieequest/model/characters/MovingCharacter.java @@ -114,7 +114,8 @@ public abstract class MovingCharacter extends SimpleCharacter { @Override public void deserialise(final JSONObject o) { this.currentRoom = Room.valueOf((String) o.get(MovingCharacter.CURRENT_ROOM_LABEL)); - this.currentDirection = Direction.valueOf((String) o.get(MovingCharacter.CURRENT_DIRECTION_LABEL)); + this.currentDirection = Direction.valueOf((String) o + .get(MovingCharacter.CURRENT_DIRECTION_LABEL)); this.canMove = (Boolean) o.get(MovingCharacter.CAN_MOVE_LABEL); } diff --git a/src/esieequest/model/items/Inventory.java b/src/esieequest/model/items/Inventory.java index 53339f5..685b691 100644 --- a/src/esieequest/model/items/Inventory.java +++ b/src/esieequest/model/items/Inventory.java @@ -112,7 +112,9 @@ public class Inventory implements SerialisableList { * @return the list of the Item-s in a String */ public String listItemsNamesString() { - return ListUtils.listToString(new ArrayList(this.items.keySet()), Text.INVENTORY_PREFIX.toString(), Text.ITEMS_NO_ITEM.toString(), Text.INVENTORY_SUFFIX.toString()); + return ListUtils.listToString(new ArrayList(this.items.keySet()), + Text.INVENTORY_PREFIX.toString(), Text.ITEMS_NO_ITEM.toString(), + Text.INVENTORY_SUFFIX.toString()); } /** @@ -179,7 +181,8 @@ public class Inventory implements SerialisableList { * @return informations about the inventory weight */ public String getWeightString() { - return Text.INVENTORY_WEIGHT_PREFIX.toString() + this.getTotalWeight() + Text.INVENTORY_WEIGHT_SUFFIX.toString(); + return Text.INVENTORY_WEIGHT_PREFIX.toString() + this.getTotalWeight() + + Text.INVENTORY_WEIGHT_SUFFIX.toString(); } /** diff --git a/src/esieequest/model/map/Room.java b/src/esieequest/model/map/Room.java index 4fceacd..5444496 100644 --- a/src/esieequest/model/map/Room.java +++ b/src/esieequest/model/map/Room.java @@ -210,9 +210,14 @@ public enum Room implements SerialisableObject { final ArrayList informations = new ArrayList(); informations.add(Text.LOCATION_PREFIX + this.getDescription() + Text.LOCATION_SUFFIX); - informations.add(ListUtils.listToString(this.listExitsDirectionsNames(), Text.EXITS_PREFIX.toString(), Text.EXITS_NO_EXIT.toString(), Text.EXITS_SUFFIX.toString())); - informations.add(ListUtils.listToString(this.listItemsNames(), Text.ITEMS_PREFIX.toString(), Text.ITEMS_NO_ITEM.toString(), Text.ITEMS_SUFFIX.toString())); - informations.add(ListUtils.listToString(this.listCharactersNames(), Text.CHARACTERS_PREFIX.toString(), Text.CHARACTERS_NO_CHARACTER.toString(), Text.CHARACTERS_SUFFIX.toString())); + informations.add(ListUtils.listToString(this.listExitsDirectionsNames(), Text.EXITS_PREFIX + .toString(), Text.EXITS_NO_EXIT.toString(), Text.EXITS_SUFFIX.toString())); + informations.add(ListUtils.listToString(this.listItemsNames(), + Text.ITEMS_PREFIX.toString(), Text.ITEMS_NO_ITEM.toString(), Text.ITEMS_SUFFIX + .toString())); + informations.add(ListUtils.listToString(this.listCharactersNames(), Text.CHARACTERS_PREFIX + .toString(), Text.CHARACTERS_NO_CHARACTER.toString(), Text.CHARACTERS_SUFFIX + .toString())); return Joiner.on(Text.SPACE.toString()).join(informations); } diff --git a/src/esieequest/view/Viewable.java b/src/esieequest/view/Viewable.java index eb9c50a..dc12973 100644 --- a/src/esieequest/view/Viewable.java +++ b/src/esieequest/view/Viewable.java @@ -63,7 +63,8 @@ public interface Viewable { * @param side * the side of a room */ - public void updateLocation(final Room room, final Direction direction, final Side side, final boolean canGoBack); + public void updateLocation(final Room room, final Direction direction, final Side side, + final boolean canGoBack); /** * Updates the view to display the items contained in the inventory diff --git a/src/esieequest/view/app/UserInterface.java b/src/esieequest/view/app/UserInterface.java index 220afc1..90a99c2 100644 --- a/src/esieequest/view/app/UserInterface.java +++ b/src/esieequest/view/app/UserInterface.java @@ -231,13 +231,15 @@ abstract class UserInterface implements Viewable, ActionListener { this.leftButton = new JButton(Text.TURN_LEFT_BUTTON.toString()); this.leftButton.setToolTipText(Text.TURN_LEFT_TOOLTIP.toString()); - this.leftButton.setActionCommand(Command.TURN.name() + Text.COMMAND_SEPARATOR.toString() + Orientation.LEFT.name()); + this.leftButton.setActionCommand(Command.TURN.name() + Text.COMMAND_SEPARATOR.toString() + + Orientation.LEFT.name()); this.bottomControlPanel.add(this.leftButton, BorderLayout.WEST); this.controlButtons.add(this.leftButton); this.rightButton = new JButton(Text.TURN_RIGHT_BUTTON.toString()); this.rightButton.setToolTipText(Text.TURN_RIGHT_TOOLTIP.toString()); - this.rightButton.setActionCommand(Command.TURN.name() + Text.COMMAND_SEPARATOR.toString() + Orientation.RIGHT.name()); + this.rightButton.setActionCommand(Command.TURN.name() + Text.COMMAND_SEPARATOR.toString() + + Orientation.RIGHT.name()); this.bottomControlPanel.add(this.rightButton, BorderLayout.EAST); this.controlButtons.add(this.rightButton); @@ -323,7 +325,8 @@ abstract class UserInterface implements Viewable, ActionListener { * the name of the image */ private void setIllustration(final String imageName) { - final URL imageURL = this.getClass().getClassLoader().getResource(imageName + UserInterface.ILLUSTRATION_EXT); + final URL imageURL = this.getClass().getClassLoader().getResource( + imageName + UserInterface.ILLUSTRATION_EXT); final StretchIcon imageIcon; if (imageURL == null) { imageIcon = new StretchIcon(this.generatePlaceholderImage(imageName), true); @@ -342,7 +345,8 @@ abstract class UserInterface implements Viewable, ActionListener { * @return the Image */ private Image generatePlaceholderImage(final String text) { - final BufferedImage bufferedImage = new BufferedImage(240, 135, BufferedImage.TYPE_BYTE_BINARY); + final BufferedImage bufferedImage = new BufferedImage(240, 135, + BufferedImage.TYPE_BYTE_BINARY); final Graphics graphics = bufferedImage.getGraphics(); graphics.drawString(text, 5, 10 + 5); return bufferedImage; @@ -418,11 +422,12 @@ abstract class UserInterface implements Viewable, ActionListener { } @Override - public void updateLocation(final Room room, final Direction direction, final Side side, final boolean canGoBack) { + public void updateLocation(final Room room, final Direction direction, final Side side, + final boolean canGoBack) { this.setIllustration(room.name() + Text.FILENAME_SEPARATOR.toString() + direction.name()); this.backButton.setEnabled(canGoBack); this.forwardButton.setEnabled(side.hasDoor()); - this.actionButton.setEnabled(side.hasCharacter() || side.getInventory().getSize() > 0); + this.actionButton.setEnabled(side.hasCharacter() || (side.getInventory().getSize() > 0)); this.echo(room.getInformations()); } @@ -440,7 +445,8 @@ abstract class UserInterface implements Viewable, ActionListener { for (final Item item : inventory.getItems().values()) { final JButton button = new JButton(item.getName()); - button.setActionCommand(Command.USE.name() + Text.COMMAND_SEPARATOR.toString() + item.getName()); + button.setActionCommand(Command.USE.name() + Text.COMMAND_SEPARATOR.toString() + + item.getName()); button.addActionListener(this); this.inventoryPanel.add(button); } diff --git a/src/esieequest/view/text/TextInterface.java b/src/esieequest/view/text/TextInterface.java index 3fc0399..76ee308 100644 --- a/src/esieequest/view/text/TextInterface.java +++ b/src/esieequest/view/text/TextInterface.java @@ -87,7 +87,8 @@ abstract class TextInterface implements Viewable { } @Override - public void updateLocation(final Room room, final Direction direction, final Side side, final boolean canGoBack) { + public void updateLocation(final Room room, final Direction direction, final Side side, + final boolean canGoBack) { this.echo(room.getInformations()); } diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java index fe67b72..8f6c1ce 100644 --- a/src/esieequest/view/web/WebInterface.java +++ b/src/esieequest/view/web/WebInterface.java @@ -204,10 +204,12 @@ class WebInterface extends Composite implements Viewable { this.backButton.addClickHandler(this.makeClickHandler(Command.BACK.name())); this.leftButton.setTitle(Text.TURN_LEFT_TOOLTIP.toString()); - this.leftButton.addClickHandler(this.makeClickHandler(Command.TURN.name() + Text.COMMAND_SEPARATOR.toString() + Orientation.LEFT.name())); + this.leftButton.addClickHandler(this.makeClickHandler(Command.TURN.name() + + Text.COMMAND_SEPARATOR.toString() + Orientation.LEFT.name())); this.rightButton.setTitle(Text.TURN_RIGHT_TOOLTIP.toString()); - this.rightButton.addClickHandler(this.makeClickHandler(Command.TURN.name() + Text.COMMAND_SEPARATOR.toString() + Orientation.RIGHT.name())); + this.rightButton.addClickHandler(this.makeClickHandler(Command.TURN.name() + + Text.COMMAND_SEPARATOR.toString() + Orientation.RIGHT.name())); } @@ -264,7 +266,8 @@ class WebInterface extends Composite implements Viewable { * the illustration page URL */ private void setIllustration(final String illustration) { - this.illustrationFrame.setUrl(WebInterface.ILLUSTRATION_DIR + illustration + WebInterface.ILLUSTRATION_EXT); + this.illustrationFrame.setUrl(WebInterface.ILLUSTRATION_DIR + illustration + + WebInterface.ILLUSTRATION_EXT); } /** @@ -327,11 +330,12 @@ class WebInterface extends Composite implements Viewable { } @Override - public void updateLocation(final Room room, final Direction direction, final Side side, final boolean canGoBack) { + public void updateLocation(final Room room, final Direction direction, final Side side, + final boolean canGoBack) { this.setIllustration(room.name() + Text.FILENAME_SEPARATOR.toString() + direction.name()); this.backButton.setEnabled(canGoBack); this.forwardButton.setEnabled(side.hasDoor()); - this.actionButton.setEnabled(side.hasCharacter() || side.getInventory().getSize() > 0); + this.actionButton.setEnabled(side.hasCharacter() || (side.getInventory().getSize() > 0)); this.echo(room.getInformations()); } @@ -348,7 +352,8 @@ class WebInterface extends Composite implements Viewable { for (final Item item : inventory.getItems().values()) { final Button button = new Button(item.getName()); - button.addClickHandler(this.makeClickHandler(Command.USE.name() + Text.COMMAND_SEPARATOR.toString() + item.getName())); + button.addClickHandler(this.makeClickHandler(Command.USE.name() + + Text.COMMAND_SEPARATOR.toString() + item.getName())); this.inventoryPanel.add(button); } diff --git a/src/org/json/simple/JSONArray.java b/src/org/json/simple/JSONArray.java index e2c7042..a71a221 100644 --- a/src/org/json/simple/JSONArray.java +++ b/src/org/json/simple/JSONArray.java @@ -49,7 +49,8 @@ public class JSONArray extends ArrayList implements JSONAware, JSONStrea * @param collection * @param out */ - public static void writeJSONString(final Collection collection, final Writer out) throws IOException { + public static void writeJSONString(final Collection collection, final Writer out) + throws IOException { if (collection == null) { out.write("null"); return; diff --git a/src/org/json/simple/JSONObject.java b/src/org/json/simple/JSONObject.java index 55eeeb6..ee6bf0a 100644 --- a/src/org/json/simple/JSONObject.java +++ b/src/org/json/simple/JSONObject.java @@ -19,7 +19,8 @@ import rejava.io.Writer; * @author FangYidong */ @SuppressWarnings("rawtypes") -public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAware { +public class JSONObject extends HashMap implements Map, JSONAware, + JSONStreamAware { private static final long serialVersionUID = -503443796854799292L; diff --git a/src/org/json/simple/JSONValue.java b/src/org/json/simple/JSONValue.java index 3d42315..47a1abe 100644 --- a/src/org/json/simple/JSONValue.java +++ b/src/org/json/simple/JSONValue.java @@ -300,7 +300,9 @@ public class JSONValue { break; default: // Reference: http://www.unicode.org/versions/Unicode5.1.0/ - if (((ch >= '\u0000') && (ch <= '\u001F')) || ((ch >= '\u007F') && (ch <= '\u009F')) || ((ch >= '\u2000') && (ch <= '\u20FF'))) { + if (((ch >= '\u0000') && (ch <= '\u001F')) + || ((ch >= '\u007F') && (ch <= '\u009F')) + || ((ch >= '\u2000') && (ch <= '\u20FF'))) { final String ss = Integer.toHexString(ch); sb.append("\\u"); for (int k = 0; k < (4 - ss.length()); k++) { diff --git a/src/org/json/simple/parser/JSONParser.java b/src/org/json/simple/parser/JSONParser.java index 4874eea..85472bb 100644 --- a/src/org/json/simple/parser/JSONParser.java +++ b/src/org/json/simple/parser/JSONParser.java @@ -78,7 +78,8 @@ public class JSONParser { return this.parse(s, (ContainerFactory) null); } - public Object parse(final String s, final ContainerFactory containerFactory) throws ParseException { + public Object parse(final String s, final ContainerFactory containerFactory) + throws ParseException { final StringReader in = new StringReader(s); try { return this.parse(in, containerFactory); @@ -109,7 +110,8 @@ public class JSONParser { * @throws ParseException */ @SuppressWarnings({ "rawtypes", "unchecked" }) - public Object parse(final Reader in, final ContainerFactory containerFactory) throws IOException, ParseException { + public Object parse(final Reader in, final ContainerFactory containerFactory) + throws IOException, ParseException { this.reset(in); final LinkedList statusStack = new LinkedList(); final LinkedList valueStack = new LinkedList(); @@ -144,7 +146,8 @@ public class JSONParser { if (this.token.type == Yytoken.TYPE_EOF) { return valueStack.removeFirst(); } else { - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), + ParseException.ERROR_UNEXPECTED_TOKEN, this.token); } case S_IN_OBJECT: @@ -250,17 +253,20 @@ public class JSONParser { }// inner switch break; case S_IN_ERROR: - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), + ParseException.ERROR_UNEXPECTED_TOKEN, this.token); }// switch if (this.status == JSONParser.S_IN_ERROR) { - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), + ParseException.ERROR_UNEXPECTED_TOKEN, this.token); } } while (this.token.type != Yytoken.TYPE_EOF); } catch (final IOException ie) { throw ie; } - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, + this.token); } private void nextToken() throws ParseException, IOException { @@ -298,7 +304,8 @@ public class JSONParser { this.parse(s, contentHandler, false); } - public void parse(final String s, final ContentHandler contentHandler, final boolean isResume) throws ParseException { + public void parse(final String s, final ContentHandler contentHandler, final boolean isResume) + throws ParseException { final StringReader in = new StringReader(s); try { this.parse(in, contentHandler, isResume); @@ -310,7 +317,8 @@ public class JSONParser { } } - public void parse(final Reader in, final ContentHandler contentHandler) throws IOException, ParseException { + public void parse(final Reader in, final ContentHandler contentHandler) throws IOException, + ParseException { this.parse(in, contentHandler, false); } @@ -331,7 +339,8 @@ public class JSONParser { * @throws ParseException */ @SuppressWarnings({ "unchecked", "rawtypes" }) - public void parse(final Reader in, final ContentHandler contentHandler, boolean isResume) throws IOException, ParseException { + public void parse(final Reader in, final ContentHandler contentHandler, boolean isResume) + throws IOException, ParseException { if (!isResume) { this.reset(in); this.handlerStatusStack = new LinkedList<>(); @@ -386,7 +395,8 @@ public class JSONParser { return; } else { this.status = JSONParser.S_IN_ERROR; - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), + ParseException.ERROR_UNEXPECTED_TOKEN, this.token); } case S_IN_OBJECT: @@ -518,10 +528,12 @@ public class JSONParser { return; case S_IN_ERROR: - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), + ParseException.ERROR_UNEXPECTED_TOKEN, this.token); }// switch if (this.status == JSONParser.S_IN_ERROR) { - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), + ParseException.ERROR_UNEXPECTED_TOKEN, this.token); } } while (this.token.type != Yytoken.TYPE_EOF); } catch (final IOException ie) { @@ -539,6 +551,7 @@ public class JSONParser { } this.status = JSONParser.S_IN_ERROR; - throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, this.token); + throw new ParseException(this.getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, + this.token); } } diff --git a/src/org/json/simple/parser/ParseException.java b/src/org/json/simple/parser/ParseException.java index df1b1d1..6bd8d8c 100644 --- a/src/org/json/simple/parser/ParseException.java +++ b/src/org/json/simple/parser/ParseException.java @@ -75,13 +75,16 @@ public class ParseException extends Exception { switch (this.errorType) { case ERROR_UNEXPECTED_CHAR: - sb.append("Unexpected character (").append(this.unexpectedObject).append(") at position ").append(this.position).append("."); + sb.append("Unexpected character (").append(this.unexpectedObject).append( + ") at position ").append(this.position).append("."); break; case ERROR_UNEXPECTED_TOKEN: - sb.append("Unexpected token ").append(this.unexpectedObject).append(" at position ").append(this.position).append("."); + sb.append("Unexpected token ").append(this.unexpectedObject).append(" at position ") + .append(this.position).append("."); break; case ERROR_UNEXPECTED_EXCEPTION: - sb.append("Unexpected exception at position ").append(this.position).append(": ").append(this.unexpectedObject); + sb.append("Unexpected exception at position ").append(this.position).append(": ") + .append(this.unexpectedObject); break; default: sb.append("Unkown error at position ").append(this.position).append("."); diff --git a/src/org/json/simple/parser/Yylex.java b/src/org/json/simple/parser/Yylex.java index 10049c4..c1cf09d 100644 --- a/src/org/json/simple/parser/Yylex.java +++ b/src/org/json/simple/parser/Yylex.java @@ -24,7 +24,10 @@ class Yylex { /** * Translates characters to character classes */ - private static final String ZZ_CMAP_PACKED = "\11\0\1\7\1\7\2\0\1\7\22\0\1\7\1\0\1\11\10\0" + "\1\6\1\31\1\2\1\4\1\12\12\3\1\32\6\0\4\1\1\5" + "\1\1\24\0\1\27\1\10\1\30\3\0\1\22\1\13\2\1\1\21" + "\1\14\5\0\1\23\1\0\1\15\3\0\1\16\1\24\1\17\1\20" + "\5\0\1\25\1\0\1\26\uff82\0"; + private static final String ZZ_CMAP_PACKED = "\11\0\1\7\1\7\2\0\1\7\22\0\1\7\1\0\1\11\10\0" + + "\1\6\1\31\1\2\1\4\1\12\12\3\1\32\6\0\4\1\1\5" + + "\1\1\24\0\1\27\1\10\1\30\3\0\1\22\1\13\2\1\1\21" + + "\1\14\5\0\1\23\1\0\1\15\3\0\1\16\1\24\1\17\1\20" + "\5\0\1\25\1\0\1\26\uff82\0"; /** * Translates characters to character classes @@ -36,7 +39,9 @@ class Yylex { */ private static final int[] ZZ_ACTION = Yylex.zzUnpackAction(); - private static final String ZZ_ACTION_PACKED_0 = "\2\0\2\1\1\2\1\3\1\4\3\1\1\5\1\6" + "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\5\0" + "\1\14\1\16\1\17\1\20\1\21\1\22\1\23\1\24" + "\1\0\1\25\1\0\1\25\4\0\1\26\1\27\2\0" + "\1\30"; + private static final String ZZ_ACTION_PACKED_0 = "\2\0\2\1\1\2\1\3\1\4\3\1\1\5\1\6" + + "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\5\0" + "\1\14\1\16\1\17\1\20\1\21\1\22\1\23\1\24" + + "\1\0\1\25\1\0\1\25\4\0\1\26\1\27\2\0" + "\1\30"; private static int[] zzUnpackAction() { final int[] result = new int[45]; @@ -64,7 +69,12 @@ class Yylex { */ private static final int[] ZZ_ROWMAP = Yylex.zzUnpackRowMap(); - private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\33\0\66\0\121\0\154\0\207\0\66\0\242" + "\0\275\0\330\0\66\0\66\0\66\0\66\0\66\0\66" + "\0\363\0\u010e\0\66\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195" + "\0\66\0\66\0\66\0\66\0\66\0\66\0\66\0\66" + "\0\u01b0\0\u01cb\0\u01e6\0\u01e6\0\u0201\0\u021c\0\u0237\0\u0252" + "\0\66\0\66\0\u026d\0\u0288\0\66"; + private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\33\0\66\0\121\0\154\0\207\0\66\0\242" + + "\0\275\0\330\0\66\0\66\0\66\0\66\0\66\0\66" + + "\0\363\0\u010e\0\66\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195" + + "\0\66\0\66\0\66\0\66\0\66\0\66\0\66\0\66" + + "\0\u01b0\0\u01cb\0\u01e6\0\u01e6\0\u0201\0\u021c\0\u0237\0\u0252" + + "\0\66\0\66\0\u026d\0\u0288\0\66"; private static int[] zzUnpackRowMap() { final int[] result = new int[45]; @@ -87,9 +97,37 @@ class Yylex { /** * The transition table of the DFA */ - private static final int ZZ_TRANS[] = { 2, 2, 3, 4, 2, 2, 2, 5, 2, 6, 2, 2, 7, 8, 2, 9, 2, 2, 2, 2, 2, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 19, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, - 16, 16, 16, 16, 16, 16, 16, -1, -1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1, -1, -1, -1, -1, -1, -1, -1, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, 35, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 39, -1, 39, -1, -1, -1, -1, -1, 39, 39, -1, -1, -1, -1, 39, 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, 42, -1, 42, -1, -1, -1, -1, -1, 42, 42, -1, -1, -1, -1, 42, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, 43, -1, 43, -1, -1, -1, -1, -1, 43, 43, -1, -1, -1, -1, 43, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 44, -1, 44, -1, -1, -1, -1, -1, 44, 44, -1, -1, -1, -1, 44, 44, -1, -1, -1, -1, -1, -1, -1, -1, }; + private static final int ZZ_TRANS[] = { 2, 2, 3, 4, 2, 2, 2, 5, 2, 6, 2, 2, 7, 8, 2, 9, 2, 2, + 2, 2, 2, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 4, 19, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 16, 16, 16, 16, 16, 16, 16, 16, -1, -1, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1, -1, -1, -1, -1, -1, -1, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 34, 35, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 39, + -1, 39, -1, -1, -1, -1, -1, 39, 39, -1, -1, -1, -1, 39, 39, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 33, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 42, -1, 42, -1, 42, -1, -1, -1, -1, -1, 42, 42, -1, -1, -1, -1, 42, + 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, 43, -1, 43, -1, -1, -1, -1, -1, 43, 43, + -1, -1, -1, -1, 43, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 44, -1, 44, -1, -1, + -1, -1, -1, 44, 44, -1, -1, -1, -1, 44, 44, -1, -1, -1, -1, -1, -1, -1, -1, }; /* error codes */ private static final int ZZ_UNKNOWN_ERROR = 0; @@ -97,14 +135,16 @@ class Yylex { private static final int ZZ_PUSHBACK_2BIG = 2; /* error messages for the codes above */ - private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input", "Error: pushback value was too large" }; + private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", + "Error: could not match input", "Error: pushback value was too large" }; /** * ZZ_ATTRIBUTE[aState] contains the attributes of state aState */ private static final int[] ZZ_ATTRIBUTE = Yylex.zzUnpackAttribute(); - private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\3\1\1\11\3\1\6\11\2\1\1\11" + "\5\0\10\11\1\0\1\1\1\0\1\1\4\0\2\11" + "\2\0\1\11"; + private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\3\1\1\11\3\1\6\11\2\1\1\11" + + "\5\0\10\11\1\0\1\1\1\0\1\1\4\0\2\11" + "\2\0\1\11"; private static int[] zzUnpackAttribute() { final int[] result = new int[45]; @@ -239,7 +279,8 @@ class Yylex { /* first: make room (if you can) */ if (this.zzStartRead > 0) { - System.arraycopy(this.zzBuffer, this.zzStartRead, this.zzBuffer, 0, this.zzEndRead - this.zzStartRead); + System.arraycopy(this.zzBuffer, this.zzStartRead, this.zzBuffer, 0, this.zzEndRead + - this.zzStartRead); /* translate stored positions */ this.zzEndRead -= this.zzStartRead; @@ -257,7 +298,8 @@ class Yylex { } /* finally: fill the buffer with new input */ - final int numRead = this.zzReader.read(this.zzBuffer, this.zzEndRead, this.zzBuffer.length - this.zzEndRead); + final int numRead = this.zzReader.read(this.zzBuffer, this.zzEndRead, this.zzBuffer.length + - this.zzEndRead); if (numRead > 0) { this.zzEndRead += numRead; @@ -532,7 +574,8 @@ class Yylex { case 33: break; case 1: { - throw new ParseException(this.yychar, ParseException.ERROR_UNEXPECTED_CHAR, new Character(this.yycharat(0))); + throw new ParseException(this.yychar, ParseException.ERROR_UNEXPECTED_CHAR, + new Character(this.yycharat(0))); } case 34: break; @@ -576,7 +619,8 @@ class Yylex { final int ch = Integer.parseInt(this.yytext().substring(2), 16); this.sb.append((char) ch); } catch (final Exception e) { - throw new ParseException(this.yychar, ParseException.ERROR_UNEXPECTED_EXCEPTION, e); + throw new ParseException(this.yychar, + ParseException.ERROR_UNEXPECTED_EXCEPTION, e); } } case 42: diff --git a/src/rejava/io/StringReader.java b/src/rejava/io/StringReader.java index dc39769..65a1aba 100644 --- a/src/rejava/io/StringReader.java +++ b/src/rejava/io/StringReader.java @@ -30,7 +30,8 @@ public class StringReader extends Reader { @Override public int read(final char[] cbuf, final int off, final int len) { - if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) { + if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) + || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (len == 0) { -- cgit v1.2.3