Changeset 15334 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/PushProgram.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/PushProgram.cs
r15189 r15334 5 5 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions { 6 6 using System.Diagnostics; 7 using System.Diagnostics.CodeAnalysis; 8 7 9 using Constants; 8 10 using Data.Pool; … … 38 40 39 41 [StorableConstructor] 40 p ublicPushProgram(bool deserializing) : this(EmptyExpressions) { }42 private PushProgram(bool deserializing) : this(EmptyExpressions) { } 41 43 42 44 public PushProgram(IReadOnlyList<Expression> expressions) { … … 67 69 } 68 70 69 void IPooledObject.Init() { }70 71 71 void IPooledObject.Reset() { 72 72 expressions = null; … … 159 159 [NonSerialized] 160 160 private int? hashCode; 161 [SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")] 161 162 public override int GetHashCode() { 162 163 if (hashCode == null) hashCode = expressions.HashCode(); … … 256 257 get 257 258 { 258 if (branches == null) { 259 branches = 1; 260 261 for (var i = 0; i < Count; i++) { 262 var expression = expressions[i]; 263 264 if (!expression.IsProgram) 265 continue; 266 267 var program = (PushProgram)expression; 268 branches += program.Branches; 269 } 270 } 271 259 if (branches == null) CountBranches(); 272 260 return branches.Value; 261 } 262 } 263 264 private void CountBranches() { 265 branches = 1; 266 267 for (var i = 0; i < Count; i++) { 268 var expression = expressions[i]; 269 270 if (!expression.IsProgram) 271 continue; 272 273 var program = (PushProgram)expression; 274 branches += program.Branches; 273 275 } 274 276 }
Note: See TracChangeset
for help on using the changeset viewer.