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<CompetenceElement,Competence>
          extended by cz.cuni.amis.pogamut.sposh.elements.CompetenceElement
All Implemented Interfaces:
IConditionElement<CompetenceElement>, INamedElement

public final class CompetenceElement
extends PoshDummyElement<CompetenceElement,Competence>
implements INamedElement, IConditionElement<CompetenceElement>

CompetenceElement is basically one of choices of the Competence. It has a name(not used elsewhere in the tree, but unique), Trigger and defined TriggeredAction that should be evaluated if the triggers is satisfied.

Example in POSH:

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

Author:
Honza

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.
 Trigger<CompetenceElement> getCondition()
          Get trigger of the choice.
 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 rename(String newName)
          Becasue name of a choice is not used as reference in the plan, this method only changes a name of a choice, identical to setName(java.lang.String).
 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
getElementId, getUnusedName, isUsedName, moveChildInList
 
Methods inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshElement
addElementListener, emitChildDeleted, emitChildMove, emitChildNode, firePropertyChange, getElementListeners, getChildId, getChildren, 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

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.


getCondition

public Trigger<CompetenceElement> getCondition()
Get trigger of the choice.

Specified by:
getCondition in interface IConditionElement<CompetenceElement>
Returns:
trigger of choice, never null.

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 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

setName

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

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

rename

public void rename(String newName)
            throws InvalidNameException,
                   CycleException,
                   DuplicateNameException
Becasue name of a choice is not used as reference in the plan, this method only changes a name of a choice, identical to setName(java.lang.String).

Specified by:
rename in interface INamedElement
Parameters:
newName - New name of choice.
Throws:
InvalidNameException - Passed name is not valid Yaposh name.
CycleException - Renaming causes cycle.
DuplicateNameException - Such name is already used in the plan.
See Also:
setName(java.lang.String)

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 © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.