<commit_before>var Step = new Class({
    initialize: function(key, stamp) {
        this.Key = key; // not in order!
        this.Stamp = stamp;
        this.LocationUnitHash = new Hash();
        this.UnitTerminals = [];
    },

    SetStamp: function(stamp) {
        this.Stamp = stamp;
        this.Div.getChildren('.step_stamp')[0].textContent = stamp;
    },

    AddUnitTerminal: function(unit) {
        this.UnitTerminals.push(unit);
    },

    RemoveUnitTerminal: function(unit) {
        this.UnitTerminals.erase(unit);
        if (this.UnitTerminals.length == 0) {
            this.RemoveStep();
        }
    },

    RemoveStep: function() {
        /* Hack - because step stamps are for when the step beings,
         * but our logic is from when the step terminates,
         * copy across the stamp here to make it look like it's the other one */
        var nextStep = steps[steps.indexOf(this) +1];
        nextStep.SetStamp(this.Stamp);

        steps.erase(this);
        this.Div.dispose();

        var key = this.Key;
        this.LocationUnitHash.each(function(unit, location) {
            unit.RemoveStep(key);
        });
    },

    AddUnit: function(unit) {
        var locationKey = unit.LocationKey;
        this.LocationUnitHash[locationKey] = unit;
    },

    GetMaxBottomY: function(bottomY) {
        Array.each(this.UnitTerminals, function(unit, index){
            var unitBottomY = unit.GetBottomY();
            if (unitBottomY > bottomY) {
                bottomY = unitBottomY;
            }
        });
        return bottomY;
    },

    SetBottomY: function(bottomY) {
        Array.each(this.UnitTerminals, function(unit, index){
            unit.SetBottomY(bottomY);
        });

        //TODO: This is run twice for each step when initialising, check ordering
        //NOTE: getting position from Unit, as step is unreliable (pos only gets updated after this frame)
        if (this.UnitTerminals.length == 0) {
            return;
        }
        var height = bottomY - this.UnitTerminals[0].Div.getPosition().y;

        this.Div.setStyle('height', height + 'px');
    },

    Reposition: function() {<commit_msg>Split step bug fix<commit_after>var Step = new Class({
    initialize: function(key, stamp) {
        this.Key = key; // not in order!
        this.Stamp = stamp;
        this.LocationUnitHash = new Hash();
        this.UnitTerminals = [];
    },

    SetStamp: function(stamp) {
        this.Stamp = stamp;
        this.Div.getChildren('.step_stamp')[0].textContent = stamp;
    },

    AddUnitTerminal: function(unit) {
        this.UnitTerminals.push(unit);
    },

    RemoveUnitTerminal: function(unit) {
        this.UnitTerminals.erase(unit);
        if (this.UnitTerminals.length == 0) {
            this.RemoveStep();
        }
    },

    RemoveStep: function() {
        /* Hack - because step stamps are for when the step beings,
         * but our logic is from when the step terminates,
         * copy across the stamp here to make it look like it's the other one */
        var nextStep = steps[steps.indexOf(this) +1];
        nextStep.SetStamp(this.Stamp);

        steps.erase(this);
        this.Div.dispose();

        var key = this.Key;
        this.LocationUnitHash.each(function(unit, location) {
            unit.RemoveStep(key);
        });
    },

    AddUnit: function(unit) {
        var locationKey = unit.LocationKey;
        this.LocationUnitHash[locationKey] = unit;
    },

    GetMaxBottomY: function(bottomY) {
        Array.each(this.UnitTerminals, function(unit, index){
            var unitBottomY = unit.GetBottomY();
            if (unitBottomY > bottomY) {
                bottomY = unitBottomY;
            }
        });
        return bottomY;
    },

    SetBottomY: function(bottomY) {
        var biggestTop = 0;
        Array.each(this.UnitTerminals, function(unit, index){
            unit.SetBottomY(bottomY);
            var unitTop = unit.Div.getPosition().y;
            if (unitTop > biggestTop) {
                biggestTop = unitTop;
            }
        });

        //TODO: This is run twice for each step when initialising, check ordering
        //NOTE: getting position from Unit, as step is unreliable (pos only gets updated after this frame)
        if (this.UnitTerminals.length == 0) {
            return;
        }
        var height = bottomY - biggestTop;

        this.Div.setStyle('height', height + 'px');
    },

    Reposition: function() {
{'fraction_non_alphanumeric': 0.11418376449598573, 'fraction_numerical': 0.0022301516503122213, 'mean_word_length': 2.026315789473684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '4985460', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1273, 'n_words': 316}