Exemplo n.º 1
0
 private MateEdge(MateInterface prevInterface, MateInterface nextInterface, MateEdge?p, MateEdge?n)
 {
     this.Prev          = prevInterface.Vertex();
     this.Next          = nextInterface.Vertex();
     this.PrevInterface = prevInterface;
     this.NextInterface = nextInterface;
     this.PrevLink      = p;
     this.NextLink      = n;
 }
Exemplo n.º 2
0
        //创建一条边
        public static MateEdge?createEdge(MateInterface prev, MateInterface next)
        {
            var pv = prev.Vertex();
            var nv = next.Vertex();

            if (!pv.CanSupport(next) || !nv.CanSupport(prev))
            {
                return(null);
            }
            MateInterface?m;
            MateEdge?     temp, newEdge = new MateEdge(prev, next, null, null);

            newEdge.Mated = (m = pv.Mate(next)) != null;
            if (pv.FirstEdge == null)    //没有表则直接将边设置为firstEdge
            {
                pv.FirstEdge = newEdge;
            }
            else   //有边则找到最后一条以pv为起点的边。将result设置为prevLink
            {
                temp = pv.FirstEdge;
                while (temp.PrevLink != null)
                {
                    temp = temp.PrevLink;
                }
                temp.PrevLink = newEdge;
            }
            //下一条边同理
            if (nv.FirstEdge == null)
            {
                nv.FirstEdge = newEdge;
            }
            else
            {
                temp = nv.FirstEdge;
                while (temp.NextLink != null)
                {
                    temp = temp.NextLink;
                }
                temp.NextLink = newEdge;
            }
            return(newEdge);
        }
Exemplo n.º 3
0
 //进行配合测试,如果参数符合则返回配合的MateInterface,否则返回null
 public abstract MateInterface?Mate(MateInterface mateInterface);
Exemplo n.º 4
0
 /// <summary>
 /// 是否能配合改接口,参数是否能符合
 /// </summary>
 /// <param name="mateInterface"></param>
 /// <returns></returns>
 public abstract bool CanMate(MateInterface mateInterface);
Exemplo n.º 5
0
 public abstract MateInterface Support(MateInterface mateInterface);
Exemplo n.º 6
0
 /// <summary>
 /// 是否支持该配合的接口
 /// </summary>
 /// <param name="mateInterface"></param>
 /// <returns></returns>
 public abstract bool CanSupport(MateInterface mateInterface);