Esempio n. 1
0
        public IClassHierarchy Merge(IClassHierarchy ch)
        {
            if (this == ch)
            {
                return(this);
            }

            if (!(ch is ClassHierarchyImpl))
            {
                Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException("Can't merge java and non-java class hierarchies yet!"), LOGGER);
            }

            if (this.assemblies.Count == 0)
            {
                return(ch);
            }

            lock (_mergeLock)
            {
                ClassHierarchyImpl        chi       = (ClassHierarchyImpl)ch;
                MonotonicHashSet <string> otherJars = new MonotonicHashSet <string>();
                otherJars.AddAll(chi.assemblies);
                MonotonicHashSet <string> myJars = new MonotonicHashSet <string>();
                myJars.AddAll(this.assemblies);
                if (myJars.ContainsAll(otherJars))
                {
                    return(this);
                }
                if (otherJars.ContainsAll(myJars))
                {
                    return(ch);
                }
                myJars.Union(otherJars);
                return(new ClassHierarchyImpl(myJars.ToArray()));
            }
        }
Esempio n. 2
0
        public ICsClassHierarchy GetDefaultClassHierarchy(string[] assemblies, Type[] parameterParsers)
        {
            SetValuedKey key = new SetValuedKey(assemblies, parameterParsers);

            ICsClassHierarchy ret = null;
            defaultClassHierarchy.TryGetValue(key, out ret);
            if (ret == null)
            {
                ret = new ClassHierarchyImpl(assemblies, parameterParsers);
                defaultClassHierarchy.Add(key, ret);
            }
            return ret;
        }