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

            Context = context;
        }
예제 #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;
            }
        }
예제 #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;
            }
        }
예제 #5
0
파일: Resource.cs 프로젝트: jhorv/NSimulate
 public Resource(SimulationContext context, object key, int capacity)
     : base(context, key)
 {
     Capacity = capacity;
 }
예제 #6
0
파일: Resource.cs 프로젝트: jhorv/NSimulate
 public Resource(SimulationContext context, object key)
     : base(context, key)
 {
 }
예제 #7
0
파일: Resource.cs 프로젝트: jhorv/NSimulate
 public Resource(SimulationContext context, int capacity)
     : base(context)
 {
     Capacity = capacity;
 }
예제 #8
0
파일: Resource.cs 프로젝트: jhorv/NSimulate
        //public Resource()
        //{
        //}

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

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

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