Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Attributes/PushExpressionAttriubte.cs @ 16101

Last change on this file since 16101 was 15334, checked in by pkimmesw, 7 years ago

#2665 Testet Problems, Testet error functions, Small fixes, Created HL files

File size: 1.8 KB
Line 
1using System;
2
3namespace HeuristicLab.Problems.ProgramSynthesis.Push.Attributes {
4  using HeuristicLab.Problems.ProgramSynthesis.Push.Stack;
5
6  [AttributeUsage(AttributeTargets.Class)]
7  public class PushExpressionAttribute : Attribute {
8    public readonly StackTypes StackType;
9    public readonly StackTypes AdditionalStackDependencies;
10    public readonly string Name;
11    public readonly string Description;
12    public readonly int? InExpressionNr;
13
14    /// <summary>
15    /// Determines if this expression manipulates the exec stack.
16    /// </summary>
17    public readonly bool ManipulatesExec;
18
19    /// <summary>
20    /// Determines the amount of items fetched form the EXEC stack required for this expression. Used for mapping individuals.
21    /// </summary>
22    public readonly uint RequiredBlockCount;
23
24    /// <summary>
25    /// Determines if the expression is visible to the user for configuration purposes.
26    /// </summary>
27    public readonly bool IsHidden;
28
29    public PushExpressionAttribute(
30      StackTypes stackType,
31      string name,
32      string description,
33      StackTypes additionalStackDependencies = default(StackTypes),
34      uint requiredBlockCount = 0,
35      bool isHidden = false,
36      int inExpressionNr = -1) {
37
38      StackType = stackType;
39      AdditionalStackDependencies = additionalStackDependencies;
40      Name = name;
41      Description = description;
42      RequiredBlockCount = requiredBlockCount;
43      IsHidden = isHidden;
44      InExpressionNr = inExpressionNr > 0 ? inExpressionNr : default(int?);
45      ManipulatesExec = stackType == StackTypes.Exec || AdditionalStackDependencies.HasFlag(StackTypes.Exec);
46    }
47
48    public bool IsInExpression { get { return this.InExpressionNr.HasValue; } }
49  }
50}
Note: See TracBrowser for help on using the repository browser.