- Timestamp:
- 10/01/13 12:08:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Block.cs
r9790 r10011 20 20 #endregion 21 21 22 22 using System; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 29 30 public class Block : CodeNode { 30 31 public override int MinimumArity { get { return 1; } } 31 public override int MaximumArity { get { return 10; } }32 public override int MaximumArity { get { return byte.MaxValue; } } 32 33 33 34 [Storable] … … 38 39 39 40 [StorableConstructor] 40 private Block(bool deserializing) : base(deserializing) { } 41 private Block(Block original, Cloner cloner) 42 : base(original, cloner) { 43 } 41 protected Block(bool deserializing) : base(deserializing) { } 42 protected Block(Block original, Cloner cloner) : base(original, cloner) { } 44 43 45 44 public Block() 46 45 : base("Block", "A group of statements.") { 47 this.Prefix = "{\r\n\t";48 this.Suffix = "\r\nexecute();\r\n}\r\n";46 Prefix = "{"; 47 Suffix = "}"; 49 48 } 50 49 … … 54 53 55 54 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 56 string result = ""; 57 foreach (ISymbolicExpressionTreeNode c in children) 58 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 59 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 55 string result = children.Aggregate(string.Empty, (current, c) => current + (Environment.NewLine + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees))); 56 return Prefix + result + Environment.NewLine + Suffix; 60 57 } 61 58 }
Note: See TracChangeset
for help on using the changeset viewer.