new ProtocolVehicle(vehicle_occupants, structures)
- Description:
- Class to define a Vehicle with Occupants that can occupy each seat
- Source:
Example
let vehicle = new ProtocolVehicle(driver, front, behind_driver, behind_front, middle);
Parameters:
Name | Type | Description |
---|---|---|
vehicle_occupants |
Array.<VehicleOccupant> | array of OccupantProduct names in driver seat |
structures |
Array.<string> | array of OccupantProduct names in driver seat |
Members
(nullable) behind_driver :VehicleOccupant
- Description:
- behind driver occupant
- Source:
behind driver occupant
Type:
(nullable) behind_front :VehicleOccupant
- Description:
- behind front occupant
- Source:
behind front occupant
Type:
(nullable) driver :VehicleOccupant
- Description:
- driver occupant
- Source:
driver occupant
Type:
(nullable) front :VehicleOccupant
- Description:
- front passenger occupant
- Source:
front passenger occupant
Type:
(nullable) middle :VehicleOccupant
- Description:
- rear middle passenger occupant names array
- Source:
rear middle passenger occupant names array
Type:
structures :Array.<string>
- Description:
- Array of Structure types
- Source:
Array of Structure types
Type:
- Array.<string>
vehicle_occupants :Array.<VehicleOccupant>
- Description:
- vehicles occupants array
- Source:
vehicles occupants array
Type:
- Array.<VehicleOccupant>
Methods
(static) FromJSON(json) → {ProtocolVehicle}
- Description:
- construct a ProtocolVehicle from JSON
- Source:
Parameters:
Name | Type | Description |
---|---|---|
json |
ProtocolVehicleJSON |
Returns:
- Type
- ProtocolVehicle
GetOccupant(position) → (nullable) {VehicleOccupant}
- Description:
- driver occupant names array
- Source:
Parameters:
Name | Type | Description |
---|---|---|
position |
string |
Returns:
- Type
- VehicleOccupant
Occupants() → {Array.<VehicleOccupant>}
- Description:
- get array of all the VehicleOccupants in the ProtocolVehicle
- Source:
Example
let occupants = this.Occupants();
Returns:
- Type
- Array.<VehicleOccupant>
OnlyOccupants(positionopt, nullable, front_rearopt, nullable, sideopt, nullable, drive_sideopt) → {Array.<VehicleOccupant>}
- Description:
- returns an array of valid (non-empty) VehicleOccupants that match all the passed criteria for position side and front_rear. Note that each position is unique so passing additonal arguments may result in an empty array being returned Note that null can be passed for any of these criteria and it will not filter on that property Note also that zero length array is returned if no matching occupants found
- Source:
Example
let occupants = this.OnlyOccupants(WorkflowOccupant.PASSENGER, WorkflowOccupant.REAR);
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
position |
string |
<optional> <nullable> |
null
|
Workflowoccupant.DRIVER or WorkflowOccupant.PASSENGER |
front_rear |
string |
<optional> <nullable> |
null
|
front or rear row seat |
side |
string |
<optional> <nullable> |
null
|
WorkflowOccupant.LEFT, WorkflowOccupant.RIGHT or WorkflowOccupant.MIDDLE |
drive_side |
string |
<optional> |
VehicleOccupant.LHD
|
VehicleOccupant.LHD by default, but can set to VehicleOccupant.RHD. This is only used if side is not null |
Returns:
- Type
- Array.<VehicleOccupant>
ToJSON(regulation, crash_test, version, descriptionopt, nullable, drive_sideopt, nullable) → {Object}
- Description:
- return JSON representation of ProtocolVehicle with protocol data
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
regulation |
string | Regulation, e.g. Regulation.CNCAP | ||
crash_test |
string | Crash test, e.g. CrashTest.ODB | ||
version |
string | Version, e.g. "2017" | ||
description |
string |
<optional> <nullable> |
null
|
e.g. "2017" |
drive_side |
string |
<optional> <nullable> |
null
|
Returns:
- Type
- Object