<commit_before>package com.acornui.component.text

import com.acornui.collection.*
import com.acornui.component.ElementParent
import com.acornui.component.UiComponentImpl
import com.acornui.component.ValidationFlags
import com.acornui.component.layout.algorithm.FlowHAlign
import com.acornui.component.layout.algorithm.FlowVAlign
import com.acornui.component.layout.algorithm.LineInfo
import com.acornui.component.layout.algorithm.LineInfoRo
import com.acornui.component.validationProp
import com.acornui.core.di.Owned
import com.acornui.core.floor
import com.acornui.core.selection.SelectionRange
import com.acornui.math.Bounds
import com.acornui.math.MathUtils.offsetRound
import com.acornui.math.MinMaxRo
import com.acornui.math.Vector3
import com.acornui.math.ceil

/**
 * A TextFlow component is a container of styleable text spans, to be used inside of a TextField.
 */
class TextFlow(owner: Owned) : UiComponentImpl(owner), TextNodeComponent, ElementParent<TextSpanElement> {

	override var textParent: TextNodeRo? = null

	val flowStyle = bind(TextFlowStyle())

	override var allowClipping: Boolean by validationProp(true, VERTICES)

	private val _lines = ArrayList<LineInfo>()

	private val _textElements = ArrayList<TextElement>()

	/**
	 * A list of all the text elements within the child spans.
	 */
	private val textElements: List<TextElement>
		get() {
			validate(TEXT_ELEMENTS)
			return _textElements
		}

	private val _placeholder = LastTextElement(this)
	override val placeholder: TextElementRo
		get() = _placeholder

	override val multiline: Boolean
		get() = flowStyle.multiline

	override val textElementsCount: Int
		get() = textElements.size

	init {
		validation.addNode(TEXT_ELEMENTS, ValidationFlags.HIERARCHY_ASCENDING, ValidationFlags.LAYOUT, this::updateTextElements)
		validation.addNode(VERTICES, ValidationFlags.LAYOUT or ValidationFlags.STYLES or ValidationFlags.CONCATENATED_TRANSFORM, 0, this::updateVertices)
		validation.addNode(CHAR_STYLE, ValidationFlags.CONCATENATED_COLOR_TRANSFORM or ValidationFlags.STYLES, 0, this::updateCharStyle)
	}

	override fun getTextElementAt(index: Int): TextElementRo = textElements[index]

	override val linesCount: Int
		get() = _lines.size

	override fun getLineAt(index: Int): LineInfoRo {<commit_msg>Add parameter names to validation<commit_after>package com.acornui.component.text

import com.acornui.collection.*
import com.acornui.component.ElementParent
import com.acornui.component.UiComponentImpl
import com.acornui.component.ValidationFlags
import com.acornui.component.layout.algorithm.FlowHAlign
import com.acornui.component.layout.algorithm.FlowVAlign
import com.acornui.component.layout.algorithm.LineInfo
import com.acornui.component.layout.algorithm.LineInfoRo
import com.acornui.component.validationProp
import com.acornui.core.di.Owned
import com.acornui.core.floor
import com.acornui.core.selection.SelectionRange
import com.acornui.math.Bounds
import com.acornui.math.MathUtils.offsetRound
import com.acornui.math.MinMaxRo
import com.acornui.math.Vector3
import com.acornui.math.ceil

/**
 * A TextFlow component is a container of styleable text spans, to be used inside of a TextField.
 */
class TextFlow(owner: Owned) : UiComponentImpl(owner), TextNodeComponent, ElementParent<TextSpanElement> {

	override var textParent: TextNodeRo? = null

	val flowStyle = bind(TextFlowStyle())

	override var allowClipping: Boolean by validationProp(true, VERTICES)

	private val _lines = ArrayList<LineInfo>()

	private val _textElements = ArrayList<TextElement>()

	/**
	 * A list of all the text elements within the child spans.
	 */
	private val textElements: List<TextElement>
		get() {
			validate(TEXT_ELEMENTS)
			return _textElements
		}

	private val _placeholder = LastTextElement(this)
	override val placeholder: TextElementRo
		get() = _placeholder

	override val multiline: Boolean
		get() = flowStyle.multiline

	override val textElementsCount: Int
		get() = textElements.size

	init {
		validation.addNode(TEXT_ELEMENTS, dependencies = 0, dependants = ValidationFlags.LAYOUT, onValidate = this::updateTextElements)
		validation.addNode(VERTICES, dependencies = ValidationFlags.LAYOUT or ValidationFlags.STYLES or ValidationFlags.CONCATENATED_TRANSFORM, dependants = 0, onValidate = this::updateVertices)
		validation.addNode(CHAR_STYLE, dependencies = ValidationFlags.CONCATENATED_COLOR_TRANSFORM or ValidationFlags.STYLES, dependants = 0, onValidate = this::updateCharStyle)
	}

	override fun getTextElementAt(index: Int): TextElementRo = textElements[index]

	override val linesCount: Int
		get() = _lines.size

	override fun getLineAt(index: Int): LineInfoRo {
{'fraction_non_alphanumeric': 0.08449496032597041, 'fraction_numerical': 0.0015011794981771391, 'mean_word_length': 5.919881305637982, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3397388', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1371, 'n_words': 331}