Class ContextCollection
Collection of contexts which all share a common set of keys defined in this class.
Namespace: Unity.Industrial.Forma.Core
Syntax
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. |
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.
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>. |
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>. |
InitializeFromJson(String)
Declaration
public void InitializeFromJson(string jsonData)
Parameters
Type | Name | Description |
---|---|---|
String | jsonData |
RemoveContext(Context)
Removes the given context from the context collection.
Declaration
public void RemoveContext(Context context)
Parameters
Type | Name | Description |
---|---|---|
Context | context | The context. |
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.
ToJson()
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
String |
Events
contextCollectionChanged
Occurs when [context collection changed].
Declaration
public event ContextCollectionChangedHandler contextCollectionChanged
Event Type
Type | Description |
---|---|
ContextCollectionChangedHandler |