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

Package class diagram package Adopt
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.elements.PoshElement<THIS,PARENT>
      extended by cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement<Adopt,PoshPlan>
          extended by cz.cuni.amis.pogamut.sposh.elements.Adopt
All Implemented Interfaces:
IConditionElement<Adopt>, INamedElement, IParametrizedElement

public class Adopt
extends PoshDummyElement<Adopt,PoshPlan>
implements IParametrizedElement, IConditionElement<Adopt>

Adopt element is a stopgap. When engine requires to clear the stack, stack will be cleared only up to first adopt with failed exit condition.

Author:
Jimmy, Honza

Field Summary
static String adName
          Property string of competence name
static String adParams
          Property string used for PropertyChangeEvent when FormalParameters are changed.
static DataFlavor dataFlavor
          Data flavor of adopt class, used for drag-and-drop
 
Fields inherited from class cz.cuni.amis.pogamut.sposh.elements.PoshDummyElement
IDENT_PATTERN
 
Constructor Summary
Adopt(String name, FormalParameters parameters, List<Sense> exitCondition, PrimitiveCall adoptedElement)
           
 
Method Summary
 void addCondition(Sense sense)
           
 TriggeredAction getAdoptedElement()
           
 List<? extends PoshElement> getChildDataNodes()
          Get list of children of this node.
 Trigger<Adopt> getCondition()
          Get exit condition of the adopt.
 DataFlavor getDataFlavor()
          Get data flavour of posh plan element,used during DnD from palette to PoshScene.
 Trigger<Adopt> getExitCondition()
           
 String getName()
          Get name of the element.
 FormalParameters getParameters()
           
 LapType getType()
          Get type of the element.
 boolean moveChild(int newIndex, PoshElement child)
          Move child to the @newIndex.
 void rename(String newName)
          Change name of the element to newName.
 void setName(String name)
           
 void setParameters(FormalParameters newParams)
          Set new parameters.
 
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, getChildId, getChildren, getElementListeners, getId, getParent, getRootNode, isChildOfParent, removeElementListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataFlavor

public static final DataFlavor dataFlavor
Data flavor of adopt class, used for drag-and-drop


adName

public static final String adName
Property string of competence name

See Also:
Constant Field Values

adParams

public static final String adParams
Property string used for PropertyChangeEvent when FormalParameters are changed.

See Also:
Constant Field Values
Constructor Detail

Adopt

public Adopt(String name,
             FormalParameters parameters,
             List<Sense> exitCondition,
             PrimitiveCall adoptedElement)
Method Detail

getParameters

public FormalParameters getParameters()
Specified by:
getParameters in interface IParametrizedElement

setParameters

public void setParameters(FormalParameters newParams)
Description copied from interface: IParametrizedElement
Set new parameters.

Specified by:
setParameters in interface IParametrizedElement
Parameters:
newParams - new parameters

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,
                    CycleException
Throws:
InvalidNameException
DuplicateNameException
CycleException

rename

public void rename(String newName)
            throws InvalidNameException,
                   CycleException,
                   DuplicateNameException
Description copied from interface: INamedElement
Change name of the element to newName. Renaming doesn't just change name, it also changes all references in the plan from the old name to a new one.

Specified by:
rename in interface INamedElement
Parameters:
newName - New name of the element.
Throws:
InvalidNameException - Passed name is not valid Yaposh name.
CycleException - Renaming causes cycle.
DuplicateNameException - Such name is already used in the plan.

addCondition

public void addCondition(Sense sense)

getExitCondition

public Trigger<Adopt> getExitCondition()

getCondition

public Trigger<Adopt> getCondition()
Get exit condition of the adopt.

Specified by:
getCondition in interface IConditionElement<Adopt>
Returns:
Exit condition
See Also:
getExitCondition()

getAdoptedElement

public TriggeredAction getAdoptedElement()

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

getChildDataNodes

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

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<Adopt,PoshPlan>
Returns:
if node succesfully moved


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