source:
branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/Expression.cs
@
17189
Last change on this file since 17189 was 15771, checked in by bburlacu, 7 years ago | |
---|---|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[15771] | 1 | using System; |
[14952] | 2 | |
[15771] | 3 | using HeuristicLab.Common; |
4 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; | |
5 | ||
6 | namespace HeuristicLab.Problems.ProgramSynthesis { | |
[14727] | 7 | |
[14746] | 8 | [Serializable] |
[14952] | 9 | [StorableClass] |
10 | public abstract class Expression : IDeepCloneable, IPooledObject { | |
11 | ||
12 | protected Expression() { } | |
13 | ||
14 | [StorableConstructor] | |
15 | protected Expression(bool deserializing) { } | |
[15344] | 16 | protected Expression(Expression origin, Cloner cloner) { } |
[14952] | 17 | |
[14905] | 18 | public bool IsProgram { get { return GetType() == typeof(PushProgram); } } |
[14727] | 19 | |
[15334] | 20 | public abstract string StringRepresentation { get; } |
[14727] | 21 | |
[14952] | 22 | public abstract bool IsNoop(IInternalPushInterpreter interpreter); |
23 | public abstract void Eval(IInternalPushInterpreter interpreter); | |
[14905] | 24 | |
[14952] | 25 | public bool TryEval(IInternalPushInterpreter interpreter) { |
26 | if (IsNoop(interpreter)) | |
27 | return false; | |
[14727] | 28 | |
[14952] | 29 | Eval(interpreter); |
30 | return true; | |
31 | } | |
32 | ||
[14727] | 33 | public override string ToString() { |
[14908] | 34 | return StringRepresentation; |
[14727] | 35 | } |
[14777] | 36 | |
[14952] | 37 | public object Clone() { |
[15334] | 38 | return this; |
[14952] | 39 | } |
40 | ||
[15189] | 41 | public virtual IDeepCloneable Clone(Cloner cloner) { |
[14952] | 42 | return this; |
43 | } | |
44 | ||
[14777] | 45 | void IPooledObject.Reset() { } |
[14727] | 46 | } |
47 | } |
Note: See TracBrowser
for help on using the repository browser.