aim4.map.lane

## Interface Lane

- All Known Implementing Classes:
    AbstractLane, LineSegmentLane

      public interface Lane

  This is a base class for all lanes. Creates an ID system for lanes such that all lanes will have a different integer ID. Also handles traffic generation methods, and other things that are the same no matter the implementation of the Lane.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(Point2D pos)` Whether or not the provided point can be considered "in" this Lane.
    `double` | `distanceAlongLane(Point2D pos)` Get the distance along the Lane from the start of the Lane to the Point in the center of the Lane nearest the given Point.
    `Point2D` | `getEndPoint()` Get the ending point of the Lane.
    `double` | `getHeadingAtNormalizedDistance(double normalizedDistance)` Get the heading of the Lane at a particular normalized distance from the start of the Lane.
    `int` | `getId()` Get the unique ID number of this Lane.
    `double` | `getInitialHeading()` Get the heading of this Lane at its starting point.
    `LaneIM` | `getLaneIM()` Get the LaneIM object that helps to locate the intersection managers on a lane.
    `Point2D` | `getLeadPoint(Point2D pos, double leadDist)` Get a point further down the Lane from the nearest point to the given position.
    `Lane` | `getLeftNeighbor()` Get the left neighbor of this Lane.
    `double` | `getLength()` Get the length of this Lane.
    `Lane` | `getNextLane()` Get the Lane into which this Lane leads, or `null` if none.
    `Point2D` | `getPointAtNormalizedDistance(double normalizedDistance)` Get a point in the center of the lane at a particular normalized distance from the start of the Lane.
    `Lane` | `getPrevLane()` Get the Lane which leads into this Lane, or `null` if none.
    `Lane` | `getRightNeighbor()` Get the right neighbor of this Lane.
    `Shape` | `getShape()` Get a Shape describing this Lane, including its width.
    `Shape` | `getShape(double startFraction, double endFraction)` Get a Shape describing an interval of this lane, using normalized distances.
    `double` | `getSpeedLimit()` Get the speed limit of this Lane, in meters per second.
    `Point2D` | `getStartPoint()` Get the starting point of the Lane.
    `double` | `getTerminalHeading()` Get the heading of this Lane at its ending point.
    `double` | `getWidth()` Get the width of this Lane, in meters.
    `boolean` | `hasLeftNeighbor()` Whether the Lane has another Lane immediately to its left travelling in the same direction.
    `boolean` | `hasNextLane()` Whether or not this Lane flows into another Lane.
    `boolean` | `hasPrevLane()` Whether or not another Lane flows into this Lane.
    `boolean` | `hasRightNeighbor()` Whether the Lane has another Lane immediately to its right travelling in the same direction.
    `Point2D` | `intersectionPoint(Line2D l)` The point at which the the given Line intersects the center of this Lane.
    `Shape` | `leftBorder()` Get a Shape representing the left border of this Lane.
    `Point2D` | `leftIntersectionPoint(Line2D l)` The point at which the the given Line intersects the left border of this Lane.
    `double` | `nearestDistance(Point2D pos)` Get the distance from a point to the center of the Lane.
    `Point2D` | `nearestPoint(Point2D p)` Get the point in the center of the Lane nearest to the provided point.
    `double` | `normalizedDistance(double distance)` Get the normalized distance at the distance from the starting point.
    `double` | `normalizedDistanceAlongLane(Point2D pos)` Get the normalized distance to the point in the center of the lane nearest the provided point.
    `double` | `remainingDistanceAlongLane(Point2D pos)` Get the amount of distance left in this Lane from the point on the Lane nearest to the given point.
    `Shape` | `rightBorder()` Get a Shape representing the right border of this Lane.
    `Point2D` | `rightIntersectionPoint(Line2D l)` The point at which the the given Line intersects the right border of this Lane.
    `void` | `setId(int id)` Set the unique ID number of this Lane.
    `void` | `setLeftNeighbor(Lane ln)` Register another Lane as a left neighbor to this Lane.
    `void` | `setNextLane(Lane nextLane)` Set the Lane into which this Lane leads.
    `void` | `setPrevLane(Lane prevLane)` Set the Lane which leads into this Lane.
    `void` | `setRightNeighbor(Lane ln)` Register another Lane as a right neighbor to this Lane.

- - ### Method Detail

    - #### getId

          int getId()

      Get the unique ID number of this Lane.
      Returns:
        the ID number of this lane

    - #### setId

          void setId(int id)

      Set the unique ID number of this Lane.
      Parameters:
        `id` - the ID number of this lane

    - #### getSpeedLimit

          double getSpeedLimit()

      Get the speed limit of this Lane, in meters per second.
      Returns:
        the speed limit of this Lane, in meters per second

    - #### getLaneIM

          LaneIM getLaneIM()

      Get the LaneIM object that helps to locate the intersection managers on a lane.
      Returns:
        the LaneIM object

    - #### hasNextLane

          boolean hasNextLane()

      Whether or not this Lane flows into another Lane.
      Returns:
        whether or not this Lane flows into another Lane

    - #### getNextLane

          Lane getNextLane()

      Get the Lane into which this Lane leads, or `null` if none.
      Returns:
        the Lane into which this Lane leads, or `null` if none

    - #### setNextLane

          void setNextLane(Lane nextLane)

      Set the Lane into which this Lane leads.
      Parameters:
        `nextLane` - the Lane into which this Lane leads

    - #### hasPrevLane

          boolean hasPrevLane()

      Whether or not another Lane flows into this Lane.
      Returns:
        whether or not another Lane flows into this Lane

    - #### getPrevLane

          Lane getPrevLane()

      Get the Lane which leads into this Lane, or `null` if none.
      Returns:
        the Lane which leads into this Lane, or `null` if none

    - #### setPrevLane

          void setPrevLane(Lane prevLane)

      Set the Lane which leads into this Lane.
      Parameters:
        `prevLane` - the Lane which leads into this Lane

    - #### hasLeftNeighbor

          boolean hasLeftNeighbor()

      Whether the Lane has another Lane immediately to its left travelling in the same direction. In other words, whether a vehicle can change lanes to the left.
      Returns:
        whether the Lane has a neighbor to its left

    - #### getLeftNeighbor

          Lane getLeftNeighbor()

      Get the left neighbor of this Lane.
      Returns:
        the left neighbor of this Lane, or `null` if none exists

    - #### setLeftNeighbor

          void setLeftNeighbor(Lane ln)

      Register another Lane as a left neighbor to this Lane. This is like having two lanes next to each other with a dotted line in between.
      Parameters:
        `ln` - the Lane to set as this Lane's left neighbor

    - #### hasRightNeighbor

          boolean hasRightNeighbor()

      Whether the Lane has another Lane immediately to its right travelling in the same direction. In other words, whether a vehicle can change lanes to the right.
      Returns:
        whether the Lane has a neighbor to its right

    - #### getRightNeighbor

          Lane getRightNeighbor()

      Get the right neighbor of this Lane.
      Returns:
        the right neighbor of this Lane, or `null` if none exists

    - #### setRightNeighbor

          void setRightNeighbor(Lane ln)

      Register another Lane as a right neighbor to this Lane. This is like having two lanes next to each other with a dotted line in between.
      Parameters:
        `ln` - the Lane to set as this Lane's right neighbor

    - #### getLength

          double getLength()

      Get the length of this Lane.
      Returns:
        the length of this Lane, in meters

    - #### getStartPoint

          Point2D getStartPoint()

      Get the starting point of the Lane.
      Returns:
        the starting point of the Lane

    - #### getEndPoint

          Point2D getEndPoint()

      Get the ending point of the Lane.
      Returns:
        the ending point of the Lane

    - #### getPointAtNormalizedDistance

          Point2D getPointAtNormalizedDistance(double normalizedDistance)

      Get a point in the center of the lane at a particular normalized distance from the start of the Lane.
      Parameters:
        `normalizedDistance` - the normalized distance (between 0 and 1) from the start of the Lane
      Returns:
        the point in the center of the Lane at the given normalized distance

    - #### nearestPoint

          Point2D nearestPoint(Point2D p)

      Get the point in the center of the Lane nearest to the provided point.
      Parameters:
        `p` - the point to which the nearest point in the center of the Lane should be found
      Returns:
        the point in the center of the Lane nearest to the given point

    - #### nearestDistance

          double nearestDistance(Point2D pos)

      Get the distance from a point to the center of the Lane.
      Parameters:
        `pos` - the point from which to find the distance to the Lane
      Returns:
        the distance from the point to the center of the Lane

    - #### getLeadPoint

          Point2D getLeadPoint(Point2D pos,
                             double leadDist)

      Get a point further down the Lane from the nearest point to the given position.
      Parameters:
        `pos` - the position from which to calculate the nearest point in the Lane
        `leadDist` - the lead distance further down the Lane, in meters
      Returns:
        a point `leadDist` further down the Lane from the closest point in the Lane to `pos`

    - #### distanceAlongLane

          double distanceAlongLane(Point2D pos)

      Get the distance along the Lane from the start of the Lane to the Point in the center of the Lane nearest the given Point.
      Parameters:
        `pos` - the point to which to find the distance along the Lane
      Returns:
        the distance along the Lane from the start of the Lane to the Point in the center of the Lane nearest the given Point

    - #### remainingDistanceAlongLane

          double remainingDistanceAlongLane(Point2D pos)

      Get the amount of distance left in this Lane from the point on the Lane nearest to the given point. This is used so a vehicle can determine how much of the Lane is left, given its current position.
      Parameters:
        `pos` - the point nearest which to find the distance to the end of the Lane
      Returns:
        the distance from the nearest point on the Lane to the given point to the end of the Lane.

    - #### normalizedDistanceAlongLane

          double normalizedDistanceAlongLane(Point2D pos)

      Get the normalized distance to the point in the center of the lane nearest the provided point. That is, given a point, find the nearest point in the center of the lane, then find the proportion of the way from the start point of the lane to the endpoint of the lane that that point is.
      Parameters:
        `pos` - the point near to which to find the normalized distance
      Returns:
        the normalized distance to the point in the center of the lane nearest to the given point

    - #### normalizedDistance

          double normalizedDistance(double distance)

      Get the normalized distance at the distance from the starting point.
      Parameters:
        `distance` - the distance along the center of the lane.
      Returns:
        the normalized distance along the center of the lane.

    - #### getInitialHeading

          double getInitialHeading()

      Get the heading of this Lane at its starting point.
      Returns:
        the initial heading of the Lane, in radians

    - #### getTerminalHeading

          double getTerminalHeading()

      Get the heading of this Lane at its ending point.
      Returns:
        the terminal heading of the Lane, in radians

    - #### getHeadingAtNormalizedDistance

          double getHeadingAtNormalizedDistance(double normalizedDistance)

      Get the heading of the Lane at a particular normalized distance from the start of the Lane.
      Parameters:
        `normalizedDistance` - the normalized distance (between 0 and 1) from the start of the Lane
      Returns:
        the heading of the lane at the given normalized distance

    - #### intersectionPoint

          Point2D intersectionPoint(Line2D l)

      The point at which the the given Line intersects the center of this Lane.
      Parameters:
        `l` - the Line with which to find the intersection
      Returns:
        the point at which the given Line intersects the center of this Lane, or `null` if it doesn't intersect

    - #### getWidth

          double getWidth()

      Get the width of this Lane, in meters.
      Returns:
        the width of this Lane, in meters

    - #### getShape

          Shape getShape()

      Get a Shape describing this Lane, including its width.
      Returns:
        a Shape describing this Lane

    - #### getShape

          Shape getShape(double startFraction,
                       double endFraction)

      Get a Shape describing an interval of this lane, using normalized distances.
      Parameters:
        `startFraction` - the normalized distance from the start of the lane to the start of the segment which the Shape represents
        `endFraction` - the normalized distance from the start of the lane to the end of the segment which the Shape represents
      Returns:
        a Shape describing the segment
      Throws:
        `IllegalArgumentException` - if `startFraction` or `endFraction` are not between 0 and 1

    - #### contains

          boolean contains(Point2D pos)

      Whether or not the provided point can be considered "in" this Lane. This is equivalent to determining whether the distance from the point to the Lane is less than half of the width of the Lane.
      Parameters:
        `pos` - the point to check
      Returns:
        whether or not the point is in the Lane

    - #### leftBorder

          Shape leftBorder()

      Get a Shape representing the left border of this Lane.
      Returns:
        a Shape representing the left border of this Lane

    - #### rightBorder

          Shape rightBorder()

      Get a Shape representing the right border of this Lane.
      Returns:
        a Shape representing the right border of this Lane

    - #### leftIntersectionPoint

          Point2D leftIntersectionPoint(Line2D l)

      The point at which the the given Line intersects the left border of this Lane.
      Parameters:
        `l` - the Line with which to find the intersection
      Returns:
        the point at which the given Line intersects the left border of this Lane, or `null` if it doesn't intersect

    - #### rightIntersectionPoint

          Point2D rightIntersectionPoint(Line2D l)

      The point at which the the given Line intersects the right border of this Lane.
      Parameters:
        `l` - the Line with which to find the intersection
      Returns:
        the point at which the given Line intersects the right border of this Lane, or `null` if it doesn't intersect

Copyright © 2013. All rights reserved.