org.dimx
Class LanguageParser

java.lang.Object
  extended by org.dimx.LanguageParser
All Implemented Interfaces:
ISayProcessor
Direct Known Subclasses:
AdvancedLanguageParser

public class LanguageParser
extends java.lang.Object
implements ISayProcessor

Still in-development. Not ready for production game servers. API still subject to significant change.


Field Summary
static java.lang.String close_bracket
           
static java.lang.String CLOSE_LC
           
static java.lang.String colon
           
static java.lang.String comma
           
static java.lang.String D_LC
           
static java.lang.String D_UC
           
static java.lang.String DOWN_LC
           
static java.lang.String DROP_LC
           
static java.lang.String E_LC
           
static java.lang.String E_UC
           
static java.lang.String EAST_LC
           
static java.lang.String ENTER_LC
           
static java.lang.String exclamation
           
static java.lang.String EXIT_LC
           
static java.lang.String GIVE_LC
           
static java.lang.String GO_LC
           
static java.lang.String HIDE_LC
           
static java.lang.String IN_LC
           
static java.lang.String L_LC
           
static java.lang.String LEFT_LC
           
static java.lang.String LOCK_LC
           
 boolean logDebug
           
static java.lang.String LOOK_LC
           
static java.lang.String N_LC
           
static java.lang.String N_UC
           
static java.lang.String NORTH_LC
           
static java.lang.String ON_LC
           
static java.lang.String open_bracket
           
static java.lang.String OPEN_LC
           
static java.lang.String period
           
static java.lang.String PICK_LC
           
static java.lang.String[] PREDICATES_LC
          localized predicates in, on, with, to
static java.lang.String PUT_LC
           
static java.lang.String question
           
static java.lang.String RIGHT_LC
           
static java.lang.String ROTATE_LC
           
static java.lang.String S_LC
           
static java.lang.String S_UC
           
static java.lang.String SAVE_LC
           
static java.lang.String SAVEEXIT_LC
           
static java.lang.String SAY_LC
           
static java.lang.String SEARCH_LC
           
static java.lang.String semicolon
           
static java.lang.String SLASH_DISCONNECT
           
static java.lang.String SLASH_HELP
           
static java.lang.String SLASH_SAVE
           
static java.lang.String SLASH_SAVEEXIT
           
static java.lang.String SOUTH_LC
           
static java.lang.String space
           
static java.lang.String TL_LC
           
static java.lang.String TO_LC
           
static java.lang.String TR_LC
           
static java.lang.String TURN_LC
           
static java.lang.String U_LC
           
static java.lang.String U_UC
           
static java.lang.String UNLOCK_LC
           
static java.lang.String UP_LC
           
static java.lang.String USE_LC
           
static java.lang.String W_LC
           
static java.lang.String W_UC
           
static java.lang.String WEST_LC
           
static java.lang.String WITH_LC
           
 
Constructor Summary
LanguageParser()
           
 
Method Summary
protected  java.util.Vector badCLOSE(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badDROP(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badENTER(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badGIVE(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badGO(multiplayer server, World world, Player player, java.lang.String direction)
          Currently just displays localized "Which way?"
protected  java.util.Vector badHIDE(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badOPEN(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badPUT(World world, Player player, java.lang.String arg1)
          Currently just displays localized "I could not do that"
protected  java.util.Vector badUSE(World world, Player player, java.lang.String arg1, java.lang.String objtext, java.lang.String predtext)
          Currently just displays localized "I could not do that"
protected  java.util.Vector clearCmdVector()
          Produce an initialized Vector with all args (0,1,2) empty ("") and arg(3) == to txtBox input string
protected  java.util.Vector cmdCLOSE(multiplayer server, World world, java.util.Vector utils, Player player)
          Close command processing.
protected  java.util.Vector cmdDISCONNECT(multiplayer server, World world, java.util.Vector utils, Player player)
          Disconnect command processing.
 java.util.Vector cmdDROP(multiplayer server, World world, java.util.Vector utils, Player player)
          Drop command processing.
 java.util.Vector cmdENTER(multiplayer server, World world, java.util.Vector utils, Player player)
          ENTER command processing.
protected  java.util.Vector cmdEXIT(multiplayer server, World world, java.util.Vector utils, Player player)
          Exit command processing.
protected  java.util.Vector cmdGIVE(multiplayer server, World world, java.util.Vector utils, Player player, java.lang.String objtext, java.lang.String predtext)
          Give command processing.
 java.util.Vector cmdGO(multiplayer server, World world, java.util.Vector utils, Player player)
          Go command processing.
protected  java.util.Vector cmdHELP(multiplayer server, World world, java.util.Vector utils, Player player)
           
protected  java.util.Vector cmdHIDE(multiplayer server, World world, java.util.Vector utils, Player player)
          Hide command processing.
protected  java.util.Vector cmdLOCK(multiplayer server, World world, java.util.Vector utils, Player player, java.lang.String objtext, java.lang.String predtext)
          Use and Use With command processing.
protected  java.util.Vector cmdLOOK(multiplayer server, World world, java.util.Vector utils, Player player)
          Look command processing.
protected  java.util.Vector cmdOPEN(multiplayer server, World world, java.util.Vector utils, Player player)
          Open command processing.
 java.util.Vector cmdPICK(multiplayer server, World world, java.util.Vector utils, Player player)
          Pick command processing.
protected  java.util.Vector cmdPUT(multiplayer server, World world, java.util.Vector utils, Player player, java.lang.String objtext, java.lang.String predtext)
          Put command processing.
protected  java.util.Vector cmdREVERSE(multiplayer server, World world, java.util.Vector utils, Player player)
          Reverse command processing.
protected  java.util.Vector cmdSAVE(multiplayer server, World world, java.util.Vector utils, Player player)
          SAVE and SAVEEXIT command processing.
 java.util.Vector cmdSAY(multiplayer server, World world, java.util.Vector utils, Player player)
          Enhanced Player Chat support in the message window.
protected  java.util.Vector cmdSAYTO(multiplayer server, World world, java.util.Vector utils, Player player)
          SAY something TO someone processing
protected  java.util.Vector cmdSEARCH(multiplayer server, World world, java.util.Vector utils, Player player)
          Search command processing.
 java.util.Vector cmdTURN(multiplayer server, World world, java.util.Vector utils, Player player)
          Turn Right, Turn Left command processing.
protected  java.util.Vector cmdUSE(multiplayer server, World world, java.util.Vector utils, Player player, java.lang.String objtext, java.lang.String predtext)
          Use and Use With command processing.
protected  java.lang.String[] getMatchingContainerIds(World world, AdvObject container, java.lang.String input_lc)
          Attempt to match the input_lc with the Name of an item in the provided container.
protected  java.lang.String[] getMatchingIds(World world, java.lang.String input_lc, Dict items)
          Attempt to match the input_lc with the Name of an AdvObject in the items Dict.
protected  java.lang.String[] getMatchingInventoryIds(World world, Player player, java.lang.String input_lc)
          Attempt to match the input_lc with the Name of an item in the Player's inventory.
 java.util.Vector processSay(multiplayer server, World world, java.lang.String cmd, java.lang.String arg1, java.lang.String arg2, Player player)
          Display ALL player SAY messages and chat in the Message panel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logDebug

public boolean logDebug

comma

public static java.lang.String comma

semicolon

public static java.lang.String semicolon

colon

public static java.lang.String colon

period

public static java.lang.String period

exclamation

public static java.lang.String exclamation

question

public static java.lang.String question

space

public static java.lang.String space

open_bracket

public static java.lang.String open_bracket

close_bracket

public static java.lang.String close_bracket

GO_LC

public static java.lang.String GO_LC

PICK_LC

public static java.lang.String PICK_LC

DROP_LC

public static java.lang.String DROP_LC

LOOK_LC

public static java.lang.String LOOK_LC

LOCK_LC

public static java.lang.String LOCK_LC

UNLOCK_LC

public static java.lang.String UNLOCK_LC

L_LC

public static java.lang.String L_LC

SEARCH_LC

public static java.lang.String SEARCH_LC

OPEN_LC

public static java.lang.String OPEN_LC

CLOSE_LC

public static java.lang.String CLOSE_LC

USE_LC

public static java.lang.String USE_LC

HIDE_LC

public static java.lang.String HIDE_LC

GIVE_LC

public static java.lang.String GIVE_LC

PUT_LC

public static java.lang.String PUT_LC

ROTATE_LC

public static java.lang.String ROTATE_LC

SAY_LC

public static java.lang.String SAY_LC

SAVE_LC

public static java.lang.String SAVE_LC

SAVEEXIT_LC

public static java.lang.String SAVEEXIT_LC

ENTER_LC

public static java.lang.String ENTER_LC

EXIT_LC

public static java.lang.String EXIT_LC

IN_LC

public static java.lang.String IN_LC

ON_LC

public static java.lang.String ON_LC

WITH_LC

public static java.lang.String WITH_LC

TO_LC

public static java.lang.String TO_LC

N_LC

public static java.lang.String N_LC

S_LC

public static java.lang.String S_LC

E_LC

public static java.lang.String E_LC

W_LC

public static java.lang.String W_LC

U_LC

public static java.lang.String U_LC

D_LC

public static java.lang.String D_LC

N_UC

public static java.lang.String N_UC

S_UC

public static java.lang.String S_UC

E_UC

public static java.lang.String E_UC

W_UC

public static java.lang.String W_UC

U_UC

public static java.lang.String U_UC

D_UC

public static java.lang.String D_UC

TL_LC

public static java.lang.String TL_LC

TR_LC

public static java.lang.String TR_LC

TURN_LC

public static java.lang.String TURN_LC

RIGHT_LC

public static java.lang.String RIGHT_LC

LEFT_LC

public static java.lang.String LEFT_LC

UP_LC

public static java.lang.String UP_LC

DOWN_LC

public static java.lang.String DOWN_LC

NORTH_LC

public static java.lang.String NORTH_LC

SOUTH_LC

public static java.lang.String SOUTH_LC

EAST_LC

public static java.lang.String EAST_LC

WEST_LC

public static java.lang.String WEST_LC

SLASH_HELP

public static java.lang.String SLASH_HELP

SLASH_SAVE

public static java.lang.String SLASH_SAVE

SLASH_SAVEEXIT

public static java.lang.String SLASH_SAVEEXIT

SLASH_DISCONNECT

public static java.lang.String SLASH_DISCONNECT

PREDICATES_LC

public static java.lang.String[] PREDICATES_LC
localized predicates in, on, with, to

Constructor Detail

LanguageParser

public LanguageParser()
Method Detail

processSay

public java.util.Vector processSay(multiplayer server,
                                   World world,
                                   java.lang.String cmd,
                                   java.lang.String arg1,
                                   java.lang.String arg2,
                                   Player player)
Display ALL player SAY messages and chat in the Message panel. If the player selects another player for the SAY then that player will receive the message but the selected player will NOT receiver player focus. If the player sends a generic message with [ENTER], or selects a non-player object then normal SAY processing occurs in addition to displaying the text in the player's message panel. The API is subject to change as the parent Interface becomes fully developed.

Specified by:
processSay in interface ISayProcessor
Parameters:
server -
world -
cmd -
arg1 -
arg2 -
player -
Returns:
NULL to allow normal SAY processing to continue; Vector{new cmd,arg1,arg2} to perform standard engine cmd. Vector{"","",""} to indicate all processing complete already.

cmdSAY

public java.util.Vector cmdSAY(multiplayer server,
                               World world,
                               java.util.Vector utils,
                               Player player)
Enhanced Player Chat support in the message window. This overrides normal game engine chat handling.

Parameters:
server -
world -
utils -
player -
Returns:
NULL to allow normal SAY processing to continue; Vector{"","",""} to bypass normal SAY processing.

cmdSAYTO

protected java.util.Vector cmdSAYTO(multiplayer server,
                                    World world,
                                    java.util.Vector utils,
                                    Player player)
SAY something TO someone processing


cmdSEARCH

protected java.util.Vector cmdSEARCH(multiplayer server,
                                     World world,
                                     java.util.Vector utils,
                                     Player player)
Search command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found. If no match is found the normal engine tries to search the player's container.

Parameters:
server -
world -
utils -
player -
Returns:

badOPEN

protected java.util.Vector badOPEN(World world,
                                   Player player,
                                   java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdOPEN

protected java.util.Vector cmdOPEN(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player)
Open command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found.

Parameters:
server -
world -
utils -
player -
Returns:

badCLOSE

protected java.util.Vector badCLOSE(World world,
                                    Player player,
                                    java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdCLOSE

protected java.util.Vector cmdCLOSE(multiplayer server,
                                    World world,
                                    java.util.Vector utils,
                                    Player player)
Close command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found.

Parameters:
server -
world -
utils -
player -
Returns:

badHIDE

protected java.util.Vector badHIDE(World world,
                                   Player player,
                                   java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdHIDE

protected java.util.Vector cmdHIDE(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player)
Hide command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found.

Parameters:
server -
world -
utils -
player -
Returns:

cmdLOOK

protected java.util.Vector cmdLOOK(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player)
Look command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found. If no matches are found the normal engine tries to look the current container.

Parameters:
server -
world -
utils -
player -
Returns:

cmdREVERSE

protected java.util.Vector cmdREVERSE(multiplayer server,
                                      World world,
                                      java.util.Vector utils,
                                      Player player)
Reverse command processing.

Parameters:
server -
world -
utils -
player -
Returns:

badGO

protected java.util.Vector badGO(multiplayer server,
                                 World world,
                                 Player player,
                                 java.lang.String direction)
Currently just displays localized "Which way?"

Parameters:
server -
world -
player -
direction -
Returns:
clearCmdVector()

cmdGO

public java.util.Vector cmdGO(multiplayer server,
                              World world,
                              java.util.Vector utils,
                              Player player)
                       throws DimxException
Go command processing.

Parameters:
server -
world -
utils - -- arg1 -- Must be a valid WAY MARKER as used in Room Links: Valid values are "N", "S", "E", "W", "U", "D"
player -
Returns:
Throws:
DimxException

cmdTURN

public java.util.Vector cmdTURN(multiplayer server,
                                World world,
                                java.util.Vector utils,
                                Player player)
Turn Right, Turn Left command processing.

Parameters:
server -
world -
utils -
player -
Returns:

cmdPICK

public java.util.Vector cmdPICK(multiplayer server,
                                World world,
                                java.util.Vector utils,
                                Player player)
Pick command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found. If no matches are found the normal engine tries to pick up ALL nearby items it can.

Parameters:
server -
world -
utils -
player -
Returns:

badDROP

protected java.util.Vector badDROP(World world,
                                   Player player,
                                   java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdDROP

public java.util.Vector cmdDROP(multiplayer server,
                                World world,
                                java.util.Vector utils,
                                Player player)
Drop command processing. Attempts to match arg1 with local items and inventory. Multiple matches will always default to the first one found.

Parameters:
server -
world -
utils -
player -
Returns:

badGIVE

protected java.util.Vector badGIVE(World world,
                                   Player player,
                                   java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdGIVE

protected java.util.Vector cmdGIVE(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player,
                                   java.lang.String objtext,
                                   java.lang.String predtext)
Give command processing. Attempts to match objtext with local items and inventory. Attempts to match predtext with local items and inventory. Multiple matches on either will always default to the first one found.

Parameters:
server -
world -
utils -
player -
objtext - -- text left of any command predicate (in, on, with, to)
predtext - -- text right of any command predicate
Returns:

badPUT

protected java.util.Vector badPUT(World world,
                                  Player player,
                                  java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdPUT

protected java.util.Vector cmdPUT(multiplayer server,
                                  World world,
                                  java.util.Vector utils,
                                  Player player,
                                  java.lang.String objtext,
                                  java.lang.String predtext)
Put command processing. Attempts to match objtext with local items and inventory. Attempts to match predtext with local items and inventory. Multiple matches on either will always default to the first one found.

Parameters:
server -
world -
utils -
player -
objtext - -- text left of any command predicate (in, on, with, to)
predtext - -- text right of any command predicate
Returns:

badUSE

protected java.util.Vector badUSE(World world,
                                  Player player,
                                  java.lang.String arg1,
                                  java.lang.String objtext,
                                  java.lang.String predtext)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
objtext -
predtext -
Returns:
clearCmdVector()

cmdUSE

protected java.util.Vector cmdUSE(multiplayer server,
                                  World world,
                                  java.util.Vector utils,
                                  Player player,
                                  java.lang.String objtext,
                                  java.lang.String predtext)
Use and Use With command processing. Attempts to match objtext with local items and inventory. Attempts to match predtext with local items, inventory, and room links. Multiple matches on either will always default to the first one found.

Parameters:
server -
world -
utils -
player -
objtext - -- text left of any command predicate (in, on, with, to)
predtext - -- text right of any command predicate
Returns:

cmdLOCK

protected java.util.Vector cmdLOCK(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player,
                                   java.lang.String objtext,
                                   java.lang.String predtext)
Use and Use With command processing. Attempts to match objtext with local items and inventory. Attempts to match predtext with local items, inventory, and room links. Multiple matches on either will always default to the first one found.

Parameters:
server -
world -
utils -
player -
objtext - -- text left of any command predicate (in, on, with, to)
predtext - -- text right of any command predicate
Returns:

cmdEXIT

protected java.util.Vector cmdEXIT(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player)
Exit command processing.

Parameters:
server -
world -
utils -
player -
Returns:

cmdDISCONNECT

protected java.util.Vector cmdDISCONNECT(multiplayer server,
                                         World world,
                                         java.util.Vector utils,
                                         Player player)
Disconnect command processing.

Parameters:
server -
world -
utils -
player -
Returns:

cmdSAVE

protected java.util.Vector cmdSAVE(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player)
SAVE and SAVEEXIT command processing.

Parameters:
server -
world -
utils -
player -
Returns:

badENTER

protected java.util.Vector badENTER(World world,
                                    Player player,
                                    java.lang.String arg1)
Currently just displays localized "I could not do that"

Parameters:
world -
player -
arg1 -
Returns:
clearCmdVector()

cmdENTER

public java.util.Vector cmdENTER(multiplayer server,
                                 World world,
                                 java.util.Vector utils,
                                 Player player)
ENTER command processing. Attempts to match arg1 with local items. Multiple matches will always default to the first one found.

Parameters:
server -
world -
utils -
player -
Returns:

clearCmdVector

protected java.util.Vector clearCmdVector()
Produce an initialized Vector with all args (0,1,2) empty ("") and arg(3) == to txtBox input string

Returns:
initialized Vector

cmdHELP

protected java.util.Vector cmdHELP(multiplayer server,
                                   World world,
                                   java.util.Vector utils,
                                   Player player)

getMatchingIds

protected java.lang.String[] getMatchingIds(World world,
                                            java.lang.String input_lc,
                                            Dict items)
Attempt to match the input_lc with the Name of an AdvObject in the items Dict. Will attempt to id items in open container items, too.

Parameters:
world -
input_lc -
items -
Returns:
0 or more item Ids who's full NAME can be found in text_lc

getMatchingInventoryIds

protected java.lang.String[] getMatchingInventoryIds(World world,
                                                     Player player,
                                                     java.lang.String input_lc)
Attempt to match the input_lc with the Name of an item in the Player's inventory. Internally, inventory contents are sought with player.getContents(false)

Parameters:
world -
player -
input_lc -
Returns:
0 or more item Ids who's full NAME can be found in text_lc

getMatchingContainerIds

protected java.lang.String[] getMatchingContainerIds(World world,
                                                     AdvObject container,
                                                     java.lang.String input_lc)
Attempt to match the input_lc with the Name of an item in the provided container. Internally, container contents are sought with container.getContents(false)

Parameters:
world -
container -
input_lc -
Returns:
0 or more item Ids who's full NAME can be found in input_lc