/// <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); } }
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); }
/// <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); }
public void Set(IDiscreteValue <T> value) { this.Value = value.Value; }
void IDiscreteField.Set(IDiscreteValue value) => this.Set(Asserts.Assert(value as IDiscreteValue <T>));