public override int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
        {
            int n1 = WritableUtils.DecodeVIntSize(b1[s1]);
            int n2 = WritableUtils.DecodeVIntSize(b2[s2]);
            IList <KeyFieldHelper.KeyDescription> allKeySpecs = keyFieldHelper.KeySpecs();

            if (allKeySpecs.Count == 0)
            {
                return(CompareBytes(b1, s1 + n1, l1 - n1, b2, s2 + n2, l2 - n2));
            }
            int[] lengthIndicesFirst  = keyFieldHelper.GetWordLengths(b1, s1 + n1, s1 + l1);
            int[] lengthIndicesSecond = keyFieldHelper.GetWordLengths(b2, s2 + n2, s2 + l2);
            foreach (KeyFieldHelper.KeyDescription keySpec in allKeySpecs)
            {
                int startCharFirst = keyFieldHelper.GetStartOffset(b1, s1 + n1, s1 + l1, lengthIndicesFirst
                                                                   , keySpec);
                int endCharFirst = keyFieldHelper.GetEndOffset(b1, s1 + n1, s1 + l1, lengthIndicesFirst
                                                               , keySpec);
                int startCharSecond = keyFieldHelper.GetStartOffset(b2, s2 + n2, s2 + l2, lengthIndicesSecond
                                                                    , keySpec);
                int endCharSecond = keyFieldHelper.GetEndOffset(b2, s2 + n2, s2 + l2, lengthIndicesSecond
                                                                , keySpec);
                int result;
                if ((result = CompareByteSequence(b1, startCharFirst, endCharFirst, b2, startCharSecond
                                                  , endCharSecond, keySpec)) != 0)
                {
                    return(result);
                }
            }
            return(0);
        }
Exemplo n.º 2
0
            public override int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
            {
                int n1 = WritableUtils.DecodeVIntSize(b1[s1]);
                int n2 = WritableUtils.DecodeVIntSize(b2[s2]);

                return(CompareBytes(b1, s1 + n1, l1 - n1, b2, s2 + n2, l2 - n2));
            }
Exemplo n.º 3
0
            public virtual int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
            {
                int n1;
                int n2;

                if (readLen)
                {
                    n1 = WritableUtils.DecodeVIntSize(b1[s1]);
                    n2 = WritableUtils.DecodeVIntSize(b2[s2]);
                }
                else
                {
                    n1 = 0;
                    n2 = 0;
                }
                for (int i = s1 + n1; i < l1 - n1; ++i)
                {
                    NUnit.Framework.Assert.AreEqual("Invalid key at " + s1, (int)TestMapCollection.KeyWritable
                                                    .keyFill, b1[i]);
                }
                for (int i_1 = s2 + n2; i_1 < l2 - n2; ++i_1)
                {
                    NUnit.Framework.Assert.AreEqual("Invalid key at " + s2, (int)TestMapCollection.KeyWritable
                                                    .keyFill, b2[i_1]);
                }
                return(l1 - l2);
            }
            public virtual int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
            {
                int n1 = WritableUtils.DecodeVIntSize(b1[s1]);
                int n2 = WritableUtils.DecodeVIntSize(b2[s2]);

                return(-1 * WritableComparator.CompareBytes(b1, s1 + n1, l1 - n1, b2, s2 + n2, l2
                                                            - n2));
            }