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

Location:
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/Number.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Number : CodeNode
    9     {
    10         public override int MinimumArity { get { return 0; } }
    11         public override int MaximumArity { get { return 0; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Number : CodeNode {
     8    public override int MinimumArity { get { return 0; } }
     9    public override int MaximumArity { get { return 0; } }
    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 Number(bool deserializing) : base(deserializing) { }
    21         private Number(Number original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private Number(bool deserializing) : base(deserializing) { }
     19    private Number(Number original, Cloner cloner)
     20      : base(original, cloner) {
     21    }
    2722
    28         public Number()
    29             : base("Number", "A Number.")
    30         {
    31             this.Prefix = "";
    32             this.Suffix = "";
    33         }
     23    public Number()
     24      : base("Number", "A Number.") {
     25      this.Prefix = "";
     26      this.Suffix = "";
     27    }
    3428
    35         public override ISymbolicExpressionTreeNode CreateTreeNode()
    36         {
    37            
    38             return new NumberTreeNode();
    39         }
     29    public override ISymbolicExpressionTreeNode CreateTreeNode() {
    4030
    41         public override IDeepCloneable Clone(Cloner cloner)
    42         {
    43             return new Number(this, cloner);
    44         }
     31      return new NumberTreeNode();
     32    }
    4533
    46         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    47         {
    48             return " " + ((NumberTreeNode)node).Value + " ";
    49         }
     34    public override IDeepCloneable Clone(Cloner cloner) {
     35      return new Number(this, cloner);
    5036    }
     37
     38    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     39      return " " + ((NumberTreeNode)node).Value + " ";
     40    }
     41  }
    5142}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/Numerical Operators/Addition.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Addition : CodeNode
    9     {
    10         public override int MinimumArity { get { return 0; } }
    11         public override int MaximumArity { get { return 0; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Addition : CodeNode {
     8    public override int MinimumArity { get { return 0; } }
     9    public override int MaximumArity { get { return 0; } }
    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 Addition(bool deserializing) : base(deserializing) { }
    21         private Addition(Addition original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "+";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private Addition(bool deserializing) : base(deserializing) { }
     19    private Addition(Addition original, Cloner cloner)
     20      : base(original, cloner) {
    2721
    28         public Addition()
    29             : base("Addition", "Addition operator.")
    30         {
    31             this.Prefix = "+";
    32             this.Suffix = "";
    33         }
     22    }
    3423
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new Addition(this, cloner);
    38         }
     24    public Addition()
     25      : base("Addition", "Addition operator.") {
     26      this.Prefix = "+";
     27      this.Suffix = "";
     28    }
    3929
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             return this.Prefix + this.Suffix;
    43         }
     30    public override IDeepCloneable Clone(Cloner cloner) {
     31      return new Addition(this, cloner);
    4432    }
     33
     34    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     35      return this.Prefix + this.Suffix;
     36    }
     37  }
    4538}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/Numerical Operators/Division.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Division : CodeNode
    9     {
    10         public override int MinimumArity { get { return 0; } }
    11         public override int MaximumArity { get { return 0; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Division : CodeNode {
     8    public override int MinimumArity { get { return 0; } }
     9    public override int MaximumArity { get { return 0; } }
    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 Division(bool deserializing) : base(deserializing) { }
    21         private Division(Division original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "/";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private Division(bool deserializing) : base(deserializing) { }
     19    private Division(Division original, Cloner cloner)
     20      : base(original, cloner) {
    2721
    28         public Division()
    29             : base("Division", "Division operator.")
    30         {
    31             this.Prefix = "/";
    32             this.Suffix = "";
    33         }
     22    }
    3423
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new Division(this, cloner);
    38         }
     24    public Division()
     25      : base("Division", "Division operator.") {
     26      this.Prefix = "/";
     27      this.Suffix = "";
     28    }
    3929
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             return this.Prefix + this.Suffix;
    43         }
     30    public override IDeepCloneable Clone(Cloner cloner) {
     31      return new Division(this, cloner);
    4432    }
     33
     34    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     35      return this.Prefix + this.Suffix;
     36    }
     37  }
    4538}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/Numerical Operators/Modulus.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Modulus : CodeNode
    9     {
    10         public override int MinimumArity { get { return 0; } }
    11         public override int MaximumArity { get { return 0; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Modulus : CodeNode {
     8    public override int MinimumArity { get { return 0; } }
     9    public override int MaximumArity { get { return 0; } }
    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 Modulus(bool deserializing) : base(deserializing) { }
    21         private Modulus(Modulus original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "%";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private Modulus(bool deserializing) : base(deserializing) { }
     19    private Modulus(Modulus original, Cloner cloner)
     20      : base(original, cloner) {
    2721
    28         public Modulus()
    29             : base("Modulus", "Modulus operator.")
    30         {
    31             this.Prefix = "%";
    32             this.Suffix = "";
    33         }
     22    }
    3423
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new Modulus(this, cloner);
    38         }
     24    public Modulus()
     25      : base("Modulus", "Modulus operator.") {
     26      this.Prefix = "%";
     27      this.Suffix = "";
     28    }
    3929
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             return this.Prefix + this.Suffix;
    43         }
     30    public override IDeepCloneable Clone(Cloner cloner) {
     31      return new Modulus(this, cloner);
    4432    }
     33
     34    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     35      return this.Prefix + this.Suffix;
     36    }
     37  }
    4538}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/Numerical Operators/Multiplication.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Multiplication : CodeNode
    9     {
    10         public override int MinimumArity { get { return 0; } }
    11         public override int MaximumArity { get { return 0; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Multiplication : CodeNode {
     8    public override int MinimumArity { get { return 0; } }
     9    public override int MaximumArity { get { return 0; } }
    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 Multiplication(bool deserializing) : base(deserializing) { }
    21         private Multiplication(Multiplication original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "*";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private Multiplication(bool deserializing) : base(deserializing) { }
     19    private Multiplication(Multiplication original, Cloner cloner)
     20      : base(original, cloner) {
    2721
    28         public Multiplication()
    29             : base("Multiplication", "Multiplication operator.")
    30         {
    31             this.Prefix = "*";
    32             this.Suffix = "";
    33         }
     22    }
    3423
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new Multiplication(this, cloner);
    38         }
     24    public Multiplication()
     25      : base("Multiplication", "Multiplication operator.") {
     26      this.Prefix = "*";
     27      this.Suffix = "";
     28    }
    3929
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             return this.Prefix + this.Suffix;
    43         }
     30    public override IDeepCloneable Clone(Cloner cloner) {
     31      return new Multiplication(this, cloner);
    4432    }
     33
     34    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     35      return this.Prefix + this.Suffix;
     36    }
     37  }
    4538}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/Numerical Operators/Subtraction.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class Subtraction : CodeNode
    9     {
    10         public override int MinimumArity { get { return 0; } }
    11         public override int MaximumArity { get { return 0; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class Subtraction : CodeNode {
     8    public override int MinimumArity { get { return 0; } }
     9    public override int MaximumArity { get { return 0; } }
    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 Subtraction(bool deserializing) : base(deserializing) { }
    21         private Subtraction(Subtraction original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "-";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private Subtraction(bool deserializing) : base(deserializing) { }
     19    private Subtraction(Subtraction original, Cloner cloner)
     20      : base(original, cloner) {
    2721
    28         public Subtraction()
    29             : base("Subtraction", "Subtraction operator.")
    30         {
    31             this.Prefix = "-";
    32             this.Suffix = "";
    33         }
     22    }
    3423
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new Subtraction(this, cloner);
    38         }
     24    public Subtraction()
     25      : base("Subtraction", "Subtraction operator.") {
     26      this.Prefix = "-";
     27      this.Suffix = "";
     28    }
    3929
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             return this.Prefix + this.Suffix;
    43         }
     30    public override IDeepCloneable Clone(Cloner cloner) {
     31      return new Subtraction(this, cloner);
    4432    }
     33
     34    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     35      return this.Prefix + this.Suffix;
     36    }
     37  }
    4538}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/NumericalExpression.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class NumericalExpression : CodeNode
    9     {
    10         public override int MinimumArity { get { return 1; } }
    11         public override int MaximumArity { get { return 1; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class NumericalExpression : CodeNode {
     8    public override int MinimumArity { get { return 1; } }
     9    public override int MaximumArity { get { return 1; } }
    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 NumericalExpression(bool deserializing) : base(deserializing) { }
    21         private NumericalExpression(NumericalExpression original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "";
    25             this.Suffix = "";
    26         }
     17    [StorableConstructor]
     18    private NumericalExpression(bool deserializing) : base(deserializing) { }
     19    private NumericalExpression(NumericalExpression original, Cloner cloner)
     20      : base(original, cloner) {
     21    }
    2722
    28         public NumericalExpression()
    29             : base("NumericalExpression", "A NumericalExpression.")
    30         {
    31             this.Prefix = "";
    32             this.Suffix = "";
    33         }
     23    public NumericalExpression()
     24      : base("NumericalExpression", "A NumericalExpression.") {
     25      this.Prefix = "";
     26      this.Suffix = "";
     27    }
    3428
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new NumericalExpression(this, cloner);
    38         }
     29    public override IDeepCloneable Clone(Cloner cloner) {
     30      return new NumericalExpression(this, cloner);
     31    }
    3932
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             var enumerator = children.GetEnumerator();
     33    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     34      var enumerator = children.GetEnumerator();
    4335
    44             if (!enumerator.MoveNext()) throw new System.Exception("NumericalExpression was not given a child.");
    45             var symbol = enumerator.Current.Symbol;
     36      if (!enumerator.MoveNext()) throw new System.Exception("NumericalExpression was not given a child.");
     37      var symbol = enumerator.Current.Symbol;
    4638
    47             if (!(symbol is Number || symbol is NumericalOperation || symbol.GetType().GetInterface(typeof(INumericalMethod).FullName) != null))
    48                 throw new System.Exception("NumericalExpression was given a child of type " + symbol.GetType().ToString() +
    49                     ". The expected child must be of type " + typeof(Number).ToString() + " or " +
    50                     typeof(NumericalOperation).ToString() + " or " +
    51                     typeof(INumericalMethod).ToString() + ".");
     39      if (!(symbol is Number || symbol is NumericalOperation || symbol.GetType().GetInterface(typeof(INumericalMethod).FullName) != null))
     40        throw new System.Exception("NumericalExpression was given a child of type " + symbol.GetType().ToString() +
     41            ". The expected child must be of type " + typeof(Number).ToString() + " or " +
     42            typeof(NumericalOperation).ToString() + " or " +
     43            typeof(INumericalMethod).ToString() + ".");
    5244
    53             string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees);
    54             if (enumerator.MoveNext()) throw new System.Exception("NumericalExpression was given more than one child.");
     45      string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees);
     46      if (enumerator.MoveNext()) throw new System.Exception("NumericalExpression was given more than one child.");
    5547
    56             return this.Prefix + result + this.Suffix;
    57         }
     48      return this.Prefix + result + this.Suffix;
    5849    }
     50  }
    5951}
  • branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/NumericalOperation.cs

    r9565 r9630  
    33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    44
    5 namespace HeuristicLab.Problems.Robocode
    6 {
    7     [StorableClass]
    8     public class NumericalOperation : CodeNode
    9     {
    10         public override int MinimumArity { get { return 3; } }
    11         public override int MaximumArity { get { return 3; } }
     5namespace HeuristicLab.Problems.Robocode {
     6  [StorableClass]
     7  public class NumericalOperation : CodeNode {
     8    public override int MinimumArity { get { return 3; } }
     9    public override int MaximumArity { get { return 3; } }
    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 NumericalOperation(bool deserializing) : base(deserializing) { }
    21         private NumericalOperation(NumericalOperation original, Cloner cloner)
    22             : base(original, cloner)
    23         {
    24             this.Prefix = "(";
    25             this.Suffix = ")";
     17    [StorableConstructor]
     18    private NumericalOperation(bool deserializing) : base(deserializing) { }
     19    private NumericalOperation(NumericalOperation original, Cloner cloner)
     20      : base(original, cloner) {
     21    }
     22
     23    public NumericalOperation()
     24      : base("NumericalOperation", "An expression consisting of two numbers and an operator.") {
     25      this.Prefix = "(";
     26      this.Suffix = ")";
     27    }
     28
     29    public override IDeepCloneable Clone(Cloner cloner) {
     30      return new NumericalOperation(this, cloner);
     31    }
     32
     33    public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) {
     34      ISymbolicExpressionTreeNode condition = null, lhs = null, rhs = null;
     35      var enumerator = children.GetEnumerator();
     36      int childCount = 0;
     37      while (enumerator.MoveNext()) {
     38        childCount++;
     39        switch (childCount) {
     40          case 1: condition = enumerator.Current; break;
     41          case 2: lhs = enumerator.Current; break;
     42          case 3: rhs = enumerator.Current; break;
     43          default: throw new System.Exception("Unexpected number of children. Expected 3 children.");
    2644        }
     45      }
     46      if (childCount < 3) throw new System.Exception("Unexpected number of children. Expected 3 children.");
    2747
    28         public NumericalOperation()
    29             : base("NumericalOperation", "An expression consisting of two numbers and an operator.")
    30         {
    31             this.Prefix = "(";
    32             this.Suffix = ")";
    33         }
     48      if (!(condition.Symbol is Addition || condition.Symbol is Division ||
     49          condition.Symbol is Modulus || condition.Symbol is Multiplication || condition.Symbol is Subtraction))
     50        throw new System.Exception("Unexpected first child for NumericalOperation of type: " +
     51            condition.GetType().ToString() + ". Expected " + typeof(Addition).ToString() +
     52            " or " + typeof(Division).ToString() +
     53            " or " + typeof(Modulus).ToString() +
     54            " or " + typeof(Multiplication).ToString() +
     55            " or " + typeof(Subtraction).ToString() + ".");
    3456
    35         public override IDeepCloneable Clone(Cloner cloner)
    36         {
    37             return new NumericalOperation(this, cloner);
    38         }
     57      // TODO Check children 2 & 3 for correct types
    3958
    40         public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
    41         {
    42             ISymbolicExpressionTreeNode condition = null, lhs = null, rhs = null;
    43             var enumerator = children.GetEnumerator();
    44             int childCount = 0;
    45             while (enumerator.MoveNext())
    46             {
    47                 childCount++;
    48                 switch (childCount)
    49                 {
    50                     case 1: condition = enumerator.Current; break;
    51                     case 2: lhs = enumerator.Current; break;
    52                     case 3: rhs = enumerator.Current; break;
    53                     default: throw new System.Exception("Unexpected number of children. Expected 3 children.");
    54                 }
    55             }
    56             if (childCount < 3) throw new System.Exception("Unexpected number of children. Expected 3 children.");
    57 
    58             if (!(condition.Symbol is Addition || condition.Symbol is Division ||
    59                 condition.Symbol is Modulus || condition.Symbol is Multiplication || condition.Symbol is Subtraction))
    60                 throw new System.Exception("Unexpected first child for NumericalOperation of type: " +
    61                     condition.GetType().ToString() + ". Expected " + typeof(Addition).ToString() +
    62                     " or " + typeof(Division).ToString() +
    63                     " or " + typeof(Modulus).ToString() +
    64                     " or " + typeof(Multiplication).ToString() +
    65                     " or " + typeof(Subtraction).ToString() + ".");
    66 
    67             // TODO Check children 2 & 3 for correct types
    68 
    69             string[] result = new string[]
     59      string[] result = new string[]
    7060            {
    7161                ((CodeNode)condition.Symbol).Interpret(condition, condition.Subtrees),
     
    7464            };
    7565
    76             return this.Prefix + " " + result[1] + " " + result[0] + " " + result[2] + " " + this.Suffix;
    77         }
     66      return this.Prefix + " " + result[1] + " " + result[0] + " " + result[2] + " " + this.Suffix;
    7867    }
     68  }
    7969}
Note: See TracChangeset for help on using the changeset viewer.