Last change
on this file since 14513 was
14513,
checked in by pkimmesw, 7 years ago
|
#2665 Added Problem.ProgramSynthesis Project, Fixed Expression Issues, Fixed Code Generation
|
File size:
971 bytes
|
Line | |
---|
1 | namespace HeuristicLab.Algorithms.PushGP.Expressions {
|
---|
2 |
|
---|
3 | using HeuristicLab.Algorithms.PushGP.Interpreter;
|
---|
4 |
|
---|
5 | public abstract class Expression {
|
---|
6 | protected int id;
|
---|
7 | protected string stringRepresentation;
|
---|
8 |
|
---|
9 | public string StringRepresentation
|
---|
10 | {
|
---|
11 | get { return this.stringRepresentation ?? (this.stringRepresentation = this.InitStringRepresentation()); }
|
---|
12 | }
|
---|
13 |
|
---|
14 | public int Id
|
---|
15 | {
|
---|
16 | get
|
---|
17 | {
|
---|
18 | if (this.id == default(int))
|
---|
19 | this.id = this.InitId();
|
---|
20 |
|
---|
21 | return this.id;
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | public abstract void Eval(IPushGpInterpreter interpreter);
|
---|
26 |
|
---|
27 | protected abstract int InitId();
|
---|
28 |
|
---|
29 | protected abstract string InitStringRepresentation();
|
---|
30 |
|
---|
31 | public override bool Equals(object obj) {
|
---|
32 | return (obj != null) && ((this.GetHashCode() == obj.GetHashCode()) || (this.GetType() == obj.GetType()));
|
---|
33 | }
|
---|
34 |
|
---|
35 | public override int GetHashCode() {
|
---|
36 | return this.Id;
|
---|
37 | }
|
---|
38 | }
|
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.