Class Vehicle
java.lang.Object
- All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Positioned<Place>, Temporal<TimeCoordinate>, Property
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:
-
Field Summary
Fields inherited from class Machine
COAL, ELECTRICITY, FUEL, GAS, MUSCULAR, SOLAR, VAPOR, WATERFALL, WIND, WOODFields inherited from class PotentialResource
id, traits -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes the specific action on a set of target objects.voidAssigns the vehicle to a specific road and initializes its position to the start of the road segment.getActionName(int i) Returns the human-readable name for a specific action index.Returns the position of this entity.getSpeed()voidmove(double seconds) Simulates the spatial progress of the vehicle along its current road over a time interval.voidsetPosition(GeodeticCoordinate position) voidsetSpeed(double speed) voidMethods inherited from class Machine
getEnergySources, isOn, setEnergySources, switchStatusMethods inherited from class Tool
getNumActions, getPurpose, getTargets, setNumActions, setPurpose, setTargetsMethods inherited from class MaterialResource
equals, getValue, hashCode, setValueMethods inherited from class Resource
addOwner, getOwners, getProducer, getProductionDate, getProductionPlace, getTimestamp, getWhen, removeOwner, setId, setOwners, setPositionMethods inherited from class PotentialResource
getAmount, getDecayTime, getDescription, getId, getKind, getTraits, setDecaySeconds, setDecayTime, setDescription, setKind, setQuantity, toStringMethods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, getTrait, setName, setTrait
-
Constructor Details
-
Vehicle
Initializes a new vehicle with a unique identity.- Parameters:
name- descriptive label for the vehicle (e.g., "Car-A1")
-
-
Method Details
-
getPosition
Description copied from interface:PositionedReturns the position of this entity.- Specified by:
getPositionin interfacePositioned<Place>- Overrides:
getPositionin classResource- Returns:
- the position.
-
getGeodeticPosition
-
setPosition
-
getActionName
Description copied from class:ToolReturns the human-readable name for a specific action index.- Specified by:
getActionNamein classTool
-
act
-
getSpeed
- Returns:
- current velocity in meters per second
-
setSpeed
- 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
- Returns:
- the road segment the vehicle is currently traversing
-
enterRoad
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
-