Last change
on this file since 15334 was
15334,
checked in by pkimmesw, 7 years ago
|
#2665 Testet Problems, Testet error functions, Small fixes, Created HL files
|
File size:
1.2 KB
|
Line | |
---|
1 | namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
|
---|
2 | using System;
|
---|
3 |
|
---|
4 | using HeuristicLab.Common;
|
---|
5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
6 | using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
|
---|
7 |
|
---|
8 | using Interpreter;
|
---|
9 |
|
---|
10 | [Serializable]
|
---|
11 | [StorableClass]
|
---|
12 | public abstract class Expression : IDeepCloneable, IPooledObject {
|
---|
13 |
|
---|
14 | protected Expression() { }
|
---|
15 |
|
---|
16 | [StorableConstructor]
|
---|
17 | protected Expression(bool deserializing) { }
|
---|
18 |
|
---|
19 | public bool IsProgram { get { return GetType() == typeof(PushProgram); } }
|
---|
20 |
|
---|
21 | public abstract string StringRepresentation { get; }
|
---|
22 |
|
---|
23 | public abstract bool IsNoop(IInternalPushInterpreter interpreter);
|
---|
24 | public abstract void Eval(IInternalPushInterpreter interpreter);
|
---|
25 |
|
---|
26 | public bool TryEval(IInternalPushInterpreter interpreter) {
|
---|
27 | if (IsNoop(interpreter))
|
---|
28 | return false;
|
---|
29 |
|
---|
30 | Eval(interpreter);
|
---|
31 | return true;
|
---|
32 | }
|
---|
33 |
|
---|
34 | public override string ToString() {
|
---|
35 | return StringRepresentation;
|
---|
36 | }
|
---|
37 |
|
---|
38 | public object Clone() {
|
---|
39 | return this;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public virtual IDeepCloneable Clone(Cloner cloner) {
|
---|
43 | return this;
|
---|
44 | }
|
---|
45 |
|
---|
46 | void IPooledObject.Reset() { }
|
---|
47 | }
|
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.