Exemple #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)
            {
                IValueToAlias valueToAliasItem = item.As <IValueToAlias>();

                if (((valueToAliasItem != null) &&
                     this._parent.Values.Remove(valueToAliasItem)))
                {
                    return(true);
                }
                ICommand commandItem = item.As <ICommand>();

                if (((commandItem != null) &&
                     this._parent.Commands.Remove(commandItem)))
                {
                    return(true);
                }
                IDiscrete discreteItem = item.As <IDiscrete>();

                if (((discreteItem != null) &&
                     this._parent.Discretes.Remove(discreteItem)))
                {
                    return(true);
                }
                return(false);
            }
Exemple #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)
            {
                IValueToAlias valuesCasted = item.As <IValueToAlias>();

                if ((valuesCasted != null))
                {
                    this._parent.Values.Add(valuesCasted);
                }
                ICommand commandsCasted = item.As <ICommand>();

                if ((commandsCasted != null))
                {
                    this._parent.Commands.Add(commandsCasted);
                }
                IDiscrete discretesCasted = item.As <IDiscrete>();

                if ((discretesCasted != null))
                {
                    this._parent.Discretes.Add(discretesCasted);
                }
            }