Class IntSet
Immutable set of integers.
Implements
Inherited Members
Namespace: Automata.Core
Assembly: Automata.Core.dll
Syntax
public class IntSet : IEquatable<IntSet>, IReadOnlySet<int>, IReadOnlyCollection<int>, IEnumerable<int>, IEnumerable
Constructors
| Edit this page View SourceIntSet(HashSet<int>)
Initializes a new instance of the IntSet class with the specified elements.
Declaration
public IntSet(HashSet<int> elements)
Parameters
Type | Name | Description |
---|---|---|
HashSet<int> | elements | Elements to include in the set. |
IntSet(IEnumerable<int>)
Initializes a new instance of the IntSet class with the specified elements.
Declaration
public IntSet(IEnumerable<int> elements)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | elements | Elements to include in the set. |
IntSet(ISet<int>)
Initializes a new instance of the IntSet class with the specified elements.
Declaration
public IntSet(ISet<int> elements)
Parameters
Type | Name | Description |
---|---|---|
ISet<int> | elements | Elements to include in the set. |
Properties
| Edit this page View SourceCount
Number of elements in the set.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceContains(int)
Determines if the set contains a specific item.
Declaration
public bool Contains(int item)
Parameters
Type | Name | Description |
---|---|---|
int | item | The item to check if the set contains. |
Returns
Type | Description |
---|---|
bool |
Equals(IntSet?)
Indicates whether the current set is equal to another set.
Declaration
public bool Equals(IntSet? other)
Parameters
Type | Name | Description |
---|---|---|
IntSet | other | Other set to compare to. |
Returns
Type | Description |
---|---|
bool | true
|
Equals(object?)
Indicates whether the current set is equal to another object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Object to compare to. |
Returns
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceGetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<int> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<int> | An enumerator that can be used to iterate through the collection. |
GetHashCode()
Hash code for the current set.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code for the current set. |
Overrides
| Edit this page View SourceIsProperSubsetOf(IEnumerable<int>)
Determines whether the current set is a proper (strict) subset of a specified collection.
Declaration
public bool IsProperSubsetOf(IEnumerable<int> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | other | The collection to compare to the current set. |
Returns
Type | Description |
---|---|
bool | true if the current set is a proper subset of other; otherwise false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
IsProperSupersetOf(IEnumerable<int>)
Determines whether the current set is a proper (strict) superset of a specified collection.
Declaration
public bool IsProperSupersetOf(IEnumerable<int> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | other | The collection to compare to the current set. |
Returns
Type | Description |
---|---|
bool | true if the collection is a proper superset of other; otherwise false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
IsSubsetOf(IEnumerable<int>)
Determine whether the current set is a subset of a specified collection.
Declaration
public bool IsSubsetOf(IEnumerable<int> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | other | The collection to compare to the current set. |
Returns
Type | Description |
---|---|
bool | true if the current set is a subset of other; otherwise false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
IsSupersetOf(IEnumerable<int>)
Determine whether the current set is a super set of a specified collection.
Declaration
public bool IsSupersetOf(IEnumerable<int> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | other | The collection to compare to the current set. |
Returns
Type | Description |
---|---|
bool | true if the current set is a subset of other; otherwise false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Overlaps(IEnumerable<int>)
Determines whether the current set overlaps with the specified collection.
Declaration
public bool Overlaps(IEnumerable<int> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | other | The collection to compare to the current set. |
Returns
Type | Description |
---|---|
bool | trueif the current set and other share at least one common element; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
SetEquals(IEnumerable<int>)
Determines whether the current set and the specified collection contain the same elements.
Declaration
public bool SetEquals(IEnumerable<int> other)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<int> | other | The collection to compare to the current set. |
Returns
Type | Description |
---|---|
bool | true if the current set is equal to other; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToString()
String that represents the current set.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current set. |