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
|
Line | |
---|
1 | namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
|
---|
2 | using System;
|
---|
3 | using System.Collections.Generic;
|
---|
4 |
|
---|
5 | using HeuristicLab.Common;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 | using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
|
---|
8 |
|
---|
9 | using Interpreter;
|
---|
10 |
|
---|
11 | [Serializable]
|
---|
12 | [StorableClass]
|
---|
13 | public abstract class Expression : IDeepCloneable, IPooledObject {
|
---|
14 |
|
---|
15 | protected Expression() { }
|
---|
16 |
|
---|
17 | [StorableConstructor]
|
---|
18 | protected Expression(bool deserializing) { }
|
---|
19 |
|
---|
20 | public bool IsProgram { get { return GetType() == typeof(PushProgram); } }
|
---|
21 |
|
---|
22 | public static readonly IReadOnlyCollection<Expression> EmptyContainer = new Expression[0];
|
---|
23 |
|
---|
24 | public abstract string StringRepresentation
|
---|
25 | {
|
---|
26 | get;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public abstract bool IsNoop(IInternalPushInterpreter interpreter);
|
---|
30 | public abstract void Eval(IInternalPushInterpreter interpreter);
|
---|
31 |
|
---|
32 | public bool TryEval(IInternalPushInterpreter interpreter) {
|
---|
33 | if (IsNoop(interpreter))
|
---|
34 | return false;
|
---|
35 |
|
---|
36 | Eval(interpreter);
|
---|
37 | return true;
|
---|
38 | }
|
---|
39 |
|
---|
40 | public override string ToString() {
|
---|
41 | return StringRepresentation;
|
---|
42 | }
|
---|
43 |
|
---|
44 | public object Clone() {
|
---|
45 | return this;
|
---|
46 | }
|
---|
47 |
|
---|
48 | public IDeepCloneable Clone(Cloner cloner) {
|
---|
49 | return this;
|
---|
50 | }
|
---|
51 |
|
---|
52 | void IPooledObject.Reset() { }
|
---|
53 | }
|
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.