Class DistanceLimit.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessage.Builder<DistanceLimit.Builder>
com.google.cloud.optimization.v1.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.GeneratedMessage.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 Summary

    Modifier and Type
    Method
    Description
     
     
     
    Cost per kilometer incurred if distance is above `soft_max_meters` limit.
    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`.
    A hard limit constraining the distance to be at most max_meters.
    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.
    double
    Cost per kilometer incurred if distance is above `soft_max_meters` limit.
    double
    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`.
     
    static final com.google.protobuf.Descriptors.Descriptor
     
    com.google.protobuf.Descriptors.Descriptor
     
    long
    A hard limit constraining the distance to be at most max_meters.
    long
    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.
    boolean
    Cost per kilometer incurred if distance is above `soft_max_meters` limit.
    boolean
    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`.
    boolean
    A hard limit constraining the distance to be at most max_meters.
    boolean
    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.
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
     
    final boolean
     
     
    mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    mergeFrom(com.google.protobuf.Message other)
     
    Cost per kilometer incurred if distance is above `soft_max_meters` limit.
    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`.
    setMaxMeters(long value)
    A hard limit constraining the distance to be at most max_meters.
    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.

    Methods inherited from class com.google.protobuf.GeneratedMessage.Builder

    addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3

    Methods inherited from class com.google.protobuf.AbstractMessage.Builder

    findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString

    Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

    addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.protobuf.Message.Builder

    mergeDelimitedFrom, mergeDelimitedFrom

    Methods inherited from interface com.google.protobuf.MessageLite.Builder

    mergeFrom

    Methods inherited from interface com.google.protobuf.MessageOrBuilder

    findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
  • 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<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.GeneratedMessage.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.GeneratedMessage.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
    • 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>
    • mergeFrom

      public DistanceLimit.Builder mergeFrom(DistanceLimit other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage.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.