Пример #1
0
        public void testParseLanguageWithoutAccreditation()
        {
            string adl = System.IO.File.ReadAllText(@"..\..\..\..\java-libs\adl-parser\src\test\resources\adl-test-entry.archetype_language_no_accreditation.test.adl");

            se.acode.openehr.parser.ADLParser  parser    = new se.acode.openehr.parser.ADLParser(adl);
            org.openehr.am.archetype.Archetype archetype = parser.parse();
            Assert.IsNotNull(archetype);
            java.util.Map translations = archetype.getTranslations();
            Assert.IsNotNull(translations);

            TranslationDetails td = (TranslationDetails)translations.get("de");

            Assert.IsNotNull(td);
            java.util.Map map = td.getAuthor();
            Assert.IsNotNull(map);
            Assert.AreEqual("Harry Potter", map.get("name"));
            Assert.AreEqual("*****@*****.**",
                            map.get("email"));

            Assert.AreEqual(null, td.getAccreditation());

            map = td.getOtherDetails();
            Assert.AreEqual("Ron Weasley", map.get("review 1"));
            Assert.AreEqual("Rubeus Hagrid", map.get("review 2"));
        }
Пример #2
0
        public override bool Equals(object o)
        {
            if (o == null || !(o is Map))
            {
                return(false);
            }
            Map m = (Map)o;

            if (size() != m.size())
            {
                return(false);
            }
            for (Iterator it = keySet().iterator(); it.hasNext();)
            {
                object k = it.next();
                if (!m.containsKey(k))
                {
                    return(false);
                }
                object v1 = get(k);
                object v2 = m.get(k);
                if (!(v1 == null ? v2 == null : v1.Equals(v2)))
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #3
0
 public virtual void putAll(Map m)
 {
     for (Iterator it = m.keySet().iterator(); it.hasNext();)
     {
         object key = it.next();
         this.put(key, m.get(key));
     }
 }
Пример #4
0
 public static void forEach(Map @this, java.util.function.BiConsumer biconsumer)
 {
     java.util.Iterator i = @this.keySet().iterator();
     while (i.hasNext())
     {
         object key   = i.next();
         object value = @this.get(key);
         biconsumer.accept(key, value);
     }
 }
Пример #5
0
        public static Dictionary <K, V> ToDictionary <K, V>(this java.util.Map map)
        {
            var dict     = new Dictionary <K, V>();
            var iterator = map.keySet().iterator();

            while (iterator.hasNext())
            {
                var key = (K)iterator.next();
                dict.Add(key, (V)map.get(key));
            }
            return(dict);
        }
Пример #6
0
 public static object getOrDefault(Map @this, object key, object def)
 {
     return(@this.containsKey(key) ? @this.get(key) : def);
 }