<commit_before>﻿using System.Linq;

namespace CsDebugScript.Drawing.Interfaces
{
    /// <summary>
    /// Useful <see cref="IGraphics"/> extensions for creating objects with different parameters.
    /// </summary>
    public static class GraphicsExtensions
    {
        /// <summary>
        /// Creates canvas object that contains the specified list of drawings.
        /// </summary>
        /// <param name="graphics"><see cref="IGraphics"/> object.</param>
        /// <param name="drawings">Drawing objects.</param>
        /// <returns>Canvas object.</returns>
        public static ICanvas CreateCanvas(this IGraphics graphics, params IDrawing[] drawings)
        {
            return graphics.CreateCanvas(drawings);
        }

        /// <summary>
        /// Creates canvas object that contains the specified list of drawings.
        /// </summary>
        /// <param name="graphics"><see cref="IGraphics"/> object.</param>
        /// <param name="drawingObjects">Drawing visualizer objects.</param>
        /// <returns>Canvas object.</returns>
        public static ICanvas CreateCanvas(this IGraphics graphics, params IDrawingVisualizerObject[] drawingObjects)
        {
            IDrawing[] drawings = drawingObjects.Where(d => d.CanVisualize()).Select(d => d.CreateDrawing(graphics)).ToArray();

            return graphics.CreateCanvas(drawings);<commit_msg>Adding extension method for easier adding multiple elements to the canvas.<commit_after>﻿using System.Linq;

namespace CsDebugScript.Drawing.Interfaces
{
    /// <summary>
    /// Useful <see cref="IGraphics"/> extensions for creating objects with different parameters.
    /// </summary>
    public static class GraphicsExtensions
    {
        /// <summary>
        /// Creates canvas object that contains the specified list of drawings.
        /// </summary>
        /// <param name="graphics"><see cref="IGraphics"/> object.</param>
        /// <param name="drawings">Drawing objects.</param>
        /// <returns>Canvas object.</returns>
        public static ICanvas CreateCanvas(this IGraphics graphics, params IDrawing[] drawings)
        {
            return graphics.CreateCanvas(drawings);
        }

        /// <summary>
        /// Creates canvas object that contains the specified list of drawings.
        /// </summary>
        /// <param name="graphics"><see cref="IGraphics"/> object.</param>
        /// <param name="drawingObjects">Drawing visualizer objects.</param>
        /// <returns>Canvas object.</returns>
        public static ICanvas CreateCanvas(this IGraphics graphics, params IDrawingVisualizerObject[] drawingObjects)
        {
            IDrawing[] drawings = drawingObjects.Where(d => d.CanVisualize()).Select(d => d.CreateDrawing(graphics)).ToArray();

            return graphics.CreateCanvas(drawings);
        }

        /// <summary>
        /// Adds drawing objects to the list of drawing objects.
        /// </summary>
        /// <param name="canvas"><see cref="ICanvas"/> object.</param>
        /// <param name="drawings">Drawing objects.</param>
        public static void Add(this ICanvas canvas, params IDrawing[] drawings)
        {
            foreach (IDrawing drawing in drawings)
                canvas.AddDrawing(drawing);
{'fraction_non_alphanumeric': 0.13020833333333334, 'fraction_numerical': 0.0, 'mean_word_length': 2.4957173447537473, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2368013', 'n_tokens_mistral': 787, 'n_tokens_neox': 777, 'n_words': 222}