Class ScyllaDisjointSet.Builder
Provides a fluent API for configuring and constructing ScyllaDisjointSet instances, optionally wrapping the result in a ScyllaDisjointSet.SynchronizedScyllaDisjointSet for thread-safe use.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public sealed class ScyllaDisjointSet.Builder
Remarks
Obtain a builder via CreateBuilder(). Configure it with the chainable methods, then call Build() to receive an IScyllaCollection (which is either a raw ScyllaDisjointSet or a ScyllaDisjointSet.SynchronizedScyllaDisjointSet depending on whether Synchronized(object) was called), or call BuildConcrete() to receive the typed ScyllaDisjointSet directly (only valid when synchronization is not requested).
Methods
Build()
Builds the configured disjoint set and returns it as IScyllaCollection.
Declaration
public IScyllaCollection Build()
Returns
| Type | Description |
|---|---|
| IScyllaCollection | A ScyllaDisjointSet.SynchronizedScyllaDisjointSet if Synchronized(object) was called, otherwise the raw ScyllaDisjointSet. In both cases the return type is IScyllaCollection. |
BuildConcrete()
Builds the configured disjoint set and returns the concrete ScyllaDisjointSet type directly.
Declaration
public ScyllaDisjointSet BuildConcrete()
Returns
| Type | Description |
|---|---|
| ScyllaDisjointSet | The newly constructed ScyllaDisjointSet instance. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when Synchronized(object) was previously called, because the synchronized wrapper cannot be cast to ScyllaDisjointSet. Use Build() instead when synchronization is required. |
Synchronized(object)
Configures the builder to wrap the constructed set in a ScyllaDisjointSet.SynchronizedScyllaDisjointSet so that all operations are thread-safe.
Declaration
public ScyllaDisjointSet.Builder Synchronized(object syncRoot = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | syncRoot | An optional external lock object. When |
Returns
| Type | Description |
|---|---|
| ScyllaDisjointSet.Builder | This ScyllaDisjointSet.Builder instance for method chaining. |
WithCapacity(int)
Configures the number of elements in the disjoint set to be built.
Declaration
public ScyllaDisjointSet.Builder WithCapacity(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capacity | The desired element count. Elements will be addressable as indices
|
Returns
| Type | Description |
|---|---|
| ScyllaDisjointSet.Builder | This ScyllaDisjointSet.Builder instance for method chaining. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when |