<commit_before>// instance - instances, ranges, iterators and manager interface
// Part of Stardazed TX
// (c) 2016 by <NAME> - @zenmumbler

namespace sd.world {

	export interface Instance<Component> extends Number {
		__C?: Component;
	}


	export interface InstanceArrayView<Component> {
		length: number;
		[index: number]: Instance<Component>;
	}


	export interface InstanceRange<Component> {
		empty: boolean;
		has(inst: Instance<Component>): boolean;

		makeIterator(): InstanceIterator<Component>;
		forEach(fn: (inst: Instance<Component>) => void, thisObj?: any): void;
	}


	export interface InstanceIterator<Component> {
		current: Instance<Component>;
		next(): boolean;
	}


	class InstanceSetIterator<Component> implements InstanceIterator<Component> {
		current: Instance<Component> = 0;

		constructor(private es6Iter: Iterator<Instance<Component>>) {}

		next() {
			var res = this.es6Iter.next();
			this.current = res.value;
			return !res.done;
		}
	}
<commit_msg>instance: use 0 for undefined instance<commit_after>// instance - instances, ranges, iterators and manager interface
// Part of Stardazed TX
// (c) 2016 by <NAME> - @zenmumbler

namespace sd.world {

	export interface Instance<Component> extends Number {
		__C?: Component;
	}


	export interface InstanceArrayView<Component> {
		length: number;
		[index: number]: Instance<Component>;
	}


	export interface InstanceRange<Component> {
		empty: boolean;
		has(inst: Instance<Component>): boolean;

		makeIterator(): InstanceIterator<Component>;
		forEach(fn: (inst: Instance<Component>) => void, thisObj?: any): void;
	}


	export interface InstanceIterator<Component> {
		current: Instance<Component>;
		next(): boolean;
	}


	class InstanceSetIterator<Component> implements InstanceIterator<Component> {
		current: Instance<Component> = 0;

		constructor(private es6Iter: Iterator<Instance<Component>>) {}

		next() {
			var res = this.es6Iter.next();
			this.current = res.value || 0;
			return !res.done;
		}
	}

{'fraction_non_alphanumeric': 0.12437562437562437, 'fraction_numerical': 0.007992007992007992, 'mean_word_length': 4.755747126436781, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, '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': '4576847', 'n_tokens_mistral': 649, 'n_tokens_neox': 598, 'n_words': 158}