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

Package class diagram package Competence
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<Competence,PoshPlan>
              extended by cz.cuni.amis.pogamut.sposh.elements.Competence
All Implemented Interfaces:
IParametrizedElement

public final class Competence
extends NamedLapElement<Competence,PoshPlan>
implements IParametrizedElement

Competence is basically a named structure offering several choices. If you imagine a decision tree, the point, where node splits into several subnodes is akin to the to the Competence.

What is difference between Competence and DriveCollection? Well, for one, DC is in the root of the plan, DC has a goal (well, Cs had goal too in the past), the main difference how they are processed by the engine (see description of how DriveCollection is evaluated).

Unlike DC, Competence is simple decision tree, engine will take the element with highest priority and satisfied trigger and traverses into that node without looking back.

Author:
HonzaH
See Also:
DriveCollection

Field Summary
static String cnName
          Property string of competence name
static String cnParams
          Property string of competence parameters
static DataFlavor dataFlavor
          Data flavor of competence classs, used for drag-and-drop
 
Fields inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
IDENT_PATTERN
 
Method Summary
 void addElement(CompetenceElement choice)
          Add passed element as the last element of this competence and emit.
 void addElement(int index, CompetenceElement choice)
          Add choice as the @index element of all competences choices + emit.
 DataFlavor getDataFlavor()
          Get data flavour of posh plan element,used during DnD from palette to PoshScene.
 List<CompetenceElement> getChildDataNodes()
          Get list of children of this node.
 String getName()
          Get name of the competence
 FormalParameters getParameters()
          Get list of formal parametrs of competence (names and default values).
 LapType getType()
          Get type of the element.
 boolean moveChild(int newIndex, PoshElement child)
          Move child to the @newIndex.
 void removeElement(CompetenceElement element)
          Remove the CompetenceElement from this competence and emit notification about deletion.
 void rename(String newCompetenceName)
          Rename Competence in the PoshPlan.
 void setName(String name)
          Change name of competence node.
 void setParameters(FormalParameters newParams)
           
 String toString()
          Create text representation of this competence, compatible with parser, so we can directly output it.
 
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

cnName

public static final String cnName
Property string of competence name

See Also:
Constant Field Values

cnParams

public static final String cnParams
Property string of competence parameters

See Also:
Constant Field Values

dataFlavor

public static final DataFlavor dataFlavor
Data flavor of competence classs, used for drag-and-drop

Method Detail

addElement

public void addElement(CompetenceElement choice)
                throws DuplicateNameException
Add passed element as the last element of this competence and emit.

Parameters:
choice - element that will be added into this competence
Throws:
DuplicateNameException

addElement

public void addElement(int index,
                       CompetenceElement choice)
                throws DuplicateNameException
Add choice as the @index element of all competences choices + emit.

Parameters:
index - Index at which should the choice be added
choice - Choice to add. Orphan.
Throws:
DuplicateNameException

toString

public String toString()
Create text representation of this competence, compatible with parser, so we can directly output it.

Overrides:
toString in class Object
Returns:

getChildDataNodes

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

setName

public void setName(String name)
             throws DuplicateNameException,
                    CycleException,
                    InvalidNameException
Change name of competence node.

Parameters:
name - new name of competence node
Throws:
DuplicateNameException
CycleException
InvalidNameException

getName

public String getName()
Get name of the competence

Specified by:
getName in class NamedLapElement<Competence,PoshPlan>
Returns:
name of the competence

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

removeElement

public void removeElement(CompetenceElement element)
Remove the CompetenceElement from this competence and emit notification about deletion.

Parameters:
element - Element to be removed.

getParameters

public FormalParameters getParameters()
Get list of formal parametrs of competence (names and default values).

Specified by:
getParameters in interface IParametrizedElement
Returns:

setParameters

public void setParameters(FormalParameters newParams)
                   throws MissingParameterException
Specified by:
setParameters in interface IParametrizedElement
Throws:
MissingParameterException

rename

public final void rename(String newCompetenceName)
                  throws InvalidNameException,
                         CycleException,
                         DuplicateNameException
Rename Competence in the PoshPlan. This method changes name fo the comeptence, finds all references to the competence (the ones with old name) and changed them to @newCompetenceName.

Parameters:
newCompetenceName - New name of comeptence after renaming
Throws:
InvalidNameException
CycleException
DuplicateNameException


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