Last change
on this file since 15017 was
15017,
checked in by pkimmesw, 7 years ago
|
#2665 Fixed Benchmark Problem Definition, Converted LoopExpressions to stateless expressions, Added several unit test to ensure funcionality, Fixed UI bugs
|
File size:
1.4 KB
|
Rev | Line | |
---|
[14727] | 1 | namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
|
---|
| 2 | using System;
|
---|
| 3 | using System.Collections.Generic;
|
---|
[14952] | 4 |
|
---|
| 5 | using HeuristicLab.Common;
|
---|
| 6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[14777] | 7 | using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
|
---|
[14727] | 8 |
|
---|
| 9 | using Interpreter;
|
---|
| 10 |
|
---|
[14746] | 11 | [Serializable]
|
---|
[14952] | 12 | [StorableClass]
|
---|
| 13 | public abstract class Expression : IDeepCloneable, IPooledObject {
|
---|
| 14 |
|
---|
| 15 | protected Expression() { }
|
---|
| 16 |
|
---|
| 17 | [StorableConstructor]
|
---|
| 18 | protected Expression(bool deserializing) { }
|
---|
| 19 |
|
---|
[14905] | 20 | public bool IsProgram { get { return GetType() == typeof(PushProgram); } }
|
---|
[14727] | 21 |
|
---|
| 22 | public static readonly IReadOnlyCollection<Expression> EmptyContainer = new Expression[0];
|
---|
| 23 |
|
---|
[15017] | 24 | public abstract string StringRepresentation
|
---|
[14727] | 25 | {
|
---|
[15017] | 26 | get;
|
---|
[14727] | 27 | }
|
---|
| 28 |
|
---|
[14952] | 29 | public abstract bool IsNoop(IInternalPushInterpreter interpreter);
|
---|
| 30 | public abstract void Eval(IInternalPushInterpreter interpreter);
|
---|
[14905] | 31 |
|
---|
[14952] | 32 | public bool TryEval(IInternalPushInterpreter interpreter) {
|
---|
| 33 | if (IsNoop(interpreter))
|
---|
| 34 | return false;
|
---|
[14727] | 35 |
|
---|
[14952] | 36 | Eval(interpreter);
|
---|
| 37 | return true;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
[14727] | 40 | public override string ToString() {
|
---|
[14908] | 41 | return StringRepresentation;
|
---|
[14727] | 42 | }
|
---|
[14777] | 43 |
|
---|
[14952] | 44 | public object Clone() {
|
---|
| 45 | return this;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public IDeepCloneable Clone(Cloner cloner) {
|
---|
| 49 | return this;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[14777] | 52 | void IPooledObject.Reset() { }
|
---|
[14727] | 53 | }
|
---|
| 54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.