Esempio n. 1
0
        /// <summary>
        /// Appends all values from deque <paramref name="b"/> to <paramref name="a"/>.
        /// </summary>
        /// <param name="a">A Deque to change.</param>
        /// <param name="b">Another Deque of compatible type to <paramref name="a"/>.</param>
        /// <returns>A truth value telling whether a was changed (i.e. b not empty)</returns>
        public static bool ConcatenateChanged <V>(Deque <V> a, Deque <V> b)
        {
            // Append b to a
            foreach (V entry in b)
            {
                a.Enqueue(entry);
            }

            return(b.Count > 0);
        }
Esempio n. 2
0
        /// <summary>
        /// Appends all values from deque <paramref name="b"/> to <paramref name="a"/>.
        /// </summary>
        /// <param name="a">A Deque to change.</param>
        /// <param name="b">Another Deque of compatible type to <paramref name="a"/>.</param>
        /// <param name="graph">The graph containing the edge containing the attribute which gets changed.</param>
        /// <param name="owner">The edge containing the attribute which gets changed.</param>
        /// <param name="attrType">The attribute type of the attribute which gets changed.</param>
        /// <returns>A truth value telling whether at least one element was changed in a</returns>
        public static bool ConcatenateChanged <V>(Deque <V> a, Deque <V> b,
                                                  IGraph graph, IEdge owner, AttributeType attrType)
        {
            // Append b to a
            foreach (V entry in b)
            {
                graph.ChangingEdgeAttribute(owner, attrType, AttributeChangeType.PutElement, entry, null);
                a.Enqueue(entry);
                graph.ChangedEdgeAttribute(owner, attrType);
            }

            return(b.Count > 0);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new deque and appends all values first from
        /// <paramref name="a"/> and then from <paramref name="b"/>.
        /// </summary>
        /// <param name="a">A Deque.</param>
        /// <param name="b">Another Deque of compatible type to <paramref name="a"/>.</param>
        /// <returns>A new Deque containing a concatenation of the parameter deques.</returns>
        public static Deque <V> Concatenate <V>(Deque <V> a, Deque <V> b)
        {
            // create new deque as a copy of a
            Deque <V> newDeque = new Deque <V>(a);

            // then append b
            foreach (V entry in b)
            {
                newDeque.Enqueue(entry);
            }

            return(newDeque);
        }