com.miginfocom.ashape.interaction
Class Interaction

java.lang.Object
  extended by com.miginfocom.ashape.interaction.Interaction
All Implemented Interfaces:
java.io.Serializable

public class Interaction
extends java.lang.Object
implements java.io.Serializable

A generic information holder for an interaction of some kind. It is defining a process like:
When trigger happens, evaluate expr and if it evaluates to true expedite the command specified in cmd.

There must exist a container that fires the appropriate triggers (E.g. Interactors and brokers that do the things specified in the cmd (E.g. AbstractInteractionBroker.

See Also:
MouseKeyInteractor, DefaultCommand, LogicalExpression, Serialized Form

Constructor Summary
Interaction(java.lang.Object id, PropertyKey trigger, boolean exclusive, Expression expr, CommandSet cmdSet, boolean consume)
          Constructor.
Interaction(java.lang.Object id, java.lang.String trigger, boolean exclusive, Expression expr, CommandSet cmdSet, boolean consume)
          Deprecated. For backwards compatibility only. Do not use!
Interaction(PropertyKey trigger, boolean exclusive, Expression expr, CommandSet cmdSet, boolean consume)
          Constructor.
 
Method Summary
static java.lang.Object createId()
          Returns a unique id.
 boolean equals(java.lang.Object o)
           
 boolean evaluate(PropertyProvider propProvider)
          Transferred directly to the Expression.evaluate(com.miginfocom.util.PropertyProvider)
 CommandSet getCommandSet()
          Return the commands associated with this interaction.
 boolean getConsume()
           
 boolean getExclusive()
           
 Expression getExpression()
          Returns the expression used for evaluate this intreaction.
 java.lang.Object getId()
          Returns the name (ID) of the interaction
 PropertyKey getTrigger()
          Returns the trigger to the action.
 boolean isConsume()
          Returns a hint whether the interaction should be "the last" interaction in the notification chains.
 boolean isExclusive()
          Returns if this interaction must be the first to act.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interaction

public Interaction(PropertyKey trigger,
                   boolean exclusive,
                   Expression expr,
                   CommandSet cmdSet,
                   boolean consume)
Constructor. Autocreates ID.

Parameters:
trigger - THe trigger that starts an evaluation of the expression and if that evaluates to true the cmd is run. This trigger is up to the Interactors to eveluate and interpret.
exclusive - If this interaction must be the first to act. Usually means the event shouldn't have been consumed before if the command should be run.
expr - The expression to evaluate.
cmdSet - The command(s) to run if expr evaluates to true when the trigger is fired. Normally interpreted by som type of "broker".
consume - If the interaction is to be consumed and further processing of interaction should be deferred.

Interaction

public Interaction(java.lang.Object id,
                   java.lang.String trigger,
                   boolean exclusive,
                   Expression expr,
                   CommandSet cmdSet,
                   boolean consume)
Deprecated. For backwards compatibility only. Do not use!


Interaction

public Interaction(java.lang.Object id,
                   PropertyKey trigger,
                   boolean exclusive,
                   Expression expr,
                   CommandSet cmdSet,
                   boolean consume)
Constructor.

Parameters:
id - The id of the interaction. Not used internally.
trigger - THe trigger that starta an evaluation of the expression and if that evaluates to true the cmd is run.
exclusive - If this interaction must be the first to act. Usually means the event shouldn't have been consumed before if the command should be run.
expr - The expression to evaluate.
cmdSet - The command(s) to run if expr evaluates to true when the trigger is fired. Normally interpreted by som type of "broker".
consume - If the interaction is to be consumed and further processing of interaction should be deferred.
Method Detail

evaluate

public boolean evaluate(PropertyProvider propProvider)
Transferred directly to the Expression.evaluate(com.miginfocom.util.PropertyProvider)


getId

public java.lang.Object getId()
Returns the name (ID) of the interaction

Returns:
The name (ID) of the interaction

getTrigger

public PropertyKey getTrigger()
Returns the trigger to the action.

Returns:
The trigger to the action.

isExclusive

public boolean isExclusive()
Returns if this interaction must be the first to act. Usually means the event shouldn't have been consumed before if the command should be run.

Returns:
If this interaction must be the first to act.

getExclusive

public boolean getExclusive()

getExpression

public Expression getExpression()
Returns the expression used for evaluate this intreaction.

Returns:
The expression used for evaluate this intreaction.

getCommandSet

public CommandSet getCommandSet()
Return the commands associated with this interaction.

Returns:
The commands associated with this interaction. The live array, should not be changed. Treated as final though elements can be changed. Changing the arrays will break the immutability of this class.

isConsume

public boolean isConsume()
Returns a hint whether the interaction should be "the last" interaction in the notification chains.

Returns:
A hint whether the interaction should be "the last" interaction in the notification chains.

getConsume

public boolean getConsume()

createId

public static java.lang.Object createId()
Returns a unique id. (Currenty an Integer increased by one for every call.)

Returns:
A unique id.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.