示例#1
0
 /**
  * default constructor
  */
 public SSTRecord()
 {
     field_1_num_strings        = 0;
     field_2_num_unique_strings = 0;
     field_3_strings            = new IntMapper <UnicodeString>();
     deserializer = new SSTDeserializer(field_3_strings);
 }
示例#2
0
        // fix warning CS0169 "never used": int startOfSST, startOfRecord;

        public SSTSerializer(IntMapper<UnicodeString> strings, int numStrings, int numUniqueStrings)
        {
            this.strings = strings;
            _numStrings = numStrings;
            _numUniqueStrings = numUniqueStrings;

            int infoRecs = ExtSSTRecord.GetNumberOfInfoRecsForStrings(strings.Size);
            this.bucketAbsoluteOffsets = new int[infoRecs];
            this.bucketRelativeOffsets = new int[infoRecs];
        }
示例#3
0
        /**
         * Constructs an SST record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public SSTRecord(RecordInputStream in1)
        {
            // this method Is ALWAYS called after construction -- using
            // the nontrivial constructor, of course -- so this Is where
            // we initialize our fields
            field_1_num_strings        = in1.ReadInt();
            field_2_num_unique_strings = in1.ReadInt();
            field_3_strings            = new IntMapper <UnicodeString>();
            deserializer = new SSTDeserializer(field_3_strings);
            deserializer.ManufactureStrings(field_2_num_unique_strings, in1);
        }
示例#4
0
        // fix warning CS0169 "never used": int startOfSST, startOfRecord;

        public SSTSerializer(IntMapper <UnicodeString> strings, int numStrings, int numUniqueStrings)
        {
            this.strings      = strings;
            _numStrings       = numStrings;
            _numUniqueStrings = numUniqueStrings;

            int infoRecs = ExtSSTRecord.GetNumberOfInfoRecsForStrings(strings.Size);

            this.bucketAbsoluteOffsets = new int[infoRecs];
            this.bucketRelativeOffsets = new int[infoRecs];
        }
示例#5
0
        public void Use_int_as_discriminator()
        {
            var mapper = new IntMapper <BasePaymentModel>(
                x => x.PaymentNumber)
                         .Register <AchInputModel>(1)
                         .Register <CreditCardInputModel>(2)
                         .Register <PayPalInputModel>(3);

            var container = RoundTrip(
                new IntConverter(mapper, _resolver.GetResolvedPropertyName));

            CheckPolymorphicModels(container);
        }
示例#6
0
        public void TestContinuationWithNoOverlap()
        {
            byte[] header = ReadSampleHexData("evencontinuation.txt", "header", FAKE_SID);
            byte[] continueBytes = ReadSampleHexData("evencontinuation.txt", "continue1", ContinueRecord.sid);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));

            IntMapper strings = new IntMapper();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(2, in1);

            Assert.AreEqual("At a dinner party or", strings[0] + "");
            Assert.AreEqual("At a dinner party", strings[1] + "");
        }
示例#7
0
        public void TestSpanRichTextToPlainText()
        {
            byte[] header = ReadSampleHexData("richtextdata.txt", "header", FAKE_SID);
            byte[] continueBytes = ReadSampleHexData("richtextdata.txt", "continue1", ContinueRecord.sid);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));


            IntMapper strings = new IntMapper();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(1, in1);

            Assert.AreEqual("At a dinner party orAt At At ", strings[0] + "");
        }
示例#8
0
        public void TestStringAcross2Continuations()
        {
            byte[] header = ReadSampleHexData("stringacross2continuations.txt", "header", FAKE_SID);
            byte[] continue1 = ReadSampleHexData("stringacross2continuations.txt", "continue1", ContinueRecord.sid);
            byte[] continue2 = ReadSampleHexData("stringacross2continuations.txt", "continue2", ContinueRecord.sid);

            byte[] bytes = Concat(header, continue1);
            bytes = Concat(bytes, continue2);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(bytes);

            IntMapper strings = new IntMapper();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(2, in1);

            Assert.AreEqual("At a dinner party or", strings[0] + "");
            Assert.AreEqual("At a dinner partyAt a dinner party", strings[1] + "");
        }
示例#9
0
        public void TestExtendedStrings()
        {
            byte[] header = ReadSampleHexData("extendedtextstrings.txt", "rich-header", FAKE_SID);
            byte[] continueBytes = ReadSampleHexData("extendedtextstrings.txt", "rich-continue1", ContinueRecord.sid);
            RecordInputStream in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));

            IntMapper strings = new IntMapper();
            SSTDeserializer deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(1, in1);

            Assert.AreEqual("At a dinner party orAt At At ", strings[0].ToString());


            header = ReadSampleHexData("extendedtextstrings.txt", "norich-header", FAKE_SID);
            continueBytes = ReadSampleHexData("extendedtextstrings.txt", "norich-continue1", ContinueRecord.sid);
            in1 = TestcaseRecordInputStream.Create(Concat(header, continueBytes));

            strings = new IntMapper();
            deserializer = new SSTDeserializer(strings);
            deserializer.ManufactureStrings(1, in1);

            Assert.AreEqual("At a dinner party orAt At At ", strings[0] + "");
        }
示例#10
0
 private static UnicodeString GetUnicodeString(IntMapper<UnicodeString> strings, int index)
 {
     return (UnicodeString)strings[index];
 }
示例#11
0
        /**
         * Constructs an SST record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public SSTRecord(RecordInputStream in1)
        {
            // this method Is ALWAYS called after construction -- using
            // the nontrivial constructor, of course -- so this Is where
            // we initialize our fields
            field_1_num_strings = in1.ReadInt();
            field_2_num_unique_strings = in1.ReadInt();
            field_3_strings = new IntMapper<UnicodeString>();
            deserializer = new SSTDeserializer(field_3_strings);
            deserializer.ManufactureStrings(field_2_num_unique_strings, in1);
        }
示例#12
0
 /**
  * default constructor
  */
 public SSTRecord()
 {
     field_1_num_strings = 0;
     field_2_num_unique_strings = 0;
     field_3_strings = new IntMapper<UnicodeString>();
     deserializer = new SSTDeserializer(field_3_strings);
 }
示例#13
0
 public SSTDeserializer(IntMapper <UnicodeString> strings)
 {
     this.strings = strings;
 }
示例#14
0
 public SSTDeserializer(IntMapper<UnicodeString> strings)
 {
     this.strings = strings;
 }
示例#15
0
 public void SetUp()
 {
     strings = new IntMapper();
 }
示例#16
0
 private static UnicodeString GetUnicodeString(IntMapper <UnicodeString> strings, int index)
 {
     return((UnicodeString)strings[index]);
 }
示例#17
0
 static public void AddToStringTable(IntMapper<UnicodeString> strings, UnicodeString str)
 {
     strings.Add(str);
 }
示例#18
0
 static public void AddToStringTable(IntMapper <UnicodeString> strings, UnicodeString str)
 {
     strings.Add(str);
 }
示例#19
0
 public SSTDeserializer(IntMapper strings)
 {
     this.strings = strings;
 }