Changeset 13017 for branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/CodeNode.cs
- Timestamp:
- 10/16/15 10:36:09 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/CodeNode.cs
r13013 r13017 27 27 namespace HeuristicLab.Problems.GeneticProgramming.Robocode { 28 28 [StorableClass] 29 public abstract class CodeNode : Symbol { 30 public abstract string Prefix { get; set; } 31 public abstract string Suffix { get; set; } 29 // a symbol that can represent any user-defined fragment of code 30 public sealed class CodeSymbol : Symbol { 31 public override int MinimumArity { get { return 1; } } 32 public override int MaximumArity { get { return 10; } } 33 34 public string Prefix { get; set; } 35 public string Suffix { get; set; } 36 37 public override bool CanChangeName { get { return false; } } // cannot change, otherwise we cannot detect these symbols in the interpreter 38 public override bool CanChangeDescription { get { return false; } } 32 39 33 40 [StorableConstructor] 34 pr otected CodeNode(bool deserializing) : base(deserializing) { }35 pr otected CodeNode(CodeNodeoriginal, Cloner cloner)41 private CodeSymbol(bool deserializing) : base(deserializing) { } 42 private CodeSymbol(CodeSymbol original, Cloner cloner) 36 43 : base(original, cloner) { 37 44 Prefix = original.Prefix; 38 45 Suffix = original.Suffix; 39 46 } 40 p rotected CodeNode(string name, string description)41 : base( name, description) {47 public CodeSymbol() 48 : base("CodeSymbol", "The CodeSymbol symbol can represent any user-defined fragment of code.") { 42 49 Prefix = string.Empty; 43 50 Suffix = string.Empty; 44 51 } 45 52 46 public abstract string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children); 53 public override IDeepCloneable Clone(Cloner cloner) { 54 return new CodeSymbol(this, cloner); 55 } 47 56 } 48 57 }
Note: See TracChangeset
for help on using the changeset viewer.