Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/Expression.cs @ 14834

Last change on this file since 14834 was 14834, checked in by pkimmesw, 7 years ago

#2665 LexicaseSelector, Performance improvements, UI Fixes, Debugger only shows used stacks, fixed Debugger stepping, Added vector expressions, ERCOptions,

File size: 1.0 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
2  using System;
3  using System.Collections.Generic;
4
5  using HeuristicLab.Problems.ProgramSynthesis.Push.Attributes;
6  using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
7
8  using Interpreter;
9
10  [Serializable]
11  public abstract class Expression : IPooledObject {
12    public bool IsProgram { get { return this.GetType() == typeof(PushProgram); } }
13
14    public static readonly IReadOnlyCollection<Expression> EmptyContainer = new Expression[0];
15
16    public virtual string StringRepresentation
17    {
18      get
19      {
20        var attribute = (PushExpressionAttribute)Attribute.GetCustomAttribute(this.GetType(), typeof(PushExpressionAttribute));
21
22        return attribute != null
23          ? attribute.ExpressionName
24          : string.Empty;
25      }
26    }
27
28    public abstract bool Eval(IInternalPushInterpreter interpreter);
29
30    public override string ToString() {
31      return this.StringRepresentation;
32    }
33
34    void IPooledObject.Reset() { }
35  }
36}
Note: See TracBrowser for help on using the repository browser.