# Cloud Optimization V1 API - Class Google::Cloud::Optimization::V1::ShipmentModel::PrecedenceRule (v0.16.0)

0.16.0 (latest) 0.15.0 0.14.1 0.13.0 0.12.0 0.11.1 0.10.0 0.9.2 0.8.2 0.7.0 0.6.0 0.5.0 0.4.1 0.3.0 0.2.1 0.1.1 Reference documentation and code samples for the Cloud Optimization V1 API class Google::Cloud::Optimization::V1::ShipmentModel::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".

<br />

Furthermore, precedences only apply when both shipments are performed and
are otherwise ignored.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #first_index

    def first_index() -> ::Integer

**Returns**

- (::Integer) --- Shipment index of the "first" event. This field must be specified.

### #first_index=

    def first_index=(value) -> ::Integer

**Parameter**

- **value** (::Integer) --- Shipment index of the "first" event. This field must be specified.
**Returns**

- (::Integer) --- Shipment index of the "first" event. This field must be specified.

### #first_is_delivery

    def first_is_delivery() -> ::Boolean

**Returns**

- (::Boolean) --- Indicates if the "first" event is a delivery.

### #first_is_delivery=

    def first_is_delivery=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- Indicates if the "first" event is a delivery.
**Returns**

- (::Boolean) --- Indicates if the "first" event is a delivery.

### #offset_duration

    def offset_duration() -> ::Google::Protobuf::Duration

**Returns**

- ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Protobuf-Duration)) --- The offset between the "first" and "second" event. It can be negative.

### #offset_duration=

    def offset_duration=(value) -> ::Google::Protobuf::Duration

**Parameter**

- **value** ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Protobuf-Duration)) --- The offset between the "first" and "second" event. It can be negative.
**Returns**

- ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-optimization-v1/latest/Google-Protobuf-Duration)) --- The offset between the "first" and "second" event. It can be negative.

### #second_index

    def second_index() -> ::Integer

**Returns**

- (::Integer) --- Shipment index of the "second" event. This field must be specified.

### #second_index=

    def second_index=(value) -> ::Integer

**Parameter**

- **value** (::Integer) --- Shipment index of the "second" event. This field must be specified.
**Returns**

- (::Integer) --- Shipment index of the "second" event. This field must be specified.

### #second_is_delivery

    def second_is_delivery() -> ::Boolean

**Returns**

- (::Boolean) --- Indicates if the "second" event is a delivery.

### #second_is_delivery=

    def second_is_delivery=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- Indicates if the "second" event is a delivery.
**Returns**

- (::Boolean) --- Indicates if the "second" event is a delivery.