Exemple #1
0
        /// <summary>
        /// Attempts to create a child node that encloses the specified window
        /// </summary>
        /// <param name="childStrip">The coverage of the first child of this node</param>
        /// <param name="itemWindow">The window of an item that is being added into this tree</param>
        /// <returns>The created child (null if the item cannot be accepted by any child node)</returns>
        Node AddChild(Extent childStrip, Extent itemWindow)
        {
            for (int i = 0; i < MAX_CHILD_COUNT; i++)
            {
                if (itemWindow.IsEnclosedBy(childStrip))
                {
                    return(CreateChild(childStrip));
                }

                ShiftStrip(childStrip);
            }

            return(null);
        }
Exemple #2
0
        /// <summary>
        /// Attempt to find an existing child node that encloses the specified window
        /// </summary>
        /// <param name="w">The window of interest</param>
        /// <returns>The first child node that entirely encloses the window (null
        /// if nothing found)</returns>
        Node FindChild(Extent w)
        {
            if (m_Children == null)
            {
                return(null);
            }

            foreach (Node n in m_Children)
            {
                if (w.IsEnclosedBy(n.Window))
                {
                    return(n);
                }
            }

            return(null);
        }
        /// <summary>
        /// Attempt to find an existing child node that encloses the specified window
        /// </summary>
        /// <param name="w">The window of interest</param>
        /// <returns>The first child node that entirely encloses the window (null
        /// if nothing found)</returns>
        Node FindChild(Extent w)
        {
            if (m_Children==null)
                return null;

            foreach (Node n in m_Children)
            {
                if (w.IsEnclosedBy(n.Window))
                    return n;
            }

            return null;
        }
        /// <summary>
        /// Attempts to create a child node that encloses the specified window
        /// </summary>
        /// <param name="childStrip">The coverage of the first child of this node</param>
        /// <param name="itemWindow">The window of an item that is being added into this tree</param>
        /// <returns>The created child (null if the item cannot be accepted by any child node)</returns>
        Node AddChild(Extent childStrip, Extent itemWindow)
        {
            for (int i=0; i<MAX_CHILD_COUNT; i++)
            {
                if (itemWindow.IsEnclosedBy(childStrip))
                    return CreateChild(childStrip);

                ShiftStrip(childStrip);
            }

            return null;
        }