|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.sposh.elements.LapChain
public final class LapChain
Chain of links that represents how are parameters passed in the chain of lap
elements. Each time action is referenced, it adds new chain of link.
The chain itself is immutable. You can listen for changes of parameters
and Arguments
of elements
referenced by the
individual links.
Example1: There is only drive that calls some action. In such case, there is
only one link of the chain - the call from the chain to the action.
Example2: There is drive action that references AP1 and that AP1 references
some action. In such case chain has two links - first link represents
reference from drive action to AP1 and second link represents reference from
AP1 to the action..
Constructor Summary | |
---|---|
LapChain()
Create new chain, It has no ChainLink . |
Method Summary | ||
---|---|---|
boolean |
addChainListener(ILapChainListener listener)
|
|
void |
childElementAdded(PoshElement parent,
PoshElement child)
Event handler will be notified that parent has added a new child among its children. |
|
void |
childElementMoved(PoshElement parent,
PoshElement child,
int oldIndex,
int newIndex)
Evenet handler will be notified that parent has moved a child. |
|
void |
childElementRemoved(PoshElement parent,
PoshElement child,
int removedChildPosition)
Event handler will be notified when parent has removed child. |
|
VariableContext |
createContext()
|
|
|
derive(REFERENCE reference)
Create and return new chain using this one as the base. |
|
|
derive(TriggeredAction action,
REFERENCED_NODE referencedNode)
Return new chain using this one as the base and create new link from the reference of action to AP. |
|
boolean |
equals(Object obj)
|
|
static LapChain |
fromPath(PoshPlan plan,
LapPath path)
Create chain from the @path. |
|
int |
hashCode()
|
|
void |
propertyChange(PropertyChangeEvent evt)
|
|
void |
register()
Add the chain as listener for changes of elements of links. |
|
boolean |
removeChainListener(ILapChainListener listener)
|
|
int |
size()
How many links of chain are there. |
|
LapChain |
subchain(int beginIndex,
int endIndex)
Create subchain created from links of this chain. |
|
LapPath |
toPath()
Create LapPath from the chain. |
|
String |
toString()
|
|
void |
unregister()
Remove the chain as listener of all links elements. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LapChain()
ChainLink
.
Method Detail |
---|
public static LapChain fromPath(PoshPlan plan, LapPath path)
path
- Path that will be used as source of info.
public LapPath toPath()
LapPath
from the chain. Since not every LapPath
can be represented by the chain (e.g. LapType.COMPETENCE_ELEMENT
),
it is not 1-on-1 mapping. Resulting LapPath
always starts with
/P:0 and ends with type of referenced node of last link. If there is not
referenced node at last link (e.g. Sense
or TriggeredAction
),
the last link of path is LapType
of IChainLink.getReference()
.
If chain is empty, return LapPath.DRIVE_COLLECTION_PATH
.
public void register()
ILapChainListener
unless it is registered.
public void unregister()
public <REFERENCED_NODE extends PoshElement & IParametrizedElement> LapChain derive(TriggeredAction action, REFERENCED_NODE referencedNode)
action
- action referencing the AP. Basis of the link.actionPattern
- referenced AP.
public <REFERENCE extends PoshElement & IReferenceElement> LapChain derive(REFERENCE reference)
reference
- Reference to action or sense in work executor
public LapChain subchain(int beginIndex, int endIndex)
beginIndex
- Begin index of subchain, inclusiveendIndex
- End index of subchain, exclusive
public int size()
public String toString()
toString
in class Object
public VariableContext createContext()
VariableContext
for current chain.public void childElementAdded(PoshElement parent, PoshElement child)
PoshElementListener
childElementAdded
in interface PoshElementListener
parent
- parent that has a new childchild
- Child that has been added.public void childElementMoved(PoshElement parent, PoshElement child, int oldIndex, int newIndex)
PoshElementListener
childElementMoved
in interface PoshElementListener
parent
- Parent element of child.child
- child that has been moved.oldIndex
- Index of the child before move.newIndex
- Absolute position of the moved child with its own
type. E.g. DriveCollection
has two types of children, Sense
s
and DriveElement
. First sense has absolute index 0 and first
drive has absolute index 0.public void childElementRemoved(PoshElement parent, PoshElement child, int removedChildPosition)
PoshElementListener
childElementRemoved
in interface PoshElementListener
parent
- parent element of childchild
- child element that has been removedremovedChildPosition
- What was position of removed child among
childrenpublic void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public boolean addChainListener(ILapChainListener listener)
public boolean removeChainListener(ILapChainListener listener)
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |