Ejemplo n.º 1
0
        public static Parameter <ArrayQuery <T> > .Builder SetDefaultQuery <T>(this Parameter <ArrayQuery <T> > .Builder builder, string query,
                                                                               ITypeConverter <double, T> numberConverter)
        {
            var converter = ArrayQuery <T> .CreateTypeConverter(numberConverter);

            return(builder.SetDefaultValue(converter.ConvertBackward(query)).SetTypeConverters(converter));
        }
Ejemplo n.º 2
0
 public BiosignalStreamer(IBiosignalSource biosignalSource, IClock clock, ArrayQuery channelSelector = null) : base(nameof(BiosignalStreamer), clock)
 {
     BiosignalSource = biosignalSource;
     Started        += (sender, e) => biosignalSource.Open();
     Stopped        += (sender, e) => biosignalSource.Shutdown();
     _channelIndices = channelSelector?.Enumerate(1, biosignalSource.ChannelNum).Select(val => (uint)(val - 1)).ToArray();
 }
Ejemplo n.º 3
0
        internal ArrayQueryOfMutablesImpl(ArrayQuery <TValueImmutable> immutableQuery, ArrayQueryOfQueries <TValueQuery, TValueImmutable> cmq, ArrayState <TValue> state)
            : base(state)
        {
            ArgumentValidator.ValidateNotNull("Collection query of queries", cmq);
            ArgumentValidator.ValidateNotNull("Immutable query", immutableQuery);

            this._iq  = immutableQuery;
            this._cmq = cmq;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Helper function to perform simple for-loop (not the foreach loop with .GetEnumerator() calls) over a <see cref="ArrayQuery{T}"/>.
 /// </summary>
 /// <typeparam name="TValue">The type of array elements.</typeparam>
 /// <param name="array">The array. If <c>null</c>, this method does nothing.</param>
 /// <param name="action">The action to execute for each array element. If <c>null</c>, this method does nothing.</param>
 public static void ForEach <TValue>(this ArrayQuery <TValue> array, Action <TValue> action)
 {
     if (array != null && action != null && array.Count > 0)
     {
         for (var i = 0; i < array.Count; ++i)
         {
             action(array[i]);
         }
     }
 }
Ejemplo n.º 5
0
        public void Test()
        {
            var result = new ArrayQuery("1:100").Enumerate().ToArray();

            Assert.IsTrue(result.Length == 100 && result[0] == 1 && result[99] == 100);
            result = new ArrayQuery("start:end").Enumerate(5, 8).ToArray();
            Assert.IsTrue(result.Length == 4 && result[0] == 5 && result[3] == 8);
            result = new ArrayQuery(":").Enumerate(5, 8).ToArray();
            Assert.IsTrue(result.Length == 4 && result[0] == 5 && result[3] == 8);
            result = new ArrayQuery("1:end").Enumerate(1, 2).ToArray();
            Assert.IsTrue(result.Length == 2 && result[0] == 1 && result[1] == 2);
            result = new ArrayQuery("1:end , 8").Enumerate(1, 10).ToArray();
            Assert.IsTrue(result.Length == 11 && result[0] == 1 && result[10] == 8);
        }
Ejemplo n.º 6
0
 public BiosignalStreamer(IBiosignalSource biosignalSource, IClock clock, IConsumer <Timestamped <ISample> > consumer, ArrayQuery channelSelector = null)
     : this(biosignalSource, clock, channelSelector) => AttachConsumer(consumer);
Ejemplo n.º 7
0
 internal ArrayWithRolesDebugView(ArrayImmutableQueryImpl <TValue, TValueQuery, TValueImmutable> array)
 {
     this._array = array;
 }
Ejemplo n.º 8
0
 internal ArrayWithRolesDebugView(ArrayQueryOfQueriesImpl <TValue, TValueQuery, TValueImmutable> array)
 {
     this._array = array.IQ;
 }
Ejemplo n.º 9
0
 internal ArrayQueryDebugView(ArrayQuery <TValue> array)
 {
     this._array = array;
 }
Ejemplo n.º 10
0
 internal ArrayMutableDebugView(ArrayMutableImpl <TValue, TArrayQuery> array)
 {
     this._array = array.CQ;
 }
Ejemplo n.º 11
0
 internal ArrayProxyImpl(ArrayQuery <TValue> cq, ArrayState <TValue> state)
     : base(cq, state)
 {
 }
Ejemplo n.º 12
0
 internal ArrayQueryOfQueriesImpl(ArrayQuery <TValueImmutable> iq, ArrayState <TValue> state)
     : base(iq)
 {
     ArgumentValidator.ValidateNotNull("State", state);
     this._state = state;
 }
Ejemplo n.º 13
0
        public static Parameter <ArrayQuery <double> > .Builder SetDefaultQuery(this Parameter <ArrayQuery <double> > .Builder builder, string query)
        {
            var converter = ArrayQuery <double> .CreateTypeConverter(IdentityTypeConverter <double> .Instance);

            return(builder.SetDefaultValue(converter.ConvertBackward(query)).SetTypeConverters(converter));
        }
Ejemplo n.º 14
0
 public ArrayQuery(ArrayQuery query, ITypeConverter <double, T> typeConverter)
 {
     BaseQuery = query ?? throw new ArgumentNullException(nameof(query));
     Converter = typeConverter;
 }