lib
Class CompetenceElement

java.lang.Object
  extended by lib.CompetenceElement
All Implemented Interfaces:
IEditableElement, INamedElement

public class CompetenceElement
extends java.lang.Object
implements IEditableElement, INamedElement

A Competence Element is is a named trigger and an action, along with an optional number of retries.


Field Summary
private  java.util.ArrayList alTrigger
           
private  java.lang.String documentation
           
private  int iRetries
           
private  int senseCount
           
private  java.lang.String strAction
           
private  java.lang.String strName
           
 
Constructor Summary
CompetenceElement(java.lang.String name, java.util.ArrayList triggerList, java.lang.String action)
          Initialize this Competence Element with a name, a list of triggers, an action and the optional number of retries IS NOT being specified.
CompetenceElement(java.lang.String name, java.util.ArrayList triggerList, java.lang.String action, int ret)
          Initialize this Competence Element with a name, a list of triggers, an action and the optional number of retries being specified.
 
Method Summary
 JTreeNode buildTree(JTreeNode root, LearnableActionPattern lap, boolean detailed, boolean expanded)
          Convert this element into a tree branch
 java.lang.String getAction()
          Get the action
 java.lang.String getDocumentation()
          Get the documentation string for this element
 java.lang.String getName()
          Get the name of this competence element
 int getRetries()
          Get the number of retries for this element
 CompetenceElement getSelf()
           
 java.util.ArrayList getTrigger()
          Get the arraylist of action elements that comprises our trigger.
 void onSelect(JAbode mainGui, JEditorWindow subGui, JDiagram diagram)
          When we click this Competence in the GUI populate the properties panel with the various attributes and setup listeners to catch modifications that are made.
 void setAction(java.lang.String action)
          Set the name of the action to invoke
 void setDocumentation(java.lang.String docString)
          Set the documentation string for this element
 void setName(java.lang.String name)
          Set the name of this competence element
 void setRetries(int val)
          Set the number of retries for this element.
 void setTrigger(java.util.ArrayList list)
          Set our list of triggers
 void showContextMenu(JTreeNode showOn, LearnableActionPattern lap, JEditorWindow window, JDiagram diagram)
          Produce and show a context menu for this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strName

private java.lang.String strName

alTrigger

private java.util.ArrayList alTrigger

strAction

private java.lang.String strAction

iRetries

private int iRetries

documentation

private java.lang.String documentation

senseCount

private int senseCount
Constructor Detail

CompetenceElement

public CompetenceElement(java.lang.String name,
                         java.util.ArrayList triggerList,
                         java.lang.String action)
Initialize this Competence Element with a name, a list of triggers, an action and the optional number of retries IS NOT being specified.

Parameters:
name - Name of this competence
triggerList - List of actionelements comprising the trigger
action - Action to invoke

CompetenceElement

public CompetenceElement(java.lang.String name,
                         java.util.ArrayList triggerList,
                         java.lang.String action,
                         int ret)
Initialize this Competence Element with a name, a list of triggers, an action and the optional number of retries being specified.

Parameters:
name - Name of this competence
triggerList - List of actionelements comprising the trigger
action - Action to invoke
Method Detail

getAction

public java.lang.String getAction()
Get the action

Returns:
Name of our invoked action

getName

public java.lang.String getName()
Get the name of this competence element

Specified by:
getName in interface INamedElement
Returns:
Name of this competence element

getRetries

public int getRetries()
Get the number of retries for this element

Returns:
Number of retries

getTrigger

public java.util.ArrayList getTrigger()
Get the arraylist of action elements that comprises our trigger.

Returns:
Arraylist of action eleemtns comprising the trigger

getDocumentation

public java.lang.String getDocumentation()
Get the documentation string for this element

Returns:
Documentation string for this element

setDocumentation

public void setDocumentation(java.lang.String docString)
Set the documentation string for this element

Parameters:
docString - New documentation string

setAction

public void setAction(java.lang.String action)
Set the name of the action to invoke

Parameters:
action - Name of new action to invoke

setName

public void setName(java.lang.String name)
Set the name of this competence element

Specified by:
setName in interface INamedElement
Parameters:
name - New name of this competence element

setRetries

public void setRetries(int val)
Set the number of retries for this element.

Parameters:
val - New number of retries.

setTrigger

public void setTrigger(java.util.ArrayList list)
Set our list of triggers


onSelect

public void onSelect(JAbode mainGui,
                     JEditorWindow subGui,
                     JDiagram diagram)
When we click this Competence in the GUI populate the properties panel with the various attributes and setup listeners to catch modifications that are made.

Specified by:
onSelect in interface IEditableElement
Parameters:
mainGui - Reference to the MDI
subGui - Reference to the editor window
diagram - Diagram refernece on our editing window

getSelf

public CompetenceElement getSelf()

showContextMenu

public void showContextMenu(JTreeNode showOn,
                            LearnableActionPattern lap,
                            JEditorWindow window,
                            JDiagram diagram)
Produce and show a context menu for this object

Specified by:
showContextMenu in interface IEditableElement
Parameters:
showOn - The tree node invoking us
lap - The file we're a part of
window - The window we're being dispalyed in
diagram - The diagram in the window we'return being shown on

buildTree

public JTreeNode buildTree(JTreeNode root,
                           LearnableActionPattern lap,
                           boolean detailed,
                           boolean expanded)
Convert this element into a tree branch

Specified by:
buildTree in interface IEditableElement
Parameters:
root - The root of this sub-tree
lap - The learnable action pattern file we're part of.
detailed - Is the diagram detailed (i.e. decorative nodes)
expanded - Is this diagram expanded (i.e. show sub-tree chained elements)
Returns:
A constructed sub-tree showing this element and any sub-elements that need to be demonstrated.