//------------------------------------------------------------------------------
// <auto-generated>
//     Dieser Code wurde von einem Tool generiert.
//     Laufzeitversion:4.0.30319.42000
//
//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
//     der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------

using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using TTC2017.SmartGrids.CIM;
using TTC2017.SmartGrids.CIM.IEC61968.Common;
using TTC2017.SmartGrids.CIM.IEC61970.Core;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfOperations;
using TTC2017.SmartGrids.CIM.IEC61970.Informative.InfWork;
using TTC2017.SmartGrids.CIM.IEC61970.Meas;

namespace TTC2017.SmartGrids.CIM.IEC61970.Informative.InfGMLSupport
{
    
    
    /// <summary>
    /// The default implementation of the GmlDiagramObject class
    /// </summary>
    [XmlNamespaceAttribute("http://iec.ch/TC57/2009/CIM-schema-cim14#InfGMLSupport")]
    [XmlNamespacePrefixAttribute("cimInfGMLSupport")]
    [ModelRepresentationClassAttribute("http://iec.ch/TC57/2009/CIM-schema-cim14#//IEC61970/Informative/InfGMLSupport/Gml" +
        "DiagramObject")]
    [DebuggerDisplayAttribute("GmlDiagramObject {UUID}")]
    public partial class GmlDiagramObject : IdentifiedObject, IGmlDiagramObject, IModelElement
    {
        
        private static Lazy<ITypedElement> _gmlRasterSymbolsReference = new Lazy<ITypedElement>(RetrieveGmlRasterSymbolsReference);
        
        /// <summary>
        /// The backing field for the GmlRasterSymbols property
        /// </summary>
        private GmlDiagramObjectGmlRasterSymbolsCollection _gmlRasterSymbols;
        
        private static Lazy<ITypedElement> _diagramsReference = new Lazy<ITypedElement>(RetrieveDiagramsReference);
        
        /// <summary>
        /// The backing field for the Diagrams property
        /// </summary>
        private GmlDiagramObjectDiagramsCollection _diagrams;
        
        private static Lazy<ITypedElement> _gmlPointSymbolsReference = new Lazy<ITypedElement>(RetrieveGmlPointSymbolsReference);
        
        /// <summary>
        /// The backing field for the GmlPointSymbols property
        /// </summary>
        private GmlDiagramObjectGmlPointSymbolsCollection _gmlPointSymbols;
        
        private static Lazy<ITypedElement> _gmlPolygonSymbolsReference = new Lazy<ITypedElement>(RetrieveGmlPolygonSymbolsReference);
        
        /// <summary>
        /// The backing field for the GmlPolygonSymbols property
        /// </summary>
        private GmlDiagramObjectGmlPolygonSymbolsCollection _gmlPolygonSymbols;
        
        private static Lazy<ITypedElement> _gmlLineSymbolsReference = new Lazy<ITypedElement>(RetrieveGmlLineSymbolsReference);
        
        /// <summary>
        /// The backing field for the GmlLineSymbols property
        /// </summary>
        private GmlDiagramObjectGmlLineSymbolsCollection _gmlLineSymbols;
        
        private static Lazy<ITypedElement> _gmlTextSymbolsReference = new Lazy<ITypedElement>(RetrieveGmlTextSymbolsReference);
        
        /// <summary>
        /// The backing field for the GmlTextSymbols property
        /// </summary>
        private GmlDiagramObjectGmlTextSymbolsCollection _gmlTextSymbols;
        
        private static Lazy<ITypedElement> _coordinateSystemsReference = new Lazy<ITypedElement>(RetrieveCoordinateSystemsReference);
        
        /// <summary>
        /// The backing field for the CoordinateSystems property
        /// </summary>
        private GmlDiagramObjectCoordinateSystemsCollection _coordinateSystems;
        
        private static Lazy<ITypedElement> _gmlObservatinsReference = new Lazy<ITypedElement>(RetrieveGmlObservatinsReference);
        
        /// <summary>
        /// The backing field for the GmlObservatins property
        /// </summary>
        private GmlDiagramObjectGmlObservatinsCollection _gmlObservatins;
        
        private static Lazy<ITypedElement> _gmlSelectorsReference = new Lazy<ITypedElement>(RetrieveGmlSelectorsReference);
        
        /// <summary>
        /// The backing field for the GmlSelectors property
        /// </summary>
        private GmlDiagramObjectGmlSelectorsCollection _gmlSelectors;
        
        private static IClass _classInstance;
        
        public GmlDiagramObject()
        {
            this._gmlRasterSymbols = new GmlDiagramObjectGmlRasterSymbolsCollection(this);
            this._gmlRasterSymbols.CollectionChanging += this.GmlRasterSymbolsCollectionChanging;
            this._gmlRasterSymbols.CollectionChanged += this.GmlRasterSymbolsCollectionChanged;
            this._diagrams = new GmlDiagramObjectDiagramsCollection(this);
            this._diagrams.CollectionChanging += this.DiagramsCollectionChanging;
            this._diagrams.CollectionChanged += this.DiagramsCollectionChanged;
            this._gmlPointSymbols = new GmlDiagramObjectGmlPointSymbolsCollection(this);
            this._gmlPointSymbols.CollectionChanging += this.GmlPointSymbolsCollectionChanging;
            this._gmlPointSymbols.CollectionChanged += this.GmlPointSymbolsCollectionChanged;
            this._gmlPolygonSymbols = new GmlDiagramObjectGmlPolygonSymbolsCollection(this);
            this._gmlPolygonSymbols.CollectionChanging += this.GmlPolygonSymbolsCollectionChanging;
            this._gmlPolygonSymbols.CollectionChanged += this.GmlPolygonSymbolsCollectionChanged;
            this._gmlLineSymbols = new GmlDiagramObjectGmlLineSymbolsCollection(this);
            this._gmlLineSymbols.CollectionChanging += this.GmlLineSymbolsCollectionChanging;
            this._gmlLineSymbols.CollectionChanged += this.GmlLineSymbolsCollectionChanged;
            this._gmlTextSymbols = new GmlDiagramObjectGmlTextSymbolsCollection(this);
            this._gmlTextSymbols.CollectionChanging += this.GmlTextSymbolsCollectionChanging;
            this._gmlTextSymbols.CollectionChanged += this.GmlTextSymbolsCollectionChanged;
            this._coordinateSystems = new GmlDiagramObjectCoordinateSystemsCollection(this);
            this._coordinateSystems.CollectionChanging += this.CoordinateSystemsCollectionChanging;
            this._coordinateSystems.CollectionChanged += this.CoordinateSystemsCollectionChanged;
            this._gmlObservatins = new GmlDiagramObjectGmlObservatinsCollection(this);
            this._gmlObservatins.CollectionChanging += this.GmlObservatinsCollectionChanging;
            this._gmlObservatins.CollectionChanged += this.GmlObservatinsCollectionChanged;
            this._gmlSelectors = new GmlDiagramObjectGmlSelectorsCollection(this);
            this._gmlSelectors.CollectionChanging += this.GmlSelectorsCollectionChanging;
            this._gmlSelectors.CollectionChanged += this.GmlSelectorsCollectionChanged;
        }
        
        /// <summary>
        /// The GmlRasterSymbols property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObject")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlRasterSymbol> GmlRasterSymbols
        {
            get
            {
                return this._gmlRasterSymbols;
            }
        }
        
        /// <summary>
        /// The Diagrams property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObjects")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IDiagram> Diagrams
        {
            get
            {
                return this._diagrams;
            }
        }
        
        /// <summary>
        /// The GmlPointSymbols property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObject")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlPointSymbol> GmlPointSymbols
        {
            get
            {
                return this._gmlPointSymbols;
            }
        }
        
        /// <summary>
        /// The GmlPolygonSymbols property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObject")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlPolygonSymbol> GmlPolygonSymbols
        {
            get
            {
                return this._gmlPolygonSymbols;
            }
        }
        
        /// <summary>
        /// The GmlLineSymbols property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObject")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlLineSymbol> GmlLineSymbols
        {
            get
            {
                return this._gmlLineSymbols;
            }
        }
        
        /// <summary>
        /// The GmlTextSymbols property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObject")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlTextSymbol> GmlTextSymbols
        {
            get
            {
                return this._gmlTextSymbols;
            }
        }
        
        /// <summary>
        /// The CoordinateSystems property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObjects")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<ICoordinateSystem> CoordinateSystems
        {
            get
            {
                return this._coordinateSystems;
            }
        }
        
        /// <summary>
        /// The GmlObservatins property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObjects")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlObservation> GmlObservatins
        {
            get
            {
                return this._gmlObservatins;
            }
        }
        
        /// <summary>
        /// The GmlSelectors property
        /// </summary>
        [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
        [XmlAttributeAttribute(true)]
        [XmlOppositeAttribute("GmlDiagramObjects")]
        [ConstantAttribute()]
        public virtual IOrderedSetExpression<IGmlSelector> GmlSelectors
        {
            get
            {
                return this._gmlSelectors;
            }
        }
        
        /// <summary>
        /// Gets the referenced model elements of this model element
        /// </summary>
        public override IEnumerableExpression<IModelElement> ReferencedElements
        {
            get
            {
                return base.ReferencedElements.Concat(new GmlDiagramObjectReferencedElementsCollection(this));
            }
        }
        
        /// <summary>
        /// Gets the Class model for this type
        /// </summary>
        public new static IClass ClassInstance
        {
            get
            {
                if ((_classInstance == null))
                {
                    _classInstance = ((IClass)(MetaRepository.Instance.Resolve("http://iec.ch/TC57/2009/CIM-schema-cim14#//IEC61970/Informative/InfGMLSupport/Gml" +
                            "DiagramObject")));
                }
                return _classInstance;
            }
        }
        
        private static ITypedElement RetrieveGmlRasterSymbolsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlRasterSymbols")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlRasterSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlRasterSymbolsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlRasterSymbols", e, _gmlRasterSymbolsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlRasterSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlRasterSymbolsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlRasterSymbols", e, _gmlRasterSymbolsReference);
        }
        
        private static ITypedElement RetrieveDiagramsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("Diagrams")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the Diagrams property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void DiagramsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("Diagrams", e, _diagramsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the Diagrams property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void DiagramsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("Diagrams", e, _diagramsReference);
        }
        
        private static ITypedElement RetrieveGmlPointSymbolsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlPointSymbols")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlPointSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlPointSymbolsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlPointSymbols", e, _gmlPointSymbolsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlPointSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlPointSymbolsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlPointSymbols", e, _gmlPointSymbolsReference);
        }
        
        private static ITypedElement RetrieveGmlPolygonSymbolsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlPolygonSymbols")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlPolygonSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlPolygonSymbolsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlPolygonSymbols", e, _gmlPolygonSymbolsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlPolygonSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlPolygonSymbolsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlPolygonSymbols", e, _gmlPolygonSymbolsReference);
        }
        
        private static ITypedElement RetrieveGmlLineSymbolsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlLineSymbols")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlLineSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlLineSymbolsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlLineSymbols", e, _gmlLineSymbolsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlLineSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlLineSymbolsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlLineSymbols", e, _gmlLineSymbolsReference);
        }
        
        private static ITypedElement RetrieveGmlTextSymbolsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlTextSymbols")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlTextSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlTextSymbolsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlTextSymbols", e, _gmlTextSymbolsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlTextSymbols property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlTextSymbolsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlTextSymbols", e, _gmlTextSymbolsReference);
        }
        
        private static ITypedElement RetrieveCoordinateSystemsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("CoordinateSystems")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the CoordinateSystems property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void CoordinateSystemsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("CoordinateSystems", e, _coordinateSystemsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the CoordinateSystems property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void CoordinateSystemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("CoordinateSystems", e, _coordinateSystemsReference);
        }
        
        private static ITypedElement RetrieveGmlObservatinsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlObservatins")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlObservatins property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlObservatinsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlObservatins", e, _gmlObservatinsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlObservatins property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlObservatinsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlObservatins", e, _gmlObservatinsReference);
        }
        
        private static ITypedElement RetrieveGmlSelectorsReference()
        {
            return ((ITypedElement)(((ModelElement)(GmlDiagramObject.ClassInstance)).Resolve("GmlSelectors")));
        }
        
        /// <summary>
        /// Forwards CollectionChanging notifications for the GmlSelectors property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlSelectorsCollectionChanging(object sender, NMF.Collections.ObjectModel.NotifyCollectionChangingEventArgs e)
        {
            this.OnCollectionChanging("GmlSelectors", e, _gmlSelectorsReference);
        }
        
        /// <summary>
        /// Forwards CollectionChanged notifications for the GmlSelectors property to the parent model element
        /// </summary>
        /// <param name="sender">The collection that raised the change</param>
        /// <param name="e">The original event data</param>
        private void GmlSelectorsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.OnCollectionChanged("GmlSelectors", e, _gmlSelectorsReference);
        }
        
        /// <summary>
        /// Gets the Model element collection for the given feature
        /// </summary>
        /// <returns>A non-generic list of elements</returns>
        /// <param name="feature">The requested feature</param>
        protected override System.Collections.IList GetCollectionForFeature(string feature)
        {
            if ((feature == "GMLRASTERSYMBOLS"))
            {
                return this._gmlRasterSymbols;
            }
            if ((feature == "DIAGRAMS"))
            {
                return this._diagrams;
            }
            if ((feature == "GMLPOINTSYMBOLS"))
            {
                return this._gmlPointSymbols;
            }
            if ((feature == "GMLPOLYGONSYMBOLS"))
            {
                return this._gmlPolygonSymbols;
            }
            if ((feature == "GMLLINESYMBOLS"))
            {
                return this._gmlLineSymbols;
            }
            if ((feature == "GMLTEXTSYMBOLS"))
            {
                return this._gmlTextSymbols;
            }
            if ((feature == "COORDINATESYSTEMS"))
            {
                return this._coordinateSystems;
            }
            if ((feature == "GMLOBSERVATINS"))
            {
                return this._gmlObservatins;
            }
            if ((feature == "GMLSELECTORS"))
            {
                return this._gmlSelectors;
            }
            return base.GetCollectionForFeature(feature);
        }
        
        /// <summary>
        /// Gets the Class for this model element
        /// </summary>
        public override IClass GetClass()
        {
            if ((_classInstance == null))
            {
                _classInstance = ((IClass)(MetaRepository.Instance.Resolve("http://iec.ch/TC57/2009/CIM-schema-cim14#//IEC61970/Informative/InfGMLSupport/Gml" +
                        "DiagramObject")));
            }
            return _classInstance;
        }
        
        /// <summary>
        /// The collection class to to represent the children of the GmlDiagramObject class
        /// </summary>
        public class GmlDiagramObjectReferencedElementsCollection : ReferenceCollection, ICollectionExpression<IModelElement>, ICollection<IModelElement>
        {
            
            private GmlDiagramObject _parent;
            
            /// <summary>
            /// Creates a new instance
            /// </summary>
            public GmlDiagramObjectReferencedElementsCollection(GmlDiagramObject parent)
            {
                this._parent = parent;
            }
            
            /// <summary>
            /// Gets the amount of elements contained in this collection
            /// </summary>
            public override int Count
            {
                get
                {
                    int count = 0;
                    count = (count + this._parent.GmlRasterSymbols.Count);
                    count = (count + this._parent.Diagrams.Count);
                    count = (count + this._parent.GmlPointSymbols.Count);
                    count = (count + this._parent.GmlPolygonSymbols.Count);
                    count = (count + this._parent.GmlLineSymbols.Count);
                    count = (count + this._parent.GmlTextSymbols.Count);
                    count = (count + this._parent.CoordinateSystems.Count);
                    count = (count + this._parent.GmlObservatins.Count);
                    count = (count + this._parent.GmlSelectors.Count);
                    return count;
                }
            }
            
            protected override void AttachCore()
            {
                this._parent.GmlRasterSymbols.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.Diagrams.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.GmlPointSymbols.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.GmlPolygonSymbols.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.GmlLineSymbols.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.GmlTextSymbols.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.CoordinateSystems.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.GmlObservatins.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
                this._parent.GmlSelectors.AsNotifiable().CollectionChanged += this.PropagateCollectionChanges;
            }
            
            protected override void DetachCore()
            {
                this._parent.GmlRasterSymbols.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.Diagrams.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.GmlPointSymbols.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.GmlPolygonSymbols.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.GmlLineSymbols.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.GmlTextSymbols.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.CoordinateSystems.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.GmlObservatins.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
                this._parent.GmlSelectors.AsNotifiable().CollectionChanged -= this.PropagateCollectionChanges;
            }
            
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IGmlRasterSymbol gmlRasterSymbolsCasted = item.As<IGmlRasterSymbol>();
                if ((gmlRasterSymbolsCasted != null))
                {
                    this._parent.GmlRasterSymbols.Add(gmlRasterSymbolsCasted);
                }
                IDiagram diagramsCasted = item.As<IDiagram>();
                if ((diagramsCasted != null))
                {
                    this._parent.Diagrams.Add(diagramsCasted);
                }
                IGmlPointSymbol gmlPointSymbolsCasted = item.As<IGmlPointSymbol>();
                if ((gmlPointSymbolsCasted != null))
                {
                    this._parent.GmlPointSymbols.Add(gmlPointSymbolsCasted);
                }
                IGmlPolygonSymbol gmlPolygonSymbolsCasted = item.As<IGmlPolygonSymbol>();
                if ((gmlPolygonSymbolsCasted != null))
                {
                    this._parent.GmlPolygonSymbols.Add(gmlPolygonSymbolsCasted);
                }
                IGmlLineSymbol gmlLineSymbolsCasted = item.As<IGmlLineSymbol>();
                if ((gmlLineSymbolsCasted != null))
                {
                    this._parent.GmlLineSymbols.Add(gmlLineSymbolsCasted);
                }
                IGmlTextSymbol gmlTextSymbolsCasted = item.As<IGmlTextSymbol>();
                if ((gmlTextSymbolsCasted != null))
                {
                    this._parent.GmlTextSymbols.Add(gmlTextSymbolsCasted);
                }
                ICoordinateSystem coordinateSystemsCasted = item.As<ICoordinateSystem>();
                if ((coordinateSystemsCasted != null))
                {
                    this._parent.CoordinateSystems.Add(coordinateSystemsCasted);
                }
                IGmlObservation gmlObservatinsCasted = item.As<IGmlObservation>();
                if ((gmlObservatinsCasted != null))
                {
                    this._parent.GmlObservatins.Add(gmlObservatinsCasted);
                }
                IGmlSelector gmlSelectorsCasted = item.As<IGmlSelector>();
                if ((gmlSelectorsCasted != null))
                {
                    this._parent.GmlSelectors.Add(gmlSelectorsCasted);
                }
            }
            
            /// <summary>
            /// Clears the collection and resets all references that implement it.
            /// </summary>
            public override void Clear()
            {
                this._parent.GmlRasterSymbols.Clear();
                this._parent.Diagrams.Clear();
                this._parent.GmlPointSymbols.Clear();
                this._parent.GmlPolygonSymbols.Clear();
                this._parent.GmlLineSymbols.Clear();
                this._parent.GmlTextSymbols.Clear();
                this._parent.CoordinateSystems.Clear();
                this._parent.GmlObservatins.Clear();
                this._parent.GmlSelectors.Clear();
            }
            
            /// <summary>
            /// Gets a value indicating whether the given element is contained in the collection
            /// </summary>
            /// <returns>True, if it is contained, otherwise False</returns>
            /// <param name="item">The item that should be looked out for</param>
            public override bool Contains(IModelElement item)
            {
                if (this._parent.GmlRasterSymbols.Contains(item))
                {
                    return true;
                }
                if (this._parent.Diagrams.Contains(item))
                {
                    return true;
                }
                if (this._parent.GmlPointSymbols.Contains(item))
                {
                    return true;
                }
                if (this._parent.GmlPolygonSymbols.Contains(item))
                {
                    return true;
                }
                if (this._parent.GmlLineSymbols.Contains(item))
                {
                    return true;
                }
                if (this._parent.GmlTextSymbols.Contains(item))
                {
                    return true;
                }
                if (this._parent.CoordinateSystems.Contains(item))
                {
                    return true;
                }
                if (this._parent.GmlObservatins.Contains(item))
                {
                    return true;
                }
                if (this._parent.GmlSelectors.Contains(item))
                {
                    return true;
                }
                return false;
            }
            
            /// <summary>
            /// Copies the contents of the collection to the given array starting from the given array index
            /// </summary>
            /// <param name="array">The array in which the elements should be copied</param>
            /// <param name="arrayIndex">The starting index</param>
            public override void CopyTo(IModelElement[] array, int arrayIndex)
            {
                IEnumerator<IModelElement> gmlRasterSymbolsEnumerator = this._parent.GmlRasterSymbols.GetEnumerator();
                try
                {
                    for (
                    ; gmlRasterSymbolsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlRasterSymbolsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlRasterSymbolsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> diagramsEnumerator = this._parent.Diagrams.GetEnumerator();
                try
                {
                    for (
                    ; diagramsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = diagramsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    diagramsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> gmlPointSymbolsEnumerator = this._parent.GmlPointSymbols.GetEnumerator();
                try
                {
                    for (
                    ; gmlPointSymbolsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlPointSymbolsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlPointSymbolsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> gmlPolygonSymbolsEnumerator = this._parent.GmlPolygonSymbols.GetEnumerator();
                try
                {
                    for (
                    ; gmlPolygonSymbolsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlPolygonSymbolsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlPolygonSymbolsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> gmlLineSymbolsEnumerator = this._parent.GmlLineSymbols.GetEnumerator();
                try
                {
                    for (
                    ; gmlLineSymbolsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlLineSymbolsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlLineSymbolsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> gmlTextSymbolsEnumerator = this._parent.GmlTextSymbols.GetEnumerator();
                try
                {
                    for (
                    ; gmlTextSymbolsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlTextSymbolsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlTextSymbolsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> coordinateSystemsEnumerator = this._parent.CoordinateSystems.GetEnumerator();
                try
                {
                    for (
                    ; coordinateSystemsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = coordinateSystemsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    coordinateSystemsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> gmlObservatinsEnumerator = this._parent.GmlObservatins.GetEnumerator();
                try
                {
                    for (
                    ; gmlObservatinsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlObservatinsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlObservatinsEnumerator.Dispose();
                }
                IEnumerator<IModelElement> gmlSelectorsEnumerator = this._parent.GmlSelectors.GetEnumerator();
                try
                {
                    for (
                    ; gmlSelectorsEnumerator.MoveNext(); 
                    )
                    {
                        array[arrayIndex] = gmlSelectorsEnumerator.Current;
                        arrayIndex = (arrayIndex + 1);
                    }
                }
                finally
                {
                    gmlSelectorsEnumerator.Dispose();
                }
            }
            
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                IGmlRasterSymbol gmlRasterSymbolItem = item.As<IGmlRasterSymbol>();
                if (((gmlRasterSymbolItem != null) 
                            && this._parent.GmlRasterSymbols.Remove(gmlRasterSymbolItem)))
                {
                    return true;
                }
                IDiagram diagramItem = item.As<IDiagram>();
                if (((diagramItem != null) 
                            && this._parent.Diagrams.Remove(diagramItem)))
                {
                    return true;
                }
                IGmlPointSymbol gmlPointSymbolItem = item.As<IGmlPointSymbol>();
                if (((gmlPointSymbolItem != null) 
                            && this._parent.GmlPointSymbols.Remove(gmlPointSymbolItem)))
                {
                    return true;
                }
                IGmlPolygonSymbol gmlPolygonSymbolItem = item.As<IGmlPolygonSymbol>();
                if (((gmlPolygonSymbolItem != null) 
                            && this._parent.GmlPolygonSymbols.Remove(gmlPolygonSymbolItem)))
                {
                    return true;
                }
                IGmlLineSymbol gmlLineSymbolItem = item.As<IGmlLineSymbol>();
                if (((gmlLineSymbolItem != null) 
                            && this._parent.GmlLineSymbols.Remove(gmlLineSymbolItem)))
                {
                    return true;
                }
                IGmlTextSymbol gmlTextSymbolItem = item.As<IGmlTextSymbol>();
                if (((gmlTextSymbolItem != null) 
                            && this._parent.GmlTextSymbols.Remove(gmlTextSymbolItem)))
                {
                    return true;
                }
                ICoordinateSystem coordinateSystemItem = item.As<ICoordinateSystem>();
                if (((coordinateSystemItem != null) 
                            && this._parent.CoordinateSystems.Remove(coordinateSystemItem)))
                {
                    return true;
                }
                IGmlObservation gmlObservationItem = item.As<IGmlObservation>();
                if (((gmlObservationItem != null) 
                            && this._parent.GmlObservatins.Remove(gmlObservationItem)))
                {
                    return true;
                }
                IGmlSelector gmlSelectorItem = item.As<IGmlSelector>();
                if (((gmlSelectorItem != null) 
                            && this._parent.GmlSelectors.Remove(gmlSelectorItem)))
                {
                    return true;
                }
                return false;
            }
            
            /// <summary>
            /// Gets an enumerator that enumerates the collection
            /// </summary>
            /// <returns>A generic enumerator</returns>
            public override IEnumerator<IModelElement> GetEnumerator()
            {
                return Enumerable.Empty<IModelElement>().Concat(this._parent.GmlRasterSymbols).Concat(this._parent.Diagrams).Concat(this._parent.GmlPointSymbols).Concat(this._parent.GmlPolygonSymbols).Concat(this._parent.GmlLineSymbols).Concat(this._parent.GmlTextSymbols).Concat(this._parent.CoordinateSystems).Concat(this._parent.GmlObservatins).Concat(this._parent.GmlSelectors).GetEnumerator();
            }
        }
    }
}

