Class Vehicle.DurationLimit.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessage.Builder<Vehicle.DurationLimit.Builder>
com.google.cloud.optimization.v1.Vehicle.DurationLimit.Builder
All Implemented Interfaces:
Vehicle.DurationLimitOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
Vehicle.DurationLimit

public static final class Vehicle.DurationLimit.Builder extends com.google.protobuf.GeneratedMessage.Builder<Vehicle.DurationLimit.Builder> implements Vehicle.DurationLimitOrBuilder
 A limit defining a maximum duration of the route of a vehicle. It can be
 either hard or soft.

 When a soft limit field is defined, both the soft max threshold and its
 associated cost must be defined together.
 
Protobuf type google.cloud.optimization.v1.Vehicle.DurationLimit
  • Method Details

    • getDescriptor

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

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.Builder<Vehicle.DurationLimit.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.GeneratedMessage.Builder<Vehicle.DurationLimit.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.GeneratedMessage.Builder<Vehicle.DurationLimit.Builder>
    • getDefaultInstanceForType

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

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

      public Vehicle.DurationLimit buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • mergeFrom

      public Vehicle.DurationLimit.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<Vehicle.DurationLimit.Builder>
    • mergeFrom

    • isInitialized

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

      public Vehicle.DurationLimit.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<Vehicle.DurationLimit.Builder>
      Throws:
      IOException
    • hasMaxDuration

      public boolean hasMaxDuration()
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
      Specified by:
      hasMaxDuration in interface Vehicle.DurationLimitOrBuilder
      Returns:
      Whether the maxDuration field is set.
    • getMaxDuration

      public com.google.protobuf.Duration getMaxDuration()
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
      Specified by:
      getMaxDuration in interface Vehicle.DurationLimitOrBuilder
      Returns:
      The maxDuration.
    • setMaxDuration

      public Vehicle.DurationLimit.Builder setMaxDuration(com.google.protobuf.Duration value)
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
    • setMaxDuration

      public Vehicle.DurationLimit.Builder setMaxDuration(com.google.protobuf.Duration.Builder builderForValue)
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
    • mergeMaxDuration

      public Vehicle.DurationLimit.Builder mergeMaxDuration(com.google.protobuf.Duration value)
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
    • clearMaxDuration

      public Vehicle.DurationLimit.Builder clearMaxDuration()
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
    • getMaxDurationBuilder

      public com.google.protobuf.Duration.Builder getMaxDurationBuilder()
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
    • getMaxDurationOrBuilder

      public com.google.protobuf.DurationOrBuilder getMaxDurationOrBuilder()
       A hard limit constraining the duration to be at most max_duration.
       
      .google.protobuf.Duration max_duration = 1;
      Specified by:
      getMaxDurationOrBuilder in interface Vehicle.DurationLimitOrBuilder
    • hasSoftMaxDuration

      public boolean hasSoftMaxDuration()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
      Specified by:
      hasSoftMaxDuration in interface Vehicle.DurationLimitOrBuilder
      Returns:
      Whether the softMaxDuration field is set.
    • getSoftMaxDuration

      public com.google.protobuf.Duration getSoftMaxDuration()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
      Specified by:
      getSoftMaxDuration in interface Vehicle.DurationLimitOrBuilder
      Returns:
      The softMaxDuration.
    • setSoftMaxDuration

      public Vehicle.DurationLimit.Builder setSoftMaxDuration(com.google.protobuf.Duration value)
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
    • setSoftMaxDuration

      public Vehicle.DurationLimit.Builder setSoftMaxDuration(com.google.protobuf.Duration.Builder builderForValue)
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
    • mergeSoftMaxDuration

      public Vehicle.DurationLimit.Builder mergeSoftMaxDuration(com.google.protobuf.Duration value)
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
    • clearSoftMaxDuration

      public Vehicle.DurationLimit.Builder clearSoftMaxDuration()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
    • getSoftMaxDurationBuilder

      public com.google.protobuf.Duration.Builder getSoftMaxDurationBuilder()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
    • getSoftMaxDurationOrBuilder

      public com.google.protobuf.DurationOrBuilder getSoftMaxDurationOrBuilder()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost. This cost adds up to other costs defined in
       the model, with the same unit.
      
       If defined, `soft_max_duration` must be nonnegative. If max_duration is
       also defined, `soft_max_duration` must be less than max_duration.
       
      .google.protobuf.Duration soft_max_duration = 2;
      Specified by:
      getSoftMaxDurationOrBuilder in interface Vehicle.DurationLimitOrBuilder
    • hasCostPerHourAfterSoftMax

      public boolean hasCostPerHourAfterSoftMax()
       Cost per hour incurred if the `soft_max_duration` threshold is violated.
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
       ```
       cost_per_hour_after_soft_max * (duration - soft_max_duration)
       ```
       The cost must be nonnegative.
       
      optional double cost_per_hour_after_soft_max = 3;
      Specified by:
      hasCostPerHourAfterSoftMax in interface Vehicle.DurationLimitOrBuilder
      Returns:
      Whether the costPerHourAfterSoftMax field is set.
    • getCostPerHourAfterSoftMax

      public double getCostPerHourAfterSoftMax()
       Cost per hour incurred if the `soft_max_duration` threshold is violated.
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
       ```
       cost_per_hour_after_soft_max * (duration - soft_max_duration)
       ```
       The cost must be nonnegative.
       
      optional double cost_per_hour_after_soft_max = 3;
      Specified by:
      getCostPerHourAfterSoftMax in interface Vehicle.DurationLimitOrBuilder
      Returns:
      The costPerHourAfterSoftMax.
    • setCostPerHourAfterSoftMax

      public Vehicle.DurationLimit.Builder setCostPerHourAfterSoftMax(double value)
       Cost per hour incurred if the `soft_max_duration` threshold is violated.
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
       ```
       cost_per_hour_after_soft_max * (duration - soft_max_duration)
       ```
       The cost must be nonnegative.
       
      optional double cost_per_hour_after_soft_max = 3;
      Parameters:
      value - The costPerHourAfterSoftMax to set.
      Returns:
      This builder for chaining.
    • clearCostPerHourAfterSoftMax

      public Vehicle.DurationLimit.Builder clearCostPerHourAfterSoftMax()
       Cost per hour incurred if the `soft_max_duration` threshold is violated.
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
       ```
       cost_per_hour_after_soft_max * (duration - soft_max_duration)
       ```
       The cost must be nonnegative.
       
      optional double cost_per_hour_after_soft_max = 3;
      Returns:
      This builder for chaining.
    • hasQuadraticSoftMaxDuration

      public boolean hasQuadraticSoftMaxDuration()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
      Specified by:
      hasQuadraticSoftMaxDuration in interface Vehicle.DurationLimitOrBuilder
      Returns:
      Whether the quadraticSoftMaxDuration field is set.
    • getQuadraticSoftMaxDuration

      public com.google.protobuf.Duration getQuadraticSoftMaxDuration()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
      Specified by:
      getQuadraticSoftMaxDuration in interface Vehicle.DurationLimitOrBuilder
      Returns:
      The quadraticSoftMaxDuration.
    • setQuadraticSoftMaxDuration

      public Vehicle.DurationLimit.Builder setQuadraticSoftMaxDuration(com.google.protobuf.Duration value)
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
    • setQuadraticSoftMaxDuration

      public Vehicle.DurationLimit.Builder setQuadraticSoftMaxDuration(com.google.protobuf.Duration.Builder builderForValue)
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
    • mergeQuadraticSoftMaxDuration

      public Vehicle.DurationLimit.Builder mergeQuadraticSoftMaxDuration(com.google.protobuf.Duration value)
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
    • clearQuadraticSoftMaxDuration

      public Vehicle.DurationLimit.Builder clearQuadraticSoftMaxDuration()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
    • getQuadraticSoftMaxDurationBuilder

      public com.google.protobuf.Duration.Builder getQuadraticSoftMaxDurationBuilder()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
    • getQuadraticSoftMaxDurationOrBuilder

      public com.google.protobuf.DurationOrBuilder getQuadraticSoftMaxDurationOrBuilder()
       A soft limit not enforcing a maximum duration limit, but when violated
       makes the route incur a cost, quadratic in the duration. This cost adds
       up to other costs defined in the model, with the same unit.
      
       If defined, `quadratic_soft_max_duration` must be nonnegative. If
       `max_duration` is also defined, `quadratic_soft_max_duration` must be
       less than `max_duration`, and the difference must be no larger than one
       day:
      
       `max_duration - quadratic_soft_max_duration <= 86400 seconds`
       
      .google.protobuf.Duration quadratic_soft_max_duration = 4;
      Specified by:
      getQuadraticSoftMaxDurationOrBuilder in interface Vehicle.DurationLimitOrBuilder
    • hasCostPerSquareHourAfterQuadraticSoftMax

      public boolean hasCostPerSquareHourAfterQuadraticSoftMax()
       Cost per square hour incurred if the
       `quadratic_soft_max_duration` threshold is violated.
      
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
      
       ```
       cost_per_square_hour_after_quadratic_soft_max *
       (duration - quadratic_soft_max_duration)^2
       ```
      
       The cost must be nonnegative.
       
      optional double cost_per_square_hour_after_quadratic_soft_max = 5;
      Specified by:
      hasCostPerSquareHourAfterQuadraticSoftMax in interface Vehicle.DurationLimitOrBuilder
      Returns:
      Whether the costPerSquareHourAfterQuadraticSoftMax field is set.
    • getCostPerSquareHourAfterQuadraticSoftMax

      public double getCostPerSquareHourAfterQuadraticSoftMax()
       Cost per square hour incurred if the
       `quadratic_soft_max_duration` threshold is violated.
      
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
      
       ```
       cost_per_square_hour_after_quadratic_soft_max *
       (duration - quadratic_soft_max_duration)^2
       ```
      
       The cost must be nonnegative.
       
      optional double cost_per_square_hour_after_quadratic_soft_max = 5;
      Specified by:
      getCostPerSquareHourAfterQuadraticSoftMax in interface Vehicle.DurationLimitOrBuilder
      Returns:
      The costPerSquareHourAfterQuadraticSoftMax.
    • setCostPerSquareHourAfterQuadraticSoftMax

      public Vehicle.DurationLimit.Builder setCostPerSquareHourAfterQuadraticSoftMax(double value)
       Cost per square hour incurred if the
       `quadratic_soft_max_duration` threshold is violated.
      
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
      
       ```
       cost_per_square_hour_after_quadratic_soft_max *
       (duration - quadratic_soft_max_duration)^2
       ```
      
       The cost must be nonnegative.
       
      optional double cost_per_square_hour_after_quadratic_soft_max = 5;
      Parameters:
      value - The costPerSquareHourAfterQuadraticSoftMax to set.
      Returns:
      This builder for chaining.
    • clearCostPerSquareHourAfterQuadraticSoftMax

      public Vehicle.DurationLimit.Builder clearCostPerSquareHourAfterQuadraticSoftMax()
       Cost per square hour incurred if the
       `quadratic_soft_max_duration` threshold is violated.
      
       The additional cost is 0 if the duration is under the threshold,
       otherwise the cost depends on the duration as follows:
      
       ```
       cost_per_square_hour_after_quadratic_soft_max *
       (duration - quadratic_soft_max_duration)^2
       ```
      
       The cost must be nonnegative.
       
      optional double cost_per_square_hour_after_quadratic_soft_max = 5;
      Returns:
      This builder for chaining.