Class DistanceLimit.Builder

  • All Implemented Interfaces:
    DistanceLimitOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
    Enclosing class:
    DistanceLimit

    public static final class DistanceLimit.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
    implements DistanceLimitOrBuilder
     A limit defining a maximum distance which can be traveled. It can be either
     hard or soft.
    
     If a soft limit is defined, both `soft_max_meters` and
     `cost_per_kilometer_above_soft_max` must be defined and be nonnegative.
     
    Protobuf type google.cloud.optimization.v1.DistanceLimit
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • clear

        public DistanceLimit.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • getDefaultInstanceForType

        public DistanceLimit getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public DistanceLimit build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public DistanceLimit buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public DistanceLimit.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • setField

        public DistanceLimit.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                              Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • clearField

        public DistanceLimit.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • clearOneof

        public DistanceLimit.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • setRepeatedField

        public DistanceLimit.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                      int index,
                                                      Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • addRepeatedField

        public DistanceLimit.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                      Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • mergeFrom

        public DistanceLimit.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<DistanceLimit.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • mergeFrom

        public DistanceLimit.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<DistanceLimit.Builder>
        Throws:
        IOException
      • hasMaxMeters

        public boolean hasMaxMeters()
         A hard limit constraining the distance to be at most max_meters. The limit
         must be nonnegative.
         
        optional int64 max_meters = 1;
        Specified by:
        hasMaxMeters in interface DistanceLimitOrBuilder
        Returns:
        Whether the maxMeters field is set.
      • getMaxMeters

        public long getMaxMeters()
         A hard limit constraining the distance to be at most max_meters. The limit
         must be nonnegative.
         
        optional int64 max_meters = 1;
        Specified by:
        getMaxMeters in interface DistanceLimitOrBuilder
        Returns:
        The maxMeters.
      • setMaxMeters

        public DistanceLimit.Builder setMaxMeters​(long value)
         A hard limit constraining the distance to be at most max_meters. The limit
         must be nonnegative.
         
        optional int64 max_meters = 1;
        Parameters:
        value - The maxMeters to set.
        Returns:
        This builder for chaining.
      • clearMaxMeters

        public DistanceLimit.Builder clearMaxMeters()
         A hard limit constraining the distance to be at most max_meters. The limit
         must be nonnegative.
         
        optional int64 max_meters = 1;
        Returns:
        This builder for chaining.
      • hasSoftMaxMeters

        public boolean hasSoftMaxMeters()
         A soft limit not enforcing a maximum distance limit, but when violated
         results in a cost which adds up to other costs defined in the model,
         with the same unit.
        
         If defined soft_max_meters must be less than max_meters and must be
         nonnegative.
         
        optional int64 soft_max_meters = 2;
        Specified by:
        hasSoftMaxMeters in interface DistanceLimitOrBuilder
        Returns:
        Whether the softMaxMeters field is set.
      • getSoftMaxMeters

        public long getSoftMaxMeters()
         A soft limit not enforcing a maximum distance limit, but when violated
         results in a cost which adds up to other costs defined in the model,
         with the same unit.
        
         If defined soft_max_meters must be less than max_meters and must be
         nonnegative.
         
        optional int64 soft_max_meters = 2;
        Specified by:
        getSoftMaxMeters in interface DistanceLimitOrBuilder
        Returns:
        The softMaxMeters.
      • setSoftMaxMeters

        public DistanceLimit.Builder setSoftMaxMeters​(long value)
         A soft limit not enforcing a maximum distance limit, but when violated
         results in a cost which adds up to other costs defined in the model,
         with the same unit.
        
         If defined soft_max_meters must be less than max_meters and must be
         nonnegative.
         
        optional int64 soft_max_meters = 2;
        Parameters:
        value - The softMaxMeters to set.
        Returns:
        This builder for chaining.
      • clearSoftMaxMeters

        public DistanceLimit.Builder clearSoftMaxMeters()
         A soft limit not enforcing a maximum distance limit, but when violated
         results in a cost which adds up to other costs defined in the model,
         with the same unit.
        
         If defined soft_max_meters must be less than max_meters and must be
         nonnegative.
         
        optional int64 soft_max_meters = 2;
        Returns:
        This builder for chaining.
      • hasCostPerKilometerBelowSoftMax

        public boolean hasCostPerKilometerBelowSoftMax()
         Cost per kilometer incurred, increasing up to `soft_max_meters`, with
         formula:
         ```
           min(distance_meters, soft_max_meters) / 1000.0 *
           cost_per_kilometer_below_soft_max.
         ```
         This cost is not supported in `route_distance_limit`.
         
        optional double cost_per_kilometer_below_soft_max = 4;
        Specified by:
        hasCostPerKilometerBelowSoftMax in interface DistanceLimitOrBuilder
        Returns:
        Whether the costPerKilometerBelowSoftMax field is set.
      • getCostPerKilometerBelowSoftMax

        public double getCostPerKilometerBelowSoftMax()
         Cost per kilometer incurred, increasing up to `soft_max_meters`, with
         formula:
         ```
           min(distance_meters, soft_max_meters) / 1000.0 *
           cost_per_kilometer_below_soft_max.
         ```
         This cost is not supported in `route_distance_limit`.
         
        optional double cost_per_kilometer_below_soft_max = 4;
        Specified by:
        getCostPerKilometerBelowSoftMax in interface DistanceLimitOrBuilder
        Returns:
        The costPerKilometerBelowSoftMax.
      • setCostPerKilometerBelowSoftMax

        public DistanceLimit.Builder setCostPerKilometerBelowSoftMax​(double value)
         Cost per kilometer incurred, increasing up to `soft_max_meters`, with
         formula:
         ```
           min(distance_meters, soft_max_meters) / 1000.0 *
           cost_per_kilometer_below_soft_max.
         ```
         This cost is not supported in `route_distance_limit`.
         
        optional double cost_per_kilometer_below_soft_max = 4;
        Parameters:
        value - The costPerKilometerBelowSoftMax to set.
        Returns:
        This builder for chaining.
      • clearCostPerKilometerBelowSoftMax

        public DistanceLimit.Builder clearCostPerKilometerBelowSoftMax()
         Cost per kilometer incurred, increasing up to `soft_max_meters`, with
         formula:
         ```
           min(distance_meters, soft_max_meters) / 1000.0 *
           cost_per_kilometer_below_soft_max.
         ```
         This cost is not supported in `route_distance_limit`.
         
        optional double cost_per_kilometer_below_soft_max = 4;
        Returns:
        This builder for chaining.
      • hasCostPerKilometerAboveSoftMax

        public boolean hasCostPerKilometerAboveSoftMax()
         Cost per kilometer incurred if distance is above `soft_max_meters` limit.
         The additional cost is 0 if the distance is under the limit, otherwise the
         formula used to compute the cost is the following:
         ```
           (distance_meters - soft_max_meters) / 1000.0 *
           cost_per_kilometer_above_soft_max.
         ```
         The cost must be nonnegative.
         
        optional double cost_per_kilometer_above_soft_max = 3;
        Specified by:
        hasCostPerKilometerAboveSoftMax in interface DistanceLimitOrBuilder
        Returns:
        Whether the costPerKilometerAboveSoftMax field is set.
      • getCostPerKilometerAboveSoftMax

        public double getCostPerKilometerAboveSoftMax()
         Cost per kilometer incurred if distance is above `soft_max_meters` limit.
         The additional cost is 0 if the distance is under the limit, otherwise the
         formula used to compute the cost is the following:
         ```
           (distance_meters - soft_max_meters) / 1000.0 *
           cost_per_kilometer_above_soft_max.
         ```
         The cost must be nonnegative.
         
        optional double cost_per_kilometer_above_soft_max = 3;
        Specified by:
        getCostPerKilometerAboveSoftMax in interface DistanceLimitOrBuilder
        Returns:
        The costPerKilometerAboveSoftMax.
      • setCostPerKilometerAboveSoftMax

        public DistanceLimit.Builder setCostPerKilometerAboveSoftMax​(double value)
         Cost per kilometer incurred if distance is above `soft_max_meters` limit.
         The additional cost is 0 if the distance is under the limit, otherwise the
         formula used to compute the cost is the following:
         ```
           (distance_meters - soft_max_meters) / 1000.0 *
           cost_per_kilometer_above_soft_max.
         ```
         The cost must be nonnegative.
         
        optional double cost_per_kilometer_above_soft_max = 3;
        Parameters:
        value - The costPerKilometerAboveSoftMax to set.
        Returns:
        This builder for chaining.
      • clearCostPerKilometerAboveSoftMax

        public DistanceLimit.Builder clearCostPerKilometerAboveSoftMax()
         Cost per kilometer incurred if distance is above `soft_max_meters` limit.
         The additional cost is 0 if the distance is under the limit, otherwise the
         formula used to compute the cost is the following:
         ```
           (distance_meters - soft_max_meters) / 1000.0 *
           cost_per_kilometer_above_soft_max.
         ```
         The cost must be nonnegative.
         
        optional double cost_per_kilometer_above_soft_max = 3;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final DistanceLimit.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>
      • mergeUnknownFields

        public final DistanceLimit.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<DistanceLimit.Builder>