Class ContextCollection
Collection of contexts which all share a common set of keys defined in this class.
Inherited Members
Namespace: UnityEngine.Industrial.Configuring.Core
Syntax
[ExecuteInEditMode]
public class ContextCollection : MonoBehaviour
Properties
contexts
Contexts within this context collection.
Declaration
public ReadOnlyCollection<Context> contexts { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<Context> | The contexts. |
keys
List of keys a context can have.
Declaration
public ReadOnlyCollection<string> keys { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<String> | The keys. |
Methods
AddContext()
Creates and adds a new context.
Declaration
public Context AddContext()
Returns
Type | Description |
---|---|
Context | Context. |
AddKey(String)
Adds a new key that is then available to all contexts.
Declaration
public void AddKey(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key must not be null nor contain only whitespaces. |
ArgumentException | The key is already present. |
GetMaximumCompatibleContext(Context, String, String)
Returns the context that is a much as possible compatible with the given configuration as possible and has the given value for the given key.
Declaration
public Context GetMaximumCompatibleContext(Context context, string key, string value)
Parameters
Type | Name | Description |
---|---|---|
Context | context | The context. |
String | key | The key. |
String | value | The value. |
Returns
Type | Description |
---|---|
Context | Context. |
Remarks
Returns
null
if no such context exists.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | context must not be null |
ArgumentNullException | key must not be null. |
ArgumentNullException | value must not be null. |
ArgumentException | |
ArgumentNullException | context must not be null |
ArgumentNullException | key must not be null. |
ArgumentNullException | value must not be null. |
ArgumentNullException |
GetPossibleCompatibleValues(String, Int32, IReadOnlyDictionary<String, String>)
Returns all possible values for given key based on previous keys.
Declaration
public List<string> GetPossibleCompatibleValues(string key, int currentKeyIndex, IReadOnlyDictionary<string, string> prevKeys)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key. |
Int32 | currentKeyIndex | Index of the current key. |
IReadOnlyDictionary<String, String> | prevKeys | The previous keys. |
Returns
Type | Description |
---|---|
List<String> | List<System.String>. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | key must not be null. |
ArgumentNullException | prevKeys must not be null. |
ArgumentException | |
ArgumentException | |
ArgumentNullException | key must not be null. |
ArgumentException | prevKeys must not be null. |
ArgumentNullException | |
ArgumentException |
GetPossibleValues(String)
Returns all possible values for given key.
Declaration
public List<string> GetPossibleValues(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key. |
Returns
Type | Description |
---|---|
List<String> | List<System.String>. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | key must not be null. |
ArgumentException |
RemoveContext(Context)
Removes the given context from the context collection.
Declaration
public void RemoveContext(Context context)
Parameters
Type | Name | Description |
---|---|---|
Context | context | The context. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The context must not be null. |
ArgumentException | The context is not part of the context collection. |
RemoveKey(String)
Removes a key from the key set.
Declaration
public void RemoveKey(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key. |
Remarks
This will remove the respective entries from the contexts in this collection.
Exceptions
Type | Condition |
---|---|
ArgumentException | The key must not be null or contain only whitespaces. |
ArgumentException | The key is not present. |
Events
contextCollectionChanged
Occurs when [context collection changed].
Declaration
public event ContextCollectionChangedHandler contextCollectionChanged
Event Type
Type | Description |
---|---|
ContextCollectionChangedHandler |