예제 #1
0
        /// <summary>
        /// Returns true if the task collection overlaps another task collection.
        /// </summary>
        /// <param name="coll">Task collection.</param>
        /// <returns>True if there's an overlap.</returns>
        public bool Overlaps(DriverTaskCollection coll)
        {
            foreach (DriverTask collTask in coll)
            {
                foreach (DriverTask thisTask in this)
                {
                    if (thisTask.Overlaps(collTask))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        /// <summary>
        /// Add a collection into the right task bucket.
        /// </summary>
        /// <param name="coll">Collection to add.</param>
        /// <returns>True if this was an independent collection.</returns>
        public bool Add(DriverTaskCollection coll)
        {
            foreach (DriverTaskCollections collections in _collections)
            {
                if (collections.Overlaps(coll))
                {
                    collections.Add(coll);
                    return(false);
                }
            }

            DriverTaskCollections newCollection = new DriverTaskCollections();

            newCollection.Add(coll);
            _collections.Add(newCollection);
            return(true);
        }