Changeset 5903 for trunk/sources/HeuristicLab.PluginInfrastructure
- Timestamp:
- 03/31/11 10:42:06 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs
r5850 r5903 225 225 } 226 226 227 internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable, bool a llTypes) {227 internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable, bool assignableToAllTypes) { 228 228 IEnumerable<Type> result = GetTypes(types.First(), onlyInstantiable); 229 229 foreach (Type type in types.Skip(1)) { 230 230 IEnumerable<Type> discoveredTypes = GetTypes(type, onlyInstantiable); 231 if (a llTypes) result = result.Intersect(discoveredTypes);231 if (assignableToAllTypes) result = result.Intersect(discoveredTypes); 232 232 else result = result.Union(discoveredTypes); 233 233 } 234 235 if (!allTypes) return result.Distinct();236 234 return result; 237 235 } … … 255 253 } 256 254 257 internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription pluginDescription, bool onlyInstantiable, bool a llTypes) {255 internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription pluginDescription, bool onlyInstantiable, bool assignableToAllTypes) { 258 256 IEnumerable<Type> result = GetTypes(types.First(), pluginDescription, onlyInstantiable); 259 257 foreach (Type type in types.Skip(1)) { 260 258 IEnumerable<Type> discoveredTypes = GetTypes(type, pluginDescription, onlyInstantiable); 261 if (a llTypes) result = result.Intersect(discoveredTypes);259 if (assignableToAllTypes) result = result.Intersect(discoveredTypes); 262 260 else result = result.Union(discoveredTypes); 263 261 } 264 265 if (!allTypes) return result.Distinct();266 262 return result; 267 263 } … … 341 337 return GetTypes(type, onlyInstantiable); 342 338 } 343 IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, bool onlyInstantiable, bool a llTypes) {344 return GetTypes(types, onlyInstantiable, a llTypes);339 IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, bool onlyInstantiable, bool assignableToAllTypes) { 340 return GetTypes(types, onlyInstantiable, assignableToAllTypes); 345 341 } 346 342 … … 348 344 return GetTypes(type, plugin, onlyInstantiable); 349 345 } 350 IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable, bool a llTypes) {351 return GetTypes(types, plugin, onlyInstantiable, a llTypes);346 IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable, bool assignableToAllTypes) { 347 return GetTypes(types, plugin, onlyInstantiable, assignableToAllTypes); 352 348 } 353 349 -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IApplicationManager.cs
r5850 r5903 65 65 /// <param name="types">The types to discover.</param> 66 66 /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param> 67 /// <param name="a llTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>67 /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param> 68 68 /// <returns>An enumerable of discovered types.</returns> 69 IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable = true, bool a llTypes = true);69 IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable = true, bool assignableToAllTypes = true); 70 70 71 71 /// <summary> … … 84 84 /// <param name="plugin">The declaring plugin.</param> 85 85 /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param> 86 /// /// <param name="a llTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>86 /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param> 87 87 /// <returns>An enumerable of discovered types.</returns> 88 IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool a llTypes = true);88 IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool assignableToAllTypes = true); 89 89 90 90 /// <summary> -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs
r5850 r5903 89 89 /// (interfaces, abstract classes... are not returned)</remarks> 90 90 /// <returns>Enumerable of the discovered types.</returns> 91 public IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable = true, bool a llTypes = true) {91 public IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable = true, bool assignableToAllTypes = true) { 92 92 IEnumerable<Type> result = GetTypes(types.First(), onlyInstantiable); 93 93 foreach (Type type in types.Skip(1)) { 94 94 IEnumerable<Type> discoveredTypes = GetTypes(type, onlyInstantiable); 95 if (a llTypes) result = result.Intersect(discoveredTypes);95 if (assignableToAllTypes) result = result.Intersect(discoveredTypes); 96 96 else result = result.Union(discoveredTypes); 97 97 } 98 99 if (!allTypes) return result.Distinct();100 98 return result; 101 99 } … … 194 192 /// <returns></returns> 195 193 /// <throws>NotSupportedException</throws> 196 public IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool a llTypes = true) {194 public IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool assignableToAllTypes = true) { 197 195 throw new NotSupportedException("LightweightApplicationManager doesn't support type discovery for plugins."); 198 196 }
Note: See TracChangeset
for help on using the changeset viewer.