Exemplo n.º 1
0
 /// <summary>
 /// Creates a new instance of <see cref="SelectByMany{TValue}"/>
 /// </summary>
 /// <param name="target">The element on which to perform the selection</param>
 /// <param name="value">The value to select</param>
 /// <param name="selectStrategy">The strategy used to select the element</param>
 public SelectBy(
     ITarget target,
     TValue value,
     ISelectStrategy <TValue> selectStrategy)
 {
     _target         = target ?? throw new System.ArgumentNullException(nameof(target));
     _value          = value;
     _selectStrategy = selectStrategy ?? throw new System.ArgumentNullException(nameof(selectStrategy));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of <see cref="SelectByMany{TValue}"/>
 /// </summary>
 /// <param name="target">The element on which to perform the selection</param>
 /// <param name="value">The value to select</param>
 /// <param name="selectStrategy">The strategy used to select the element</param>
 public SelectBy(
     ITarget target,
     TValue value,
     ISelectStrategy <TValue> selectStrategy)
 {
     Guard.ForNull(target, nameof(value));
     Guard.ForNull(selectStrategy, nameof(selectStrategy));
     _target         = target;
     _value          = value;
     _selectStrategy = selectStrategy;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new instance of <see cref="SelectByMany{TValue}"/>
 /// </summary>
 /// <param name="target">The element on which to perform the selection</param>
 /// <param name="values">The values to select</param>
 /// <param name="selectStrategy">The strategy used to select the element</param>
 public SelectByMany(
     ITarget target,
     IEnumerable <TValue> values,
     ISelectStrategy <TValue> selectStrategy)
 {
     Guard.ForNull(values, nameof(values));
     Guard.ForNull(target, nameof(target));
     Guard.ForNull(selectStrategy, nameof(selectStrategy));
     _values         = values.ToImmutableArray();
     _target         = target;
     _selectStrategy = selectStrategy;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new instance of <see cref="SelectByMany{TValue}"/>
        /// </summary>
        /// <param name="target">The element on which to perform the selection</param>
        /// <param name="values">The values to select</param>
        /// <param name="selectStrategy">The strategy used to select the element</param>
        public SelectByMany(
            ITarget target,
            IEnumerable <TValue> values,
            ISelectStrategy <TValue> selectStrategy)
        {
            if (values == null)
            {
                throw new System.ArgumentNullException(nameof(values));
            }

            _values         = values.ToImmutableArray();
            _target         = target ?? throw new System.ArgumentNullException(nameof(target));
            _selectStrategy = selectStrategy ?? throw new System.ArgumentNullException(nameof(selectStrategy));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new instance of <see cref="SelectBuilderMany{TValue}"/>
 /// </summary>
 /// <param name="value">The values to select</param>
 /// <param name="strategy">The strategy used to perform the selection on the element</param>
 public SelectBuilderMany(IEnumerable <TValue> value, ISelectStrategy <TValue> strategy)
     : base(t => new SelectByMany <TValue>(t, value, strategy))
 {
 }
Exemplo n.º 6
0
 /****************************************************************************************************/
 /*  Public methods for playing the game                                                             */
 /****************************************************************************************************/
 public void Select(string pid, params string[] cards)
 {
     CheckOption(pid, OptionType.Select);
     _select.OnSelect(this, pid, cards);
     var after = _select.AfterSelect();
     _select = null;
     after();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new instance of <see cref="SelectBuilder{TValue}"/>
 /// </summary>
 /// <param name="value">The value to select</param>
 /// <param name="strategy">The strategy used to perform the selection on the element</param>
 public SelectBuilder(TValue value, ISelectStrategy <TValue> strategy)
     : base(t => new SelectBy <TValue>(t, value, strategy))
 {
 }
 public void AddSelectStrategy(ISelectStrategy <TContent> strategy)
 {
     _selects.Add(strategy);
 }