GSet

@Serializable
class GSet<E> : Quilted<GSet<E>>

A grow-only set of E. add returns a Patch carrying a one-element set; piece is union. Once added, an element cannot be removed — for remove-supporting sets see TwoPhaseSet (tombstones) or ORSet (causal).

Samples

var set = GSet.empty<String>()
set = set.piece(set.add("alice"))
set = set.piece(set.add("bob"))
check(set.elements == setOf("alice", "bob"))

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val elements: Set<E>

Functions

Link copied to clipboard
fun add(element: E): Patch<GSet<E>>

Add element, returning a delta. The receiver is unchanged.

Link copied to clipboard
open fun causalDots(): Set<Dot>

The causal Dots this state has delivered — (author, author-seq) per op.

Link copied to clipboard
fun contains(element: E): Boolean

True if element is in this set.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun piece(other: GSet<E>): GSet<E>

The join: set union.

Link copied to clipboard
open override fun toString(): String