示例#1
0
文件: Class.cs 项目: kouweizhong/NMF
 /// <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(NMF.Models.IModelElement item)
 {
     NMF.Models.Meta.IClass classItem = item.As <NMF.Models.Meta.IClass>();
     if (((classItem != null) &&
          this._parent.BaseTypes.Remove(classItem)))
     {
         return(true);
     }
     if ((this._parent.InstanceOf == item))
     {
         this._parent.InstanceOf = null;
         return(true);
     }
     if ((this._parent.Identifier == item))
     {
         this._parent.Identifier = null;
         return(true);
     }
     NMF.Models.Meta.IAttributeConstraint attributeConstraintItem = item.As <NMF.Models.Meta.IAttributeConstraint>();
     if (((attributeConstraintItem != null) &&
          this._parent.AttributeConstraints.Remove(attributeConstraintItem)))
     {
         return(true);
     }
     NMF.Models.Meta.IReferenceConstraint referenceConstraintItem = item.As <NMF.Models.Meta.IReferenceConstraint>();
     if (((referenceConstraintItem != null) &&
          this._parent.ReferenceConstraints.Remove(referenceConstraintItem)))
     {
         return(true);
     }
     return(false);
 }
示例#2
0
 /// <summary>
 /// Gets the Class for this model element
 /// </summary>
 public override NMF.Models.Meta.IClass GetClass()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://github.com/georghinkel/DeepADL/1.0#//Interface")));
     }
     return(_classInstance);
 }
示例#3
0
 /// <summary>
 /// Gets the Class for this model element
 /// </summary>
 public override NMF.Models.Meta.IClass GetClass()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://class/1.0#//Attribute")));
     }
     return(_classInstance);
 }
示例#4
0
 /// <summary>
 /// Gets the ComponentType for this model element
 /// </summary>
 public override IComponentType GetComponentType()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://github.com/georghinkel/mediaStore/Repository#//AudioStoreInterface")));
     }
     return((IComponentType)(_classInstance));
 }
示例#5
0
 /// <summary>
 /// Gets the Class for this model element
 /// </summary>
 public override NMF.Models.Meta.IClass GetClass()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://momot.big.tuwien.ac.at/architectureCRA/1.0#//NamedElement")));
     }
     return(_classInstance);
 }
 /// <summary>
 /// Gets the Class for this model element
 /// </summary>
 public override NMF.Models.Meta.IClass GetClass()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://github.com/georghinkel/mediaStore/Repository#//MediaStoreSystem")));
     }
     return(_classInstance);
 }
示例#7
0
 /// <summary>
 /// Gets the Class for this model element
 /// </summary>
 public override NMF.Models.Meta.IClass GetClass()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("test:architecture#//Attribute")));
     }
     return(_classInstance);
 }
 /// <summary>
 /// Gets the ComponentType for this model element
 /// </summary>
 public virtual IComponentType GetComponentType()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://github.com/georghinkel/mediaStore/Repository#//UserManagement")));
     }
     return((IComponentType)(_classInstance));
 }
示例#9
0
 /// <summary>
 /// Gets the Class for this model element
 /// </summary>
 public override NMF.Models.Meta.IClass GetClass()
 {
     if ((_classInstance == null))
     {
         _classInstance = ((NMF.Models.Meta.IClass)(MetaRepository.Instance.Resolve("http://www.transformation-tool-contest.eu/2017/LiveContest/SimpleCodeDOM#//Field")));
     }
     return(_classInstance);
 }
示例#10
0
        /// <summary>
        /// Gets called when the parent model element of the current model element is about to change
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanging(NMF.Models.IModelElement newParent, NMF.Models.IModelElement oldParent)
        {
            NMF.Models.Meta.IClass oldDeclaringType = ModelHelper.CastAs <NMF.Models.Meta.IClass>(oldParent);
            NMF.Models.Meta.IClass newDeclaringType = ModelHelper.CastAs <NMF.Models.Meta.IClass>(newParent);
            ValueChangedEventArgs  e = new ValueChangedEventArgs(oldDeclaringType, newDeclaringType);

            this.OnDeclaringTypeChanging(e);
            this.OnPropertyChanging("DeclaringType", e, _declaringTypeReference);
        }
示例#11
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     if ((this._parent.AdornedClass == null))
     {
         NMF.Models.Meta.IClass adornedClassCasted = item.As <NMF.Models.Meta.IClass>();
         if ((adornedClassCasted != null))
         {
             this._parent.AdornedClass = adornedClassCasted;
             return;
         }
     }
 }
示例#12
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     if ((this._parent.DeclaringType == null))
     {
         NMF.Models.Meta.IClass declaringTypeCasted = item.As <NMF.Models.Meta.IClass>();
         if ((declaringTypeCasted != null))
         {
             this._parent.DeclaringType = declaringTypeCasted;
             return;
         }
     }
     this._parent.References.Add(item);
 }
示例#13
0
        /// <summary>
        /// Gets called when the parent model element of the current model element changes
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanged(NMF.Models.IModelElement newParent, NMF.Models.IModelElement oldParent)
        {
            NMF.Models.Meta.IClass oldDeclaringType = ModelHelper.CastAs <NMF.Models.Meta.IClass>(oldParent);
            NMF.Models.Meta.IClass newDeclaringType = ModelHelper.CastAs <NMF.Models.Meta.IClass>(newParent);
            if ((oldDeclaringType != null))
            {
                oldDeclaringType.ReferenceConstraints.Remove(this);
            }
            if ((newDeclaringType != null))
            {
                newDeclaringType.ReferenceConstraints.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldDeclaringType, newDeclaringType);

            this.OnDeclaringTypeChanged(e);
            this.OnPropertyChanged("DeclaringType", e, _declaringTypeReference);
            base.OnParentChanged(newParent, oldParent);
        }
示例#14
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     if ((this._parent.DeclaringType == null))
     {
         NMF.Models.Meta.IClass declaringTypeCasted = item.As <NMF.Models.Meta.IClass>();
         if ((declaringTypeCasted != null))
         {
             this._parent.DeclaringType = declaringTypeCasted;
             return;
         }
     }
     if ((this._parent.Constrains == null))
     {
         NMF.Models.Meta.IAttribute constrainsCasted = item.As <NMF.Models.Meta.IAttribute>();
         if ((constrainsCasted != null))
         {
             this._parent.Constrains = constrainsCasted;
             return;
         }
     }
 }
示例#15
0
文件: Class.cs 项目: kouweizhong/NMF
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     NMF.Models.Meta.IClass baseTypesCasted = item.As <NMF.Models.Meta.IClass>();
     if ((baseTypesCasted != null))
     {
         this._parent.BaseTypes.Add(baseTypesCasted);
     }
     if ((this._parent.InstanceOf == null))
     {
         NMF.Models.Meta.IClass instanceOfCasted = item.As <NMF.Models.Meta.IClass>();
         if ((instanceOfCasted != null))
         {
             this._parent.InstanceOf = instanceOfCasted;
             return;
         }
     }
     if ((this._parent.Identifier == null))
     {
         NMF.Models.Meta.IAttribute identifierCasted = item.As <NMF.Models.Meta.IAttribute>();
         if ((identifierCasted != null))
         {
             this._parent.Identifier = identifierCasted;
             return;
         }
     }
     NMF.Models.Meta.IAttributeConstraint attributeConstraintsCasted = item.As <NMF.Models.Meta.IAttributeConstraint>();
     if ((attributeConstraintsCasted != null))
     {
         this._parent.AttributeConstraints.Add(attributeConstraintsCasted);
     }
     NMF.Models.Meta.IReferenceConstraint referenceConstraintsCasted = item.As <NMF.Models.Meta.IReferenceConstraint>();
     if ((referenceConstraintsCasted != null))
     {
         this._parent.ReferenceConstraints.Add(referenceConstraintsCasted);
     }
 }