Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/14/13 11:03:13 (11 years ago)
Author:
ascheibe
Message:

#2069 fixed cloning constructors and formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Block.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Block : CodeNode
    9     {
    10         public override int MinimumArity { get { return 1; } }
    11         public override int MaximumArity { get { return 10; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Block : CodeNode {
     8    public override int MinimumArity { get { return 1; } }
     9    public override int MaximumArity { get { return 10; } }
    1210
    13         [Storable]
    14         public override string Prefix { get; set; }
     11    [Storable]
     12    public override string Prefix { get; set; }
    1513
    16         [Storable]
    17         public override string Suffix { get; set; }
     14    [Storable]
     15    public override string Suffix { get; set; }
    1816
    19         [StorableConstructor]
    20         private Block(bool deserializing) : base(deserializing) { }
    21         private Block(Block original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "{\r\n\t";
    25             this.Suffix = "\r\nexecute();\r\n}\r\n";
    26         }
     17    [StorableConstructor]
     18    private Block(bool deserializing) : base(deserializing) { }
     19    private Block(Block original, Cloner cloner)
     20      : base(original, cloner) {
     21    }
    2722
    28         public Block()
    29             : base("Block", "A group of statements.")
    30         {
    31             this.Prefix = "{\r\n\t";
    32             this.Suffix = "\r\nexecute();\r\n}\r\n";
    33         }
     23    public Block()
     24      : base("Block", "A group of statements.") {
     25      this.Prefix = "{\r\n\t";
     26      this.Suffix = "\r\nexecute();\r\n}\r\n";
     27    }
    3428
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new Block(this, cloner);
    38         }
     29    public override IDeepCloneable Clone(Cloner cloner) {
     30      return new Block(this, cloner);
     31    }
    3932
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             string result = "";
    43             foreach (ISymbolicExpressionTreeNode c in children)
    44                 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees);
    45             return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix;
    46         }
     33    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     34      string result = "";
     35      foreach (ISymbolicExpressionTreeNode c in children)
     36        result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees);
     37      return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix;
    4738    }
     39  }
    4840}
Note: See TracChangeset for help on using the changeset viewer.