public IClassHierarchy Merge(IClassHierarchy ch) { if (this == ch) { return(this); } if (!(ch is ClassHierarchyImpl)) { Org.Apache.Reef.Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException("Can't merge java and non-java class hierarchies yet!"), LOGGER); } if (this.assemblies.Count == 0) { return(ch); } 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.AddAll(otherJars); return(new ClassHierarchyImpl(myJars.ToArray())); }
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); }