cz.cuni.amis.pogamut.sposh.elements
Class TriggeredAction

Package class diagram package TriggeredAction
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.elements.PoshElement<THIS,PARENT>
      extended by cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
          extended by cz.cuni.amis.pogamut.sposh.elements.TriggeredAction
All Implemented Interfaces:
INamedElement, IReferenceElement

public class TriggeredAction
extends PoshDummyElement
implements IReferenceElement, INamedElement

Triggered action is basically a call of some other entity that is supposed to be executed. The referenced element can be action (through IWorkExecutor), Competence or ActionPattern. The call needs name of a callee and possibly some arguments to pass.

How is the target determined? Engine takes the name and checks if there is a Competence or ActionPattern with same name (names of all C and AP are unique, otherwise they get DuplicateNameException). If there is, the action will execute the found C/AP. If there is no such C/AP, it assumes that is is a name of an action so it tries to use IWorkExecutor. If that fails, stop the bot.

Note that we do not allow cycles (thx to CycleException).

Author:
HonzaH

Field Summary
static DataFlavor dataFlavor
           
static String taArgs
           
static String taName
           
 
Fields inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
IDENT_PATTERN
 
Method Summary
 PrimitiveCall getActionCall()
           
 Arguments getArguments()
          Get arguments of this action.
 List<PoshElement> getChildDataNodes()
          Get list of children of this node.
 DataFlavor getDataFlavor()
          Get data flavour of posh plan element,used during DnD from palette to PoshScene.
 String getName()
          Get name of the element.
 LapType getType()
          Get type of the element.
 boolean moveChild(int newIndex, PoshElement child)
          Move child to the @newIndex.
 void rename(String newName)
          XXX: Not implemented, because I don't have a usecase, but interface has it.
 void setActionName(String newName)
          Set name of the action.
 void setArguments(Arguments newArguments)
          Action basically consists from
 void synchronize(TriggeredAction source)
          Take @source action and set all properties (name, parameters...) to be same as the @source.
 String toString()
           
 
Methods inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
getElementId, getUnusedName, isUsedName, moveChildInList
 
Methods inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshElement
addElementListener, emitChildDeleted, emitChildMove, emitChildNode, firePropertyChange, getChildId, getChildren, getElementListeners, getId, getParent, getRootNode, isChildOfParent, removeElementListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataFlavor

public static final DataFlavor dataFlavor

taName

public static final String taName
See Also:
Constant Field Values

taArgs

public static final String taArgs
See Also:
Constant Field Values
Method Detail

getChildDataNodes

public List<PoshElement> getChildDataNodes()
Description copied from class: PoshElement
Get list of children of this node. Most likely auto generated every time this method is called.

Specified by:
getChildDataNodes in class PoshElement
Returns:
List of all children of this node.

toString

public String toString()
Overrides:
toString in class Object

getName

public String getName()
Description copied from interface: INamedElement
Get name of the element. The actual name, not display name (e.g. action can have FQN of class, but display name would be derived fromk annotations of the class) or representation (e.g. sense name "health" is different from actual condition of sense "health > 90").

Specified by:
getName in interface INamedElement
Returns:
Name of the element

getActionCall

public PrimitiveCall getActionCall()

setActionName

public void setActionName(String newName)
                   throws InvalidNameException,
                          CycleException
Set name of the action.

Parameters:
newName - New name of an action
Throws:
InvalidNameException - If name is not valid
CycleException - if namechange would cause a cycle.

rename

public void rename(String newName)
            throws InvalidNameException,
                   CycleException,
                   DuplicateNameException
XXX: Not implemented, because I don't have a usecase, but interface has it. Finds all actions in the plan with the same name as this sense and changes their name to newName. } + fire property.

Specified by:
rename in interface INamedElement
Parameters:
newName - What will be new name of all actions with old name.
Throws:
InvalidNameException - Passed name is not valid Yaposh name.
CycleException - Renaming causes cycle.
DuplicateNameException - Such name is already used in the plan.

moveChild

public boolean moveChild(int newIndex,
                         PoshElement child)
Description copied from class: PoshElement
Move child to the @newIndex. After child was moved (if it was moved), notify listeners.

Specified by:
moveChild in class PoshElement
Returns:
if node succesfully moved

getDataFlavor

public DataFlavor getDataFlavor()
Description copied from class: PoshElement
Get data flavour of posh plan element,used during DnD from palette to PoshScene.

Specified by:
getDataFlavor in class PoshElement
Returns:
dataFlavour of posh plan element, never null.

getType

public LapType getType()
Description copied from class: PoshElement
Get type of the element.

Specified by:
getType in class PoshElement
Returns:
Type of element.

synchronize

public void synchronize(TriggeredAction source)
                 throws CycleException
Take @source action and set all properties (name, parameters...) to be same as the @source. All changes will be emitted.

Parameters:
source - The source of the data this action will synchronize to.
Throws:
CycleException

setArguments

public void setArguments(Arguments newArguments)
Action basically consists from


getArguments

public Arguments getArguments()
Get arguments of this action.

Specified by:
getArguments in interface IReferenceElement
Returns:
Arguments of the action.


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.