Пример #1
0
        // ReSharper restore NonLocalizedString

        // ReSharper disable NonLocalizedString
        public void WriteXml(XmlWriter writer)
        {
            if (Name != null)
            {
                writer.WriteAttributeString("name", Name);
            }
            if (Caption != null)
            {
                writer.WriteAttributeString("caption", Caption);
            }
            if (Format != null)
            {
                writer.WriteAttributeString("format", Format);
            }
            if (Hidden)
            {
                writer.WriteAttributeString("hidden", "true");
            }
            if (SortIndex != null)
            {
                writer.WriteAttributeString("sortindex", SortIndex.ToString());
            }
            if (SortDirection != null)
            {
                writer.WriteAttributeString("sortdirection", SortDirection.ToString());
            }
            if (Total != TotalOperation.GroupBy)
            {
                writer.WriteAttributeString("total", Total.ToString());
            }
        }
Пример #2
0
        public void TestIndexByte()
        {
            using (var validDocsBitmap = new UnmanagedLib.BitVector(Pool))
            {
                validDocsBitmap.EnsureCapacity(1);
                validDocsBitmap.ChangeAll(true);

                using (var data = new ColumnData<byte>(DbType.Byte, Pool))
                {
                    data.EnsureCapacity(4);

                    data.DataArray.GetBlock(0)[0] = 1;
                    data.DataArray.GetBlock(0)[1] = 3;
                    data.DataArray.GetBlock(0)[2] = 0;
                    data.DataArray.GetBlock(0)[3] = 255;

                    data.NotNulls.Set(0);
                    data.NotNulls.Set(1);
                    data.NotNulls.Set(2);
                    data.NotNulls.Clear(3);

                    var index = new SortIndex();
                    index.Update(data, validDocsBitmap, 4);

                    Assert.AreEqual(4, index.OrderData.Length);

                    // expected resulting order: 3, 2, 0, 1
                    // item 3 goes on top because it is marked as NULL
                    Assert.AreEqual(3, index.OrderData[0]);
                    Assert.AreEqual(2, index.OrderData[1]);
                    Assert.AreEqual(0, index.OrderData[2]);
                    Assert.AreEqual(1, index.OrderData[3]);
                }
            }
        }
        public DocumentDataContainerEnumerator_IndexScan(
            int untrimmedCount,
            DriverRowData rowData,
            DocumentDataContainer dataContainer,
            IReadOnlyList<FieldMetadata> fields,
            int countOfMainFields,
            SortIndex sortIndex,
            bool descending)
            : base(untrimmedCount, rowData, dataContainer, fields, countOfMainFields)
        {
            if (sortIndex == null)
            {
                throw new ArgumentNullException("sortIndex");
            }

            // note that we ignore value of sortIndex.IsValid here
            // that's because invalidation of index only happens when the data is stale
            // we only check state of an index and optionally update it in the beginning of processing pipeline
            if (sortIndex.OrderData == null || sortIndex.OrderData.Length > untrimmedCount)
            {
                throw new ArgumentException("Index on column is in invalid state", "sortIndex");
            }

            m_sortIndex = sortIndex;
            m_descending = descending;
            PositionInIndex = descending ? m_sortIndex.ValidDocCount : -1;

            ReadStructureAndTakeLocks();
        }
Пример #4
0
        public void TestIndexByte()
        {
            using (var validDocsBitmap = new UnmanagedLib.BitVector(Pool))
            {
                validDocsBitmap.EnsureCapacity(1);
                validDocsBitmap.ChangeAll(true);

                using (var data = new ColumnData <byte>(DbType.Byte, Pool))
                {
                    data.EnsureCapacity(4);

                    data.DataArray.GetBlock(0)[0] = 1;
                    data.DataArray.GetBlock(0)[1] = 3;
                    data.DataArray.GetBlock(0)[2] = 0;
                    data.DataArray.GetBlock(0)[3] = 255;

                    data.NotNulls.Set(0);
                    data.NotNulls.Set(1);
                    data.NotNulls.Set(2);
                    data.NotNulls.Clear(3);

                    var index = new SortIndex();
                    index.Update(data, validDocsBitmap, 4);

                    Assert.AreEqual(4, index.OrderData.Length);

                    // expected resulting order: 3, 2, 0, 1
                    // item 3 goes on top because it is marked as NULL
                    Assert.AreEqual(3, index.OrderData[0]);
                    Assert.AreEqual(2, index.OrderData[1]);
                    Assert.AreEqual(0, index.OrderData[2]);
                    Assert.AreEqual(1, index.OrderData[3]);
                }
            }
        }
 public void Sort(SortIndex SortBy, bool ascending)
 {
     switch (SortBy)
     {
     case SortIndex.EPC:
         m_items.Sort(new LvEpcSorter(ascending));
         break;
     }
 }
Пример #6
0
        public override int GetHashCode()
        {
            var hashCode = 996675367;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Field);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Value);

            hashCode = hashCode * -1521134295 + ConnectionValueType.GetHashCode();
            hashCode = hashCode * -1521134295 + SortIndex.GetHashCode();

            return(hashCode);
        }
Пример #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Name.GetHashCode();
         result = (result * 397) ^ (Caption != null ? Caption.GetHashCode() : 0);
         result = (result * 397) ^ (Format != null ? Format.GetHashCode() : 0);
         result = (result * 397) ^ Hidden.GetHashCode();
         result = (result * 397) ^ (SortIndex != null ? SortIndex.GetHashCode() : 0);
         result = (result * 397) ^ (SortDirection != null ? SortDirection.GetHashCode() : 0);
         result = (result * 397) ^ Total.GetHashCode();
         return(result);
     }
 }
Пример #8
0
        public SortIndexManager(DocumentDataContainer documentStore)
        {
            if (documentStore == null)
            {
                throw new ArgumentNullException("documentStore");
            }

            m_documentStore = documentStore;
            m_fieldIdToIndexHandle = new ConcurrentDictionary<int, int>();

            if (m_documentStore.FieldIdToColumnStore.Count != m_documentStore.DocDesc.Fields.Length)
            {
                throw new Exception("Internal error: fieldid->colstore map and array of fields in document descriptor have different lengths");
            }

            m_fieldIndexes = new SortIndex[m_documentStore.FieldIdToColumnStore.Count];
            for (var ordinal = 0; ordinal < m_fieldIndexes.Length; ordinal++)
            {
                m_fieldIndexes[ordinal] = new SortIndex();
                m_fieldIdToIndexHandle[m_documentStore.DocDesc.Fields[ordinal]] = ordinal;
            }
        }
Пример #9
0
        internal void UpdateIndex(int fieldId, SortIndex index, int count)
        {
            if (!index.IsValid)
            {
                var columnStore = m_documentStore.RequireColumnStore(fieldId);

                var method = typeof (SortIndex).GetMethod("Update").MakeGenericMethod(columnStore.ElementType);

                m_documentStore.StructureLock.EnterWriteLock();
                try
                {
                    method.Invoke(index, new object[] { columnStore, m_documentStore.ValidDocumentsBitmap, count });
                }
                catch (TargetInvocationException e)
                {
                    throw e.InnerException;
                }
                finally
                {
                    m_documentStore.StructureLock.ExitWriteLock();
                }
            }
        }
Пример #10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (MaxDistanceValid != false)
            {
                hash ^= MaxDistanceValid.GetHashCode();
            }
            if (SensorIdValid != false)
            {
                hash ^= SensorIdValid.GetHashCode();
            }
            if (RadarPowerValid != false)
            {
                hash ^= RadarPowerValid.GetHashCode();
            }
            if (OutputTypeValid != false)
            {
                hash ^= OutputTypeValid.GetHashCode();
            }
            if (SendQualityValid != false)
            {
                hash ^= SendQualityValid.GetHashCode();
            }
            if (SendExtInfoValid != false)
            {
                hash ^= SendExtInfoValid.GetHashCode();
            }
            if (SortIndexValid != false)
            {
                hash ^= SortIndexValid.GetHashCode();
            }
            if (StoreInNvmValid != false)
            {
                hash ^= StoreInNvmValid.GetHashCode();
            }
            if (CtrlRelayValid != false)
            {
                hash ^= CtrlRelayValid.GetHashCode();
            }
            if (RcsThresholdValid != false)
            {
                hash ^= RcsThresholdValid.GetHashCode();
            }
            if (MaxDistance != 0)
            {
                hash ^= MaxDistance.GetHashCode();
            }
            if (SensorId != 0)
            {
                hash ^= SensorId.GetHashCode();
            }
            if (OutputType != 0)
            {
                hash ^= OutputType.GetHashCode();
            }
            if (RadarPower != 0)
            {
                hash ^= RadarPower.GetHashCode();
            }
            if (CtrlRelay != 0)
            {
                hash ^= CtrlRelay.GetHashCode();
            }
            if (SendExtInfo != false)
            {
                hash ^= SendExtInfo.GetHashCode();
            }
            if (SendQuality != false)
            {
                hash ^= SendQuality.GetHashCode();
            }
            if (SortIndex != 0)
            {
                hash ^= SortIndex.GetHashCode();
            }
            if (StoreInNvm != 0)
            {
                hash ^= StoreInNvm.GetHashCode();
            }
            if (RcsThreshold != 0)
            {
                hash ^= RcsThreshold.GetHashCode();
            }
            if (InputSendInterval != 0UL)
            {
                hash ^= InputSendInterval.GetHashCode();
            }
            return(hash);
        }
Пример #11
0
 public int CompareTo(object obj)
 {
     return(SortIndex.CompareTo((obj as GroupingDetails).SortIndex));
 }
Пример #12
0
 public FavoritesItemSorter(SortIndex columnIndex, bool ascending)
 {
     _colIndex  = columnIndex;
     _ascending = ascending;
 }