Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/16 22:57:11 (7 years ago)
Author:
pkimmesw
Message:

#2665 Added Problem.ProgramSynthesis Project, Fixed Expression Issues, Fixed Code Generation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FlushExpressions.cs

    r14398 r14513  
    1 using HeuristicLab.Algorithms.PushGP.Interpreter;
    2 using HeuristicLab.Algorithms.PushGP.Stack;
     1namespace HeuristicLab.Algorithms.PushGP.Expressions
     2{
     3  using HeuristicLab.Algorithms.PushGP.Interpreter;
     4  using HeuristicLab.Algorithms.PushGP.Stack;
    35
    4 namespace HeuristicLab.Algorithms.PushGP.Expressions
    5 {
    6     /// <summary>
    7     /// Empties the given stack.
    8     /// </summary>
    9     /// <typeparam name="T">Stacktype</typeparam>
    10     public abstract class FlushExpression<T> : StatelessExpression
     6  /// <summary>
     7  ///     Empties the given stack.
     8  /// </summary>
     9  /// <typeparam name="T">Stacktype</typeparam>
     10  public abstract class FlushExpression<T> : StatelessExpression
     11  {
     12    public void Eval(IStack<T> stack)
    1113    {
    12         public void Eval(IStack<T> stack)
    13         {
    14             stack.Clear();
    15         }
     14      stack.Clear();
     15    }
     16  }
     17
     18  public class IntegerFlushExpression : FlushExpression<long>
     19  {
     20    protected override string InitStringRepresentation()
     21    {
     22      return "INTEGER.FLUSH";
    1623    }
    1724
    18     public class IntegerFlushExpression : FlushExpression<long>
     25    public override void Eval(IPushGpInterpreter interpreter)
    1926    {
    20         protected override string InitStringRepresentation() { return "INTEGER.FLUSH"; }
     27      this.Eval(interpreter.IntegerStack);
     28    }
     29  }
    2130
    22         public override void Eval(IInterpreter interpreter)
    23         {
    24             Eval(interpreter.IntegerStack);
    25         }
     31  public class FloatFlushExpression : FlushExpression<double>
     32  {
     33    protected override string InitStringRepresentation()
     34    {
     35      return "FLOAT.FLUSH";
    2636    }
    2737
    28     public class FloatFlushExpression : FlushExpression<double>
     38    public override void Eval(IPushGpInterpreter interpreter)
    2939    {
    30         protected override string InitStringRepresentation() { return "FLOAT.FLUSH"; }
     40      this.Eval(interpreter.FloatStack);
     41    }
     42  }
    3143
    32         public override void Eval(IInterpreter interpreter)
    33         {
    34             Eval(interpreter.FloatStack);
    35         }
     44  public class BooleanFlushExpression : FlushExpression<bool>
     45  {
     46    protected override string InitStringRepresentation()
     47    {
     48      return "BOOLEAN.FLUSH";
    3649    }
    3750
    38     public class BooleanFlushExpression : FlushExpression<bool>
     51    public override void Eval(IPushGpInterpreter interpreter)
    3952    {
    40         protected override string InitStringRepresentation() { return "BOOLEAN.FLUSH"; }
     53      this.Eval(interpreter.BooleanStack);
     54    }
     55  }
    4156
    42         public override void Eval(IInterpreter interpreter)
    43         {
    44             Eval(interpreter.BooleanStack);
    45         }
     57  public class NameFlushExpression : FlushExpression<string>
     58  {
     59    protected override string InitStringRepresentation()
     60    {
     61      return "NAME.FLUSH";
    4662    }
    4763
    48     public class NameFlushExpression : FlushExpression<string>
     64    public override void Eval(IPushGpInterpreter interpreter)
    4965    {
    50         protected override string InitStringRepresentation() { return "NAME.FLUSH"; }
     66      this.Eval(interpreter.NameStack);
     67    }
     68  }
    5169
    52         public override void Eval(IInterpreter interpreter)
    53         {
    54             Eval(interpreter.NameStack);
    55         }
     70  public class ExecFlushExpression : FlushExpression<Expression>
     71  {
     72    protected override string InitStringRepresentation()
     73    {
     74      return "EXEC.FLUSH";
    5675    }
    5776
    58     public class ExecFlushExpression : FlushExpression<Expression>
     77    public override void Eval(IPushGpInterpreter interpreter)
    5978    {
    60         protected override string InitStringRepresentation() { return "EXEC.FLUSH"; }
     79      this.Eval(interpreter.ExecStack);
     80    }
     81  }
    6182
    62         public override void Eval(IInterpreter interpreter)
    63         {
    64             Eval(interpreter.ExecStack);
    65         }
     83  public class CodeFlushExpression : FlushExpression<Expression>
     84  {
     85    protected override string InitStringRepresentation()
     86    {
     87      return "CODE.FLUSH";
    6688    }
    6789
    68     public class CodeFlushExpression : FlushExpression<Expression>
     90    public override void Eval(IPushGpInterpreter interpreter)
    6991    {
    70         protected override string InitStringRepresentation() { return "CODE.FLUSH"; }
    71 
    72         public override void Eval(IInterpreter interpreter)
    73         {
    74             Eval(interpreter.CodeStack);
    75         }
     92      this.Eval(interpreter.CodeStack);
    7693    }
     94  }
    7795}
Note: See TracChangeset for help on using the changeset viewer.