<commit_before>package com.tomgibara.storage;

import java.util.Arrays;

import com.tomgibara.bits.BitStore;
import com.tomgibara.bits.Bits;

abstract class NullPrimitiveStore<V> extends AbstractStore<V> {

	private static final int BYTE    =  1;
	private static final int FLOAT   =  2;
	private static final int CHAR    =  3;
	private static final int SHORT   =  4;
	private static final int LONG    =  6;
	private static final int INT     =  7;
	private static final int DOUBLE  = 11;
	private static final int BOOLEAN = 12;

	@SuppressWarnings("unchecked")
	static <V> NullPrimitiveStore<V> newStore(Class<V> type, int size) {
		switch((type.getName().hashCode() >> 8) & 0xf) {
		case BYTE:    return (NullPrimitiveStore<V>) new ByteStore     (size);
		case FLOAT:   return (NullPrimitiveStore<V>) new FloatStore    (size);
		case CHAR:    return (NullPrimitiveStore<V>) new CharacterStore(size);
		case SHORT:   return (NullPrimitiveStore<V>) new ShortStore    (size);
		case LONG:    return (NullPrimitiveStore<V>) new LongStore     (size);
		case INT:     return (NullPrimitiveStore<V>) new IntegerStore  (size);
		case DOUBLE:  return (NullPrimitiveStore<V>) new DoubleStore   (size);
		case BOOLEAN: return (NullPrimitiveStore<V>) new BooleanStore  (size);
		default: throw new IllegalArgumentException(type.getName());
		}
	}

	int count;
	BitStore populated;
	
	protected NullPrimitiveStore(BitStore populated, int count) {
		this.populated = populated;
		this.count = count;
	}
	
	protected NullPrimitiveStore(int size) {
		populated = Bits.newBitStore(size);
		this.count = 0;
	}

	// store<commit_msg>Matches bits API changes.<commit_after>package com.tomgibara.storage;

import java.util.Arrays;

import com.tomgibara.bits.BitStore;
import com.tomgibara.bits.Bits;

abstract class NullPrimitiveStore<V> extends AbstractStore<V> {

	private static final int BYTE    =  1;
	private static final int FLOAT   =  2;
	private static final int CHAR    =  3;
	private static final int SHORT   =  4;
	private static final int LONG    =  6;
	private static final int INT     =  7;
	private static final int DOUBLE  = 11;
	private static final int BOOLEAN = 12;

	@SuppressWarnings("unchecked")
	static <V> NullPrimitiveStore<V> newStore(Class<V> type, int size) {
		switch((type.getName().hashCode() >> 8) & 0xf) {
		case BYTE:    return (NullPrimitiveStore<V>) new ByteStore     (size);
		case FLOAT:   return (NullPrimitiveStore<V>) new FloatStore    (size);
		case CHAR:    return (NullPrimitiveStore<V>) new CharacterStore(size);
		case SHORT:   return (NullPrimitiveStore<V>) new ShortStore    (size);
		case LONG:    return (NullPrimitiveStore<V>) new LongStore     (size);
		case INT:     return (NullPrimitiveStore<V>) new IntegerStore  (size);
		case DOUBLE:  return (NullPrimitiveStore<V>) new DoubleStore   (size);
		case BOOLEAN: return (NullPrimitiveStore<V>) new BooleanStore  (size);
		default: throw new IllegalArgumentException(type.getName());
		}
	}

	int count;
	BitStore populated;
	
	protected NullPrimitiveStore(BitStore populated, int count) {
		this.populated = populated;
		this.count = count;
	}
	
	protected NullPrimitiveStore(int size) {
		populated = Bits.store(size);
		this.count = 0;
	}

	// store
{'fraction_non_alphanumeric': 0.10358688930117502, 'fraction_numerical': 0.008039579468150896, 'mean_word_length': 4.126782884310618, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, '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': '6958747', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1042, 'n_words': 306}