Esempio n. 1
0
        public override string ToString()
        {
            string s = string.Empty;

            if (ConstrainedValue != null)
            {
                s += ConstrainedValue.GetVariableName(ConstraintColumn) + " ";
            }

            if (ConstraintOperation != null)
            {
                s += ConstraintOperation.ToString() + " ";
            }

            if (ConstraintData != null)
            {
                s += ConstraintData.ToString();
            }
            else
            {
                s += "null";
            }

            s += ".";
            return(s);
        }
Esempio n. 2
0
        public new bool[] Check()
        {
            bool[] result = new bool[ConstrainedValue.Rows];

            if (!Active)
            {
                return(result);
            }

            for (int row = 0; row < ConstrainedValue.Rows; ++row)
            {
                object item = null;
                if (ConstrainedValue.VariableHasType <double>(constraintColumn))
                {
                    item = new HeuristicLab.Data.DoubleValue(ConstrainedValue.GetCell <double>(ConstraintColumn, row));
                }
                else if (ConstrainedValue.VariableHasType <DateTime>(constraintColumn))
                {
                    item = new HeuristicLab.Data.DateTimeValue(ConstrainedValue.GetCell <DateTime>(ConstraintColumn, row));
                }
                else
                {
                    item = new StringValue(ConstrainedValue.GetCell <string>(ConstraintColumn, row));
                }

                result[row] = !base.Check(item);
            }

            return(result);
        }
Esempio n. 3
0
        protected override bool Check(object constrainedMember)
        {
            if (!Active)
            {
                return(true);
            }

            foreach (IRun run in ConstrainedValue.Where(r => r.Visible))
            {
                run.Visible = !ConstraintData.Contains(run);
            }
            return(true);
        }
Esempio n. 4
0
        protected override bool Check(object constrainedMember, out string errorMessage)
        {
            errorMessage = string.Empty;
            if (!Active)
            {
                return(true);
            }

            foreach (IRun run in ConstrainedValue.Where(r => r.Visible))
            {
                run.Visible = !ConstraintData.Contains(run);
            }
            return(true);
        }
        protected override bool Check(object constrainedMember)
        {
            if (!Active)
            {
                return(true);
            }

            foreach (IRun run in ConstrainedValue.Where(r => r.Visible))
            {
                IItem item = ConstrainedValue.GetValue(run, constraintColumn);
                if (item != null && !base.Check(item.ToString()))
                {
                    run.Visible = false;
                }
            }
            return(true);
        }
        protected override bool Check(object constrainedMember, out string errorMessage)
        {
            errorMessage = string.Empty;
            if (!Active)
            {
                return(true);
            }

            foreach (IRun run in ConstrainedValue.Where(r => r.Visible))
            {
                IItem item = ConstrainedValue.GetValue(run, constraintColumn);
                if (!base.Check(item))
                {
                    run.Visible = false;
                }
            }
            return(true);
        }
Esempio n. 7
0
            // for generic vec * 2 , vec * any Type we set the vector as a type of it
            private static TOperatorReturn ExecuteArithmeticOperation <TVal>(
                Vector <TSelf, T, TDim, TOperatorReturn> source,
                T dist,
                Func <ConstrainedValue <T>, ConstrainedValue <T>, T> op)
                where TVal : IComparable, IComparable <TVal>, IEquatable <TVal>
            {
                var result = new TOperatorReturn()
                {
                    Vec = (T[])source.Vec.Clone(), Dim = source.Dim
                };

                for (int i = 0; i < result.Dim; i++)
                {
                    var a = new ConstrainedValue <T>(result[i]);
                    result[i] = op(a, new ConstrainedValue <T>(dist));
                }
                return(result);
            }
Esempio n. 8
0
        public FloatSlider()
        {
            InitializeComponent();

            Constraint = new ConstrainedValue(0f, 1f, 0.5f);
        }