/// <summary> /// Initializes a new instance of the <see cref="NSimulate.SimulationElement"/> class. /// </summary> /// <param name='context'> /// Context. /// </param> /// <param name='key'> /// Key. /// </param> public SimulationElement(SimulationContext context, object key) { Key = key; context?.Register(this.GetType(), this); Context = context; }
protected SimulationElement(SimulationContext context, object key) { Key = key; if (context != null) { context.Register(GetType(), this); } Context = context; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> /// <filterpriority> /// 2 /// </filterpriority> /// <remarks> /// Call <see cref="Dispose"/> when you are finished using the <see cref="NSimulate.SimulationContext"/>. The /// <see cref="Dispose"/> method leaves the <see cref="NSimulate.SimulationContext"/> in an unusable state. After /// calling <see cref="Dispose"/>, you must release all references to the <see cref="NSimulate.SimulationContext"/> so /// the garbage collector can reclaim the memory that the <see cref="NSimulate.SimulationContext"/> was occupying. /// </remarks> public void Dispose() { if (_current == this) { _current = null; } if (_currentForThread == this) { _currentForThread = null; } }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.SimulationContext"/> class. /// </summary> /// <param name="isDefaultContextForProcess">if true, this context will become the default for the process</param> /// <param name="isDefaultContextForThread">if true, this context will become the default for the current thread</param> public SimulationContext(bool isDefaultContextForProcess, bool isDefaultContextForThread = false) { if (isDefaultContextForProcess) { _current = this; } if (isDefaultContextForThread) { _currentForThread = this; } }
public Resource(SimulationContext context, object key, int capacity) : base(context, key) { Capacity = capacity; }
public Resource(SimulationContext context, object key) : base(context, key) { }
public Resource(SimulationContext context, int capacity) : base(context) { Capacity = capacity; }
//public Resource() //{ //} //public Resource(int capacity) //{ // Capacity = capacity; //} //public Resource(object key, int capacity) // : base(key) //{ // Capacity = capacity; //} public Resource(SimulationContext context) : base(context) { }
//protected SimulationElement() // : this(SimulationContext.Current, Guid.NewGuid()) //{ //} //protected SimulationElement(object key) // : this(SimulationContext.Current, key) //{ //} protected SimulationElement(SimulationContext context) : this(context, Guid.NewGuid()) { }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Process"/> class. /// </summary> public Process(SimulationContext context, object key) : base(context, key) { SimulationState = new ProcessSimulationState(); }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Process"/> class. /// </summary> public Process(SimulationContext context) : base(context) { SimulationState = new ProcessSimulationState(); }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.SimulationElement"/> class. /// </summary> /// <param name='context'> /// Context. /// </param> public SimulationElement(SimulationContext context) : this(context, Guid.NewGuid()) { }
/// <summary> /// Initializes a new instance of the <see cref="NSimulate.Simulator"/> class. /// </summary> public Simulator(SimulationContext context) { Context = context; }
public SimulationEndTrigger(SimulationContext context, Func <bool> condition) : base(context) { Condition = condition; }
public ActivityHostProcess(SimulationContext context, Activity activity, long waitTime) : base(context) { WaitTime = waitTime; Activity = activity; }