GHashSet[A: Any val, H: HashFunction[A] val]¶
An unordered mutable grow-only set. That is, it only allows insertion.
Because the set is unordered and elements can only be added (never deleted), the results are eventually consistent when converged.
All mutator methods accept and return a convergent delta-state.
class ref GHashSet[A: Any val, H: HashFunction[A] val] is
Comparable[GHashSet[A, H] ref] ref,
Convergent[GHashSet[A, H] ref] ref,
Replicated ref
Implements¶
- Comparable[GHashSet[A, H] ref] ref
- Convergent[GHashSet[A, H] ref] ref
- Replicated ref
Constructors¶
create¶
Returns¶
- GHashSet[A, H] ref^
Public Functions¶
is_empty¶
Return true if the data structure contains no information (bottom state).
Returns¶
- Bool val
size¶
Return the number of items in the set.
Returns¶
- USize val
apply¶
Return the value if it's in the set, otherwise raise an error.
Parameters¶
- value: val->A
Returns¶
- val->A ?
contains¶
Check whether the set contains the given value.
Parameters¶
- value: val->A
Returns¶
- Bool val
set[optional D: GHashSet[A, H] ref]¶
Add a value to the set. Accepts and returns a convergent delta-state.
Parameters¶
- value: A
- delta: D = recover GHashSet[A, H] end
Returns¶
- D^
union[optional D: GHashSet[A, H] ref]¶
Add everything in the given iterator to the set. Accepts and returns a convergent delta-state.
fun ref union[optional D: GHashSet[A, H] ref](
that: Iterator[A] ref,
delta: D = recover GHashSet[A, H] end)
: D^
Parameters¶
- that: Iterator[A] ref
- delta: D = recover GHashSet[A, H] end
Returns¶
- D^
converge¶
Converge from the given GSet into this one. For this data type, the convergence is a simple union. Returns true if the convergence added new information to the data structure.
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
string¶
Return a best effort at printing the set. If A is a Stringable, use the string representation of each value; otherwise print them as question marks.
Returns¶
- String iso^
eq¶
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
ne¶
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
lt¶
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
le¶
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
gt¶
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
ge¶
Parameters¶
- that: GHashSet[A, H] box
Returns¶
- Bool val
values¶
Returns¶
- Iterator[A] ref^
from_tokens¶
Deserialize an instance of this data structure from a stream of tokens.
Parameters¶
- that: TokensIterator ref
Returns¶
- None val ?
each_token¶
Serialize the data structure, capturing each token into the given Tokens.
Parameters¶
- tokens: Tokens ref
Returns¶
- None val
compare¶
Parameters¶
- that: GHashSet[A, H] box