Last change
on this file since 5246 was
4838,
checked in by epitzer, 14 years ago
|
Better reflect single successor operation generation inside user visible code. (#1275)
|
File size:
1.6 KB
|
Rev | Line | |
---|
[4828] | 1 |
|
---|
| 2 | using HeuristicLab.Common;
|
---|
| 3 | using HeuristicLab.Core;
|
---|
| 4 | using HeuristicLab.Parameters;
|
---|
| 5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 6 | namespace HeuristicLab.Operators.Programmable {
|
---|
| 7 |
|
---|
| 8 | [Item("ProgrammableSingleSuccessorOperator", "An operator that can be programmed for arbitrary needs and handle a single successor.")]
|
---|
| 9 | [StorableClass]
|
---|
| 10 | public class ProgrammableSingleSuccessorOperator : ProgrammableOperator {
|
---|
| 11 |
|
---|
[4838] | 12 | public IOperator Successor {
|
---|
| 13 | get {
|
---|
| 14 | IParameter parameter;
|
---|
| 15 | Parameters.TryGetValue("Successor", out parameter);
|
---|
| 16 | OperatorParameter successorParameter = parameter as OperatorParameter;
|
---|
| 17 | if (successorParameter == null)
|
---|
| 18 | return null;
|
---|
| 19 | return successorParameter.Value;
|
---|
| 20 | }
|
---|
| 21 | set {
|
---|
| 22 | ((OperatorParameter)Parameters["Successor"]).Value = value;
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 |
|
---|
[4828] | 26 | [StorableConstructor]
|
---|
| 27 | protected ProgrammableSingleSuccessorOperator(bool deserializing) : base(deserializing) { }
|
---|
| 28 | protected ProgrammableSingleSuccessorOperator(ProgrammableSingleSuccessorOperator original, Cloner cloner)
|
---|
| 29 | : base(original, cloner) {
|
---|
| 30 | }
|
---|
| 31 | public ProgrammableSingleSuccessorOperator()
|
---|
| 32 | : base() {
|
---|
| 33 | Parameters.Add(new OperatorParameter("Successor", "Operator that is executed next."));
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 37 | return new ProgrammableSingleSuccessorOperator(this, cloner);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
[4838] | 40 | public override string MethodSuffix {
|
---|
| 41 | get { return "return op.Successor == null ? null : context.CreateOperation(op.Successor);"; }
|
---|
[4828] | 42 | }
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.