Class ResourceSingleFailureEvent

  • All Implemented Interfaces:
    ObservableIfc, GetNameIfc, IdentityIfc

    public class ResourceSingleFailureEvent
    extends SchedulingElement
    Models a single failure event that can effect many resource units. If no resource units are attached then a warning message occurs. If you really do not want to attach resource units and do not want the warning then use setNoResourceUnitWarningOption(false)
    • Constructor Detail

      • ResourceSingleFailureEvent

        public ResourceSingleFailureEvent​(ModelElement parent,
                                          RandomIfc eventDuration,
                                          RandomIfc initialStartTimeRV)
        Parameters:
        parent - a parent model element
        eventDuration - the duration of the event
        initialStartTimeRV - the initial starting time for the event
      • ResourceSingleFailureEvent

        public ResourceSingleFailureEvent​(ModelElement parent,
                                          RandomIfc eventDuration,
                                          RandomIfc initialStartTimeRV,
                                          java.lang.String name)
        Parameters:
        parent - a parent model element
        eventDuration - the duration of the event
        initialStartTimeRV - the initial starting time for the event
        name - the name of model element
    • Method Detail

      • setEventDurationInitialRandomSource

        public void setEventDurationInitialRandomSource​(RandomIfc eventDuration)
        Parameters:
        eventDuration - the source of randomness for the event duration
      • beforeReplication

        protected void beforeReplication()
        Allows each replication to start at a different time and to have a different failure duration.
        Overrides:
        beforeReplication in class ModelElement
      • initialize

        protected void initialize()
        Description copied from class: ModelElement
        This method should be overridden by subclasses that need actions performed to initialize prior to a replication. It is called once before each replication occurs if the model element wants initialization. It is called after beforeReplication() is called
        Overrides:
        initialize in class ModelElement
      • getEventStartTime

        public final double getEventStartTime()
        Returns:
        the time that the event will occur
      • getDuration

        public final double getDuration()
        Returns:
        the duration of the event for this replication
      • getAutoStartProcessOption

        public final boolean getAutoStartProcessOption()
        The default is false
        Returns:
        true if failure process will start automatically upon initialization
      • addFailureEventListener

        public final void addFailureEventListener​(FailureEventListenerIfc listener)
        Adds a listener to react to failureStarted event
        Parameters:
        listener - the listener to add
      • removeFailureEventListener

        public final void removeFailureEventListener​(FailureEventListenerIfc listener)
        Removes the listener from the event
        Parameters:
        listener - the listener to remove
      • getNoResourceUnitWarningOption

        public final boolean getNoResourceUnitWarningOption()
        Returns:
        true means that a warning will occur if there are no resource units attached when running the simulation
      • setNoResourceUnitWarningOption

        public final void setNoResourceUnitWarningOption​(boolean option)
        Parameters:
        option - true means that a warning will occur if there are no resource units attached when running the simulation
      • beforeExperiment

        protected void beforeExperiment()
        Description copied from class: ModelElement
        This method should be overridden by subclasses that need logic to be performed prior to an experiment. The beforeExperiment method allows model elements to be setup prior to the first replication within an experiment. It is called once before any replications occur.
        Overrides:
        beforeExperiment in class ModelElement
      • start

        public final void start()
        Start the process at the current time. In other words in getTime() + 0.0 into the future.
      • start

        public final void start​(GetValueIfc value)
        Causes the failure process to start at getTime() + value.getValue().
        Parameters:
        value - the GetValueIfc object that should be used get the value of the starting time
      • start

        public final void start​(double time)
        Starts the failure event process. If the process is already started, nothing happens
      • scheduleFailure

        protected final void scheduleFailure​(double time)
        Schedules the failure event and the end of the failure
        Parameters:
        time - the time that the failure should occur
      • cancelFailure

        protected final void cancelFailure()
        Causes the single event to be canceled if it has not yet occurred.
      • stop

        public final void stop()
        If the failure process is started, then it is stopped (i.e. it will not occur). If it has not been started nothing happens. If it has already been stopped, nothing happens.
      • resume

        public final void resume()
        If the failure process is suspended (and started and not stopped), then it is resumed. This reschedules the failure event to the original failure event time for the replication.
      • suspend

        public final void suspend()
        If the failure process has been started (but not suspended or stopped) then will be suspended. Otherwise nothing happens
      • isStarted

        public final boolean isStarted()
        Returns:
        true if the failure process is started (i.e. scheduled to occur)
      • isStopped

        public final boolean isStopped()
        Once stopped, it cannot be restarted.
        Returns:
        true if the failure process is stopped.
      • isSuspended

        public final boolean isSuspended()
        Returns:
        true if the failure process is suspended.
      • addResourceUnit

        public final void addResourceUnit​(ResourceUnit resourceUnit)
        Adds a resource unit to the failure event
        Parameters:
        resourceUnit - must not be null. Repeats are silently ignored.
      • hasResourceUnits

        public final boolean hasResourceUnits()
        Returns:
        true if resource units have been added to the failure event
      • addResourceUnits

        public final void addResourceUnits​(java.util.Collection<ResourceUnit> units)
        Parameters:
        units - the resource units to add. Must not be null
      • addResourceUnits

        public final void addResourceUnits​(ResourcePool pool)
        Parameters:
        pool - the ResourcePool to add resource units from, must not be null
      • notifyFailureEventListenersFailureStarted

        protected final void notifyFailureEventListenersFailureStarted()
        Used internally to notify failure event listeners that the failure started
      • notifyFailureEventListenersFailureCompleted

        protected final void notifyFailureEventListenersFailureCompleted()
        Used internally to notify failure event listeners that the failure completed
      • failureStarted

        protected void failureStarted​(JSLEvent event)
        Subclasses can override this method to provide behavior when the event starts This method occurs before any associated resources start the failure and before any failure event listeners are notified of the start of the event
        Parameters:
        event - the event that started the failure
      • failureEnded

        protected void failureEnded​(JSLEvent event)
        Subclasses can override this method to provide behavior after the failure ends This method occurs before any failure event listeners are notified of the end of the failure
        Parameters:
        event - the event that ended the failure