/// <summary> /// /// </summary> /// <param name="cls">The class</param> /// <param name="classBehavior">True for class behavior, false for instance.</param> /// <param name="directProtocols">Directly defined by the class.</param> /// <param name="inheritedProtocols">Indirectly defined by the class, because the direct protocols inherit from those.</param> /// <param name="implementedProtocols">Protocols implemented by the class or the class' superclasses.</param> /// <returns></returns> private void GetClassProtocols(Definitions.Implementation.Class cls, bool classBehavior, out IEnumerable<string> directProtocols, out HashSet<string> inheritedProtocols, out HashSet<string> implementedProtocols) { directProtocols = (classBehavior ? cls.ImplementedClassProtocols : cls.ImplementedInstanceProtocols); inheritedProtocols = new HashSet<string>(); implementedProtocols = new HashSet<string>(); foreach (string protocolName in directProtocols) { var protocol = this.SmalltalkSystem.SystemDescription.Protocols.FirstOrDefault(p => p.Name == protocolName); if (protocol != null) { foreach (var p in protocol.AllConformsTo()) inheritedProtocols.Add(p); } } foreach (var c in cls.WithAllSuperclasses()) { foreach (var p in (classBehavior ? c.ImplementedClassProtocols : c.ImplementedInstanceProtocols)) implementedProtocols.Add(p); } }