Beispiel #1
0
        public static void AllocateRecords(ICollection <DynamicRecord> target, object array, DynamicRecordAllocator recordAllocator, bool allowStorePointsAndTemporal)
        {
            if (!array.GetType().IsArray)
            {
                throw new System.ArgumentException(array + " not an array");
            }

            Type type = array.GetType().GetElementType();

            if (type.Equals(typeof(string)))
            {
                AllocateFromString(target, ( string[] )array, recordAllocator);
            }
            else if (type.Equals(typeof(PointValue)))
            {
                AllocateFromCompositeType(target, GeometryType.encodePointArray(( PointValue[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.POINT_PROPERTIES);
            }
            else if (type.Equals(typeof(LocalDate)))
            {
                AllocateFromCompositeType(target, TemporalType.encodeDateArray(( LocalDate[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.TEMPORAL_PROPERTIES);
            }
            else if (type.Equals(typeof(LocalTime)))
            {
                AllocateFromCompositeType(target, TemporalType.encodeLocalTimeArray(( LocalTime[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.TEMPORAL_PROPERTIES);
            }
            else if (type.Equals(typeof(DateTime)))
            {
                AllocateFromCompositeType(target, TemporalType.encodeLocalDateTimeArray(( DateTime[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.TEMPORAL_PROPERTIES);
            }
            else if (type.Equals(typeof(OffsetTime)))
            {
                AllocateFromCompositeType(target, TemporalType.encodeTimeArray(( OffsetTime[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.TEMPORAL_PROPERTIES);
            }
            else if (type.Equals(typeof(ZonedDateTime)))
            {
                AllocateFromCompositeType(target, TemporalType.encodeDateTimeArray(( ZonedDateTime[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.TEMPORAL_PROPERTIES);
            }
            else if (type.Equals(typeof(DurationValue)))
            {
                AllocateFromCompositeType(target, TemporalType.encodeDurationArray(( DurationValue[] )array), recordAllocator, allowStorePointsAndTemporal, Capability.TEMPORAL_PROPERTIES);
            }
            else
            {
                AllocateFromNumbers(target, array, recordAllocator);
            }
        }