IndexTreeNode

abstract class IndexTreeNode<T : IndexTreeNode<T>>

IndexTreeNode is the node of IndexTree. It is used to represent the document of text-based editors.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard

Returns the children of the node including tombstones.

Link copied to clipboard

Returns the children of the node. Tombstone nodes remain awhile in the tree during editing. They will be removed after the editing is done. So, we need to filter out the tombstone nodes to get the real children.

Link copied to clipboard

Returns true if the node's children consist of only text children.

Link copied to clipboard
abstract val isRemoved: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var parent: T?
Link copied to clipboard
Link copied to clipboard
var size: Int
Link copied to clipboard
abstract val type: String
Link copied to clipboard
abstract var value: String

Functions

Link copied to clipboard
fun append(node: T)

Appends the given node to the children.

Link copied to clipboard
abstract fun cloneElement(issueTimeTicket: () -> TimeTicket): T

Clones the element node with the given issueTimeTicket lambda and value.

Link copied to clipboard
abstract fun cloneText(offset: Int): T

Clones the text node with the given id and value.

Link copied to clipboard
fun findOffset(node: T): Int
Link copied to clipboard

getChildrenText returns text value of all text type children.

Link copied to clipboard
fun insertAfter(targetNode: T, newNode: T)

Inserts the newNode after the targetNode.

Link copied to clipboard
fun insertAt(offset: Int, newNode: T)

Inserts the newNode at the given offset.

Link copied to clipboard
fun insertBefore(targetNode: T, newNode: T)

Inserts the newNode before the targetNode.

Link copied to clipboard
fun prepend(node: T)

Prepends the given node to the children.

Link copied to clipboard
fun removeChild(child: T)

Removes the given child.

Link copied to clipboard
fun splitElement(offset: Int, issueTimeTicket: () -> TimeTicket): T
Link copied to clipboard
fun splitText(offset: Int, absOffset: Int): T?
Link copied to clipboard

Updates the size of the ancestors. It is used when the size of the node is changed.

Link copied to clipboard

Updates the size of the descendants. It is used when the tree is newly created and the size of the descendants is not calculated.