<commit_before>// Add functionality for keeping a moving window of samples per SampledProperty,
// so that the data doesn't accumulate indefinitely

import {SampledProperty, SampledPositionProperty, binarySearch, JulianDate, Matrix3, Matrix4} from './cesium-imports.ts'

Matrix3['prototype'].length = 9;
Matrix4['prototype'].length = 16;

var __slice = Array.prototype.slice

var after = function(fn: Function, after: Function) {
    return function() {
        var result = fn.apply(this, arguments)
        after.call(this, result)
        return result
    }
}

function removeBeforeDate(property: any, time: JulianDate) {
    var times = property._times
    var index = ~binarySearch(times, time, JulianDate.compare)
    if (index > 0) {
        times.splice(0, index)
        property._values.splice(0, index * property._innerType.packedLength)
        property._updateTableLength = true
        property._definitionChanged.raiseEvent(property)
    }
}

SampledProperty.prototype.removeSamplesBeforeDate = function(time) {
    removeBeforeDate(this, time)
}

SampledPositionProperty.prototype.removeSamplesBeforeDate = function(time) {
    removeBeforeDate(this._property, time)
}

function removeOldSamples(property: any, maxNumSamples: number) {
    if (maxNumSamples === undefined) maxNumSamples = 10
    var removeCount = property._times.length - maxNumSamples
    if (removeCount > 0) {
        property._times.splice(0, removeCount)
        property._values.splice(0, removeCount * property._innerType.packedLength)<commit_msg>Don't limit the number of samples in SampledProperties by default<commit_after>// Add functionality for keeping a moving window of samples per SampledProperty,
// so that the data doesn't accumulate indefinitely

import {SampledProperty, SampledPositionProperty, binarySearch, JulianDate, Matrix3, Matrix4} from './cesium-imports.ts'

Matrix3['prototype'].length = 9;
Matrix4['prototype'].length = 16;

var __slice = Array.prototype.slice

var after = function<T extends Function>(fn: T, after: Function) : T {
    return <T><any>function() {
        var result = fn.apply(this, arguments)
        after.call(this, result)
        return result
    }
}

function removeBeforeDate(property: any, time: JulianDate) {
    var times = property._times
    var index = ~binarySearch(times, time, JulianDate.compare)
    if (index > 0) {
        times.splice(0, index)
        property._values.splice(0, index * property._innerType.packedLength)
        property._updateTableLength = true
        property._definitionChanged.raiseEvent(property)
    }
}

SampledProperty.prototype.removeSamplesBeforeDate = function(time) {
    removeBeforeDate(this, time)
}

SampledPositionProperty.prototype.removeSamplesBeforeDate = function(time) {
    removeBeforeDate(this._property, time)
}

function removeOldSamples(property: any, maxNumSamples: number) {
    if (maxNumSamples === undefined) return;
    var removeCount = property._times.length - maxNumSamples
    if (removeCount > 0) {
        property._times.splice(0, removeCount)
        property._values.splice(0, removeCount * property._innerType.packedLength)
{'fraction_non_alphanumeric': 0.09993634627625717, 'fraction_numerical': 0.008911521323997454, 'mean_word_length': 4.1524590163934425, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, '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': '5301754', 'n_tokens_mistral': 897, 'n_tokens_neox': 861, 'n_words': 220}