namespace HeuristicLab.Problems.ProgramSynthesis { using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Data; using HeuristicLab.Parameters; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; [StorableClass] public class DataBounds : ParameterizedNamedItem { private const string TrainingParameterName = "Training"; private const string TestParameterName = "Test"; public DataBounds() : this(0, 0, 0, 0) { } public DataBounds(int trainingStart, int trainingEnd, int testStart, int testEnd) { Parameters.Add(new FixedValueParameter(TrainingParameterName, new IntRange(trainingStart, trainingEnd))); Parameters.Add(new FixedValueParameter(TestParameterName, new IntRange(testStart, testEnd))); } [StorableConstructor] public DataBounds(bool deserializing) : base(deserializing) { } public DataBounds(DataBounds origin, Cloner cloner) : base(origin, cloner) { } public IValueParameter TrainingParameter { get { return (IValueParameter)Parameters[TrainingParameterName]; } } public IntRange TrainingRange { get { return TrainingParameter.Value; } set { TrainingParameter.Value = value; } } public IValueParameter TestParameter { get { return (IValueParameter)Parameters[TestParameterName]; } } public IntRange TestRange { get { return TestParameter.Value; } set { TestParameter.Value = value; } } public override IDeepCloneable Clone(Cloner cloner) { return new DataBounds(this, cloner); } } }