coreEngine.reliabilityAnalysis.DataStruct

## Class IncidentEvent

- java.lang.Object
- - coreEngine.reliabilityAnalysis.DataStruct.ScenarioEvent
  - - coreEngine.reliabilityAnalysis.DataStruct.IncidentEvent

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<IncidentEvent>

      public class IncidentEvent
      extends ScenarioEvent
      implements java.lang.Comparable<IncidentEvent>

  Author:
    jltrask
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `IncidentEvent.Comparators`
    `private class` | `IncidentEvent.InvalidSegmentTypeException`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int[]` | `scenarioLanesAvailable` Array holding the number of open lanes in the segment in each period for the duration of the incident event.
    `private int` | `segment` Segment in which the incident event occurs.
    `int` | `segmentType` Segment type of the incident (GP or ML).
    `private static long` | `serialVersionUID`
    `private static int` | `TYPE_GP` Identifier for General Purpose (GP) segment incidents.
    `private static int` | `TYPE_ML` Identifier for Managed Lane (ML) segment incidents.

    - ### Fields inherited from class coreEngine.reliabilityAnalysis.DataStruct.ScenarioEvent

      `duration, scenarioInfo, seed, severity, startPeriod`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IncidentEvent(Seed seed, ScenarioInfo scenarioInfo, int severity, int startPeriod, int duration, int segment, int segmentType)` Constructor for Incident ScenarioEvents

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `checkSegmentSwapGP(java.util.ArrayList<ScenarioInfo> scenarioInfos, IncidentEvent inc1, IncidentEvent inc2)` Checks if swapping the segments of two incidents (GP) is valid.
    `static boolean` | `checkSegmentSwapML(java.util.ArrayList<ScenarioInfo> scenarioInfos, IncidentEvent inc1, IncidentEvent inc2)` Checks if swapping the segments of two incidents (ML) is valid.
    `int` | `compareTo(IncidentEvent o)`
    `float` | `getEventCAF(int period, int segment)`
    `float` | `getEventDAF(int period, int segment)`
    `int` | `getEventLAF(int period, int segment)`
    `float` | `getEventOAF(int period, int segment)`
    `float` | `getEventSAF(int period, int segment)`
    `int` | `getSegment()`
    `int` | `getSegmentType()`
    `java.lang.String` | `getSeverityString()`
    `boolean` | `hasOverlap(IncidentEvent incEvent)` Checks to see if the event overlaps with the specified incident event.
    `boolean` | `hasOverlap(ScenarioEvent event)` Checks to see if the event overlaps with the specified incident event.
    `boolean` | `isValid()` Checks to see if the event is valid for the seed/scenario in both the spatial and temporal sense.
    `boolean` | `isValidSeverity()` Checks if the incident is valid for the scenario.
    `private int` | `mapPeriod(int period)`
    `void` | `setSegment(int newSegment)`
    `java.lang.String` | `toString()`
    `private void` | `updateNumLanes()` Updates the number of lanes array to reflect any change in segment.

    - ### Methods inherited from class coreEngine.reliabilityAnalysis.DataStruct.ScenarioEvent

      `checkActiveInPeriod, getEndPeriod, hasPeriodWrapping`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### serialVersionUID

          private static final long serialVersionUID

      See Also:
        Constant Field Values

    - #### TYPE_GP

          private static final int TYPE_GP

      Identifier for General Purpose (GP) segment incidents.
      See Also:
        Constant Field Values

    - #### TYPE_ML

          private static final int TYPE_ML

      Identifier for Managed Lane (ML) segment incidents.
      See Also:
        Constant Field Values

    - #### segmentType

          public final int segmentType

      Segment type of the incident (GP or ML).

    - #### segment

          private int segment

      Segment in which the incident event occurs.

    - #### scenarioLanesAvailable

          private int[] scenarioLanesAvailable

      Array holding the number of open lanes in the segment in each period for the duration of the incident event. Used to calculate adjustment factors.

  - ### Constructor Detail

    - #### IncidentEvent

          public IncidentEvent(Seed seed,
                               ScenarioInfo scenarioInfo,
                               int severity,
                               int startPeriod,
                               int duration,
                               int segment,
                               int segmentType)

      Constructor for Incident ScenarioEvents
      Parameters:
        `seed` - Seed instance associated with the Reliability analysis containing the scenario event.
        `scenarioInfo` - ScenarioInfo instance to which the event is/will be assigned.
        `severity` - Incident severity (0 - Shoulder closure, 1 - 1 Lane closure, 2 - 2 lane closure, 3 - 3 Lane closure, 4 - 4+ Lane closure).
        `startPeriod` - Period in which the incident event begins.
        `duration` - Duration of the incident event.
        `segment` - Segment in which the incident event occurs.
        `segmentType` - Identifier for a GP or ML incident.

  - ### Method Detail

    - #### updateNumLanes

          private void updateNumLanes()

      Updates the number of lanes array to reflect any change in segment.

    - #### isValidSeverity

          public boolean isValidSeverity()

      Checks if the incident is valid for the scenario. An incident is valid only if its severity (lane closure) is less than the number of open lanes in the segment for each period in the duration of the incident.
      Returns:
        True if the incident is valid, False otherwise

    - #### isValid

          public boolean isValid()

      Checks to see if the event is valid for the seed/scenario in both the spatial and temporal sense.
      Returns:
        true if the event is valid, false if not valid

    - #### checkSegmentSwapGP

          public static boolean checkSegmentSwapGP(java.util.ArrayList<ScenarioInfo> scenarioInfos,
                                                   IncidentEvent inc1,
                                                   IncidentEvent inc2)

      Checks if swapping the segments of two incidents (GP) is valid.
      Parameters:
        `scenarioInfos` - List of ScenarioInfos for the reliability analysis the IncidentEvents are associated with.
        `inc1` - First IncidentEvent (GP)
        `inc2` - Second IncidentEvent (GP)
      Returns:
        True if the segments can be swapped, false otherwise

    - #### checkSegmentSwapML

          public static boolean checkSegmentSwapML(java.util.ArrayList<ScenarioInfo> scenarioInfos,
                                                   IncidentEvent inc1,
                                                   IncidentEvent inc2)

      Checks if swapping the segments of two incidents (ML) is valid.
      Parameters:
        `scenarioInfos` - List of ScenarioInfos for the reliability analysis the IncidentEvents are associated with.
        `inc1` - First IncidentEvent (ML)
        `inc2` - Second IncidentEvent (ML)
      Returns:
        True if the segments can be swapped, false otherwise

    - #### hasOverlap

          public boolean hasOverlap(ScenarioEvent event)

      Checks to see if the event overlaps with the specified incident event. The input event must be a incident event or else the method will automatically return false.
      Specified by:
        `hasOverlap` in class `ScenarioEvent`
      Parameters:
        `event` - Event with which to check overlap.
      Returns:
        True if the events overlap, false otherwise.

    - #### hasOverlap

          public boolean hasOverlap(IncidentEvent incEvent)

      Checks to see if the event overlaps with the specified incident event.
      Parameters:
        `incEvent` - Event with which to check overlap.
      Returns:
        True if the events overlap, false otherwise.

    - #### getEventCAF

          public float getEventCAF(int period,
                                   int segment)

      Specified by:
        `getEventCAF` in class `ScenarioEvent`

    - #### getEventOAF

          public float getEventOAF(int period,
                                   int segment)

      Specified by:
        `getEventOAF` in class `ScenarioEvent`

    - #### getEventDAF

          public float getEventDAF(int period,
                                   int segment)

      Specified by:
        `getEventDAF` in class `ScenarioEvent`

    - #### getEventSAF

          public float getEventSAF(int period,
                                   int segment)

      Specified by:
        `getEventSAF` in class `ScenarioEvent`

    - #### getEventLAF

          public int getEventLAF(int period,
                                 int segment)

      Specified by:
        `getEventLAF` in class `ScenarioEvent`

    - #### compareTo

          public int compareTo(IncidentEvent o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<IncidentEvent>`

    - #### getSegment

          public int getSegment()

    - #### setSegment

          public void setSegment(int newSegment)

    - #### getSegmentType

          public int getSegmentType()

    - #### mapPeriod

          private int mapPeriod(int period)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getSeverityString

          public java.lang.String getSeverityString()