<commit_before>﻿using System.Text.RegularExpressions;

namespace Raccoon {
    public struct Size {
        #region Private Members

        private static readonly Regex StringFormatRegex = new Regex(@"(\-?\d+(?:\.?\d+)?)(?: *, *| +)(\-?\d+(?:\.?\d+)?)");

        #endregion Private Members

        #region Public Members

        public static readonly Size Empty = new Size(0);
        public static readonly Size Unit = new Size(1);

        public float Width, Height;

        #endregion Public Members

        #region Constructors

        public Size(float w, float h) {
            Width = System.Math.Abs(w);
            Height = System.Math.Abs(h);
        }

        public Size(float wh) : this(wh, wh) {
        }

        public Size(Vector2 v) : this(v.X, v.Y) {
        }

        #endregion Constructors

        #region Public Properties

        public float Area { get { return Width * Height; } }
        public bool IsEmpty { get { return (int) Width == 0 && (int) Height == 0; } }

        #endregion Public Properties

        #region Public Methods

        public static Size Parse(string value) {
            MatchCollection matches = StringFormatRegex.Matches(value);

            if (matches.Count == 0 || !matches[0].Success) {
                throw new System.FormatException($"String '{value}' doesn't not typify a Size.");
            }

            return new Size(
                float.Parse(matches[0].Groups[1].Value),
                float.Parse(matches[0].Groups[2].Value)
            );
        }

        public static bool TryParse(string value, out Size result) {
            MatchCollection matches = StringFormatRegex.Matches(value);<commit_msg>Fix Size.IsEmpty<commit_after>﻿using System.Text.RegularExpressions;

namespace Raccoon {
    public struct Size {
        #region Private Members

        private static readonly Regex StringFormatRegex = new Regex(@"(\-?\d+(?:\.?\d+)?)(?: *, *| +)(\-?\d+(?:\.?\d+)?)");

        #endregion Private Members

        #region Public Members

        public static readonly Size Empty = new Size(0);
        public static readonly Size Unit = new Size(1);

        public float Width, Height;

        #endregion Public Members

        #region Constructors

        public Size(float w, float h) {
            Width = System.Math.Abs(w);
            Height = System.Math.Abs(h);
        }

        public Size(float wh) : this(wh, wh) {
        }

        public Size(Vector2 v) : this(v.X, v.Y) {
        }

        #endregion Constructors

        #region Public Properties

        public float Area { get { return Width * Height; } }
        public bool IsEmpty { get { return (int) Width == 0 || (int) Height == 0; } }

        #endregion Public Properties

        #region Public Methods

        public static Size Parse(string value) {
            MatchCollection matches = StringFormatRegex.Matches(value);

            if (matches.Count == 0 || !matches[0].Success) {
                throw new System.FormatException($"String '{value}' doesn't not typify a Size.");
            }

            return new Size(
                float.Parse(matches[0].Groups[1].Value),
                float.Parse(matches[0].Groups[2].Value)
            );
        }

        public static bool TryParse(string value, out Size result) {
            MatchCollection matches = StringFormatRegex.Matches(value);
{'fraction_non_alphanumeric': 0.11818449749484232, 'fraction_numerical': 0.006483937518420277, 'mean_word_length': 2.0115350488021297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5069482', 'n_tokens_mistral': 955, 'n_tokens_neox': 882, 'n_words': 264}