org.starhope.appius.user.events
Class ActionHandler

java.lang.Object
  extended by org.starhope.appius.user.events.ActionHandler
All Implemented Interfaces:
Comparable<Object>, ActionHandlerInterface

public class ActionHandler
extends Object
implements ActionHandlerInterface

WRITEME: Document this type.

Author:
brpocock@star-hope.org

Field Summary
private  boolean anyIndirectObject
          whether to match any indirect object
private  boolean anyObject
          whether any direct object is matched
private  boolean anyRoom
          WRITEME
private  boolean anySubject
          WRITEME
private  boolean anyVerb
          whether any verb is matched
private  String myIndirectObject
           
private  AbstractUser myObject
          WRITEME
private  Room myRoom
          WRITEME
private  AbstractUser mySubject
          WRITEME
private  ActionMethod myTarget
          target method of the action
private  String myVerb
          verb to be matched
private  boolean zoneMatch
          WRITEME
 
Constructor Summary
ActionHandler(Room room, AbstractUser subject, String verb, AbstractUser object, ActionMethod target)
          Create a new action handler matching a usual set of conditions.
ActionHandler(Room room, AbstractUser subject, String verb, AbstractUser object, String dative, ActionMethod target)
          This is the “old form” action handler interface, to be replaced with the new Action object interface.
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object obj)
           
 String getIndirectObject()
           
 AbstractUser getObject()
           
 Room getRoom()
           
 AbstractUser getSubject()
           
 ActionMethod getTarget()
           
 String getVerb()
           
 int hashCode()
           
 boolean invoke(Action action)
          WRITEME: Document this method brpocock@star-hope.org
 boolean isAnyIndirectObject()
           
 boolean isAnyObject()
           
 boolean isAnyRoom()
           
 boolean isAnySubject()
           
 boolean isAnyVerb()
           
 boolean isZoneMatch()
           
 boolean matches(Action action)
          WRITEME: Document this method brpocock@star-hope.org
 void setAnyIndirectObject(boolean really)
           
 void setAnyObject(boolean newObject)
           
 void setAnyRoom(boolean newRoom)
           
 void setAnySubject(boolean newSubject)
           
 void setAnyVerb(boolean newVerb)
           
 void setIndirectObject(String indirectObject)
           
 void setObject(AbstractUser newObject)
           
 void setRoom(Room newRoom)
           
 void setSubject(AbstractUser newSubject)
           
 void setTarget(ActionMethod newTarget)
           
 void setVerb(String newVerb)
           
 void setZoneMatch(boolean newMatch)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

anyObject

private boolean anyObject
whether any direct object is matched


anyRoom

private boolean anyRoom
WRITEME


anySubject

private boolean anySubject
WRITEME


anyVerb

private boolean anyVerb
whether any verb is matched


myObject

private AbstractUser myObject
WRITEME


myRoom

private Room myRoom
WRITEME


mySubject

private AbstractUser mySubject
WRITEME


myTarget

private ActionMethod myTarget
target method of the action


myVerb

private String myVerb
verb to be matched


zoneMatch

private boolean zoneMatch
WRITEME


anyIndirectObject

private boolean anyIndirectObject
whether to match any indirect object


myIndirectObject

private String myIndirectObject
Constructor Detail

ActionHandler

public ActionHandler(Room room,
                     AbstractUser subject,
                     String verb,
                     AbstractUser object,
                     ActionMethod target)
Create a new action handler matching a usual set of conditions. Setting any condition-noun to “null” will cause it to match any possible item of that type; e.g. setting the room to null will setAnyRoom(boolean) to true. These conditions can be altered once the handler is created.

Parameters:
room - WRITEME
subject - WRITEME
verb - WRITEME
object - WRITEME
target - WRITEME

ActionHandler

public ActionHandler(Room room,
                     AbstractUser subject,
                     String verb,
                     AbstractUser object,
                     String dative,
                     ActionMethod target)
This is the “old form” action handler interface, to be replaced with the new Action object interface.

Parameters:
room - place in which the action happened
subject - actor causing something to happen
verb - what happened
object - actor to whom something has happened
dative - indirect object explaining more about what happened
target - code to be run if the event occurs as described
Method Detail

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable<Object>
Specified by:
compareTo in interface ActionHandlerInterface
See Also:
ActionHandlerInterface.compareTo(Object)

equals

public boolean equals(Object obj)
Specified by:
equals in interface ActionHandlerInterface
Overrides:
equals in class Object
See Also:
ActionHandlerInterface.equals(java.lang.Object)

getIndirectObject

public String getIndirectObject()
Returns:
the myIndirectObject

getObject

public AbstractUser getObject()
Specified by:
getObject in interface ActionHandlerInterface
Returns:
the myObject
See Also:
ActionHandlerInterface.getObject()

getRoom

public Room getRoom()
Specified by:
getRoom in interface ActionHandlerInterface
Returns:
the myRoom
See Also:
ActionHandlerInterface.getRoom()

getSubject

public AbstractUser getSubject()
Specified by:
getSubject in interface ActionHandlerInterface
Returns:
the mySubject
See Also:
ActionHandlerInterface.getSubject()

getTarget

public ActionMethod getTarget()
Specified by:
getTarget in interface ActionHandlerInterface
Returns:
the myTarget
See Also:
ActionHandlerInterface.getTarget()

getVerb

public String getVerb()
Specified by:
getVerb in interface ActionHandlerInterface
Returns:
the myVerb
See Also:
ActionHandlerInterface.getVerb()

hashCode

public int hashCode()
Specified by:
hashCode in interface ActionHandlerInterface
Overrides:
hashCode in class Object
See Also:
ActionHandlerInterface.hashCode()

invoke

public boolean invoke(Action action)
Description copied from interface: ActionHandlerInterface
WRITEME: Document this method brpocock@star-hope.org

Specified by:
invoke in interface ActionHandlerInterface
Parameters:
action - WRITEME
Returns:
true, if the action has been handled completely
See Also:
ActionHandlerInterface.invoke(org.starhope.appius.user.events.Action)

isAnyIndirectObject

public boolean isAnyIndirectObject()
Returns:
the anyIndirectObject

isAnyObject

public boolean isAnyObject()
Specified by:
isAnyObject in interface ActionHandlerInterface
Returns:
the anyObject
See Also:
ActionHandlerInterface.isAnyObject()

isAnyRoom

public boolean isAnyRoom()
Specified by:
isAnyRoom in interface ActionHandlerInterface
Returns:
the anyRoom
See Also:
ActionHandlerInterface.isAnyRoom()

isAnySubject

public boolean isAnySubject()
Specified by:
isAnySubject in interface ActionHandlerInterface
Returns:
the anySubject
See Also:
ActionHandlerInterface.isAnySubject()

isAnyVerb

public boolean isAnyVerb()
Specified by:
isAnyVerb in interface ActionHandlerInterface
Returns:
the anyVerb
See Also:
ActionHandlerInterface.isAnyVerb()

isZoneMatch

public boolean isZoneMatch()
Specified by:
isZoneMatch in interface ActionHandlerInterface
Returns:
the zoneMatch
See Also:
ActionHandlerInterface.isZoneMatch()

matches

public boolean matches(Action action)
Description copied from interface: ActionHandlerInterface
WRITEME: Document this method brpocock@star-hope.org

Specified by:
matches in interface ActionHandlerInterface
Parameters:
action - WRITEME
Returns:
WRITEME
See Also:
ActionHandlerInterface.matches(org.starhope.appius.user.events.Action)

setAnyIndirectObject

public void setAnyIndirectObject(boolean really)
Parameters:
really - the anyIndirectObject to set

setAnyObject

public void setAnyObject(boolean newObject)
Specified by:
setAnyObject in interface ActionHandlerInterface
Parameters:
newObject - the anyObject to set
See Also:
ActionHandlerInterface.setAnyObject(boolean)

setAnyRoom

public void setAnyRoom(boolean newRoom)
Specified by:
setAnyRoom in interface ActionHandlerInterface
Parameters:
newRoom - the anyRoom to set
See Also:
ActionHandlerInterface.setAnyRoom(boolean)

setAnySubject

public void setAnySubject(boolean newSubject)
Specified by:
setAnySubject in interface ActionHandlerInterface
Parameters:
newSubject - the anySubject to set
See Also:
ActionHandlerInterface.setAnySubject(boolean)

setAnyVerb

public void setAnyVerb(boolean newVerb)
Specified by:
setAnyVerb in interface ActionHandlerInterface
Parameters:
newVerb - the anyVerb to set
See Also:
ActionHandlerInterface.setAnyVerb(boolean)

setIndirectObject

public void setIndirectObject(String indirectObject)
Parameters:
indirectObject - the Indirect Object to set

setObject

public void setObject(AbstractUser newObject)
Specified by:
setObject in interface ActionHandlerInterface
Parameters:
newObject - the myObject to set
See Also:
ActionHandlerInterface.setObject(org.starhope.appius.user.AbstractUser)

setRoom

public void setRoom(Room newRoom)
Specified by:
setRoom in interface ActionHandlerInterface
Parameters:
newRoom - the myRoom to set
See Also:
ActionHandlerInterface.setRoom(org.starhope.appius.game.Room)

setSubject

public void setSubject(AbstractUser newSubject)
Specified by:
setSubject in interface ActionHandlerInterface
Parameters:
newSubject - the mySubject to set
See Also:
ActionHandlerInterface.setSubject(org.starhope.appius.user.AbstractUser)

setTarget

public void setTarget(ActionMethod newTarget)
Specified by:
setTarget in interface ActionHandlerInterface
Parameters:
newTarget - the myTarget to set
See Also:
ActionHandlerInterface.setTarget(org.starhope.appius.user.events.ActionMethod)

setVerb

public void setVerb(String newVerb)
Specified by:
setVerb in interface ActionHandlerInterface
Parameters:
newVerb - the myVerb to set
See Also:
ActionHandlerInterface.setVerb(java.lang.String)

setZoneMatch

public void setZoneMatch(boolean newMatch)
Specified by:
setZoneMatch in interface ActionHandlerInterface
Parameters:
newMatch - the zoneMatch to set
See Also:
ActionHandlerInterface.setZoneMatch(boolean)

toString

public String toString()
Specified by:
toString in interface ActionHandlerInterface
Overrides:
toString in class Object
See Also:
ActionHandlerInterface.toString()