<commit_before>package org.vaadin.textfieldformatter;

import com.vaadin.ui.AbstractTextField;

public class CustomStringBlockFormatter extends AbstractTextFieldFormatterExtension {

	/**
	 * Creates an instance of CustomStringBlockFormatter
	 * 
	 * @param field
	 *            the AbstractTextField to create the extension for
	 * @param blocks
	 *            an array configuring the character blocks. The length of the array
	 *            is the number of character blocks. The integers in the array are
	 *            the length of the blocks.
	 * @param delimiters
	 *            the delimiter characters to be used between the character blocks
	 * @param forceCase
	 *            enumeration to control letter case of characters. One of
	 *            ForceCase.NONE don't touch letter case. ForceCase.LOWER transform
	 *            characters to lower case. ForceCase.UPPER transform characters to
	 *            upper case.
	 * @param prefix
	 *            String prefix for the input
	 * @param numericOnly
	 *            true for allowing numeric characters only. Defaults to false.
	 */
	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, String[] delimiters, ForceCase forceCase,
			String prefix, boolean numericOnly) {
		super(field);
		getState().formatBlocks = blocks;
		getState().delimiters = delimiters;
		if (forceCase == ForceCase.UPPER) {
			getState().lowercase = false;
			getState().uppercase = true;
		} else if (forceCase == ForceCase.LOWER) {
			getState().lowercase = true;
			getState().uppercase = false;
		}
		getState().prefix = prefix;
		getState().numericOnly = numericOnly;
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, String[] delimiters, ForceCase forceCase,
			boolean numericOnly) {
		this(field, blocks, delimiters, forceCase, null, numericOnly);
	}

	/**
	 * Creates an instance of CustomStringBlockFormatter. Call extend to attach this
	 * formatter to a TextField.
	 * 
	 * @param blocks
	 *            an array configuring the character blocks. The length of the array
	 *            is the number of character blocks. The integers in the array are
	 *            the length of the blocks.
	 * @param delimiters
	 *            the delimiter characters to be used between the character blocks
	 * @param forceCase
	 *            enumeration to control letter case of characters. One of
	 *            ForceCase.NONE don't touch letter case. ForceCase.LOWER transform
	 *            characters to lower case. ForceCase.UPPER transform characters to
	 *            upper case.
	 * @param prefix
	 *            String prefix for the input
	 * @param numericOnly
	 *            true for allowing numeric characters only. Defaults to false.
	 */
	public CustomStringBlockFormatter(int[] blocks, String[] delimiters, ForceCase forceCase, String prefix,
			boolean numericOnly) {
		getState().formatBlocks = blocks;
		getState().delimiters = delimiters;
		if (forceCase == ForceCase.UPPER) {
			getState().lowercase = false;
			getState().uppercase = true;
		} else if (forceCase == ForceCase.LOWER) {
			getState().lowercase = true;
			getState().uppercase = false;
		}
		getState().prefix = prefix;
		getState().numericOnly = numericOnly;
	}

	public CustomStringBlockFormatter(int[] blocks, String[] delimiters, ForceCase forceCase, boolean numericOnly) {
		this(blocks, delimiters, forceCase, null, numericOnly);
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, String[] delimiters, ForceCase forceCase) {
		this(field, blocks, delimiters, forceCase, false);
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, ForceCase forceCase) {
		this(field, blocks, null, forceCase);
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks) {
		this(field, blocks, null, ForceCase.NONE);
	}

	public CustomStringBlockFormatter(AbstractTextField field, Options options) {
		this(field, options.blocks, options.delimiters, options.forceCase, options.numericOnly);
	}

	public CustomStringBlockFormatter(Options options) {
		this(options.blocks, options.delimiters, options.forceCase, options.numericOnly);
	}

	/**
	 * Adds this extension to a AbstractTextField. Extension cannot be moved to
	 * another TextField. again.
	 */<commit_msg>Fixed missing initialization from Options<commit_after>package org.vaadin.textfieldformatter;

import com.vaadin.ui.AbstractTextField;

public class CustomStringBlockFormatter extends AbstractTextFieldFormatterExtension {

	/**
	 * Creates an instance of CustomStringBlockFormatter
	 * 
	 * @param field
	 *            the AbstractTextField to create the extension for
	 * @param blocks
	 *            an array configuring the character blocks. The length of the array
	 *            is the number of character blocks. The integers in the array are
	 *            the length of the blocks.
	 * @param delimiters
	 *            the delimiter characters to be used between the character blocks
	 * @param forceCase
	 *            enumeration to control letter case of characters. One of
	 *            ForceCase.NONE don't touch letter case. ForceCase.LOWER transform
	 *            characters to lower case. ForceCase.UPPER transform characters to
	 *            upper case.
	 * @param prefix
	 *            String prefix for the input
	 * @param numericOnly
	 *            true for allowing numeric characters only. Defaults to false.
	 */
	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, String[] delimiters, ForceCase forceCase,
			String prefix, boolean numericOnly) {
		super(field);
		getState().formatBlocks = blocks;
		getState().delimiters = delimiters;
		if (forceCase == ForceCase.UPPER) {
			getState().lowercase = false;
			getState().uppercase = true;
		} else if (forceCase == ForceCase.LOWER) {
			getState().lowercase = true;
			getState().uppercase = false;
		}
		getState().prefix = prefix;
		getState().numericOnly = numericOnly;
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, String[] delimiters, ForceCase forceCase,
			boolean numericOnly) {
		this(field, blocks, delimiters, forceCase, null, numericOnly);
	}

	/**
	 * Creates an instance of CustomStringBlockFormatter. Call extend to attach this
	 * formatter to a TextField.
	 * 
	 * @param blocks
	 *            an array configuring the character blocks. The length of the array
	 *            is the number of character blocks. The integers in the array are
	 *            the length of the blocks.
	 * @param delimiters
	 *            the delimiter characters to be used between the character blocks
	 * @param forceCase
	 *            enumeration to control letter case of characters. One of
	 *            ForceCase.NONE don't touch letter case. ForceCase.LOWER transform
	 *            characters to lower case. ForceCase.UPPER transform characters to
	 *            upper case.
	 * @param prefix
	 *            String prefix for the input
	 * @param numericOnly
	 *            true for allowing numeric characters only. Defaults to false.
	 */
	public CustomStringBlockFormatter(int[] blocks, String[] delimiters, ForceCase forceCase, String prefix,
			boolean numericOnly) {
		getState().formatBlocks = blocks;
		getState().delimiters = delimiters;
		if (forceCase == ForceCase.UPPER) {
			getState().lowercase = false;
			getState().uppercase = true;
		} else if (forceCase == ForceCase.LOWER) {
			getState().lowercase = true;
			getState().uppercase = false;
		}
		getState().prefix = prefix;
		getState().numericOnly = numericOnly;
	}

	public CustomStringBlockFormatter(int[] blocks, String[] delimiters, ForceCase forceCase, boolean numericOnly) {
		this(blocks, delimiters, forceCase, null, numericOnly);
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, String[] delimiters, ForceCase forceCase) {
		this(field, blocks, delimiters, forceCase, false);
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks, ForceCase forceCase) {
		this(field, blocks, null, forceCase);
	}

	public CustomStringBlockFormatter(AbstractTextField field, int[] blocks) {
		this(field, blocks, null, ForceCase.NONE);
	}

	public CustomStringBlockFormatter(AbstractTextField field, Options options) {
		this(field, options.blocks, options.delimiters, options.forceCase, options.prefix, options.numericOnly);
	}

	public CustomStringBlockFormatter(Options options) {
		this(options.blocks, options.delimiters, options.forceCase, options.prefix, options.numericOnly);
	}

	/**
	 * Adds this extension to a AbstractTextField. Extension cannot be moved to
	 * another TextField. again.
	 */
{'fraction_non_alphanumeric': 0.08290993071593533, 'fraction_numerical': 0.0, 'mean_word_length': 3.4575398867730316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6746144', 'n_tokens_mistral': 2423, 'n_tokens_neox': 2200, 'n_words': 768}