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

Package class diagram package CompetenceElement
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.elements.PoshElement<THIS,PARENT>
      extended by cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement<THIS,PARENT>
          extended by cz.cuni.amis.pogamut.sposh.elements.NamedLapElement<CompetenceElement,Competence>
              extended by cz.cuni.amis.pogamut.sposh.elements.CompetenceElement

public final class CompetenceElement
extends NamedLapElement<CompetenceElement,Competence>

CompetenceElement is basically one of choices of the competence. It has a name(not used elsewhere in the tree, but unique), trigger and defined action that should be done if the triggers is satisfied.

Example in POSH:

(move (trigger ((see-player))) move-player)

Author:
HonzaH

Field Summary
static String ceComment
          Property name of comment.
static String ceName
          Property name of name.
static String ceRetries
          Property name of retries.
static DataFlavor dataFlavor
          Data flavor of competence element, used for drag and drop.
static int INFINITE_RETRIES
          Special value for infinite number of retries.
 
Fields inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
IDENT_PATTERN
 
Constructor Summary
CompetenceElement(String name, List<Sense> triggerSenses, PrimitiveCall actionCall, int retries, String comment)
          Create a choice.
 
Method Summary
 TriggeredAction getAction()
          Get action of this choice.
 String getComment()
          Deprecated. Not supported in the editor.
 DataFlavor getDataFlavor()
          Get data flavour of posh plan element,used during DnD from palette to PoshScene.
 List<PoshElement> getChildDataNodes()
          Get list of children of this node.
 String getName()
          Get name of the element.
 int getRetries()
          Deprecated. Remnants of original posh,
 Trigger<CompetenceElement> getTrigger()
          Get trigger of this choice.
 LapType getType()
          Get type of the element.
 boolean moveChild(int newIndex, PoshElement child)
          Move child to the @newIndex.
 void setComment(String newComment)
          Deprecated. Not used in the editor
 void setName(String name)
          Set name of this choice.
 void setRetries(int newRetries)
          Deprecated. Not used in the editor
 String toString()
           
 
Methods inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
getUnusedName, isUsedName, moveChildInList
 
Methods inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshElement
addElementListener, emitChildDeleted, emitChildMove, emitChildNode, firePropertyChange, getElementListeners, getNumberOfChildInstances, getParent, getRootNode, isChildOfParent, removeElementListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ceName

public static final String ceName
Property name of name.

See Also:
Constant Field Values

ceRetries

public static final String ceRetries
Property name of retries.

See Also:
Constant Field Values

ceComment

public static final String ceComment
Property name of comment.

See Also:
Constant Field Values

dataFlavor

public static final DataFlavor dataFlavor
Data flavor of competence element, used for drag and drop.


INFINITE_RETRIES

public static final int INFINITE_RETRIES
Special value for infinite number of retries.

See Also:
getRetries(), Constant Field Values
Constructor Detail

CompetenceElement

public CompetenceElement(String name,
                         List<Sense> triggerSenses,
                         PrimitiveCall actionCall,
                         int retries,
                         String comment)
Create a choice.

Parameters:
name - Name of a choice
triggerSenses - List of senses that will trigger the action of this choice
actionCall - Action call(=action name with arguments), name can be a normal action, an AP/C name.
Method Detail

getTrigger

public Trigger<CompetenceElement> getTrigger()
Get trigger of this choice. Trigger can contain number of senses that are evaluated (along with retries) to determine elegibility of the element for traversal.


getAction

public TriggeredAction getAction()
Get action of this choice.

Returns:
Action of this choice.

toString

public String toString()
Overrides:
toString in class Object

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<CompetenceElement,Competence>
Returns:
List of all children of this node.

getName

public String getName()
Description copied from class: NamedLapElement
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 class NamedLapElement<CompetenceElement,Competence>
Returns:
Name of the element

setName

public void setName(String name)
             throws InvalidNameException,
                    DuplicateNameException
Set name of this choice.

Parameters:
name - new name of this choice.
Throws:
InvalidNameException
DuplicateNameException

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<CompetenceElement,Competence>
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<CompetenceElement,Competence>
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<CompetenceElement,Competence>
Returns:
Type of element.

getRetries

@Deprecated
public int getRetries()
Deprecated. Remnants of original posh,

When engine is evaluating drive and it encounteres a node How many retries can this element experience before it is removed from list of elegible elements for current traverasal.

Returns:

setRetries

@Deprecated
public void setRetries(int newRetries)
Deprecated. Not used in the editor

Change number of allowed retries of this node and fire the change.

Parameters:
newRetries - new number of retries. Must be ≥0 or INFINITE_RETRIES.

getComment

@Deprecated
public String getComment()
Deprecated. Not supported in the editor.

Get comment for this element.

Returns:
Comment, not null(maybe blank)

setComment

@Deprecated
public void setComment(String newComment)
Deprecated. Not used in the editor

Change the comment of this element and fire the change.

Parameters:
newComment - New comment of this element


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