Class Environment
This stands for the environment in which the scenario engine operates.
The register references all the relations and all the relational objects.
It stores every executed realizations and those that need to be executed.
Assembly: Xareus.Scenarios.Relations.dll
Syntax
public class Environment : IContext, ITypeDescriptorContext, IServiceProvider, IRealizationManager
Constructors
Environment(IEngine)
Declaration
public Environment(IEngine engine)
Parameters
Type |
Name |
Description |
IEngine |
engine |
|
Fields
RELATION_ENGINE_PATH
Declaration
public static readonly string RELATION_ENGINE_PATH
Field Value
subContexts
Declaration
protected List<IContext> subContexts
Field Value
subContextsInPath
Declaration
protected Dictionary<string, List<IContext>> subContextsInPath
Field Value
Properties
Container
Declaration
public virtual IContainer Container { get; }
Property Value
Instance
Gets the object that is connected with this type descriptor request.
Declaration
public virtual object Instance { get; }
Property Value
Type |
Description |
object |
The object that invokes the method on the TypeDescriptor; otherwise, null if there is no object responsible for the call.
|
Objects
Declaration
public Dictionary<string, IObject> Objects { get; }
Property Value
PropertyDescriptor
Declaration
public virtual PropertyDescriptor PropertyDescriptor { get; }
Property Value
RelationEngine
The relation engine linked to this environment
Declaration
public IEngine RelationEngine { get; }
Property Value
Relations
Declaration
public Dictionary<string, IRelation> Relations { get; }
Property Value
Methods
AddExecutedRealization(Realization)
Add the given realization to the log.
Declaration
public void AddExecutedRealization(Realization realization)
Parameters
AddSubContext(IContext)
Add a sub-context that will be browsed when accessing values
Declaration
public void AddSubContext(IContext subContext)
Parameters
Type |
Name |
Description |
IContext |
subContext |
|
AddSubContext(IContext, string)
Add a sub-context that will be browsed when accessing values
Declaration
public void AddSubContext(IContext subContext, string path)
Parameters
Clear()
Declaration
EnqueueRealizationToExecute(Realization)
Add the given realization to the backlog.
Declaration
public void EnqueueRealizationToExecute(Realization realization)
Parameters
GetExecutedRealizations(IRelation, HashSet<IObject>, DateTime, DateTime)
Returns every realization that match the given relation and objects and that were created between the start and end DateTime.
Declaration
public IEnumerable<Realization> GetExecutedRealizations(IRelation relation, HashSet<IObject> objects, DateTime start, DateTime end)
Parameters
Returns
GetNextRealizationToExecute()
Returns the oldest realization in the backlog.
Declaration
public Realization GetNextRealizationToExecute()
Returns
GetPaths()
Lists all the valid paths
Declaration
public IEnumerable<string> GetPaths()
Returns
GetService(Type)
Gets the service object of the specified type.
Declaration
public virtual object GetService(Type serviceType)
Parameters
Type |
Name |
Description |
Type |
serviceType |
An object that specifies the type of service object to get.
|
Returns
Type |
Description |
object |
A service object of type serviceType .
-or-
null if there is no service object of type serviceType .
|
GetValue(string)
Get the first value at the given path in the environment or one of its sub contexts
Declaration
public object GetValue(string path)
Parameters
Type |
Name |
Description |
string |
path |
|
Returns
GetValueOrDefault(string, object)
Get the first value at the given path in the environment or one of its sub contexts or the given default value if not found
Declaration
public object GetValueOrDefault(string path, object defaultValue = null)
Parameters
Returns
HasPath(string)
Checks if the given path exists in the environment or on of its sub contexts
Declaration
public bool HasPath(string path)
Parameters
Type |
Name |
Description |
string |
path |
|
Returns
HasSubContext(IContext, bool)
Check if a sub-context is present in the Environment
Declaration
public bool HasSubContext(IContext subContext, bool atAnyPath = true)
Parameters
Returns
OnComponentChanged()
Declaration
public virtual void OnComponentChanged()
OnComponentChanging()
Declaration
public virtual bool OnComponentChanging()
Returns
Type |
Description |
bool |
true if this object can be changed; otherwise, false.
|
RemoveSubContext(IContext, bool)
Declaration
public void RemoveSubContext(IContext subContext, bool atAnyPath = true)
Parameters
SetValue(string, object)
Sets the value at the given path in the environment (note that sub contexts won't be affected)
Declaration
public void SetValue(string path, object value)
Parameters
Union(string, IContext)
Merges the given context into this one at the given path
Declaration
public void Union(string path, IContext other)
Parameters
Union(IContext, bool)
Declaration
public void Union(IContext other, bool overrideDuplicates = true)
Parameters
Type |
Name |
Description |
IContext |
other |
|
bool |
overrideDuplicates |
|
Implements