Converted all CRLF to LF.
[indepmod/mmn.git] / IndependentModeler / src / cz / cvut / promod / services / pluginLoaderService / utils / NotationSpecificPlugins.java
blobb17725f29ae8c1b985c31d161cf84fc260e9402c
1 package cz.cvut.promod.services.pluginLoaderService.utils;
3 import cz.cvut.promod.plugin.notationSpecificPlugIn.notation.Notation;
4 import cz.cvut.promod.plugin.notationSpecificPlugIn.module.Module;
5 import cz.cvut.promod.plugin.notationSpecificPlugIn.DockableFrameData;
7 import java.util.*;
9 /**
10 * ProMod, master thesis project
11 * User: Petr Zverina, petr.zverina@gmail.com
12 * Date: 22:34:23, 12.10.2009
15 /**
16 * NotationSpecificPlugins is holder for notation and it's related modules.
18 * It is not possible to change the list holding modules.
20 public final class NotationSpecificPlugins {
22 private final Notation notation;
24 private final List<Module> modules;
27 /**
28 * Constructs new NotationSpecificPlugins for the specified notation.
30 * @param notation is the notation
31 * @param modules unchangeable list of plugins
33 public NotationSpecificPlugins(final Notation notation, final List<Module> modules){
34 this.notation = notation;
36 this.modules = modules;
39 /**
40 * Returns notation object.
42 * @return notation object
44 public Notation getNotation() {
45 return notation;
48 /**
49 * Returns list of notation in the same order as they were specified in plugin configuration file and have been
50 * instantiated.
52 * @return list of modules
54 public List<Module> getModules() {
55 return modules;
58 /**
59 * Returns already stored module according to it's identifier.
61 * @param moduleIdentifier is the identifier of required module
62 * @return module, if any with given identifier is found, null otherwise
64 public Module getModule(final String moduleIdentifier){
65 for(final Module module : modules){
66 if(module.getIdentifier().equals(moduleIdentifier)){
67 return module;
71 return null;
74 /**
75 * Checks whether a module with given identifier has been already loaded and stored.
77 * @param moduleIdentifier is the required module's identifier
78 * @return true, if such a module has already been loaded and stored, false otherwise
80 public boolean existModule(final String moduleIdentifier){
81 return getModule(moduleIdentifier) != null;
85 /**
86 * Returns dockable frame data defined by the notation and all it's related modules.
88 * @return dockable frame data defined by the notation and all it's related modules
90 public Collection<DockableFrameData> getDockableFramesData(){
91 final Collection<DockableFrameData> dockableFrameData = new HashSet<DockableFrameData>();
93 final Set<DockableFrameData> notationFrameData = getNotation().getDockableFrames();
95 if(notationFrameData != null){
96 dockableFrameData.addAll(notationFrameData);
99 for(final Module module : getModules()){
100 final Set<DockableFrameData> moduleFrameData = module.getDockableFrames();
102 if(moduleFrameData != null){
103 dockableFrameData.addAll(module.getDockableFrames());
107 return dockableFrameData;