templates.model
Interface TemplateModel

All Superinterfaces:
ides.api.core.Annotable, ides.api.plugin.model.DESModel, ides.api.plugin.model.DESModelPublisher, ides.api.plugin.model.ParentModel, TemplateModelPublisher
All Known Implementing Classes:
TemplateDesign

public interface TemplateModel
extends ides.api.plugin.model.ParentModel, TemplateModelPublisher

Describes a template design (which includes modules, channels and links).

Author:
Lenko Grigorov

Field Summary
static java.lang.String FSA_NAME_PREFIX
          Prefix for the names of the FSA models contained in TemplateComponents.
 
Fields inherited from interface ides.api.core.Annotable
COMPOSED_OF, COMPOSED_OF_NAMES, CONTROL_MAP, FILE, LAYOUT, TEXT_ANNOTATION
 
Method Summary
 void addComponent(TemplateComponent component)
          Add a TemplateComponent to the model.
 void addLink(TemplateLink link)
          Add a TemplateLink to the model.
 TemplateComponent assembleComponent()
          Create a new TemplateComponent which can be then added to the model without breaking the model consistency (e.g., it has a unique id).
 TemplateLink assembleLink(long leftId, long rightId)
          Create a new TemplateLink which can be then added to the model without breaking the model consistency (e.g., it has a unique id).
 void assignFSA(long componentId, ides.api.model.fsa.FSAModel fsa)
          Assign an FSAModel to the TemplateComponent with the given id.
 TemplateComponent createComponent()
          Create a new TemplateComponent and add it to the model.
 TemplateLink createLink(long leftId, long rightId)
          Create a new TemplateLink and add it to the model.
 boolean existsLink(long leftId, long rightId)
          Check if there is a TemplateLink between the TemplateComponents with the given ids.
 java.util.Collection<TemplateLink> getAdjacentLinks(long componentId)
          Retrieve all the TemplateLinks connected to the TemplateComponent with the given id.
 java.util.Collection<TemplateComponent> getChannels()
          Retrieve all the TemplateComponents in the model which are channels.
 TemplateComponent getComponent(long id)
          Return the TemplateComponent with the given id.
 int getComponentCount()
          Return the number of TemplateComponents in the model.
 java.util.Collection<TemplateComponent> getComponents()
          Retrieve all the TemplateComponents in the model.
 java.util.Collection<TemplateComponent> getCover(long channelId)
          Retrieve all the modules linked to the channel with the given id.
 TemplateLink getLink(long id)
          Return the TemplateLink with the given id.
 java.util.Collection<TemplateLink> getLinks()
          Retrieve all the TemplateLinks in the model.
 java.util.Collection<TemplateLink> getLinks(long leftId, long rightId)
          Retrieve the TemplateLinks between the TemplateComponents with the given ids.
 java.util.Collection<TemplateComponent> getModules()
          Retrieve all the TemplateComponents in the model which are modules.
 void removeComponent(long id)
          Remove the TemplateComponent with the given id.
 void removeFSA(long componentId)
          Remove the FSAModel assigned to the TemplateComponent with the given id.
 void removeLink(long id)
          Remove the TemplateLink with the given id.
 void setComponentType(long componentId, int type)
          Set the type (module or channel) of the TemplateComponent with the given id.
 
Methods inherited from interface ides.api.plugin.model.ParentModel
getChildModel, getChildModelId
 
Methods inherited from interface ides.api.plugin.model.DESModel
getEventSet, getModelType, getName, getParentModel, metadataChanged, modelSaved, needsSave, setName, setParentModel
 
Methods inherited from interface ides.api.core.Annotable
getAnnotation, hasAnnotation, removeAnnotation, setAnnotation
 
Methods inherited from interface ides.api.plugin.model.DESModelPublisher
addSubscriber, getDESModelSubscribers, removeSubscriber
 
Methods inherited from interface templates.model.TemplateModelPublisher
addSubscriber, fireTemplateModelStructureChanged, getTemplateModelSubscribers, removeSubscriber
 

Field Detail

FSA_NAME_PREFIX

static final java.lang.String FSA_NAME_PREFIX
Prefix for the names of the FSA models contained in TemplateComponents.

See Also:
Constant Field Values
Method Detail

getComponents

java.util.Collection<TemplateComponent> getComponents()
Retrieve all the TemplateComponents in the model.

Returns:
a collection of all the TemplateComponents in the model

getModules

java.util.Collection<TemplateComponent> getModules()
Retrieve all the TemplateComponents in the model which are modules.

Returns:
a collection of all the TemplateComponents in the model which are modules

getChannels

java.util.Collection<TemplateComponent> getChannels()
Retrieve all the TemplateComponents in the model which are channels.

Returns:
a collection of all the TemplateComponents in the model which are channels

getComponentCount

int getComponentCount()
Return the number of TemplateComponents in the model.

Returns:
the number of TemplateComponents in the model

getLinks

java.util.Collection<TemplateLink> getLinks()
Retrieve all the TemplateLinks in the model.

Returns:
a collection of all the TemplateLinks in the model

getComponent

TemplateComponent getComponent(long id)
Return the TemplateComponent with the given id.

Parameters:
id - the id of the TemplateComponent
Returns:
the TemplateComponent with the given id; null if there is no TemplateComponent with such an id

getLink

TemplateLink getLink(long id)
Return the TemplateLink with the given id.

Parameters:
id - the id of the TemplateLink
Returns:
the TemplateLink with the given id; null if there is no TemplateLink with such an id

assembleComponent

TemplateComponent assembleComponent()
Create a new TemplateComponent which can be then added to the model without breaking the model consistency (e.g., it has a unique id).

Returns:
a new TemplateComponent which can be then added to the model without breaking the model consistency

createComponent

TemplateComponent createComponent()
Create a new TemplateComponent and add it to the model.

Returns:
the new TemplateComponent which was added to the model

addComponent

void addComponent(TemplateComponent component)
Add a TemplateComponent to the model.

Parameters:
component - the TemplateComponent to be added
Throws:
InconsistentModificationException - if the model already contain a TemplateComponent with the same id

assembleLink

TemplateLink assembleLink(long leftId,
                          long rightId)
Create a new TemplateLink which can be then added to the model without breaking the model consistency (e.g., it has a unique id).

Parameters:
leftId - the id of the first TemplateComponent to be linked
rightId - the id of the second TemplateComponent to be linked
Returns:
a new TemplateLink which can be then added to the model without breaking the model consistency
Throws:
InconsistentModificationException - if the model does not contain TemplateComponents with the given ids

createLink

TemplateLink createLink(long leftId,
                        long rightId)
Create a new TemplateLink and add it to the model.

Parameters:
leftId - the id of the first TemplateComponent to be linked
rightId - the id of the second TemplateComponent to be linked
Returns:
the new TemplateLink which was added to the model
Throws:
InconsistentModificationException - if the model does not contain TemplateComponents with the given ids

addLink

void addLink(TemplateLink link)
Add a TemplateLink to the model.

Parameters:
link - the TemplateLink to be added
Throws:
InconsistentModificationException - if the model already contain a TemplateLink with the same id or if the model does not contain the TemplateComponents linked by the TemplateLink

removeComponent

void removeComponent(long id)
Remove the TemplateComponent with the given id.

Parameters:
id - the id of the TemplateComponent to be removed

removeLink

void removeLink(long id)
Remove the TemplateLink with the given id.

Parameters:
id - the id of the TemplateLink to be removed

getAdjacentLinks

java.util.Collection<TemplateLink> getAdjacentLinks(long componentId)
Retrieve all the TemplateLinks connected to the TemplateComponent with the given id.

Parameters:
componentId - the id of the TemplateComponent
Returns:
all the TemplateLinks connected to the TemplateComponent with the given id

getCover

java.util.Collection<TemplateComponent> getCover(long channelId)
Retrieve all the modules linked to the channel with the given id.

Parameters:
channelId - the id of the channel TemplateComponent
Returns:
all the modules linked to the channel with the given id; an empty collection if the TemplateComponent with the given id is not a channel

existsLink

boolean existsLink(long leftId,
                   long rightId)
Check if there is a TemplateLink between the TemplateComponents with the given ids.

Parameters:
leftId - the id of the first TemplateComponent
rightId - the id of the second TemplateComponent
Returns:
true if there is a TemplateLink between the TemplateComponents with the given ids; false otherwise

getLinks

java.util.Collection<TemplateLink> getLinks(long leftId,
                                            long rightId)
Retrieve the TemplateLinks between the TemplateComponents with the given ids.

Parameters:
leftId - the id of the first TemplateComponent
rightId - the id of the second TemplateComponent
Returns:
all the TemplateLinks between the TemplateComponents with the given ids

assignFSA

void assignFSA(long componentId,
               ides.api.model.fsa.FSAModel fsa)
Assign an FSAModel to the TemplateComponent with the given id.

Parameters:
componentId - the id of the TemplateComponent
fsa - the FSAModel to be assigned
Throws:
InconsistentModificationException - if the model already contains a TemplateComponent with the given FSAModel

removeFSA

void removeFSA(long componentId)
Remove the FSAModel assigned to the TemplateComponent with the given id.

Parameters:
componentId - the id of the TemplateComponent whose FSAModel is to be removed

setComponentType

void setComponentType(long componentId,
                      int type)
Set the type (module or channel) of the TemplateComponent with the given id.

Parameters:
componentId - the id of the TemplateComponent whose type is to be changed
type - the type to be set (TemplateComponent.TYPE_MODULE or TemplateComponent.TYPE_CHANNEL)