Class Vehicle

All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Positioned<Place>, Temporal<TimeCoordinate>, Property

public class Vehicle extends Machine
Represents a generic vehicle entity within a macro or microscopic traffic system. It tracks physical state including geographical position, current velocity, and network location (current road).
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Constructor Details

    • Vehicle

      public Vehicle(String name)
      Initializes a new vehicle with a unique identity.
      Parameters:
      name - descriptive label for the vehicle (e.g., "Car-A1")
  • Method Details

    • getPosition

      public Place getPosition()
      Description copied from interface: Positioned
      Returns the position of this entity.
      Specified by:
      getPosition in interface Positioned<Place>
      Overrides:
      getPosition in class Resource
      Returns:
      the position.
    • getGeodeticPosition

      public GeodeticCoordinate getGeodeticPosition()
    • setPosition

      public void setPosition(GeodeticCoordinate position)
    • getActionName

      public String getActionName(int i)
      Description copied from class: Tool
      Returns the human-readable name for a specific action index.
      Specified by:
      getActionName in class Tool
    • act

      public void act(int i, Object[] objects)
      Description copied from class: Tool
      Executes the specific action on a set of target objects.
      Specified by:
      act in class Tool
    • getSpeed

      public Real getSpeed()
      Returns:
      current velocity in meters per second
    • setSpeed

      public void setSpeed(Real speed)
      Parameters:
      speed - new velocity as a Real value in m/s
    • setSpeed

      public void setSpeed(double speed)
      Parameters:
      speed - new velocity as a double in m/s
    • getCurrentRoad

      public Road getCurrentRoad()
      Returns:
      the road segment the vehicle is currently traversing
    • enterRoad

      public void enterRoad(Road road)
      Assigns the vehicle to a specific road and initializes its position to the start of the road segment.
      Parameters:
      road - the road to enter
    • move

      public void move(double seconds)
      Simulates the spatial progress of the vehicle along its current road over a time interval.
      Parameters:
      seconds - time delta in seconds