es.ucm.fdi.hysteria.console.command
Class ExamineCommand

java.lang.Object
  extended by es.ucm.fdi.hysteria.console.command.Command
      extended by es.ucm.fdi.hysteria.console.command.ExamineCommand
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ExamineCommand
extends Command
implements java.lang.Cloneable, java.io.Serializable

This class represents the EXAMINE command. This command is employed to examine the items stored in the inventory or the whole inventory. When the user types EXAMINE, the game shows the names of every item stored in the inventory. When the user types EXAMINE , the game shows the description of the item with this name stored in the inventory. If there is not any item with this name it prints a warning message about that the item was not found in the inventory.

Author:
MiniSandor
See Also:
Serialized Form

Field Summary
protected  boolean _examineInventory
          A flag that decides if examining the whole inventory or only an item
protected  java.lang.String _itemName
          The name of the item to be examined
 
Fields inherited from class es.ucm.fdi.hysteria.console.command.Command
_config, _executed, _game, _parsed, _result, _successful
 
Constructor Summary
ExamineCommand(Game theGame)
          Constructor for the Examine command
ExamineCommand(Game theGame, java.util.Properties config)
           
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this command.
 boolean execute()
          Executes the command.
 java.lang.String getHelp()
          Creates a string with the information about the command.
 boolean parse(java.lang.String line)
          Tries to configure the command with the information contained in a string.
 java.lang.String toString()
           
 
Methods inherited from class es.ucm.fdi.hysteria.console.command.Command
getResult, hasResult, setConfig, setGame
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_examineInventory

protected boolean _examineInventory
A flag that decides if examining the whole inventory or only an item


_itemName

protected java.lang.String _itemName
The name of the item to be examined

Constructor Detail

ExamineCommand

public ExamineCommand(Game theGame)
               throws java.lang.IllegalArgumentException
Constructor for the Examine command

Parameters:
theGame - Reference to main Game
Throws:
java.lang.IllegalArgumentException

ExamineCommand

public ExamineCommand(Game theGame,
                      java.util.Properties config)
               throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

execute

public boolean execute()
                throws UnparsedCommandException
Description copied from class: Command
Executes the command.

Overrides:
execute in class Command
Throws:
UnparsedCommandException

getHelp

public java.lang.String getHelp()
Description copied from class: Command
Creates a string with the information about the command.

Specified by:
getHelp in class Command
Returns:
How to write this command

parse

public boolean parse(java.lang.String line)
Description copied from class: Command
Tries to configure the command with the information contained in a string.

Specified by:
parse in class Command
Parameters:
line - Order to parse
Returns:
Successfulness of the parse

toString

public java.lang.String toString()
Specified by:
toString in class Command

clone

public java.lang.Object clone()
Description copied from class: Command
Returns a clone of this command.

Overrides:
clone in class Command