<commit_before>/**
 * Copyright (C) 2012-2014 MK124
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.gtaun.shoebill.common.dialog;

import java.util.function.BooleanSupplier;
import java.util.function.Supplier;

public class ListDialogItem
{
	@SuppressWarnings("unchecked")
	public static abstract class AbstractItemBuilder
	<ItemType extends ListDialogItem, ItemBuilderType extends AbstractItemBuilder<ItemType, ItemBuilderType>>
	{
		protected final ItemType item;
		
		
		protected AbstractItemBuilder(ItemType item)
		{
			this.item = item;
		}
		
		public ItemBuilderType data(Object data)
		{
			item.setData(data);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType itemText(String itemText)
		{
			item.setItemText(itemText);
			return (ItemBuilderType) this;
		}

		public ItemBuilderType itemText(Supplier<String> textSupplier)
		{
			item.setItemText(textSupplier);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType itemText(ItemTextSupplier<?> textSupplier)
		{
			item.setItemText(textSupplier);
			return (ItemBuilderType) this;
		}

		public ItemBuilderType enabled(BooleanSupplier enabledSupplier)
		{
			item.setItemEnabledSupplier(enabledSupplier);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType enabled(ItemBooleanSupplier<?> enabledSupplier)
		{
			item.setItemEnabledSupplier(enabledSupplier);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType onSelect(ItemSelectSimpleHandler selectHandler)
		{
			item.setSelectHandler(selectHandler);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType onSelect(ItemSelectHandler<?> selectHandler)
		{
			item.setSelectHandler(selectHandler);
			return (ItemBuilderType) this;
		}
		
		public ItemType build()
		{
			return item;
		}
	}
	
	public static class ItemBuilder extends AbstractItemBuilder<ListDialogItem, ItemBuilder>
	{
		private ItemBuilder()
		{
			super(new ListDialogItem("-"));
		}
	}
	
	public static AbstractItemBuilder<?, ?> create()
	{
		return new ItemBuilder();
	}
	
	
	@FunctionalInterface
	public interface ItemTextSupplier<ItemData>
	{
		String getItemText(ItemData data);
	}
	
	@FunctionalInterface
	public interface ItemBooleanSupplier<ItemData>
	{
		boolean getBoolean(ItemData data);
	}

	@FunctionalInterface
	public interface ItemSelectSimpleHandler
	{
		void onItemSelect(ListDialogItem item);
	}
	
	@FunctionalInterface
	public interface ItemSelectHandler<ItemData>
	{
		void onItemSelect(ListDialogItem item, ItemData data);
	}
	
	
	protected ListDialog currentDialog;
	
	protected Object data;
	protected ItemTextSupplier<Object> itemTextSupplier;
	protected ItemBooleanSupplier<Object> itemEnabledSupplier;
	protected ItemSelectHandler<Object> selectHandler;
	

	protected <DataType> ListDialogItem(String itemText)
	{
		setItemText(itemText);
	}
	
	protected <DataType> ListDialogItem(Supplier<String> textSupplier)
	{
		setItemText(textSupplier);
	}
	
	public ListDialogItem(String itemText, ItemSelectSimpleHandler handler)
	{
		setItemText(itemText);
		setSelectHandler(handler);
	}
	
	public ListDialogItem(Supplier<String> textSupplier, ItemSelectSimpleHandler handler)
	{
		setItemText(textSupplier);
		setSelectHandler(handler);
	}

	public ListDialogItem(String itemText, BooleanSupplier enabledSupplier, ItemSelectSimpleHandler handler)
	{
		setItemText(itemText);
		setItemEnabledSupplier(enabledSupplier);
		setSelectHandler(handler);
	}
	
	public ListDialogItem(Supplier<String> textSupplier, BooleanSupplier enabledSupplier, ItemSelectSimpleHandler handler)
	{
		setItemText(textSupplier);
		setItemEnabledSupplier(enabledSupplier);
		setSelectHandler(handler);<commit_msg>Change some constructor of ListDialogItem to public<commit_after>/**
 * Copyright (C) 2012-2014 MK124
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.gtaun.shoebill.common.dialog;

import java.util.function.BooleanSupplier;
import java.util.function.Supplier;

public class ListDialogItem
{
	@SuppressWarnings("unchecked")
	public static abstract class AbstractItemBuilder
	<ItemType extends ListDialogItem, ItemBuilderType extends AbstractItemBuilder<ItemType, ItemBuilderType>>
	{
		protected final ItemType item;
		
		
		protected AbstractItemBuilder(ItemType item)
		{
			this.item = item;
		}
		
		public ItemBuilderType data(Object data)
		{
			item.setData(data);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType itemText(String itemText)
		{
			item.setItemText(itemText);
			return (ItemBuilderType) this;
		}

		public ItemBuilderType itemText(Supplier<String> textSupplier)
		{
			item.setItemText(textSupplier);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType itemText(ItemTextSupplier<?> textSupplier)
		{
			item.setItemText(textSupplier);
			return (ItemBuilderType) this;
		}

		public ItemBuilderType enabled(BooleanSupplier enabledSupplier)
		{
			item.setItemEnabledSupplier(enabledSupplier);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType enabled(ItemBooleanSupplier<?> enabledSupplier)
		{
			item.setItemEnabledSupplier(enabledSupplier);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType onSelect(ItemSelectSimpleHandler selectHandler)
		{
			item.setSelectHandler(selectHandler);
			return (ItemBuilderType) this;
		}
		
		public ItemBuilderType onSelect(ItemSelectHandler<?> selectHandler)
		{
			item.setSelectHandler(selectHandler);
			return (ItemBuilderType) this;
		}
		
		public ItemType build()
		{
			return item;
		}
	}
	
	public static class ItemBuilder extends AbstractItemBuilder<ListDialogItem, ItemBuilder>
	{
		private ItemBuilder()
		{
			super(new ListDialogItem("-"));
		}
	}
	
	public static AbstractItemBuilder<?, ?> create()
	{
		return new ItemBuilder();
	}
	
	
	@FunctionalInterface
	public interface ItemTextSupplier<ItemData>
	{
		String getItemText(ItemData data);
	}
	
	@FunctionalInterface
	public interface ItemBooleanSupplier<ItemData>
	{
		boolean getBoolean(ItemData data);
	}

	@FunctionalInterface
	public interface ItemSelectSimpleHandler
	{
		void onItemSelect(ListDialogItem item);
	}
	
	@FunctionalInterface
	public interface ItemSelectHandler<ItemData>
	{
		void onItemSelect(ListDialogItem item, ItemData data);
	}
	
	
	protected ListDialog currentDialog;
	
	protected Object data;
	protected ItemTextSupplier<Object> itemTextSupplier;
	protected ItemBooleanSupplier<Object> itemEnabledSupplier;
	protected ItemSelectHandler<Object> selectHandler;
	

	public <DataType> ListDialogItem(String itemText)
	{
		setItemText(itemText);
	}
	
	public <DataType> ListDialogItem(Supplier<String> textSupplier)
	{
		setItemText(textSupplier);
	}
	
	public ListDialogItem(String itemText, ItemSelectSimpleHandler handler)
	{
		setItemText(itemText);
		setSelectHandler(handler);
	}
	
	public ListDialogItem(Supplier<String> textSupplier, ItemSelectSimpleHandler handler)
	{
		setItemText(textSupplier);
		setSelectHandler(handler);
	}

	public ListDialogItem(String itemText, BooleanSupplier enabledSupplier, ItemSelectSimpleHandler handler)
	{
		setItemText(itemText);
		setItemEnabledSupplier(enabledSupplier);
		setSelectHandler(handler);
	}
	
	public ListDialogItem(Supplier<String> textSupplier, BooleanSupplier enabledSupplier, ItemSelectSimpleHandler handler)
	{
		setItemText(textSupplier);
		setItemEnabledSupplier(enabledSupplier);
		setSelectHandler(handler);
{'fraction_non_alphanumeric': 0.07922912205567452, 'fraction_numerical': 0.0035688793718772305, 'mean_word_length': 5.177075679647318, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6961127', 'n_tokens_mistral': 2707, 'n_tokens_neox': 2410, 'n_words': 585}