Class MutableAlphabet
Mutable alphabet associated with a finite state automaton.
Implements
Inherited Members
Namespace: Automata.Core
Assembly: Automata.Core.dll
Syntax
public class MutableAlphabet : IAlphabet
Constructors
| Edit this page View SourceMutableAlphabet()
Initializes a new instance of the MutableAlphabet class.
Declaration
public MutableAlphabet()
MutableAlphabet(CanonicalAlphabet)
Initializes a new instance of the MutableAlphabet class from an existing CanonicalAlphabet.
Declaration
public MutableAlphabet(CanonicalAlphabet alphabet)
Parameters
Type | Name | Description |
---|---|---|
CanonicalAlphabet | alphabet | Canonical alphabet to initialize from. |
MutableAlphabet(IEnumerable<string>)
Initializes a new instance of the MutableAlphabet class with the specified symbols.
Declaration
public MutableAlphabet(IEnumerable<string> symbols)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | symbols | Symbols to initialize the alphabet with. |
Properties
| Edit this page View SourceCount
Number of symbols in the alphabet.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Symbol at the specified index.
Declaration
public string this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the symbol to get. |
Property Value
Type | Description |
---|---|
string | Symbol at the specified index. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the index is out of range. |
this[string]
Index of the specified symbol.
Declaration
public int this[string symbol] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | symbol | Symbol whose index to get. |
Property Value
Type | Description |
---|---|
int | Index of the specified symbol, or InvalidSymbolIndex if not found. |
Symbols
Read-only collection of symbols in the alphabet.
Declaration
public IReadOnlyCollection<string> Symbols { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<string> |
Methods
| Edit this page View SourceAddAll(IEnumerable<string>)
Adds all the specified symbols to the alphabet that are not already present.
Declaration
public void AddAll(IEnumerable<string> symbols)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | symbols | Symbols to add. |
Contains(string)
Indicates whether the alphabet contains the specified symbol.
Declaration
public bool Contains(string symbol)
Parameters
Type | Name | Description |
---|---|---|
string | symbol | Symbol to locate in the alphabet. |
Returns
Type | Description |
---|---|
bool |
GetOrAdd(string)
Index of the specified symbol or adds it if it does not exist.
Declaration
public int GetOrAdd(string symbol)
Parameters
Type | Name | Description |
---|---|---|
string | symbol | Symbol to get or add. |
Returns
Type | Description |
---|---|
int | Index of the specified symbol. |
ToString()
String that represents the current alphabet, including its size.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string representation of the alphabet. |
Overrides
| Edit this page View SourceToStringExpanded()
String with each symbol and its index, separated by a newline.
Declaration
public string ToStringExpanded()
Returns
Type | Description |
---|---|
string | A string with each symbol and its index, separated by a newline. |