public IPositionateEdge ResolveConflict(IAbsolutePositionateEdge edge)
 {
     return(new IPositionateEdgeMock()
     {
         Left = this.Left, Right = this.Right
     });
 }
Exemplo n.º 2
0
 private void AssertAbsoluteEdge(IAbsolutePositionateEdge edge, PlaceType placeType, Type type)
 {
     Assert.IsNotNull(edge);
     Assert.IsInstanceOfType(edge, typeof(AbsoluteEdge));
     Assert.IsInstanceOfType(edge, type);
     Assert.AreEqual(edge.Type, placeType);
     Assert.IsNotNull(edge.Left);
     Assert.AreEqual(edge.Left, this.Left);
 }
Exemplo n.º 3
0
        public override IPositionateEdge ResolveConflict(IAbsolutePositionateEdge edge)
        {
            var cornerEdge = (InCornerEdge)edge;

            if (cornerEdge.Horizontal != this.Horizontal || cornerEdge.Vertical != this.Vertical)
            {
                return(null);
            }

            return(this.ResolveConflictWithGivenEdge(edge.Left, new ToLeftEdge()));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Method for adding absolute edges
        /// </summary>
        /// <param name="edge"></param>
        /// <returns>Edge to add into a graph</returns>
        private IPositionateEdge AddAbsoluteEdge(IAbsolutePositionateEdge edge)
        {
            foreach (var absEdge in this.AbsoluteEdges)
            {
                if (absEdge.GetType() == edge.GetType())
                {
                    // Edge will return us which edge we should add into graph
                    var newEdge = absEdge.ResolveConflict(edge);
                    if (newEdge == null)
                    {
                        continue;
                    }

                    return(newEdge);
                }
            }

            this.AbsoluteEdges.Add(edge);
            return(edge);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Interface method for resolving conflicts of same type.
 /// </summary>
 /// <param name="edge">Edge to resolve</param>
 /// <returns>New edge connecting elements</returns>
 public abstract IPositionateEdge ResolveConflict(IAbsolutePositionateEdge edge);
Exemplo n.º 6
0
 public override IPositionateEdge ResolveConflict(IAbsolutePositionateEdge edge)
 {
     return(this.ResolveConflictWithGivenEdge(edge.Left, new ToLeftEdge()));
 }