Example #1
0
File: Class.cs Project: lukeIam/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)
            {
                IClass classItem = item.As <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);
                }
                IAttributeConstraint attributeConstraintItem = item.As <IAttributeConstraint>();

                if (((attributeConstraintItem != null) &&
                     this._parent.AttributeConstraints.Remove(attributeConstraintItem)))
                {
                    return(true);
                }
                IReferenceConstraint referenceConstraintItem = item.As <IReferenceConstraint>();

                if (((referenceConstraintItem != null) &&
                     this._parent.ReferenceConstraints.Remove(referenceConstraintItem)))
                {
                    return(true);
                }
                return(false);
            }
Example #2
0
 public AttributeDeclaration(String name, IType type, IAttributeConstraint constraint, IdentifierList indexTypes)
     : base(name)
 {
     this.type       = type;
     this.constraint = constraint;
     this.indexTypes = indexTypes;
 }
Example #3
0
File: Class.cs Project: lukeIam/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)
            {
                IAttributeConstraint attributeConstraintsCasted = item.As <IAttributeConstraint>();

                if ((attributeConstraintsCasted != null))
                {
                    this._parent.AttributeConstraints.Add(attributeConstraintsCasted);
                }
                IReferenceConstraint referenceConstraintsCasted = item.As <IReferenceConstraint>();

                if ((referenceConstraintsCasted != null))
                {
                    this._parent.ReferenceConstraints.Add(referenceConstraintsCasted);
                }
            }
Example #4
0
File: Class.cs Project: lukeIam/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)
            {
                IAttributeConstraint attributeConstraintItem = item.As <IAttributeConstraint>();

                if (((attributeConstraintItem != null) &&
                     this._parent.AttributeConstraints.Remove(attributeConstraintItem)))
                {
                    return(true);
                }
                IReferenceConstraint referenceConstraintItem = item.As <IReferenceConstraint>();

                if (((referenceConstraintItem != null) &&
                     this._parent.ReferenceConstraints.Remove(referenceConstraintItem)))
                {
                    return(true);
                }
                return(false);
            }
Example #5
0
File: Class.cs Project: lukeIam/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)
            {
                IClass baseTypesCasted = item.As <IClass>();

                if ((baseTypesCasted != null))
                {
                    this._parent.BaseTypes.Add(baseTypesCasted);
                }
                if ((this._parent.InstanceOf == null))
                {
                    IClass instanceOfCasted = item.As <IClass>();
                    if ((instanceOfCasted != null))
                    {
                        this._parent.InstanceOf = instanceOfCasted;
                        return;
                    }
                }
                if ((this._parent.Identifier == null))
                {
                    IAttribute identifierCasted = item.As <IAttribute>();
                    if ((identifierCasted != null))
                    {
                        this._parent.Identifier = identifierCasted;
                        return;
                    }
                }
                IAttributeConstraint attributeConstraintsCasted = item.As <IAttributeConstraint>();

                if ((attributeConstraintsCasted != null))
                {
                    this._parent.AttributeConstraints.Add(attributeConstraintsCasted);
                }
                IReferenceConstraint referenceConstraintsCasted = item.As <IReferenceConstraint>();

                if ((referenceConstraintsCasted != null))
                {
                    this._parent.ReferenceConstraints.Add(referenceConstraintsCasted);
                }
            }
Example #6
0
 public void setConstraint(IAttributeConstraint constraint)
 {
     this.constraint = constraint;
 }
Example #7
0
 private void LoadAttributeConstraint(IAttributeConstraint attConstraint)
 {
     GetOrCreateDecomposedAttribute(attConstraint.Constrains).AddConstraint(attConstraint.Values);
 }