templates.model.v3
Class Link

java.lang.Object
  extended by templates.model.v3.Link
All Implemented Interfaces:
ides.api.core.Annotable, ides.api.plugin.model.DESElement, TemplateLink

public class Link
extends java.lang.Object
implements TemplateLink

Implementation of TemplateLink.

Author:
Lenko Grigorov

Field Summary
protected  java.util.Hashtable<java.lang.String,java.lang.Object> annotations
          A map with the annotations of this element.
protected  long id
          The id of the link.
protected  TemplateComponent left
          The first TemplateComponent linked by the link.
protected  java.lang.String leftEvent
          The event (of the first TemplateComponent) which is linked by the link.
protected  TemplateComponent right
          The second TemplateComponent linked by the link.
protected  java.lang.String rightEvent
          The event (of the second TemplateComponent) which is linked by the link.
 
Fields inherited from interface ides.api.core.Annotable
COMPOSED_OF, COMPOSED_OF_NAMES, CONTROL_MAP, FILE, LAYOUT, TEXT_ANNOTATION
 
Constructor Summary
Link(long id, TemplateComponent left, TemplateComponent right)
          Construct a new link with the given parameters.
 
Method Summary
 boolean existsLeftEvent()
          Checks if the FSAModel of the first TemplateComponent contains the linked event.
 boolean existsRightEvent()
          Checks if the FSAModel of the second TemplateComponent contains the linked event.
 java.lang.Object getAnnotation(java.lang.String key)
           
 TemplateComponent getChannel()
          Retrieve the channel linked by the link, if any.
 TemplateComponent[] getComponents()
          Retrieve the two TemplateComponents linked by the link.
 long getId()
           
 TemplateComponent getLeftComponent()
          Retrieve the first TemplateComponent linked by the link.
 ides.api.plugin.model.DESEvent getLeftEvent()
          Retrieves the linked DESEvent from the first TemplateComponent.
 java.lang.String getLeftEventName()
          Retrieve the name of the linked event from the first TemplateComponent.
 TemplateComponent getModule()
          Retrieve the module linked by the link, if any.
 TemplateComponent getRightComponent()
          Retrieve the second TemplateComponent linked by the link.
 ides.api.plugin.model.DESEvent getRightEvent()
          Retrieves the linked DESEvent from the second TemplateComponent.
 java.lang.String getRightEventName()
          Retrieve the name of the linked event from the second TemplateComponent.
 boolean hasAnnotation(java.lang.String key)
           
 void removeAnnotation(java.lang.String key)
           
 void setAnnotation(java.lang.String key, java.lang.Object annotation)
           
 void setId(long id)
           
 void setLeftEventName(java.lang.String name)
          Set the name of the linked event from the first TemplateComponent .
 void setRightEventName(java.lang.String name)
          Set the name of the linked event from the second TemplateComponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotations

protected java.util.Hashtable<java.lang.String,java.lang.Object> annotations
A map with the annotations of this element.


id

protected long id
The id of the link.


left

protected TemplateComponent left
The first TemplateComponent linked by the link.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.


right

protected TemplateComponent right
The second TemplateComponent linked by the link.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.


leftEvent

protected java.lang.String leftEvent
The event (of the first TemplateComponent) which is linked by the link.

A link is symmetric. "Left" and "right" are used only to enable addressing the two events separately.


rightEvent

protected java.lang.String rightEvent
The event (of the second TemplateComponent) which is linked by the link.

A link is symmetric. "Left" and "right" are used only to enable addressing the two events separately.

Constructor Detail

Link

public Link(long id,
            TemplateComponent left,
            TemplateComponent right)
Construct a new link with the given parameters.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Parameters:
id - the id of the link
left - the first TemplateComponent linked by the link
right - the second TemplateComponent linked by the link
Method Detail

getAnnotation

public java.lang.Object getAnnotation(java.lang.String key)
Specified by:
getAnnotation in interface ides.api.core.Annotable

hasAnnotation

public boolean hasAnnotation(java.lang.String key)
Specified by:
hasAnnotation in interface ides.api.core.Annotable

removeAnnotation

public void removeAnnotation(java.lang.String key)
Specified by:
removeAnnotation in interface ides.api.core.Annotable

setAnnotation

public void setAnnotation(java.lang.String key,
                          java.lang.Object annotation)
Specified by:
setAnnotation in interface ides.api.core.Annotable

getId

public long getId()
Specified by:
getId in interface ides.api.plugin.model.DESElement

setId

public void setId(long id)
Specified by:
setId in interface ides.api.plugin.model.DESElement

getChannel

public TemplateComponent getChannel()
Description copied from interface: TemplateLink
Retrieve the channel linked by the link, if any.

Specified by:
getChannel in interface TemplateLink
Returns:
the channel linked by the link (if both TemplateComponents are channels, returns arbitrarily one of them); null if no channel is linked

getRightEvent

public ides.api.plugin.model.DESEvent getRightEvent()
Description copied from interface: TemplateLink
Retrieves the linked DESEvent from the second TemplateComponent.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
getRightEvent in interface TemplateLink
Returns:
the linked DESEvent from the FSAModel of the second TemplateComponent, if the TemplateComponent has an assigned FSAModel and if this FSAModel contains the linked event; null otherwise

getRightEventName

public java.lang.String getRightEventName()
Description copied from interface: TemplateLink
Retrieve the name of the linked event from the second TemplateComponent.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
getRightEventName in interface TemplateLink
Returns:
the name of the linked event from the second TemplateComponent

getModule

public TemplateComponent getModule()
Description copied from interface: TemplateLink
Retrieve the module linked by the link, if any.

Specified by:
getModule in interface TemplateLink
Returns:
the module linked by the link (if both TemplateComponents are modules, returns arbitrarily one of them); null if no module is linked

getLeftEvent

public ides.api.plugin.model.DESEvent getLeftEvent()
Description copied from interface: TemplateLink
Retrieves the linked DESEvent from the first TemplateComponent.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
getLeftEvent in interface TemplateLink
Returns:
the linked DESEvent from the FSAModel of the first TemplateComponent, if the TemplateComponent has an assigned FSAModel and if this FSAModel contains the linked event; null otherwise

getLeftEventName

public java.lang.String getLeftEventName()
Description copied from interface: TemplateLink
Retrieve the name of the linked event from the first TemplateComponent.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
getLeftEventName in interface TemplateLink
Returns:
the name of the linked event from the first TemplateComponent

existsRightEvent

public boolean existsRightEvent()
Description copied from interface: TemplateLink
Checks if the FSAModel of the second TemplateComponent contains the linked event.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
existsRightEvent in interface TemplateLink
Returns:
true if the second linked TemplateComponent has an assigned FSAModel and if this FSAModel contains the linked event; false otherwise

existsLeftEvent

public boolean existsLeftEvent()
Description copied from interface: TemplateLink
Checks if the FSAModel of the first TemplateComponent contains the linked event.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
existsLeftEvent in interface TemplateLink
Returns:
true if the first linked TemplateComponent has an assigned FSAModel and if this FSAModel contains the linked event; false otherwise

setRightEventName

public void setRightEventName(java.lang.String name)
Description copied from interface: TemplateLink
Set the name of the linked event from the second TemplateComponent.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
setRightEventName in interface TemplateLink
Parameters:
name - the name of the linked event from the second TemplateComponent

setLeftEventName

public void setLeftEventName(java.lang.String name)
Description copied from interface: TemplateLink
Set the name of the linked event from the first TemplateComponent .

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
setLeftEventName in interface TemplateLink
Parameters:
name - the name of the linked event from the first TemplateComponent

getComponents

public TemplateComponent[] getComponents()
Description copied from interface: TemplateLink
Retrieve the two TemplateComponents linked by the link.

Specified by:
getComponents in interface TemplateLink
Returns:
the two TemplateComponents linked by the link

getLeftComponent

public TemplateComponent getLeftComponent()
Description copied from interface: TemplateLink
Retrieve the first TemplateComponent linked by the link.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
getLeftComponent in interface TemplateLink
Returns:
the first TemplateComponent linked by the link

getRightComponent

public TemplateComponent getRightComponent()
Description copied from interface: TemplateLink
Retrieve the second TemplateComponent linked by the link.

A link is symmetric. "Left" and "right" are used only to enable addressing the two TemplateComponents separately.

Specified by:
getRightComponent in interface TemplateLink
Returns:
the second TemplateComponent linked by the link