lib
Class Competence

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

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

A competence is a named list of lists of competence elements with a goal and an interval

Version:
1.0
Author:
CobaltSoftware (abode.devteam@cobaltsoftware.net)

Field Summary
private  java.util.ArrayList alElementLists
           
private  java.util.ArrayList alGoal
           
private static int compElement
           
private  java.lang.String documentation
           
private  java.lang.String strName
           
private  TimeUnit tTimeout
           
 
Constructor Summary
Competence(java.lang.String name, TimeUnit timeUnit)
          Create an empty competence with only a name and a time unit, and put some default values for our goal and element lists
Competence(java.lang.String name, TimeUnit timeUnit, java.util.ArrayList goal, java.util.ArrayList elementLists)
          Create this competence with a name, ymir-like timeout and a goal (Arraylist of actionelements) as well as an arraylist of arraylists of CompetenceElements comprising the competence itself.
 
Method Summary
 JTreeNode buildTree(JTreeNode root, LearnableActionPattern lap, boolean detailed, boolean expanded)
          Convert this element into a tree branch
 java.lang.String getDocumentation()
          Get the documentation string for this element
 java.util.ArrayList getElementLists()
          Get our list of element lists
 java.util.ArrayList getGoal()
          Get the goal list
 java.lang.String getName()
          Get the name of this element
 IEditableElement getSelf()
          Get a reference to this object.
 TimeUnit getTimeout()
          Get the timeout of this competence
 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 setDocumentation(java.lang.String docString)
          Set the documentation string for this element
 void setElementLists(java.util.ArrayList lists)
          Set our arraylist of element lists
 void setGoal(java.util.ArrayList goal)
          Set the goal
 void setName(java.lang.String name)
          Set the name of this element
 void setTimeout(TimeUnit timeout)
          Set the timeout of this competence.
 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

alElementLists

private java.util.ArrayList alElementLists

alGoal

private java.util.ArrayList alGoal

tTimeout

private TimeUnit tTimeout

documentation

private java.lang.String documentation

compElement

private static int compElement
Constructor Detail

Competence

public Competence(java.lang.String name,
                  TimeUnit timeUnit)
Create an empty competence with only a name and a time unit, and put some default values for our goal and element lists

Parameters:
name - Name of this competence
timeUnit - Timeout

Competence

public Competence(java.lang.String name,
                  TimeUnit timeUnit,
                  java.util.ArrayList goal,
                  java.util.ArrayList elementLists)
Create this competence with a name, ymir-like timeout and a goal (Arraylist of actionelements) as well as an arraylist of arraylists of CompetenceElements comprising the competence itself.

Parameters:
name - Name of the competence
timeUnit - Timeout
goal - Goal to try and obtain
elementLists - Lists of lists of competence elements that comprise the actions etc.
Method Detail

getElementLists

public java.util.ArrayList getElementLists()
Get our list of element lists

Returns:
Arraylist of arraylists of competence element objects.

getGoal

public java.util.ArrayList getGoal()
Get the goal list

Returns:
Arraylist of actionelements that comprise the goal

getName

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

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

getTimeout

public TimeUnit getTimeout()
Get the timeout of this competence

Returns:
Timeout of this competence

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

setElementLists

public void setElementLists(java.util.ArrayList lists)
Set our arraylist of element lists

Parameters:
lists - List of lists of competence elements

setGoal

public void setGoal(java.util.ArrayList goal)
Set the goal

Parameters:
goal - Arraylist of actionelements that comprises the goal

setName

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

Specified by:
setName in interface INamedElement
Parameters:
name - Name of the object

setTimeout

public void setTimeout(TimeUnit timeout)
Set the timeout of this competence.

Parameters:
timeout - Timeout value

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 IEditableElement getSelf()
Get a reference to this object. This is an evil hack brought on by the use of the anonymous innner classes, which need a nice clean reference to "this" from time to time.

Returns:
This object, again.

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.