<commit_before>package com.matthewtamlin.spyglass.library.handler_processors;

import android.content.res.TypedArray;

import com.matthewtamlin.spyglass.library.handler_annotations.BooleanHandler;

import static com.matthewtamlin.java_utilities.checkers.NullChecker.checkNotNull;

public class BooleanAttributeProcessor implements AttributeProcessor<Boolean, BooleanHandler> {
	@Override
	public boolean attributeValueIsAvailable(
			final TypedArray attrs,
			final BooleanHandler annotation) {

		checkNotNull(attrs, "Argument 'attrs' cannot be null.");
		checkNotNull(annotation, "Argument 'annotation' cannot be null.");

		final boolean reading1 = attrs.getBoolean(annotation.attributeId(), false);
		final boolean reading2 = attrs.getBoolean(annotation.attributeId(), true);
		final boolean defaultConsistentlyReturned = (reading1 != reading2);

		return !defaultConsistentlyReturned;
	}

	@Override
	public Boolean getAttributeValue(final TypedArray attrs, final BooleanHandler annotation) {
		checkNotNull(attrs, "Argument 'attrs' cannot be null.");
		checkNotNull(annotation, "Argument 'annotation' cannot be null.");

		if (attributeValueIsAvailable(attrs, annotation)) {
			return attrs.getBoolean(annotation.attributeId(), false);
		} else {
			throw new RuntimeException("No attribute found for ID " + annotation.attributeId());
		}
	}

	@Override
	public boolean attributeIsMandatory(final BooleanHandler annotation) {<commit_msg>Added missing null check<commit_after>package com.matthewtamlin.spyglass.library.handler_processors;

import android.content.res.TypedArray;

import com.matthewtamlin.spyglass.library.handler_annotations.BooleanHandler;

import static com.matthewtamlin.java_utilities.checkers.NullChecker.checkNotNull;

public class BooleanAttributeProcessor implements AttributeProcessor<Boolean, BooleanHandler> {
	@Override
	public boolean attributeValueIsAvailable(
			final TypedArray attrs,
			final BooleanHandler annotation) {

		checkNotNull(attrs, "Argument 'attrs' cannot be null.");
		checkNotNull(annotation, "Argument 'annotation' cannot be null.");

		final boolean reading1 = attrs.getBoolean(annotation.attributeId(), false);
		final boolean reading2 = attrs.getBoolean(annotation.attributeId(), true);
		final boolean defaultConsistentlyReturned = (reading1 != reading2);

		return !defaultConsistentlyReturned;
	}

	@Override
	public Boolean getAttributeValue(final TypedArray attrs, final BooleanHandler annotation) {
		checkNotNull(attrs, "Argument 'attrs' cannot be null.");
		checkNotNull(annotation, "Argument 'annotation' cannot be null.");

		if (attributeValueIsAvailable(attrs, annotation)) {
			return attrs.getBoolean(annotation.attributeId(), false);
		} else {
			throw new RuntimeException("No attribute found for ID " + annotation.attributeId());
		}
	}

	@Override
	public boolean attributeIsMandatory(final BooleanHandler annotation) {
		checkNotNull(annotation, "Argument 'annotation' cannot be null.");

{'fraction_non_alphanumeric': 0.0919501515661839, 'fraction_numerical': 0.002694509936005389, 'mean_word_length': 6.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6749424', 'n_tokens_mistral': 836, 'n_tokens_neox': 780, 'n_words': 210}