Ejemplo n.º 1
0
 /// <summary>
 /// Constructor that sets corresponding members of class
 /// </summary>
 /// <param name="parentControlUnit"> Parent control of waiting activity</param>
 /// <param name="affectedEntity">Entity that is waiting</param>
 /// <param name="waitingArea">Optional parameter for a holding entity such as waiting rooms, or storage rooms</param>
 public ActivityWait(ControlUnit parentControlUnit,
                     Entity affectedEntity,
                     IDynamicHoldingEntity waitingArea = null)
     : base(parentControlUnit, "ActivityWait", true)
 {
     _waitingEntity = affectedEntity;
     _waitingArea   = waitingArea;
 } // end of Activity
Ejemplo n.º 2
0
        /// <summary>
        /// Basic constructor
        /// </summary>
        /// <param name="parentControlUnit"> Control unit the activity is nested in, has to be set upon creation of object and not triggering of start event</param>
        /// <param name="activityType">String representing the activity type, e.g move</param>
        /// <param name="preEmptable">Indicitates of activity may be interuppted (pre-empted)</param>
        public Activity(ControlUnit parentControlUnit, string activityType, bool preEmptable)
        {
            _parentControlUnit = parentControlUnit;
            _preEmtable        = preEmptable;

            // events for start and end are created
            _startEvent = new EventActivity(this, EventType.Start);
            _endEvent   = new EventActivity(this, EventType.End);

            _activityType = activityType;
        } // end of Event
Ejemplo n.º 3
0
        } // end of SetChildControlUnits

        #endregion

        #region FindSmallestJointControl

        /// <summary>
        /// Helping function that returns the lowest joint control unit in the control tree that contains
        /// both control units in its sub-tree.
        /// </summary>
        /// <param name="otherControl"> the other control unit that the smallest joint control is used for</param>
        /// <returns>Control unit that is lowest in the control tree and has both control units in its subtree,
        ///          returns null if no joint control has been found</returns>
        public ControlUnit FindSmallestJointControl(ControlUnit otherControl)
        {
            if (ChildControlUnits.Contains(otherControl))
            {
                return(this);
            }
            else
            {
                if (ParentControlUnit == null)
                {
                    return(null);
                }

                return(ParentControlUnit.FindSmallestJointControl(otherControl));
            } // end if
        }     // end of FindSmallestJointControl
Ejemplo n.º 4
0
        /// <summary>
        /// Basic constructor. Initializes members of control unit
        /// </summary>
        /// <param name="name">String representer of control unit</param>
        /// <param name="parentControlUnit">If there exists a parent control unit (in case it is not the root control unit), it should be passed here</param>
        public ControlUnit(string name,
                           ControlUnit parentControlUnit,
                           SimulationModel parentSimulationModel)
        {
            _name = name;
            _parentControlUnit     = parentControlUnit;
            _parentSimulationModel = parentSimulationModel;
            _rael = new List <ActivityRequest>();
            _currentActivitesPerType = new Dictionary <string, List <Activity> >();
            _childControlUnits       = new ControlUnit[] {};
            _delegateInbox           = new List <IDelegate>();
            _delegateOutBox          = new List <IDelegate>();
            _currentActivities       = new List <Activity>();
            _delegateHandlingMethods = new Dictionary <Type, HandleDelegateOfType>();

            _controlledEntities    = new Dictionary <Type, HashSet <Entity> >();
            _allControlledEntities = new List <Entity>();

            _stateData = new Dictionary <DateTime, object>();
        } // end of ControlUnit
Ejemplo n.º 5
0
        } // end of HandleReceiveDelegates

        #endregion

        #region SendDeleateTo

        /// <summary>
        /// Sends a single delegate to a destinition control unit
        /// </summary>
        /// <param name="destination">Destinatin control unit</param>
        /// <param name="del">Delegate to send.</param>
        public void SendDelegateTo(ControlUnit destination, IDelegate del)
        {
            BehaviorOccured = true;
            destination.ReceiveDelegate(del);
        } // end of SendDelegateTo
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor where type and hosting control unit is defined.
 /// </summary>
 /// <param name="type">Type of activity</param>
 /// <param name="parentControlUnit">Control unit where event will be triggered</param>
 public Event(EventType type, ControlUnit parentControlUnit)
 {
     _eventType         = type;
     _parentControlUnit = parentControlUnit;
     _sequentialEvents  = new List <Event>();
 } // end of Event