Example #1
0
            public void ProducesExpectedArray()
            {
                var time32Type = new Time32Type(TimeUnit.Second);
                var array      = new Time32Array.Builder(time32Type)
                                 .Append(1)
                                 .Build();

                Assert.Equal(1, array.Length);
                var valueSeconds = array.GetSeconds(0);

                Assert.NotNull(valueSeconds);
                Assert.Equal(1, valueSeconds.Value);
                var valueMilliSeconds = array.GetMilliSeconds(0);

                Assert.NotNull(valueMilliSeconds);
                Assert.Equal(1_000, valueMilliSeconds.Value);

                time32Type = new Time32Type(TimeUnit.Millisecond);
                array      = new Time32Array.Builder(time32Type)
                             .Append(1_000)
                             .Build();

                Assert.Equal(1, array.Length);
                valueSeconds = array.GetSeconds(0);
                Assert.NotNull(valueSeconds);
                Assert.Equal(1, valueSeconds.Value);
                valueMilliSeconds = array.GetMilliSeconds(0);
                Assert.NotNull(valueMilliSeconds);
                Assert.Equal(1_000, valueMilliSeconds.Value);
            }
Example #2
0
            public void Visit(Time32Type actualType)
            {
                Assert.IsAssignableFrom <Time32Type>(_expectedType);
                var expectedType = (Time32Type)_expectedType;

                Assert.Equal(expectedType.Unit, actualType.Unit);
            }
Example #3
0
 public Time32Array(
     Time32Type type,
     ArrowBuffer valueBuffer, ArrowBuffer nullBitmapBuffer,
     int length, int nullCount, int offset)
     : this(new ArrayData(type, length, nullCount, offset,
                          new[] { nullBitmapBuffer, valueBuffer }))
 {
 }
Example #4
0
 public void Visit(Time32Type actualType)
 {
     if (_expectedType is Time32Type expectedType &&
         expectedType.Unit == actualType.Unit)
     {
         _dataTypeMatch = true;
     }
 }
Example #5
0
            public void Visit(Time32Type type)
            {
                var builder = new Time32Array.Builder(type).Reserve(Length);

                for (var i = 0; i < Length; i++)
                {
                    builder.Append(i);
                }

                Array = builder.Build();
            }
 public void Visit(Time32Type type)
 {
     Result = FieldType.Build(
         Flatbuf.Type.Time,
         Flatbuf.Time.CreateTime(Builder, ToFlatBuffer(type.Unit)));
 }
Example #7
0
 /// <summary>
 /// Construct a new instance of the <see cref="Builder"/> class.
 /// </summary>
 public Builder(Time32Type type)
     : base()
 {
     DataType = type;
 }
Example #8
0
 public void Visit(Time32Type type) => GenerateArray <int, Time32Array>((v, n, c, nc, o) => new Time32Array(type, v, n, c, nc, o));
Example #9
0
 public void Visit(Time32Type type)
 {
     throw new NotImplementedException();
 }
Example #10
0
 public Time32Array Time32(Time32Type type, Action <Time32Array.Builder> action) =>
 Build <Time32Array, Time32Array.Builder>(
     new Time32Array.Builder(type), action);