コード例 #1
0
            /// <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)
            {
                IUserAttribute userAttributeItem = item.As <IUserAttribute>();

                if (((userAttributeItem != null) &&
                     this._parent.AssetProperites.Remove(userAttributeItem)))
                {
                    return(true);
                }
                IReliabilityInfo reliabilityInfoItem = item.As <IReliabilityInfo>();

                if (((reliabilityInfoItem != null) &&
                     this._parent.ReliabilityInfos.Remove(reliabilityInfoItem)))
                {
                    return(true);
                }
                if (((userAttributeItem != null) &&
                     this._parent.Ratings.Remove(userAttributeItem)))
                {
                    return(true);
                }
                IQualificationRequirement qualificationRequirementItem = item.As <IQualificationRequirement>();

                if (((qualificationRequirementItem != null) &&
                     this._parent.QualificationRequirements.Remove(qualificationRequirementItem)))
                {
                    return(true);
                }
                IAssetPropertyCurve assetPropertyCurveItem = item.As <IAssetPropertyCurve>();

                if (((assetPropertyCurveItem != null) &&
                     this._parent.AssetPropertyCurves.Remove(assetPropertyCurveItem)))
                {
                    return(true);
                }
                IDimensionsInfo dimensionsInfoItem = item.As <IDimensionsInfo>();

                if (((dimensionsInfoItem != null) &&
                     this._parent.DimensionsInfos.Remove(dimensionsInfoItem)))
                {
                    return(true);
                }
                IMedium mediumItem = item.As <IMedium>();

                if (((mediumItem != null) &&
                     this._parent.Mediums.Remove(mediumItem)))
                {
                    return(true);
                }
                return(false);
            }
コード例 #2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IUserAttribute assetProperitesCasted = item.As <IUserAttribute>();

                if ((assetProperitesCasted != null))
                {
                    this._parent.AssetProperites.Add(assetProperitesCasted);
                }
                IReliabilityInfo reliabilityInfosCasted = item.As <IReliabilityInfo>();

                if ((reliabilityInfosCasted != null))
                {
                    this._parent.ReliabilityInfos.Add(reliabilityInfosCasted);
                }
                IUserAttribute ratingsCasted = item.As <IUserAttribute>();

                if ((ratingsCasted != null))
                {
                    this._parent.Ratings.Add(ratingsCasted);
                }
                IQualificationRequirement qualificationRequirementsCasted = item.As <IQualificationRequirement>();

                if ((qualificationRequirementsCasted != null))
                {
                    this._parent.QualificationRequirements.Add(qualificationRequirementsCasted);
                }
                IAssetPropertyCurve assetPropertyCurvesCasted = item.As <IAssetPropertyCurve>();

                if ((assetPropertyCurvesCasted != null))
                {
                    this._parent.AssetPropertyCurves.Add(assetPropertyCurvesCasted);
                }
                IDimensionsInfo dimensionsInfosCasted = item.As <IDimensionsInfo>();

                if ((dimensionsInfosCasted != null))
                {
                    this._parent.DimensionsInfos.Add(dimensionsInfosCasted);
                }
                IMedium mediumsCasted = item.As <IMedium>();

                if ((mediumsCasted != null))
                {
                    this._parent.Mediums.Add(mediumsCasted);
                }
            }
コード例 #3
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.Asset == null))
     {
         IAsset assetCasted = item.As <IAsset>();
         if ((assetCasted != null))
         {
             this._parent.Asset = assetCasted;
             return;
         }
     }
     if ((this._parent.TypeAsset == null))
     {
         ITypeAsset typeAssetCasted = item.As <ITypeAsset>();
         if ((typeAssetCasted != null))
         {
             this._parent.TypeAsset = typeAssetCasted;
             return;
         }
     }
     if ((this._parent.AssetModel == null))
     {
         IAssetModel assetModelCasted = item.As <IAssetModel>();
         if ((assetModelCasted != null))
         {
             this._parent.AssetModel = assetModelCasted;
             return;
         }
     }
     if ((this._parent.DimensionsInfo == null))
     {
         IDimensionsInfo dimensionsInfoCasted = item.As <IDimensionsInfo>();
         if ((dimensionsInfoCasted != null))
         {
             this._parent.DimensionsInfo = dimensionsInfoCasted;
             return;
         }
     }
 }