Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Renamings due to typos, ManagedPool tests, Skip Noops in Debugger

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