<commit_before>package openmods.utils.bitmap;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import net.minecraftforge.common.util.ForgeDirection;
import openmods.api.IValueProvider;
import openmods.api.IValueReceiver;

import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Maps;
import com.google.common.collect.UnmodifiableIterator;

public class BitMapUtils {

	public static <T> Iterator<Map.Entry<T, Boolean>> createFlagIterator(final IReadableBitMap<T> map, final Iterable<T> values) {
		return createFlagIterator(map, values.iterator());
	}

	public static <T> Iterator<Map.Entry<T, Boolean>> createFlagIterator(final IReadableBitMap<T> map, final Iterator<T> values) {
		return new UnmodifiableIterator<Map.Entry<T, Boolean>>() {
			@Override
			public boolean hasNext() {
				return values.hasNext();
			}

			@Override
			public Entry<T, Boolean> next() {
				final T key = values.next();
				final boolean value = map.get(key);
				return Maps.immutableEntry(key, value);
			}
		};
	}

	public static <T> Iterator<T> createTrueValuesIterator(final IReadableBitMap<T> map, final Iterable<T> values) {
		return createTrueValuesIterator(map, values.iterator());
	}

	public static <T> Iterator<T> createTrueValuesIterator(final IReadableBitMap<T> map, final Iterator<T> values) {
		return new AbstractIterator<T>() {
			@Override
			protected T computeNext() {
				while (values.hasNext()) {
					final T key = values.next();
					if (map.get(key)) return key;
				}

				return endOfData();
			}
		};
	}

	public static <T> IValueProvider<Boolean> singleBitProvider(final IReadableBitMap<T> map, final T key) {
		return new IValueProvider<Boolean>() {
			@Override
			public Boolean getValue() {
				return map.get(key);
			}
		};
	}

	public static <T> IValueReceiver<Boolean> singleBitReceiver(final IWriteableBitMap<T> map, final T key) {
		return new IValueReceiver<Boolean>() {
			@Override
			public void setValue(Boolean value) {
				map.set(key, value);
			}
		};
	}

	public static <T> IValueReceiver<Boolean> singleBitReceiver(final IRpcIntBitMap map, final int key) {
		return new IValueReceiver<Boolean>() {
			@Override<commit_msg>Remove warning<commit_after>package openmods.utils.bitmap;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import net.minecraftforge.common.util.ForgeDirection;
import openmods.api.IValueProvider;
import openmods.api.IValueReceiver;

import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Maps;
import com.google.common.collect.UnmodifiableIterator;

public class BitMapUtils {

	public static <T> Iterator<Map.Entry<T, Boolean>> createFlagIterator(final IReadableBitMap<T> map, final Iterable<T> values) {
		return createFlagIterator(map, values.iterator());
	}

	public static <T> Iterator<Map.Entry<T, Boolean>> createFlagIterator(final IReadableBitMap<T> map, final Iterator<T> values) {
		return new UnmodifiableIterator<Map.Entry<T, Boolean>>() {
			@Override
			public boolean hasNext() {
				return values.hasNext();
			}

			@Override
			public Entry<T, Boolean> next() {
				final T key = values.next();
				final boolean value = map.get(key);
				return Maps.immutableEntry(key, value);
			}
		};
	}

	public static <T> Iterator<T> createTrueValuesIterator(final IReadableBitMap<T> map, final Iterable<T> values) {
		return createTrueValuesIterator(map, values.iterator());
	}

	public static <T> Iterator<T> createTrueValuesIterator(final IReadableBitMap<T> map, final Iterator<T> values) {
		return new AbstractIterator<T>() {
			@Override
			protected T computeNext() {
				while (values.hasNext()) {
					final T key = values.next();
					if (map.get(key)) return key;
				}

				return endOfData();
			}
		};
	}

	public static <T> IValueProvider<Boolean> singleBitProvider(final IReadableBitMap<T> map, final T key) {
		return new IValueProvider<Boolean>() {
			@Override
			public Boolean getValue() {
				return map.get(key);
			}
		};
	}

	public static <T> IValueReceiver<Boolean> singleBitReceiver(final IWriteableBitMap<T> map, final T key) {
		return new IValueReceiver<Boolean>() {
			@Override
			public void setValue(Boolean value) {
				map.set(key, value);
			}
		};
	}

	public static IValueReceiver<Boolean> singleBitReceiver(final IRpcIntBitMap map, final int key) {
		return new IValueReceiver<Boolean>() {
			@Override
{'fraction_non_alphanumeric': 0.11791280777049921, 'fraction_numerical': 0.0, 'mean_word_length': 4.655172413793103, 'pattern_counts': {'":': 0, '<': 68, '<?xml version=': 0, '>': 68, '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': '5995580', 'n_tokens_mistral': 1573, 'n_tokens_neox': 1400, 'n_words': 337}