Exemple #1
0
        public void TestImport1()
        {
            StrStrHashMap map = new StrStrHashMap();

            map.Add("a", "1");
            TestMap(map);
        }
Exemple #2
0
        public void TestImport3()
        {
            StrStrHashMap map = new StrStrHashMap();

            map.Add("a", "1");
            map.Add("b", "2");
            map.Add("c", "3");
            TestMap(map);
        }
Exemple #3
0
        public override Object ImportValue(StructValue sv)
        {
            StrStrHashMap map = new StrStrHashMap();

            Object[] keysAndValues = ( Object[] )sv.Get(field);
            int      n             = keysAndValues.Length;
            int      index         = 0;

            while (index < n)
            {
                String key   = ( String )keysAndValues[index++];
                String value = ( String )keysAndValues[index++];
                map.Add(key, value);
            }

            return(map);
        }
Exemple #4
0
        // no tests for null keys as string? isn't allowed

        public void TestMap(StrStrHashMap map)
        {
            XType type = new XType("map");

            Class2TypeMap class2type = new Class2TypeMap();

            StrStrHashMapSerializer.Init(type, class2type);
            ImportExportHelper helper = type.GetImportExportHelper();

            StructValue sv = helper.ExportValue(vf, map);

            Assert.AreEqual(sv.GetXType, type);

            StrStrHashMap map2 = (StrStrHashMap)helper.ImportValue(sv);

            Assert.AreEqual(map, map2);
        }
Exemple #5
0
        public override StructValue ExportValue(ValueFactory vf, Object value)
        {
            StrStrHashMap map = ( StrStrHashMap )value;

            Object[] keysAndValues = new Object[map.Count * 2];
            int      index         = 0;

            foreach (KeyValuePair <String, String> me in map)
            {
                keysAndValues[index++] = me.Key;
                keysAndValues[index++] = me.Value;
            }

            StructValue sv = new StructValue(type, vf);

            sv.Add(field, keysAndValues);
            return(sv);
        }
Exemple #6
0
        public void TestImport0()
        {
            StrStrHashMap map = new StrStrHashMap();

            TestMap(map);
        }
Exemple #7
0
 /// <summary>
 /// Constructs a StrStrHashMap initialized from another
 /// </summary>
 /// <param name="other"></param>
 public StrStrHashMap(StrStrHashMap other)
     : base(other)
 {
 }