コード例 #1
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.ValueAliasSet == null))
                {
                    IValueAliasSet valueAliasSetCasted = item.As <IValueAliasSet>();
                    if ((valueAliasSetCasted != null))
                    {
                        this._parent.ValueAliasSet = valueAliasSetCasted;
                        return;
                    }
                }
                if ((this._parent.Command == null))
                {
                    ICommand commandCasted = item.As <ICommand>();
                    if ((commandCasted != null))
                    {
                        this._parent.Command = commandCasted;
                        return;
                    }
                }
                IDiscreteValue discreteValuesCasted = item.As <IDiscreteValue>();

                if ((discreteValuesCasted != null))
                {
                    this._parent.DiscreteValues.Add(discreteValuesCasted);
                }
            }
コード例 #2
0
            public Builder AddPossibleValue(
                string name,
                T value,
                bool isDefault = false)
            {
                var newValue = new DiscreteValue(name, value);

                this.possibleValues_.Add(newValue);
                if (isDefault)
                {
                    this.defaultValue_ = newValue;
                }

                return(this);
            }
コード例 #3
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)
            {
                if ((this._parent.ValueAliasSet == item))
                {
                    this._parent.ValueAliasSet = null;
                    return(true);
                }
                if ((this._parent.Command == item))
                {
                    this._parent.Command = null;
                    return(true);
                }
                IDiscreteValue discreteValueItem = item.As <IDiscreteValue>();

                if (((discreteValueItem != null) &&
                     this._parent.DiscreteValues.Remove(discreteValueItem)))
                {
                    return(true);
                }
                return(false);
            }
コード例 #4
0
 public void Set(IDiscreteValue <T> value)
 {
     this.Value = value.Value;
 }
コード例 #5
0
 void IDiscreteField.Set(IDiscreteValue value)
 => this.Set(Asserts.Assert(value as IDiscreteValue <T>));