示例#1
0
 public Analysis(CheckFind checkFind, Node node, bool isBlanck)
 {
     this.checkFind = checkFind;
     this.node      = node;
     this.isBlanck  = isBlanck;
     NodesGridView  = new List <Nodes>();
 }
示例#2
0
        public CheckFind Copy()
        {
            int maxCc = this.maxX;
            int maxRc = this.maxY;
            int minCc = this.minX;
            int minRc = this.minY;
            List <GrideView> grideViewsc = this.Copy(this._grideViews);
            //new List<GrideView>();
            //foreach (var _v in this._grideViews)
            //{
            //    grideViewsc.Add(_v.Copy());
            //}
            CheckFind checkFind = new CheckFind(maxRc, maxCc, minRc, minCc, grideViewsc);

            return(checkFind);
        }
示例#3
0
        public static Nodes AnalysisData(bool?IsBlanck, CheckFind checkFind, bool isCheck)
        {
            List <Nodes> TNodesGridView = new List <Nodes>();
            List <Node>  _entitys       = checkFind.GetAllNodes(1, IsBlanck);

            if (_entitys == null || _entitys.Count <= 0)
            {
                return(null);
            }
            foreach (var _entity in _entitys)
            {
                List <Nodes> ls = checkFind.GetData(_entity, IsBlanck);
                TNodesGridView.AddRange(ls);
            }
            if (isCheck)
            {
                var _resultLis = TNodesGridView.Where(x => x.SuccessRate >= 2.5M).ToList();
                if (_resultLis != null && _resultLis.Count > 0)
                {
                    _resultLis = _resultLis.OrderByDescending(x => x.SuccessRate).ToList();
                    return(_resultLis[0]);

                    //var _node1 = _resultLis[0].NextNode;
                    //if (_node1 != null)
                    //{
                    //    text = _resultLis[0].RateText;
                    //    return _resultLis[0].SuccessRate;
                    //}
                }
                return(null);
            }
            else
            {
                var _NodesGridView = TNodesGridView.OrderByDescending(x => x.SuccessRate).ToList();
                if (_NodesGridView != null && _NodesGridView.Count > 0)
                {
                    return(_NodesGridView[0]);
                }
                //return GetDefautNode(node);
                throw new NotImplementedException("未处理异常!");
            }
        }
示例#4
0
        public static Decimal Contrast(Node _node, CheckFind checkFind, bool isBlanck, out string text)
        {
            text = "";
            bool IsBlanck = isBlanck;
            Node node     = checkFind.GetNode(_node);
            bool falg     = checkFind.SimulateSetState(isBlanck, 1, node);//node.SetState(IsBlanck, 1);

            if (!falg)
            {
                return(0.00M);
            }
            Nodes nodes = AnalysisData(IsBlanck, checkFind, true);

            if (nodes != null)
            {
                text = nodes.RateText;
                return(nodes.SuccessRate);
            }
            return(0.00M);
        }
示例#5
0
 public Nodes(int count, List <Node> ls, Angle angle, CheckFind checkFind)
 {
     NoTuseds = new List <Node>();
     Ls       = new List <Node>();
     foreach (var _node in ls)
     {
         if (_node.State == 0)
         {
             _node.Angle = angle;
             this.NoTuseds.Add(_node);
         }
         else
         {
             _node.Angle = angle;
             this.Ls.Add(_node);
         }
     }
     Count = this.Ls.Count;
     Angle = angle;
     this.InitData(checkFind);
 }
示例#6
0
        public void InitData(CheckFind checkFind)
        {
            Node max;
            Node min;
            bool isMax = false;
            bool isMin = false;

            if (this.Ls.Count <= 0)
            {
                return;
            }
            min = Top;
            max = After;
            if (this.Angle == Angle.HENG)
            {
                isMin = checkFind.CheckNextIsNull(min, Position.L);

                isMax = checkFind.CheckNextIsNull(max, Position.R);
                if (isMax)
                {
                    AfterNext       = checkFind.GetNextIsNull(max, Position.R);
                    AfterNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(AfterNext, Position.R, max.IsBlanck, 1);
                    if (n == null)
                    {
                        AfterNextNext = 0;
                    }
                    else
                    {
                        AfterNextNext = 1;
                    }
                }
                else if (isMin)
                {
                    TopNext       = checkFind.GetNextIsNull(min, Position.L);
                    TopNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(TopNext, Position.L, min.IsBlanck, 1);
                    if (n == null)
                    {
                        TopNextNext = 0;
                    }
                    else
                    {
                        TopNextNext = 1;
                    }
                }
            }
            else if (this.Angle == Angle.SHU)
            {
                isMin = checkFind.CheckNextIsNull(min, Position.T);
                isMax = checkFind.CheckNextIsNull(max, Position.D);
                if (isMax)
                {
                    AfterNext       = checkFind.GetNextIsNull(max, Position.D);
                    AfterNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(AfterNext, Position.D, max.IsBlanck, 1);
                    if (n == null)
                    {
                        AfterNextNext = 0;
                    }
                    else
                    {
                        AfterNextNext = 1;
                    }
                }
                else if (isMin)
                {
                    TopNext       = checkFind.GetNextIsNull(min, Position.T);
                    TopNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(TopNext, Position.T, min.IsBlanck, 1);
                    if (n == null)
                    {
                        TopNextNext = 0;
                    }
                    else
                    {
                        TopNextNext = 1;
                    }
                }
            }
            else if (this.Angle == Angle.ZX)
            {
                isMin = checkFind.CheckNextIsNull(min, Position.TL);
                isMax = checkFind.CheckNextIsNull(max, Position.DR);
                if (isMax)
                {
                    AfterNext       = checkFind.GetNextIsNull(max, Position.DR);
                    AfterNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(AfterNext, Position.DR, max.IsBlanck, 1);
                    if (n == null)
                    {
                        AfterNextNext = 0;
                    }
                    else
                    {
                        AfterNextNext = 1;
                    }
                }
                else if (isMin)
                {
                    TopNext       = checkFind.GetNextIsNull(min, Position.TL);
                    TopNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(TopNext, Position.TL, min.IsBlanck, 1);
                    if (n == null)
                    {
                        TopNextNext = 0;
                    }
                    else
                    {
                        TopNextNext = 1;
                    }
                }
            }
            else if (this.Angle == Angle.YX)
            {
                isMin = checkFind.CheckNextIsNull(min, Position.DL);
                isMax = checkFind.CheckNextIsNull(max, Position.TR);
                if (isMax)
                {
                    AfterNext       = checkFind.GetNextIsNull(max, Position.TR);
                    AfterNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(AfterNext, Position.TR, max.IsBlanck, 1);
                    if (n == null)
                    {
                        AfterNextNext = 0;
                    }
                    else
                    {
                        AfterNextNext = 1;
                    }
                }
                else if (isMin)
                {
                    TopNext       = checkFind.GetNextIsNull(min, Position.DL);
                    TopNext.Angle = this.Angle;
                    var n = checkFind.GetNextNode(TopNext, Position.DL, min.IsBlanck, 1);
                    if (n == null)
                    {
                        TopNextNext = 0;
                    }
                    else
                    {
                        TopNextNext = 1;
                    }
                }
            }

            if (isMin || isMax)
            {
                Block = 2;
            }
            if (!isMin && !isMax)
            {
                Block = -1;
            }
            if (isMin && isMax)
            {
                Block = 1;
            }
        }
示例#7
0
        public Node GetNode(CheckFind checkFind, bool isBlanck)
        {
            string outText = "";

            if (Block == 1)
            {
                /// 需要侧列
                if (NoTuseds != null && NoTuseds.Count == 1)
                {
                    var __nodel = NoTuseds[NoTuseds.Count - 1];
                    __nodel.Rate     = Analysis.Contrast(__nodel, checkFind, isBlanck, out outText);
                    __nodel.RateText = outText;
                    return(__nodel);
                }
                else
                {
                    if (AfterNextNext != 0 && TopNextNext != 0)
                    {
                        var afterRa = Analysis.Contrast(AfterNext, checkFind, isBlanck, out outText);
                        var topRa   = Analysis.Contrast(TopNext, checkFind, isBlanck, out outText);
                        if (afterRa > topRa)
                        {
                            AfterNext.Rate     = afterRa;
                            AfterNext.RateText = outText;
                            return(AfterNext);
                        }
                        else
                        {
                            TopNext.Rate     = topRa;
                            TopNext.RateText = outText;
                            return(TopNext);
                        }
                    }
                    else if (AfterNextNext != 0)
                    {
                        var afterRa = Analysis.Contrast(AfterNext, checkFind, isBlanck, out outText);
                        AfterNext.Rate     = afterRa;
                        AfterNext.RateText = outText;
                        return(AfterNext);
                    }
                    else if (TopNextNext != 0)
                    {
                        var topRa = Analysis.Contrast(TopNext, checkFind, isBlanck, out outText);
                        TopNext.Rate     = topRa;
                        TopNext.RateText = outText;
                        return(TopNext);
                    }
                }
                // 还需要策略[挨着墙]
                var __node = TopNext != null ? TopNext : AfterNext;
                __node.Rate     = Analysis.Contrast(__node, checkFind, isBlanck, out outText);
                __node.RateText = outText;
                return(__node);
            }
            if (Block == 2)
            {
                var __node = TopNext != null ? TopNext : AfterNext;
                __node.Rate     = Analysis.Contrast(__node, checkFind, isBlanck, out outText);
                __node.RateText = outText;
                return(__node);
            }
            return(null);
        }