Changeset 15334 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ExpressionTable.cs
- Timestamp:
- 08/21/17 11:33:53 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP
- Property svn:ignore
-
old new 1 1 *.user 2 packages 3 TestResults
-
- Property svn:ignore
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ExpressionTable.cs
r15273 r15334 6 6 using Attributes; 7 7 using Data.Pool; 8 9 using HeuristicLab.Problems.ProgramSynthesis.Base.Extensions; 10 8 11 using Stack; 9 12 … … 124 127 } 125 128 126 private static bool IsSubclassOf(Type type, Type baseType) { 127 if (type == null || baseType == null || type == baseType) 128 return false; 129 130 if (baseType.IsGenericType == false) { 131 if (type.IsGenericType == false) 132 return type.IsSubclassOf(baseType); 133 } else { 134 baseType = baseType.GetGenericTypeDefinition(); 135 } 136 137 type = type.BaseType; 138 var objectType = typeof(object); 139 while (type != objectType && type != null) { 140 var curentType = type.IsGenericType ? type.GetGenericTypeDefinition() : type; 141 if (curentType == baseType) 142 return true; 143 144 type = type.BaseType; 145 } 146 147 return false; 148 } 129 149 130 150 131 private static IEnumerable<Type> GetExpressionTypes(Type baseType) { … … 152 133 from assemblyType in domainAssembly.GetTypes() 153 134 where !assemblyType.IsAbstract && 154 IsSubclassOf(assemblyType,baseType) &&135 assemblyType.IsSubclass(baseType) && 155 136 assemblyType.GetConstructor(Type.EmptyTypes) != null 156 137 select assemblyType;
Note: See TracChangeset
for help on using the changeset viewer.