Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/EmptyEvent.cs @ 9609

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

#2069

  • Added EmptyEvent.cs
  • Modified Grammar.cs to allow EmptyEvent as a child in place of all Event Methods except for Run and OnScannedEvent
File size: 1.3 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
3using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
4
5namespace HeuristicLab.Problems.Robocode
6{
7    class EmptyEvent: CodeNode
8    {
9        public override int MinimumArity { get { return 0; } }
10        public override int MaximumArity { get { return 0; } }
11
12        [Storable]
13        public override string Prefix { get; set; }
14
15        [Storable]
16        public override string Suffix { get; set; }
17
18        [StorableConstructor]
19        private EmptyEvent(bool deserializing) : base(deserializing) { }
20        private EmptyEvent(EmptyEvent original, Cloner cloner)
21            : base(original, cloner)
22        {
23            this.Prefix = "";
24            this.Suffix = "";
25        }
26
27        public EmptyEvent()
28            : base("EmptyEvent", "This is a placeholder for an empty event.")
29        {
30            this.Prefix = "";
31            this.Suffix = "";
32        }
33
34        public override IDeepCloneable Clone(Cloner cloner)
35        {
36            return new EmptyEvent(this, cloner);
37        }
38
39        public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children)
40        {
41            return "";
42        }
43    }
44}
Note: See TracBrowser for help on using the repository browser.