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

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

public final class ActionPattern
extends PoshDummyElement<ActionPattern,PoshPlan>
implements IParametrizedElement

AP is a named sequence of actions. Action patterns: or simple sequences. These are a basic kind of plan aggregate which turn out to be useful in quite a lot of situations, despite their lack of flexibility. They reduce the combinatorial complexity of the agent when a full competence is not really necessary.

Author:
HonzaH

Field Summary
static String apComment
          Property name for comment
static String apName
          Property name for name of this AP.
static String apParams
          Property name for parameters of AP.
static DataFlavor dataFlavor
          Data flavor of AP for drag and drop.
protected  FormalParameters params
          Formal parameters of this AP.
 
Fields inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
IDENT_PATTERN
 
Method Summary
 void addAction(int index, TriggeredAction action)
          Add new @action as action of this AP, emit new child.
 void addAction(TriggeredAction action)
          Add new TriggeredAction as child of this AP.
 TriggeredAction getAction(int actionId)
          Get action with @actionId.
 List<TriggeredAction> getActions()
          Get list of actions in this AP.
 List<TriggeredAction> 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 AP.
 FormalParameters getParameters()
          Get formal parametrs of this AP.
 LapType getType()
          Get type of the element.
 boolean moveChild(int newIndex, PoshElement child)
          Move child to the @newIndex.
 void removeAction(TriggeredAction action)
          Remove action from this AP and emit notification.
 void rename(String newAPName)
          Rename ActionPattern in the PoshPlan.
 void setName(String name)
          Set name of AP.
 void setParameters(FormalParameters newParams)
          Change parameters of the AP.
 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

params

protected FormalParameters params
Formal parameters of this AP. Can be passed to the actions.


apName

public static final String apName
Property name for name of this AP.

See Also:
Constant Field Values

apComment

public static final String apComment
Property name for comment

See Also:
Constant Field Values

apParams

public static final String apParams
Property name for parameters of AP.

See Also:
Constant Field Values

dataFlavor

public static final DataFlavor dataFlavor
Data flavor of AP for drag and drop.

Method Detail

addAction

public void addAction(TriggeredAction action)
               throws CycleException
Add new TriggeredAction as child of this AP.

Parameters:
action - action to be added into this AP
Throws:
CycleException

addAction

public void addAction(int index,
                      TriggeredAction action)
               throws CycleException
Add new @action as action of this AP, emit new child.

Parameters:
index - Index at which to put the @action.
action - orphan
Throws:
CycleException

toString

public String toString()
Overrides:
toString in class Object

getChildDataNodes

public List<TriggeredAction> 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<ActionPattern,PoshPlan>
Returns:
List of all children of this node.

setName

public void setName(String name)
             throws InvalidNameException,
                    DuplicateNameException,
                    CycleException
Set name of AP. Check for cycles and make sure the name is unique not same as some AP or Competence.

Parameters:
name - string tham matches IDENT_PATTERN
Throws:
InvalidNameException
DuplicateNameException
CycleException

getName

public String getName()
Get name of AP.

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

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<ActionPattern,PoshPlan>
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<ActionPattern,PoshPlan>
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<ActionPattern,PoshPlan>
Returns:
Type of element.

removeAction

public void removeAction(TriggeredAction action)
Remove action from this AP and emit notification.

Parameters:
action - Action that will be removed.

getActions

public List<TriggeredAction> getActions()
Get list of actions in this AP.

Returns:
unmodifiable list of actions.

getParameters

public FormalParameters getParameters()
Get formal parametrs of this AP. Formal paramaters contain map of parameterName-default value this AP accepts.

Specified by:
getParameters in interface IParametrizedElement
Returns:
formal parameters of this AP

setParameters

public void setParameters(FormalParameters newParams)
                   throws MissingParameterException
Change parameters of the AP.

Specified by:
setParameters in interface IParametrizedElement
Parameters:
newParams - New parameters of AP.
Throws:
MissingParameterException

rename

public void rename(String newAPName)
            throws InvalidNameException,
                   DuplicateNameException,
                   CycleException
Rename ActionPattern in the PoshPlan. This method finds all references ín the plan where this AP is references and changes them to the @newAPName

Parameters:
newAPName - New name for this AP in the plan.
Throws:
InvalidNameException
DuplicateNameException
CycleException

getAction

public TriggeredAction getAction(int actionId)
Get action with @actionId. Equivalent of getActions().List.get(int).

Parameters:
actionId - Id of desired action.
Returns:
Specified action.


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