Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Logical Expressions/LogicalValue.cs @ 9593

Last change on this file since 9593 was 9565, checked in by melkaref, 11 years ago

Robocode Plugin code without Mutation Operators

File size: 1.5 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
3using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
4
5namespace HeuristicLab.Problems.Robocode
6{
7    [StorableClass]
8    public class LogicalValue : CodeNode
9    {
10        public override int MinimumArity { get { return 0; } }
11        public override int MaximumArity { get { return 0; } }
12
13        [Storable]
14        public override string Prefix { get; set; }
15
16        [Storable]
17        public override string Suffix { get; set; }
18
19        [StorableConstructor]
20        private LogicalValue(bool deserializing) : base(deserializing) { }
21        private LogicalValue(LogicalValue original, Cloner cloner)
22            : base(original, cloner)
23        {
24            this.Prefix = "";
25            this.Suffix = "";
26        }
27
28        public LogicalValue()
29            : base("LogicalValue", "A LogicalValue.")
30        {
31            this.Prefix = "";
32            this.Suffix = "";
33        }
34
35        public override ISymbolicExpressionTreeNode CreateTreeNode()
36        {
37
38            return new BooleanTreeNode();
39        }
40
41        public override IDeepCloneable Clone(Cloner cloner)
42        {
43            return new LogicalValue(this, cloner);
44        }
45
46        public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
47        {
48            return " " + ((BooleanTreeNode)node).Value.ToString().ToLower() + " ";
49        }
50    }
51}
Note: See TracBrowser for help on using the repository browser.