<commit_before>import UnitaryObject from './unitaryobject.js';
import Point from './point.js';

export default class Image_ extends UnitaryObject {
    constructor(src, startPoint) {
        super();
        this.src = src;
        this.startPoint = startPoint;
        this.dx = startPoint.x;
        this.dy = startPoint.y;
        this.dw = null;
        this.dh = null;
        this.sw = null;
        this.sh = null;
        this.sx = null;
        this.sy = null;
    }
    trim(startPoint, sw, sh, dw = null, dh = null) {
        const newImage = new Image_(this.src, this.startPoint);
        if (dw == null) {
            dw = sw;
        }
        if (dh == null) {
            dh = sh;
        }
        newImage.sx = startPoint.x;
        newImage.sy = startPoint.y;
        newImage.sw = sw;
        newImage.sh = sh;
        newImage.dw = dw;
        newImage.dh = dh;
        return newImage;
    };
    resize(dw, dh) {
        const newImage = new Image_(this.src, this.startPoint);
        newImage.dw = dw;
        newImage.dh = dh;
        newImage.sw = this.sw;
        newImage.sh = this.sh;
        newImage.sx = this.sx;
        newImage.sy = this.sy;
        return newImage;
    }
    equals(B) {
        if (!super.equals(B)) {
            return false;
        }
        return this.src === B.src && this.dx === B.dx && this.dy === B.dy && this.dw === B.dw && this.dh === B.dh && this.sw === B.sw && this.sh === B.sh && this.sx === B.sx && this.sy === B.sy;
    }
    move(dx, dy) {
        if (dx === 0 && dy === 0) return this;
        let newImage = new Image_(this.src, this.startPoint.move(dx, dy));
        if (this.sx !== null) {
            newImage = newImage.trim(new Point(this.sx, this.sy), this.sw, this.sh, this.dw, this.dh);
        }
        return newImage;
    }
    name() { return 'Image'; }
}<commit_msg>Image.prototype.move() returns resized image when it has been resized<commit_after>import UnitaryObject from './unitaryobject.js';
import Point from './point.js';

export default class Image_ extends UnitaryObject {
    constructor(src, startPoint) {
        super();
        this.src = src;
        this.startPoint = startPoint;
        this.dx = startPoint.x;
        this.dy = startPoint.y;
        this.dw = null;
        this.dh = null;
        this.sw = null;
        this.sh = null;
        this.sx = null;
        this.sy = null;
    }
    trim(startPoint, sw, sh, dw = null, dh = null) {
        const newImage = new Image_(this.src, this.startPoint);
        if (dw == null) {
            dw = sw;
        }
        if (dh == null) {
            dh = sh;
        }
        newImage.sx = startPoint.x;
        newImage.sy = startPoint.y;
        newImage.sw = sw;
        newImage.sh = sh;
        newImage.dw = dw;
        newImage.dh = dh;
        return newImage;
    };
    resize(dw, dh) {
        const newImage = new Image_(this.src, this.startPoint);
        newImage.dw = dw;
        newImage.dh = dh;
        newImage.sw = this.sw;
        newImage.sh = this.sh;
        newImage.sx = this.sx;
        newImage.sy = this.sy;
        return newImage;
    }
    equals(B) {
        if (!super.equals(B)) {
            return false;
        }
        return this.src === B.src && this.dx === B.dx && this.dy === B.dy && this.dw === B.dw && this.dh === B.dh && this.sw === B.sw && this.sh === B.sh && this.sx === B.sx && this.sy === B.sy;
    }
    move(dx, dy) {
        if (dx === 0 && dy === 0) return this;
        let newImage = new Image_(this.src, this.startPoint.move(dx, dy));
        if (this.sx !== null) {
            newImage = newImage.trim(new Point(this.sx, this.sy), this.sw, this.sh, this.dw, this.dh);
        } else if (this.dw !== null) {
            newImage = newImage.resize(this.dw, this.dh);
        }
        return newImage;
    }
    name() { return 'Image'; }
}
{'fraction_non_alphanumeric': 0.15185281160922517, 'fraction_numerical': 0.0010365379632029023, 'mean_word_length': 1.6768377253814146, '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': '1316630', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1267, 'n_words': 313}