# Google Maps Route Optimization V1 Client - Class PrecedenceRule (0.6.2)

0.6.2 (latest) 0.6.1 0.5.1 0.4.1 0.3.3 0.2.0 0.1.0 Reference documentation and code samples for the Google Maps Route Optimization V1 Client class PrecedenceRule.

A precedence rule between two events (each event is the pickup or the
delivery of a shipment): the "second" event has to start at least
`offset_duration` after "first" has started.

Several precedences can refer to the same (or related) events, e.g.,
"pickup of B happens after delivery of A" and "pickup of C happens after
pickup of B".
Furthermore, precedences only apply when both shipments are performed and
are otherwise ignored.

Generated from protobuf message `google.maps.routeoptimization.v1.ShipmentModel.PrecedenceRule`

## Namespace

Google \\ Maps \\ RouteOptimization \\ V1 \\ ShipmentModel

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ first_index` | `int` Shipment index of the "first" event. This field must be specified. |
| `↳ first_is_delivery` | `bool` Indicates if the "first" event is a delivery. |
| `↳ second_index` | `int` Shipment index of the "second" event. This field must be specified. |
| `↳ second_is_delivery` | `bool` Indicates if the "second" event is a delivery. |
| `↳ offset_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` The offset between the "first" and "second" event. It can be negative. |

### getFirstIndex

Shipment index of the "first" event. This field must be specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasFirstIndex

### clearFirstIndex

### setFirstIndex

Shipment index of the "first" event. This field must be specified.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getFirstIsDelivery

Indicates if the "first" event is a delivery.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setFirstIsDelivery

Indicates if the "first" event is a delivery.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSecondIndex

Shipment index of the "second" event. This field must be specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasSecondIndex

### clearSecondIndex

### setSecondIndex

Shipment index of the "second" event. This field must be specified.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSecondIsDelivery

Indicates if the "second" event is a delivery.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setSecondIsDelivery

Indicates if the "second" event is a delivery.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOffsetDuration

The offset between the "first" and "second" event. It can be negative.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasOffsetDuration

### clearOffsetDuration

### setOffsetDuration

The offset between the "first" and "second" event. It can be negative.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |