Package com.anylogic.engine.markup.rail
- All Superinterfaces:
Serializable
public interface TrackDataSource extends Serializable
Modifier and Type | Method | Description |
---|---|---|
void | cancelReservation() |
Cancel any existing reservations, if any.
|
Agent | getCar |
Returns a car on the track at a given position counted from the beginning of the track.
|
List<Agent> | getCars() |
Returns the list of rail cars that are (maybe, partially) located
of this track
|
Agent | getFirstCar() |
Returns the car closest to the beginning of the track, or null if
the track is empty
|
double | getFreeSpace |
Tests the availability of space on the track.
|
Agent | getLastCar() |
Returns the car closest to the end of the track, or null if
the track is empty
|
int | getNCars() |
Returns the number of cars on the track (including partially)
|
List<Agent> | getReservations() |
Return all the trains that this track has been reserved for
|
List<Agent> | getTrains() |
Returns the list of the trains on the track
|
boolean | isAvailableFor |
Tests if the certain train is prohibited from moving through the track
|
boolean | isEmpty() |
Tests if the track is empty, i.e.
|
void | onToggleBlock() |
Callback at block status toggle
|
void | reserveFor |
Allow or disallow the specified trains to go through the track.
|
boolean isEmpty()
Tests if the track is empty, i.e. there are no cars that are (even
partially) on the track.
- Returns:
- true if the track is empty, false otherwise
int getNCars()
Returns the number of cars on the track (including partially)
- Returns:
- the number of cars on the track
Agent getFirstCar()
Returns the car closest to the beginning of the track, or null if
the track is empty
- Returns:
- the first car on the track or null
Agent getLastCar()
Returns the car closest to the end of the track, or null if
the track is empty
- Returns:
- the last car on the track or null
Agent getCar(int index)
Returns a car on the track at a given position counted from the beginning of the track.
All cars count: moving, standing, coupled, and cars that are only partially
on this track.
- Parameters:
index
- the index of the car- Returns:
- the car at a given position, or null
List<Agent> getCars()
Returns the list of rail cars that are (maybe, partially) located
of this track
- Returns:
- the list of cars on this track
double getFreeSpace(boolean fromstart)
Tests the availability of space on the track. If there are no
cars on the track, returns infinity. If there are cars,
returns the distance from the track start or end point (depending on the
parameter fromstart) to the nearest car. If there is a car partially
entered or exited the track at a given side, returns a negative value.
- Parameters:
fromstart
- if true, space is checked from the start point of the track, otherwise from end point- Returns:
- the free space from a given side of the track in meters, or infinity
List<Agent> getTrains()
Returns the list of the trains on the track
void onToggleBlock()
Callback at block status toggle
boolean isAvailableFor(Agent train)
Tests if the certain train is prohibited from moving through the track
- Parameters:
train
-- Returns:
- true if the train cannot move through the track, false otherwise
void reserveFor(Agent... trains)
Allow or disallow the specified trains to go through the track. Every call invalidates previous calls of this method and rewrites
- Parameters:
trains
- trains that are allowed or disallowed on the trackallow
- if true - only the specified trains can go through the track, if false - all but the specified trains are allowed
List<Agent> getReservations()
Return all the trains that this track has been reserved for
- Returns:
- all the trains that this track has been reserved for
void cancelReservation()
Cancel any existing reservations, if any. NB: global block is unaffected