using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Random; namespace HeuristicLab.Problems.TradeRules { [StorableClass] public sealed class ConstantIntTreeNode : SymbolicExpressionTreeTerminalNode { public new ConstantInt Symbol { get { return (ConstantInt)base.Symbol; } } private double ConstantIntValue; [Storable] public double Value { get { return ConstantIntValue; } set { ConstantIntValue = value; } } [StorableConstructor] private ConstantIntTreeNode(bool deserializing) : base(deserializing) { } private ConstantIntTreeNode(ConstantIntTreeNode original, Cloner cloner) : base(original, cloner) { ConstantIntValue = original.ConstantIntValue; } private ConstantIntTreeNode() : base() { } public ConstantIntTreeNode(ConstantInt ConstantIntSymbol) : base(ConstantIntSymbol) { } public override bool HasLocalParameters { get { return true; } } public override void ResetLocalParameters(IRandom random) { base.ResetLocalParameters(random); Value = random.Next(100)+1; } public override IDeepCloneable Clone(Cloner cloner) { return new ConstantIntTreeNode(this, cloner); } public override string ToString() { return ConstantIntValue.ToString("E5"); } } }