<commit_before>package tink.reactive.bindings;
import tink.lang.Cls;

/**
 * ...
 * @author back2dos
 */

class BindableArray<T> implements Cls {
	var data:Array<T>;
	static inline var CHANGE = 'change';//TODO: all this is not particularly granular, but optimizing it is non-trivial since operations like shift mess with the whole array
	@:bindable(change) @:read(data.length) var length:Int;
	public function new(?data) {
		this.data = data == null ? [] : data;
	}
	function onChange<T>(value:T) {
		this.bindings.fire(CHANGE);
		return value;
	}
	@:bindable(CHANGE) public function first() {
		return data[0];
	}
	@:bindable(CHANGE) public function last() {
		return data[data.length - 1];
	}
	public function push(x:T):Int {
		return onChange(data.push(x));
	}
	public function pop(x:T):Null<T> {
		return onChange(data.pop());
	}
	public function unshift(x:T):Int {
		onChange(data.unshift(x));
		return length;
	}
	public function shift():Null<T> {
		return onChange(data.shift());
	}
	@:bindable(CHANGE) public function get(index:Int) {
		return data[index];
	}
	public function set(index:Int, x:T) {<commit_msg>Added BindableArray::remove.<commit_after>package tink.reactive.bindings;
import tink.lang.Cls;

/**
 * ...
 * @author back2dos
 */

class BindableArray<T> implements Cls {
	var data:Array<T>;
	static inline var CHANGE = 'change';//TODO: all this is not particularly granular, but optimizing it is non-trivial since operations like shift mess with the whole array
	@:bindable(change) @:read(data.length) var length:Int;
	public function new(?data) {
		this.data = data == null ? [] : data;
	}
	function onChange<T>(value:T) {
		this.bindings.fire(CHANGE);
		return value;
	}
	@:bindable(CHANGE) public function first() {
		return data[0];
	}
	@:bindable(CHANGE) public function last() {
		return data[data.length - 1];
	}
	public function push(x:T):Int {
		return onChange(data.push(x));
	}
	public function pop(x:T):Null<T> {
		return onChange(data.pop());
	}
	public function unshift(x:T):Int {
		onChange(data.unshift(x));
		return length;
	}
	public function remove(x:T):Bool {
		return data.remove(x) && onChange(true);
	}
	public function shift():Null<T> {
		return onChange(data.shift());
	}
	@:bindable(CHANGE) public function get(index:Int) {
		return data[index];
	}
	public function set(index:Int, x:T) {
{'fraction_non_alphanumeric': 0.15130732961851692, 'fraction_numerical': 0.002571795970852979, 'mean_word_length': 4.624096385542169, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6603397', 'n_tokens_mistral': 847, 'n_tokens_neox': 824, 'n_words': 201}