Free cookie consent management tool by TermsFeed Policy Generator

source: branches/SimulationCore/HeuristicLab.SimulationCore.Dsl/Dsl/GeneratedCode/DomainModel.cs @ 11142

Last change on this file since 11142 was 10525, checked in by abeham, 11 years ago

#1610: added visual model

File size: 20.1 KB
Line 
1//------------------------------------------------------------------------------
2// <auto-generated>
3//     This code was generated by a tool.
4//
5//     Changes to this file may cause incorrect behavior and will be lost if
6//     the code is regenerated.
7// </auto-generated>
8//------------------------------------------------------------------------------
9
10using DslModeling = global::Microsoft.VisualStudio.Modeling;
11using DslDesign = global::Microsoft.VisualStudio.Modeling.Design;
12using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;
13namespace HeuristicLab.SimulationCore
14{
15  /// <summary>
16  /// DomainModel HLSimDomainModel
17  /// Description for HeuristicLab.SimulationCore.HLSim
18  /// </summary>
19  [DslDesign::DisplayNameResource("HeuristicLab.SimulationCore.HLSimDomainModel.DisplayName", typeof(global::HeuristicLab.SimulationCore.HLSimDomainModel), "HeuristicLab.SimulationCore.GeneratedCode.DomainModelResx")]
20  [DslDesign::DescriptionResource("HeuristicLab.SimulationCore.HLSimDomainModel.Description", typeof(global::HeuristicLab.SimulationCore.HLSimDomainModel), "HeuristicLab.SimulationCore.GeneratedCode.DomainModelResx")]
21  [global::System.CLSCompliant(true)]
22  [DslModeling::DependsOnDomainModel(typeof(global::Microsoft.VisualStudio.Modeling.CoreDomainModel))]
23  [DslModeling::DependsOnDomainModel(typeof(global::Microsoft.VisualStudio.Modeling.Diagrams.CoreDesignSurfaceDomainModel))]
24  [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Generated code.")]
25  [DslModeling::DomainObjectId("e76b5f9b-81a1-45f0-ac20-8a25077fff36")]
26  public partial class HLSimDomainModel : DslModeling::DomainModel
27  {
28    #region Constructor, domain model Id
29 
30    /// <summary>
31    /// HLSimDomainModel domain model Id.
32    /// </summary>
33    public static readonly global::System.Guid DomainModelId = new global::System.Guid(0xe76b5f9b, 0x81a1, 0x45f0, 0xac, 0x20, 0x8a, 0x25, 0x07, 0x7f, 0xff, 0x36);
34 
35    /// <summary>
36    /// Constructor.
37    /// </summary>
38    /// <param name="store">Store containing the domain model.</param>
39    public HLSimDomainModel(DslModeling::Store store)
40      : base(store, DomainModelId)
41    {
42      // Call the partial method to allow any required serialization setup to be done.
43      this.InitializeSerialization(store);   
44    }
45   
46 
47    ///<Summary>
48    /// Defines a partial method that will be called from the constructor to
49    /// allow any necessary serialization setup to be done.
50    ///</Summary>
51    ///<remarks>
52    /// For a DSL created with the DSL Designer wizard, an implementation of this
53    /// method will be generated in the GeneratedCode\SerializationHelper.cs class.
54    ///</remarks>
55    partial void InitializeSerialization(DslModeling::Store store);
56 
57 
58    #endregion
59    #region Domain model reflection
60     
61    /// <summary>
62    /// Gets the list of generated domain model types (classes, rules, relationships).
63    /// </summary>
64    /// <returns>List of types.</returns>
65    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Generated code.")]
66    protected sealed override global::System.Type[] GetGeneratedDomainModelTypes()
67    {
68      return new global::System.Type[]
69      {
70        typeof(SimulationModel),
71        typeof(Activity),
72        typeof(Action),
73        typeof(SimulationModelHasActivities),
74        typeof(SimulationModelHasActions),
75        typeof(ActivityReferencesTriggers),
76        typeof(ActionReferencesListeners),
77        typeof(HLSimDiagram),
78        typeof(Trigger),
79        typeof(Listener),
80        typeof(ActivityShape),
81        typeof(ActionShape),
82        typeof(global::HeuristicLab.SimulationCore.FixUpDiagram),
83        typeof(global::HeuristicLab.SimulationCore.ConnectorRolePlayerChanged),
84      };
85    }
86    /// <summary>
87    /// Gets the list of generated domain properties.
88    /// </summary>
89    /// <returns>List of property data.</returns>
90    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Generated code.")]
91    protected sealed override DomainMemberInfo[] GetGeneratedDomainProperties()
92    {
93      return new DomainMemberInfo[]
94      {
95        new DomainMemberInfo(typeof(SimulationModel), "ModelType", SimulationModel.ModelTypeDomainPropertyId, typeof(SimulationModel.ModelTypePropertyHandler)),
96        new DomainMemberInfo(typeof(Activity), "Name", Activity.NameDomainPropertyId, typeof(Activity.NamePropertyHandler)),
97        new DomainMemberInfo(typeof(Action), "Name", Action.NameDomainPropertyId, typeof(Action.NamePropertyHandler)),
98      };
99    }
100    /// <summary>
101    /// Gets the list of generated domain roles.
102    /// </summary>
103    /// <returns>List of role data.</returns>
104    protected sealed override DomainRolePlayerInfo[] GetGeneratedDomainRoles()
105    {
106      return new DomainRolePlayerInfo[]
107      {
108        new DomainRolePlayerInfo(typeof(SimulationModelHasActivities), "SimulationModel", SimulationModelHasActivities.SimulationModelDomainRoleId),
109        new DomainRolePlayerInfo(typeof(SimulationModelHasActivities), "Activity", SimulationModelHasActivities.ActivityDomainRoleId),
110        new DomainRolePlayerInfo(typeof(SimulationModelHasActions), "SimulationModel", SimulationModelHasActions.SimulationModelDomainRoleId),
111        new DomainRolePlayerInfo(typeof(SimulationModelHasActions), "Action", SimulationModelHasActions.ActionDomainRoleId),
112        new DomainRolePlayerInfo(typeof(ActivityReferencesTriggers), "Activity", ActivityReferencesTriggers.ActivityDomainRoleId),
113        new DomainRolePlayerInfo(typeof(ActivityReferencesTriggers), "Action", ActivityReferencesTriggers.ActionDomainRoleId),
114        new DomainRolePlayerInfo(typeof(ActionReferencesListeners), "Action", ActionReferencesListeners.ActionDomainRoleId),
115        new DomainRolePlayerInfo(typeof(ActionReferencesListeners), "Activity", ActionReferencesListeners.ActivityDomainRoleId),
116      };
117    }
118    #endregion
119    #region Factory methods
120    private static global::System.Collections.Generic.Dictionary<global::System.Type, int> createElementMap;
121 
122    /// <summary>
123    /// Creates an element of specified type.
124    /// </summary>
125    /// <param name="partition">Partition where element is to be created.</param>
126    /// <param name="elementType">Element type which belongs to this domain model.</param>
127    /// <param name="propertyAssignments">New element property assignments.</param>
128    /// <returns>Created element.</returns>
129    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
130    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Generated code.")]
131    public sealed override DslModeling::ModelElement CreateElement(DslModeling::Partition partition, global::System.Type elementType, DslModeling::PropertyAssignment[] propertyAssignments)
132    {
133      if (elementType == null) throw new global::System.ArgumentNullException("elementType");
134 
135      if (createElementMap == null)
136      {
137        createElementMap = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(8);
138        createElementMap.Add(typeof(SimulationModel), 0);
139        createElementMap.Add(typeof(Activity), 1);
140        createElementMap.Add(typeof(Action), 2);
141        createElementMap.Add(typeof(HLSimDiagram), 3);
142        createElementMap.Add(typeof(Trigger), 4);
143        createElementMap.Add(typeof(Listener), 5);
144        createElementMap.Add(typeof(ActivityShape), 6);
145        createElementMap.Add(typeof(ActionShape), 7);
146      }
147      int index;
148      if (!createElementMap.TryGetValue(elementType, out index))
149      {
150        // construct exception error message   
151        string exceptionError = string.Format(
152                global::System.Globalization.CultureInfo.CurrentCulture,
153                global::HeuristicLab.SimulationCore.HLSimDomainModel.SingletonResourceManager.GetString("UnrecognizedElementType"),
154                elementType.Name);
155        throw new global::System.ArgumentException(exceptionError, "elementType");
156      }
157      switch (index)
158      {
159        case 0: return new SimulationModel(partition, propertyAssignments);
160        case 1: return new Activity(partition, propertyAssignments);
161        case 2: return new Action(partition, propertyAssignments);
162        case 3: return new HLSimDiagram(partition, propertyAssignments);
163        case 4: return new Trigger(partition, propertyAssignments);
164        case 5: return new Listener(partition, propertyAssignments);
165        case 6: return new ActivityShape(partition, propertyAssignments);
166        case 7: return new ActionShape(partition, propertyAssignments);
167        default: return null;
168      }
169    }
170 
171    private static global::System.Collections.Generic.Dictionary<global::System.Type, int> createElementLinkMap;
172 
173    /// <summary>
174    /// Creates an element link of specified type.
175    /// </summary>
176    /// <param name="partition">Partition where element is to be created.</param>
177    /// <param name="elementLinkType">Element link type which belongs to this domain model.</param>
178    /// <param name="roleAssignments">List of relationship role assignments for the new link.</param>
179    /// <param name="propertyAssignments">New element property assignments.</param>
180    /// <returns>Created element link.</returns>
181    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
182    public sealed override DslModeling::ElementLink CreateElementLink(DslModeling::Partition partition, global::System.Type elementLinkType, DslModeling::RoleAssignment[] roleAssignments, DslModeling::PropertyAssignment[] propertyAssignments)
183    {
184      if (elementLinkType == null) throw new global::System.ArgumentNullException("elementLinkType");
185      if (roleAssignments == null) throw new global::System.ArgumentNullException("roleAssignments");
186 
187      if (createElementLinkMap == null)
188      {
189        createElementLinkMap = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(4);
190        createElementLinkMap.Add(typeof(SimulationModelHasActivities), 0);
191        createElementLinkMap.Add(typeof(SimulationModelHasActions), 1);
192        createElementLinkMap.Add(typeof(ActivityReferencesTriggers), 2);
193        createElementLinkMap.Add(typeof(ActionReferencesListeners), 3);
194      }
195      int index;
196      if (!createElementLinkMap.TryGetValue(elementLinkType, out index))
197      {
198        // construct exception error message
199        string exceptionError = string.Format(
200                global::System.Globalization.CultureInfo.CurrentCulture,
201                global::HeuristicLab.SimulationCore.HLSimDomainModel.SingletonResourceManager.GetString("UnrecognizedElementLinkType"),
202                elementLinkType.Name);
203        throw new global::System.ArgumentException(exceptionError, "elementLinkType");
204     
205      }
206      switch (index)
207      {
208        case 0: return new SimulationModelHasActivities(partition, roleAssignments, propertyAssignments);
209        case 1: return new SimulationModelHasActions(partition, roleAssignments, propertyAssignments);
210        case 2: return new ActivityReferencesTriggers(partition, roleAssignments, propertyAssignments);
211        case 3: return new ActionReferencesListeners(partition, roleAssignments, propertyAssignments);
212        default: return null;
213      }
214    }
215    #endregion
216    #region Resource manager
217   
218    private static global::System.Resources.ResourceManager resourceManager;
219   
220    /// <summary>
221    /// The base name of this model's resources.
222    /// </summary>
223    public const string ResourceBaseName = "HeuristicLab.SimulationCore.GeneratedCode.DomainModelResx";
224   
225    /// <summary>
226    /// Gets the DomainModel's ResourceManager. If the ResourceManager does not already exist, then it is created.
227    /// </summary>
228    public override global::System.Resources.ResourceManager ResourceManager
229    {
230      [global::System.Diagnostics.DebuggerStepThrough]
231      get
232      {
233        return HLSimDomainModel.SingletonResourceManager;
234      }
235    }
236 
237    /// <summary>
238    /// Gets the Singleton ResourceManager for this domain model.
239    /// </summary>
240    public static global::System.Resources.ResourceManager SingletonResourceManager
241    {
242      [global::System.Diagnostics.DebuggerStepThrough]
243      get
244      {
245        if (HLSimDomainModel.resourceManager == null)
246        {
247          HLSimDomainModel.resourceManager = new global::System.Resources.ResourceManager(ResourceBaseName, typeof(HLSimDomainModel).Assembly);
248        }
249        return HLSimDomainModel.resourceManager;
250      }
251    }
252    #endregion
253    #region Copy/Remove closures
254    /// <summary>
255    /// CopyClosure cache
256    /// </summary>
257    private static DslModeling::IElementVisitorFilter copyClosure;
258    /// <summary>
259    /// DeleteClosure cache
260    /// </summary>
261    private static DslModeling::IElementVisitorFilter removeClosure;
262    /// <summary>
263    /// Returns an IElementVisitorFilter that corresponds to the ClosureType.
264    /// </summary>
265    /// <param name="type">closure type</param>
266    /// <param name="rootElements">collection of root elements</param>
267    /// <returns>IElementVisitorFilter or null</returns>
268    public override DslModeling::IElementVisitorFilter GetClosureFilter(DslModeling::ClosureType type, global::System.Collections.Generic.ICollection<DslModeling::ModelElement> rootElements)
269    {
270      switch (type)
271      {
272        case DslModeling::ClosureType.CopyClosure:
273          return HLSimDomainModel.CopyClosure;
274        case DslModeling::ClosureType.DeleteClosure:
275          return HLSimDomainModel.DeleteClosure;
276      }
277      return base.GetClosureFilter(type, rootElements);
278    }
279    /// <summary>
280    /// CopyClosure cache
281    /// </summary>
282    private static DslModeling::IElementVisitorFilter CopyClosure
283    {
284      get
285      {
286        // Incorporate all of the closures from the models we extend
287        if (HLSimDomainModel.copyClosure == null)
288        {
289          DslModeling::ChainingElementVisitorFilter copyFilter = new DslModeling::ChainingElementVisitorFilter();
290          copyFilter.AddFilter(new HLSimCopyClosure());
291          copyFilter.AddFilter(new DslModeling::CoreCopyClosure());
292          copyFilter.AddFilter(new DslDiagrams::CoreDesignSurfaceCopyClosure());
293         
294          HLSimDomainModel.copyClosure = copyFilter;
295        }
296        return HLSimDomainModel.copyClosure;
297      }
298    }
299    /// <summary>
300    /// DeleteClosure cache
301    /// </summary>
302    private static DslModeling::IElementVisitorFilter DeleteClosure
303    {
304      get
305      {
306        // Incorporate all of the closures from the models we extend
307        if (HLSimDomainModel.removeClosure == null)
308        {
309          DslModeling::ChainingElementVisitorFilter removeFilter = new DslModeling::ChainingElementVisitorFilter();
310          removeFilter.AddFilter(new HLSimDeleteClosure());
311          removeFilter.AddFilter(new DslModeling::CoreDeleteClosure());
312          removeFilter.AddFilter(new DslDiagrams::CoreDesignSurfaceDeleteClosure());
313   
314          HLSimDomainModel.removeClosure = removeFilter;
315        }
316        return HLSimDomainModel.removeClosure;
317      }
318    }
319    #endregion
320    #region Diagram rule helpers
321    /// <summary>
322    /// Enables rules in this domain model related to diagram fixup for the given store.
323    /// If diagram data will be loaded into the store, this method should be called first to ensure
324    /// that the diagram behaves properly.
325    /// </summary>
326    public static void EnableDiagramRules(DslModeling::Store store)
327    {
328      if(store == null) throw new global::System.ArgumentNullException("store");
329     
330      DslModeling::RuleManager ruleManager = store.RuleManager;
331      ruleManager.EnableRule(typeof(global::HeuristicLab.SimulationCore.FixUpDiagram));
332      ruleManager.EnableRule(typeof(global::HeuristicLab.SimulationCore.ConnectorRolePlayerChanged));
333    }
334   
335    /// <summary>
336    /// Disables rules in this domain model related to diagram fixup for the given store.
337    /// </summary>
338    public static void DisableDiagramRules(DslModeling::Store store)
339    {
340      if(store == null) throw new global::System.ArgumentNullException("store");
341     
342      DslModeling::RuleManager ruleManager = store.RuleManager;
343      ruleManager.DisableRule(typeof(global::HeuristicLab.SimulationCore.FixUpDiagram));
344      ruleManager.DisableRule(typeof(global::HeuristicLab.SimulationCore.ConnectorRolePlayerChanged));
345    }
346    #endregion
347  }
348   
349  #region Copy/Remove closure classes
350  /// <summary>
351  /// Remove closure visitor filter
352  /// </summary>
353  [global::System.CLSCompliant(true)]
354  public partial class HLSimDeleteClosure : HLSimDeleteClosureBase, DslModeling::IElementVisitorFilter
355  {
356    /// <summary>
357    /// Constructor
358    /// </summary>
359    public HLSimDeleteClosure() : base()
360    {
361    }
362  }
363 
364  /// <summary>
365  /// Base class for remove closure visitor filter
366  /// </summary>
367  [global::System.CLSCompliant(true)]
368  public partial class HLSimDeleteClosureBase : DslModeling::IElementVisitorFilter
369  {
370    /// <summary>
371    /// DomainRoles
372    /// </summary>
373    private global::System.Collections.Specialized.HybridDictionary domainRoles;
374    /// <summary>
375    /// Constructor
376    /// </summary>
377    public HLSimDeleteClosureBase()
378    {
379      #region Initialize DomainData Table
380      DomainRoles.Add(global::HeuristicLab.SimulationCore.SimulationModelHasActivities.ActivityDomainRoleId, true);
381      DomainRoles.Add(global::HeuristicLab.SimulationCore.SimulationModelHasActions.ActionDomainRoleId, true);
382      #endregion
383    }
384    /// <summary>
385    /// Called to ask the filter if a particular relationship from a source element should be included in the traversal
386    /// </summary>
387    /// <param name="walker">ElementWalker that is traversing the model</param>
388    /// <param name="sourceElement">Model Element playing the source role</param>
389    /// <param name="sourceRoleInfo">DomainRoleInfo of the role that the source element is playing in the relationship</param>
390    /// <param name="domainRelationshipInfo">DomainRelationshipInfo for the ElementLink in question</param>
391    /// <param name="targetRelationship">Relationship in question</param>
392    /// <returns>Yes if the relationship should be traversed</returns>
393    public virtual DslModeling::VisitorFilterResult ShouldVisitRelationship(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::DomainRoleInfo sourceRoleInfo, DslModeling::DomainRelationshipInfo domainRelationshipInfo, DslModeling::ElementLink targetRelationship)
394    {
395      return DslModeling::VisitorFilterResult.Yes;
396    }
397    /// <summary>
398    /// Called to ask the filter if a particular role player should be Visited during traversal
399    /// </summary>
400    /// <param name="walker">ElementWalker that is traversing the model</param>
401    /// <param name="sourceElement">Model Element playing the source role</param>
402    /// <param name="elementLink">Element Link that forms the relationship to the role player in question</param>
403    /// <param name="targetDomainRole">DomainRoleInfo of the target role</param>
404    /// <param name="targetRolePlayer">Model Element that plays the target role in the relationship</param>
405    /// <returns></returns>
406    public virtual DslModeling::VisitorFilterResult ShouldVisitRolePlayer(DslModeling::ElementWalker walker, DslModeling::ModelElement sourceElement, DslModeling::ElementLink elementLink, DslModeling::DomainRoleInfo targetDomainRole, DslModeling::ModelElement targetRolePlayer)
407    {
408      if (targetDomainRole == null) throw new global::System.ArgumentNullException("targetDomainRole");
409      return this.DomainRoles.Contains(targetDomainRole.Id) ? DslModeling::VisitorFilterResult.Yes : DslModeling::VisitorFilterResult.DoNotCare;
410    }
411    /// <summary>
412    /// DomainRoles
413    /// </summary>
414    private global::System.Collections.Specialized.HybridDictionary DomainRoles
415    {
416      get
417      {
418        if (this.domainRoles == null)
419        {
420          this.domainRoles = new global::System.Collections.Specialized.HybridDictionary();
421        }
422        return this.domainRoles;
423      }
424    }
425 
426  }
427  /// <summary>
428  /// Copy closure visitor filter
429  /// </summary>
430  [global::System.CLSCompliant(true)]
431  public partial class HLSimCopyClosure : HLSimCopyClosureBase, DslModeling::IElementVisitorFilter
432  {
433    /// <summary>
434    /// Constructor
435    /// </summary>
436    public HLSimCopyClosure() : base()
437    {
438    }
439  }
440  /// <summary>
441  /// Base class for copy closure visitor filter
442  /// </summary>
443  [global::System.CLSCompliant(true)]
444  public partial class HLSimCopyClosureBase : DslModeling::CopyClosureFilter, DslModeling::IElementVisitorFilter
445  {
446    /// <summary>
447    /// Constructor
448    /// </summary>
449    public HLSimCopyClosureBase():base()
450    {
451    }
452  }
453  #endregion
454   
455}
456
Note: See TracBrowser for help on using the repository browser.