<commit_before>﻿using PowerArgs.Cli.Physics;

namespace PowerArgs.Cli
{

    public class Rectangular : ObservableObject, ICollider
    {
        private int x, y, w, h;
        private RectF fBounds;


        private int z;
 
        public int ZIndex { get => z; set => SetHardIf(ref z, value, z != value); }

        public int ColliderHashCode { get; internal set; }

        public RectF Bounds
        {
            get { return fBounds; }
            set
            {
                fBounds = value;
                var newX = ConsoleMath.Round(value.Left);
                var newY = ConsoleMath.Round(value.Top);
                var newW = ConsoleMath.Round(value.Width);
                var newH = ConsoleMath.Round(value.Height);
                if (newX == x && newY == y && newW == w && newH == h) return;

                x = newX;
                y = newY;
                w = newW;
                h = newH;

                FirePropertyChanged(nameof(Bounds));
            }
        }

        public virtual bool CanCollideWith(ICollider other) => true;

        public int Width
        {
            get
            {
                return w;
            }
            set
            {
                if (w == value) return;
                w = value;
                fBounds = new RectF(fBounds.Left, fBounds.Top, w, fBounds.Height);
                FirePropertyChanged(nameof(Bounds));
            }
        }
        public int Height
        {
            get
            {
                return h;
            }
            set<commit_msg>objects can't collide with themselves<commit_after>﻿using PowerArgs.Cli.Physics;

namespace PowerArgs.Cli
{

    public class Rectangular : ObservableObject, ICollider
    {
        private int x, y, w, h;
        private RectF fBounds;


        private int z;
 
        public int ZIndex { get => z; set => SetHardIf(ref z, value, z != value); }

        public int ColliderHashCode { get; internal set; }

        public RectF Bounds
        {
            get { return fBounds; }
            set
            {
                fBounds = value;
                var newX = ConsoleMath.Round(value.Left);
                var newY = ConsoleMath.Round(value.Top);
                var newW = ConsoleMath.Round(value.Width);
                var newH = ConsoleMath.Round(value.Height);
                if (newX == x && newY == y && newW == w && newH == h) return;

                x = newX;
                y = newY;
                w = newW;
                h = newH;

                FirePropertyChanged(nameof(Bounds));
            }
        }

        public virtual bool CanCollideWith(ICollider other) => object.ReferenceEquals(this, other) == false;

        public int Width
        {
            get
            {
                return w;
            }
            set
            {
                if (w == value) return;
                w = value;
                fBounds = new RectF(fBounds.Left, fBounds.Top, w, fBounds.Height);
                FirePropertyChanged(nameof(Bounds));
            }
        }
        public int Height
        {
            get
            {
                return h;
            }
            set
{'fraction_non_alphanumeric': 0.08764815970056145, 'fraction_numerical': 0.0, 'mean_word_length': 1.1509054325955734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5158866', 'n_tokens_mistral': 890, 'n_tokens_neox': 824, 'n_words': 227}