public class Establishment
extends java.lang.Object
implements org.liris.smartgov.simulator.core.agent.moving.ParkingArea
This class implements the ParkingArea interface, to represent the fact that vehicle are waiting outside of the road graph between each delivery.
Constructor and Description |
---|
Establishment(java.lang.String id,
java.lang.String name,
ST8 activity,
org.liris.smartgov.simulator.urban.geo.utils.LatLon location)
Establishment constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAgent(org.liris.smartgov.simulator.urban.osm.agent.OsmAgent agent)
Adds an agent to the establishment.
|
void |
addRound(Vehicle vehicle,
Round round)
Adds a round to be performed by the specified vehicle.
|
void |
addVehicleToFleet(Vehicle vehicle)
Adds a vehicle to the establishment's fleet.
|
void |
enter(org.liris.smartgov.simulator.core.agent.moving.MovingAgent agent)
Currently, does not does anything special, but allows vehicles to
leave the graph to enter this establishment.
|
ST8 |
getActivity()
Returns establishment's activity.
|
java.util.Collection<org.liris.smartgov.simulator.urban.osm.agent.OsmAgent> |
getAgents()
Returns agents belonging to this establishment.
|
org.liris.smartgov.simulator.urban.osm.environment.graph.OsmNode |
getClosestOsmNode()
Returns this establishment's closest osm node, that can be used to
perform deliveries.
|
java.util.Map<java.lang.String,Vehicle> |
getFleet()
Returns the establishment vehicles, indexed by their ids.
|
java.util.Map<VehicleCapacity,java.util.Collection<Vehicle>> |
getFleetByCapacity()
Returns a convenient fleet representation, indexed by vehicles
capacities.
|
java.lang.String |
getId()
Returns establishment's id.
|
org.liris.smartgov.simulator.urban.geo.utils.LatLon |
getLocation()
Returns establishment's geographical location.
|
java.lang.String |
getName()
Returns establishment's name.
|
java.util.Map<java.lang.String,Personality> |
getPersonalities() |
java.util.Map<java.lang.String,Round> |
getRounds()
Returns rounds that must be performed by this establishment,
indexed by delivery vehicle ids that must perform each round.
|
void |
leave(org.liris.smartgov.simulator.core.agent.moving.MovingAgent agent)
Currently, does not does anything special, but allows vehicles to
leave this establishment and enter the road graph.
|
void |
replaceVehicle(java.lang.String id,
Vehicle vehicle) |
void |
resetFleet() |
void |
setClosestOsmNode(org.liris.smartgov.simulator.urban.osm.environment.graph.OsmNode closestOsmNode)
Sets the closest available osm node of this establishment, that
belongs to a road.
|
void |
setPersonality(java.lang.String vehicleId,
Personality personality)
Returns the personality at the specified id
|
int |
spaceLeft()
Unused.
|
java.lang.String |
toString() |
public Establishment(java.lang.String id, java.lang.String name, ST8 activity, org.liris.smartgov.simulator.urban.geo.utils.LatLon location)
id
- establishment idname
- nameactivity
- ST8 categorylocation
- geographic locationpublic java.lang.String getId()
public java.lang.String getName()
public ST8 getActivity()
public org.liris.smartgov.simulator.urban.geo.utils.LatLon getLocation()
public void setClosestOsmNode(org.liris.smartgov.simulator.urban.osm.environment.graph.OsmNode closestOsmNode)
closestOsmNode
- closest available osm nodepublic org.liris.smartgov.simulator.urban.osm.environment.graph.OsmNode getClosestOsmNode()
public void setPersonality(java.lang.String vehicleId, Personality personality)
id
- the id of the personalitypublic java.util.Map<java.lang.String,Personality> getPersonalities()
public void addVehicleToFleet(Vehicle vehicle)
Vehicles are indexed by their internal DeliveryVehicle ids.
In the current context, the vehicle's id does not have to be unique
in the complete simulation, and only need to be unique by
establishment, and so does the EstablishmentLoader
.
vehicle
- vehicle to add to the fleetpublic void resetFleet()
public void addRound(Vehicle vehicle, Round round)
Rounds are indexed by vehicle ids.
vehicle
- vehicle that can perform this roundround
- round to performpublic java.util.Map<java.lang.String,Vehicle> getFleet()
public void replaceVehicle(java.lang.String id, Vehicle vehicle)
public java.util.Map<VehicleCapacity,java.util.Collection<Vehicle>> getFleetByCapacity()
Can be used to easily associate vehicles to rounds according to their respective capacities and weight for example.
public java.util.Map<java.lang.String,Round> getRounds()
public void addAgent(org.liris.smartgov.simulator.urban.osm.agent.OsmAgent agent)
Such agents are not direcly used by the establishments, but represents a nice way to monitor agents and establishments behavior when agents added are agents corresponding to DeliveryDriverBodies that perform establishment's rounds (as it's done currently).
agent
- agent to System.out.println(agents.size());add to this establishmentpublic java.util.Collection<org.liris.smartgov.simulator.urban.osm.agent.OsmAgent> getAgents()
Currently, corresponds to agents associated to the delivery drivers that performs establishment's rounds.
public void enter(org.liris.smartgov.simulator.core.agent.moving.MovingAgent agent)
enter
in interface org.liris.smartgov.simulator.core.agent.moving.ParkingArea
agent
- delivery agent entering this establishmentpublic void leave(org.liris.smartgov.simulator.core.agent.moving.MovingAgent agent)
leave
in interface org.liris.smartgov.simulator.core.agent.moving.ParkingArea
agent
- delivery agent leaving this establishmentpublic int spaceLeft()
spaceLeft
in interface org.liris.smartgov.simulator.core.agent.moving.ParkingArea
public java.lang.String toString()
toString
in class java.lang.Object