Item(id, left, origin, right, rightOrigin, parent, parentSub, content)

Abstract class that represents any content.

new Item(id, left, origin, right, rightOrigin, parent, parentSub, content)

Parameters:
Name Type Description
id ID
left Item | null
origin ID | null
right Item | null
rightOrigin ID | null
parent AbstractType.<any> | ID | null

Is a type if integrated, is null if it is possible to copy parent from left or right, is ID before integration to search for it.

parentSub string | null
content AbstractContent

Classes

Item

Members

content :AbstractContent

deleted :Boolean

Whether this item was deleted or not.

info :number

bit1: keep bit2: countable bit3: deleted bit4: mark - mark node as fast-search-marker

keep

If true, do not garbage collect this Item.

lastId

Computes the last content address of this Item.

left :Item|null

The item that is currently to the left of this item.

marker :boolean

This is used to mark the item as an indexed fast-search marker

next

Returns the next non-deleted item

origin :ID|null

The item that was originally to the left of this item.

parent :AbstractType.<any>|ID|null

parent :AbstractType.<any>

parent :AbstractType.<any>

parent :AbstractType.<any>

parentSub :String|null

If the parent refers to this item with some kind of key (e.g. YMap, the key is specified here. The key is then used to refer to the list in which to insert this item. If parentSub = null type._start is the list in which to insert to. Otherwise it is parent._map.

prev

Returns the previous non-deleted item

redone :ID|null

If this type's effect is reundone this type refers to the type that undid this operation.

The item that is currently to the right of this item.

rightOrigin :ID|null

The item that was originally to the right of this item.

Methods

delete(transaction)

Mark this Item as deleted.

Parameters:
Name Type Description
transaction Transaction

gc(store, parentGCd)

Parameters:
Name Type Description
store StructStore
parentGCd boolean

getMissing(transaction, store) → {null|number}

Return the creator clientID of the missing op or define missing items and return null.

Parameters:
Name Type Description
transaction Transaction
store StructStore
Returns:
null | number

integrate(transaction, offset)

Parameters:
Name Type Description
transaction Transaction
offset number

mergeWith(right) → {boolean}

Try to merge two items

Parameters:
Name Type Description
right Item
Returns:
boolean

write(encoder, offset)

Transform the properties of this type to binary and write it to an BinaryEncoder.

This is called when this Item is sent to a remote peer.

Parameters:
Name Type Description
encoder AbstractUpdateEncoder

The encoder to write data to.

offset number