com.azalient.api.sim.agents
Interface IMotor

All Superinterfaces:
IAgent, IBlocker, IChangingDrawable, IDrawable, ILoopOccupier, IObstacle, IRecord, IRouteFinder, IUserData, RecordR, RecordRW, RecordW, SortableData, StoreRecordRW
All Known Subinterfaces:
ITransport, IVehicle

public interface IMotor
extends IAgent, IRouteFinder

The base interface for motorised agents - private vehicles and public transport vehicles


Field Summary
static IMotor[] ZERO
          A static zero-length array, created for convenience, and to save memory
 
Fields inherited from interface com.azalient.api.sim.agents.IObstacle
ZERO_OBSTACLES
 
Fields inherited from interface com.azalient.api.a.tables.IRecord
DELETED, KEY_SEP, KEY_SEP_CHAR
 
Method Summary
 boolean allowStandingLaneChange()
          Returns true if this motor can change lanes while not moving forward
 boolean changeLane(int direction, boolean checkParking, boolean checkGaps, boolean urgent)
          Attempt to force a lane change, with direction either -1 for left, or +1 for right.
 void colour(int rgb)
          Set the colour of this motor for display
 int destinationIndex()
          Return a value in the range [1..NZ] - this is not the same as zone.nameInt(), but is zone.index()+1
 IExitChoice exitChoice(ILink link, int lookAhead)
          Exit choices for given link and 1 or more intersections ahead
 int exitLaneIndex()
          1..N exit lane value
 void exitLaneIndex(int lane)
          Set the preferred index for the exit lane, which will be used if there is a choice of streams from a lane
 int extraPeople()
          Returns the number of extra people, not being modelled as Person objects, either as occupant() and friends() or as passengers().
 IMotorCalibration.FollowingModel followingModel()
          Return the current following model being used by this motor.
 double headFromPathStart()
          The distance of the front of the vehicle from the start of the pathway
 double headToPathEnd()
          The distance of the front of the vehicle from the end of the pathway
 int intersectionExit()
          Exit index [1..N] for next intersection from current position
 boolean isCycle()
          Returns true if this motor is a cycle
 boolean isTransport()
          Returns true if this motor is a public transport vehicle
 void kill()
          Destroy this motor
 ILane lane()
          Returns the current lane for this motor, or the next lane, if this motor is currently on a stream
 int laneHigh()
          Returns the highest acceptable lane index
 void laneHigh(int lane)
          Set the highest acceptable lane index on the current link
 int laneIndex()
          Returns the index of the current lane.
 ILane laneK()
          Returns any lane to the kerb side of this motor
 int laneLow()
          Returns the lowest acceptable lane index
 void laneLow(int lane)
          Set the lowest acceptable lane index on the current link
 void laneLowHigh(int lo, int hi)
          Set the lane range - the lowest and highest acceptable lane indices - on the current link
 ILane laneM()
          Returns any lane to the median side of this motor
 int laneOrderIndex()
          Returns the index of this motor on the current lane [0..N-1] where 0 is nearest the end of the lane
 IMotor leaderMotor()
          Returns any leader (as IMotor, not IAgent) which may be null if the motor is in free-flow
 ILink link()
          Returns the current link for this motor
 ILink nextLink()
          Returns the next link for this motor
 ISurface nextSurface()
          Returns the next surface for this motor, either a lane or an intersection
 void occupy(ILoop lp)
          [Internal] Cause this Motor to occupy the given loop
 int originIndex()
          Return a value in the range [1..NZ] - this is not the same as zone.nameInt(), but is zone.index()+1
 int people()
          The number of people in the motor, either as occupant() and friends() or as passengers().
 void reselectExit()
          re-select next stream - this might be called after changing route parameters or current lane.
 boolean routeExists(ILink link)
          Return true if a route exists for this motor on the given link.
 void speed(Speed speed)
          Set the speed of this motor to the given value
 int startTime()
          Returns the scheduled departure time of this motor, in whole seconds, after midnight on the first day of simulation
 boolean stopped()
          Returns true if the motor is stopped, for example for parked, or at a boom gate
 void stopped(boolean value)
          Set this to true to stop the vehicle
 int stops()
          A count of stops using the low and high speeds defined in the calibration parameters
 IStream stream()
          Returns the next or current stream for this motor, may be null if it has not yet been chosen
 int streamOrderIndex()
          Returns the index of this motor on the current stream [0..N-1] where 0 is nearest the end of the stream
 ISurface surface()
          Returns the current surface for this motor, either a lane or an intersection
 IMotorType type()
          [Overrides, with specialisation of return type] Returns the type - the type of a motor is always IMotorType
 void type(IType t)
          Set this to change the type of the vehicle (and the type of the corresponding trip)
 void unoccupy(ILoop lp)
          [Internal] Cause this Motor to unoccupy the given loop
 boolean uturn()
          Attempt to force a U-Turn movement.
 
Methods inherited from interface com.azalient.api.sim.agents.IAgent
acceleration, age, age, agentVision, arrived, attached, basePolygon, behaviour, blockedBy, blocker, centre, creationTime, emissionGrams, exclude, finished, followingAlgorithm, forward, freeMovingAlgorithm, frozen, gradient, halfLength, halfLengthHead, halfLengthTail, halfWidth, halted, halted, head, headDistance, headGroup, height, include, isAttached, keepSide, keepSide, leader, length, maxAcceleration, maxDeceleration, maxSpeedMPS, minimumGap, next, nextPathway, nextPathwayForward, pathPosition, pathway, pathwayFarthest, pathwayForward, perceivedHalfLengthHead, perceivedHalfWidth, reactionTime, selected, selected, specialMaxSpeed, speedMPS, steerFunction, steerToPathNow, stoppingDistance, tail, tailDistance, tailGroup, targetSpeedMPS, timeOnPathway, totalDistanceTravelled, totalTravelDistanceMetres, totalTravelStopsCount, totalTravelTimeSeconds, trackingMe, trip, tripDetailRecord, twig, unblock, uniqueID, velocity, weightKG, width, zombie
 
Methods inherited from interface com.azalient.api.sim.detection.ILoopOccupier
loops
 
Methods inherited from interface com.azalient.api.sim.agents.IObstacle
annotationPoint
 
Methods inherited from interface com.azalient.api.a.IUserData
userData, userData, userDataHashCode
 
Methods inherited from interface com.azalient.api.file.StoreRecordRW
canRename, rename, store
 
Methods inherited from interface com.azalient.api.file.RecordR
extraSet, finished, isApplicable, isEditable, set
 
Methods inherited from interface com.azalient.api.a.tables.IRecord
name
 
Methods inherited from interface com.azalient.api.file.RecordW
extraCols, extraGet, extraGetB, extraGetD, extraGetI, extraGetS, extraGetT, get, isVolatile
 
Methods inherited from interface com.azalient.api.sim.agents.IBlocker
blocked, blockerDescription, blockPointDistance, doneBlocking, nowBlocking
 
Methods inherited from interface com.azalient.api.draw.IChangingDrawable
drawChangeables
 
Methods inherited from interface com.azalient.api.draw.IDrawable
canExplode, centroid, destroy, draw, isTransparent, name, remove, removed
 
Methods inherited from interface com.azalient.api.sim.agents.IRouteFinder
arrivesHere, routeExitIndex
 

Field Detail

ZERO

static final IMotor[] ZERO
A static zero-length array, created for convenience, and to save memory

Method Detail

type

IMotorType type()
[Overrides, with specialisation of return type] Returns the type - the type of a motor is always IMotorType

Specified by:
type in interface IAgent

lane

ILane lane()
Returns the current lane for this motor, or the next lane, if this motor is currently on a stream


link

ILink link()
Returns the current link for this motor


nextLink

ILink nextLink()
Returns the next link for this motor


surface

ISurface surface()
Returns the current surface for this motor, either a lane or an intersection


nextSurface

ISurface nextSurface()
Returns the next surface for this motor, either a lane or an intersection


stream

IStream stream()
Returns the next or current stream for this motor, may be null if it has not yet been chosen


laneK

ILane laneK()
Returns any lane to the kerb side of this motor


laneM

ILane laneM()
Returns any lane to the median side of this motor


leaderMotor

IMotor leaderMotor()
Returns any leader (as IMotor, not IAgent) which may be null if the motor is in free-flow


headFromPathStart

double headFromPathStart()
The distance of the front of the vehicle from the start of the pathway


headToPathEnd

double headToPathEnd()
The distance of the front of the vehicle from the end of the pathway


originIndex

int originIndex()
Return a value in the range [1..NZ] - this is not the same as zone.nameInt(), but is zone.index()+1


destinationIndex

int destinationIndex()
Return a value in the range [1..NZ] - this is not the same as zone.nameInt(), but is zone.index()+1


routeExists

boolean routeExists(ILink link)
Return true if a route exists for this motor on the given link. If the vehicle has no destination or service then this will return true. This is abstract in Motor because it uses the router for Vehicles and Service definition for Transport


isCycle

boolean isCycle()
Returns true if this motor is a cycle


isTransport

boolean isTransport()
Returns true if this motor is a public transport vehicle


stopped

boolean stopped()
Returns true if the motor is stopped, for example for parked, or at a boom gate


allowStandingLaneChange

boolean allowStandingLaneChange()
Returns true if this motor can change lanes while not moving forward


laneIndex

int laneIndex()
Returns the index of the current lane.


laneOrderIndex

int laneOrderIndex()
Returns the index of this motor on the current lane [0..N-1] where 0 is nearest the end of the lane


streamOrderIndex

int streamOrderIndex()
Returns the index of this motor on the current stream [0..N-1] where 0 is nearest the end of the stream


laneHigh

int laneHigh()
Returns the highest acceptable lane index


laneLow

int laneLow()
Returns the lowest acceptable lane index


startTime

int startTime()
Returns the scheduled departure time of this motor, in whole seconds, after midnight on the first day of simulation


exitChoice

IExitChoice exitChoice(ILink link,
                       int lookAhead)
Exit choices for given link and 1 or more intersections ahead


intersectionExit

int intersectionExit()
Exit index [1..N] for next intersection from current position


exitLaneIndex

int exitLaneIndex()
1..N exit lane value


speed

void speed(Speed speed)
Set the speed of this motor to the given value


exitLaneIndex

void exitLaneIndex(int lane)
Set the preferred index for the exit lane, which will be used if there is a choice of streams from a lane


laneHigh

void laneHigh(int lane)
Set the highest acceptable lane index on the current link


laneLow

void laneLow(int lane)
Set the lowest acceptable lane index on the current link


laneLowHigh

void laneLowHigh(int lo,
                 int hi)
Set the lane range - the lowest and highest acceptable lane indices - on the current link


stopped

void stopped(boolean value)
Set this to true to stop the vehicle


type

void type(IType t)
Set this to change the type of the vehicle (and the type of the corresponding trip)


kill

void kill()
Destroy this motor


changeLane

boolean changeLane(int direction,
                   boolean checkParking,
                   boolean checkGaps,
                   boolean urgent)
Attempt to force a lane change, with direction either -1 for left, or +1 for right. Returns true if successful.


uturn

boolean uturn()
Attempt to force a U-Turn movement. Returns true if successful.


colour

void colour(int rgb)
Set the colour of this motor for display


occupy

void occupy(ILoop lp)
[Internal] Cause this Motor to occupy the given loop

Internal - Not recommended for use. Public as a side-effect of implementation method

unoccupy

void unoccupy(ILoop lp)
[Internal] Cause this Motor to unoccupy the given loop

Internal - Not recommended for use. Public as a side-effect of implementation method

reselectExit

void reselectExit()
re-select next stream - this might be called after changing route parameters or current lane. It will be effective only if the motor is currently on a lane (not currently on a stream)

Specified by:
reselectExit in interface IAgent

followingModel

IMotorCalibration.FollowingModel followingModel()
Return the current following model being used by this motor. This can change by link.


stops

int stops()
A count of stops using the low and high speeds defined in the calibration parameters


people

int people()
The number of people in the motor, either as occupant() and friends() or as passengers().


extraPeople

int extraPeople()
Returns the number of extra people, not being modelled as Person objects, either as occupant() and friends() or as passengers(). This can include the driver of a bus, a taxi, a drop-off or pick-up vehicle.

This is not really intended to model people in vehicle-only trips. If you want to do that, replace the vehicle-trips with person-trips.