Example #1
0
        /// <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;
        }
Example #2
0
        protected SimulationElement(SimulationContext context, object key)
        {
            Key = key;
            if (context != null)
            {
                context.Register(GetType(), this);
            }

            Context = context;
        }
Example #3
0
        /// <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;
            }
        }
Example #4
0
        /// <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;
            }
        }
Example #5
0
 public Resource(SimulationContext context, object key, int capacity)
     : base(context, key)
 {
     Capacity = capacity;
 }
Example #6
0
 public Resource(SimulationContext context, object key)
     : base(context, key)
 {
 }
Example #7
0
 public Resource(SimulationContext context, int capacity)
     : base(context)
 {
     Capacity = capacity;
 }
Example #8
0
        //public Resource()
        //{
        //}

        //public Resource(int capacity)
        //{
        //    Capacity = capacity;
        //}

        //public Resource(object key, int capacity)
        //    : base(key)
        //{
        //    Capacity = capacity;
        //}

        public Resource(SimulationContext context)
            : base(context)
        {
        }
Example #9
0
        //protected SimulationElement()
        //    : this(SimulationContext.Current, Guid.NewGuid())
        //{
        //}

        //protected SimulationElement(object key)
        //    : this(SimulationContext.Current, key)
        //{
        //}

        protected SimulationElement(SimulationContext context)
            : this(context, Guid.NewGuid())
        {
        }
Example #10
0
 /// <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();
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NSimulate.Process"/> class.
 /// </summary>
 public Process(SimulationContext context)
     : base(context)
 {
     SimulationState = new ProcessSimulationState();
 }
Example #12
0
 /// <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())
 {
 }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NSimulate.Simulator"/> class.
 /// </summary>
 public Simulator(SimulationContext context)
 {
     Context = context;
 }
Example #14
0
 public SimulationEndTrigger(SimulationContext context, Func <bool> condition)
     : base(context)
 {
     Condition = condition;
 }
Example #15
0
 public ActivityHostProcess(SimulationContext context, Activity activity, long waitTime)
     : base(context)
 {
     WaitTime = waitTime;
     Activity = activity;
 }