using System;
namespace HeuristicLab.Problems.ProgramSynthesis.Push.Attributes {
using HeuristicLab.Problems.ProgramSynthesis.Push.Stack;
[AttributeUsage(AttributeTargets.Class)]
public class PushExpressionAttribute : Attribute {
public readonly StackTypes StackType;
public readonly StackTypes AdditionalStackDependencies;
public readonly string Name;
public readonly string Description;
public readonly int? InExpressionNr;
///
/// Determines if this expression manipulates the exec stack.
///
public readonly bool ManipulatesExec;
///
/// Determines the amount of items fetched form the EXEC stack required for this expression. Used for mapping individuals.
///
public readonly uint RequiredBlockCount;
///
/// Determines if the expression is visible to the user for configuration purposes.
///
public readonly bool IsHidden;
public PushExpressionAttribute(
StackTypes stackType,
string name,
string description,
StackTypes additionalStackDependencies = default(StackTypes),
uint requiredBlockCount = 0,
bool isHidden = false,
int inExpressionNr = -1) {
StackType = stackType;
AdditionalStackDependencies = additionalStackDependencies;
Name = name;
Description = description;
RequiredBlockCount = requiredBlockCount;
IsHidden = isHidden;
InExpressionNr = inExpressionNr > 0 ? inExpressionNr : default(int?);
ManipulatesExec = stackType == StackTypes.Exec || AdditionalStackDependencies.HasFlag(StackTypes.Exec);
}
public bool IsInExpression { get { return this.InExpressionNr.HasValue; } }
}
}