#region License Information /* HeuristicLab * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using System.Text; using System.Xml; using HeuristicLab.Core; using System.Globalization; namespace HeuristicLab.Data { /// /// Represents a double value having some constraints (e.g. smaller than 5.3). /// public class ConstrainedDoubleData : ConstrainedObjectData { /// /// Gets or sets the double value of the current instance as . /// /// Uses property of base /// class . No own data storage present. public new double Data { get { return ((DoubleData)base.Data).Data; } set { ((DoubleData)base.Data).Data = value; } } /// /// Initializes a new instance of with default value 0.0. /// public ConstrainedDoubleData() : this(0.0) { } /// /// Initializes a new instance of with the specified /// double value as . /// /// The double value to represent. public ConstrainedDoubleData(double data) : base() { base.Data = new DoubleData(data); } /// public virtual bool TrySetData(double data) { return base.TrySetData(new DoubleData(data)); } /// public virtual bool TrySetData(double data, out ICollection violatedConstraints) { return base.TrySetData(new DoubleData(data), out violatedConstraints); } /// /// Creates a new instance of . /// /// The created instance as . public override IView CreateView() { return new ConstrainedDoubleDataView(this); } /// /// Clones the current instance. /// /// Uses the implementation of base class . /// A dictionary of all already cloned objects. /// The cloned instance as . public override object Clone(IDictionary clonedObjects) { ConstrainedDoubleData clone = (ConstrainedDoubleData)base.Clone(clonedObjects); return clone; } } }