Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public object Clone()
        {
            bagOfWords output = new bagOfWords();

            foreach (var pair in items)
            {
                output.Add(pair.Key, pair.Value);
            }
            return(output);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the specified second.
        /// </summary>
        /// <param name="second">The second.</param>
        /// <param name="op">The op.</param>
        public void calculate(bagOfWords second, operation op)
        {
            switch (op)
            {
            case operation.assign:
                Clear();
                AddInstanceRange(second);
                break;

            case operation.plus:
                AddInstanceRange(second);
                break;

            case operation.minus:
                Remove(second);
                break;

            default:
                break;
            }
        }