Пример #1
0
        public override PConstrianResult test(object newValue)
        {
            var r = new PConstrianResults(list.Count);

            for (int i = 0; i < list.Count; i++)
            {
                var c = list[i];
                r.Add(c.test(newValue));
            }
            return(r);
        }
Пример #2
0
        public override PConstrianResults apply <T>(T value, ref T property)
        {
            var r = new PConstrianResults(list.Count);
            var bc = int.MinValue; var bi = 0;             //best correctnes and it's index

            for (int i = 0; i < list.Count; i++)
            {
                var c  = list[i];
                var tr = c.test(value); r.Add(tr);
                if (tr.status == PCostrainStatus.PASSED)
                {
                    bi = i; break;
                }
                if (tr.status == PCostrainStatus.CORRECTED &&
                    tr.correctnes > bc)
                {
                    bc = tr.correctnes; bi = i;
                }
            }
            list[bi].correct(value, ref property);
            return(r);
        }