text
stringlengths
1
1.05M
/** * @file main.cpp * @author Christian (<EMAIL>) * * HASHCC is distributed under the MIT License (MIT); this file is part of. * * Copyright (c) 2008-2018 Christian (<EMAIL>) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef __cplusplus #error compiler is not a C++ one #endif /******************************************************************************/ #include "./hashcc/hashcc.h" // HASHCC:: /******************************************************************************/ int // main main( int argc, char** argv ) { argc = 0; // due 2 W4 - MSVS annoys me if not used argv = 0; // due 2 W4 - MSVS annoys me if not used try { // try everything ~8> std::cout << "HASHCC::" << std::endl << std::flush; std::cout << "package" << " " << _HASHCC_PACKAGE_ << std::endl << std::flush; std::cout << "version" << " " << _HASHCC_VERSION_NO_ << " " << _HASHCC_VERSION_DATE_ << std::endl << std::flush; std::cout << "built " << " " << _HASHCC_BUILT_DATE_ << " " << _HASHCC_BUILT_TIME_ << std::endl << std::flush; std::cout << std::endl << std::flush; // /// //// HASHCC::TEST //// /// // HASHCC::TEST::testStc( ); std::cout << std::endl << std::flush; // /// //// HASHCC::TEST //// /// // std::cout << "testing hashes ... " << std::flush; HASHCC::TEST::testHash( ); std::cout << "done" << std::endl << std::flush; std::cout << std::endl << std::flush; // /// //// HASHCC::TEST //// /// // // HASHCC::TEST::testHashMap( HASHCC::OBJ::Type::Dec10Elf ); // std::cout << std::endl << std::flush; // /// //// HASHCC::TEST //// /// // // HASHCC::TEST::testHashMap( HASHCC::OBJ::Type::Dec24Adler ); // std::cout << std::endl << std::flush; // /// //// HASHCC::TEST //// /// // HASHCC::TEST::testHashMap( HASHCC::OBJ::Type::Dec24Fnv ); std::cout << std::endl << std::flush; // /// //// HASHCC::TEST //// /// // // HASHCC::TEST::test( ); // std::cout << std::endl << std::flush; std::cout << "done" << std::endl << std::flush; } // HASHCC exception class catch( HASHCC::ERR::Exception& e ) { e.report( ); // break it down } // standard exception class catch( std::exception& e ) { std::cout << "std::exception caught:" << std::endl << std::flush; std::cout << e.what( ) << std::endl << std::flush; } // any other exception thrown catch( ... ) { std::cout << "Strange exception caught:" << std::endl << std::flush; } // try return 0; } // main /****************************************************************************/
<html> <head> <title>Table with four columns</title> </head> <body> <table> <tr> <th>Name</th> <th>Age</th> <th>City</th> <th>Country</th> </tr> <!-- Add rows here --> </table> </body> </html>
kubectl create -f gate/svcs kubectl create -f gate/rcs
# Resizes images to X, whose sizes is greater than X SIZE=512; magick mogrify -resize "$SIZE>x$SIZE>" -format png -verbose -path ../images$SIZE *.png
<reponame>dhval/dhval.github.io define(['./ajax-loader.module', 'ajax-loader'], function (module, ajaxLoader) { module.directive('ajaxLoader', function () { return { restrict: 'E', replace: true, scope: false, template: ajaxLoader.templates.ajaxLoader }; }); });
<gh_stars>1-10 // we just take the idea of difference array. Whole code is same, it's just that we do two updates here : // upd(l, val) // upd(r + 1, -val) #include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) #define ll long long int #define ld long double using namespace std; const int MOD = 1e9 + 7; const int N = 1e6 + 5; long long int n, fenwick[N]; void upd(int node, int val){ for(int i = node; i <= n; i += (i & -i)) fenwick[i] += val; } int query(int node){ long long int sum = 0; for(int i = node; i >= 1; i -= (i & -i)) sum += fenwick[i]; return sum; } void solve(){ memset(fenwick, 0, sizeof fenwick); int u; cin >> n >> u; while(u--){ int l, r, val; cin >> l >> r >> val; ++l, ++r; if(val == 0) continue; upd(l, val); upd(r + 1, -val); } int q; cin >> q; while(q--){ int pos; cin >> pos; ++pos; cout << query(pos) << '\n'; } } int main() { fast; int t = 1; cin >> t; while(t--) solve(); }
<reponame>RainPoetry/mybatis-3 package com.cc.mybatis.executor; /** * @author chenchong * @create 2021/2/5 8:23 下午 * @description Executor 的基础实现 * 封装了一层缓存在里面 * * * 模板方法 * * * Executor 解析的很透彻 * https://www.cnblogs.com/ZhuChangwu/p/11745562.html */ public class BaseExecutorDemo { }
#!/bin/bash source ../spec.sh source ./module_spec.sh # Let's get rid of ${DIR}/var/log/setup rm -r ${DIR}/var/log/setup rm ${DIR}/run/lock/pkgtools/ldconfig.lock rmdir ${DIR}/run/lock/pkgtools # Clean up dbus and grub if [ "${INCMOD010XORG}" != "Y" ]; then rm -f ${DIR}/usr/bin/dbus-launch rm -f ${DIR}/usr/bin/grub-mkfont fi # Clean up glibc if [ "${INCGD}" != "Y" ]; then rm ${DIR}/usr/bin/memusagestat fi # What other libraries from aaa_elflibs-*.txz can we remove? rm -f ${DIR}/usr/${LIBDIR}/libargon2* rm -f ${DIR}/usr/${LIBDIR}/libjson-c.* rm -f ${DIR}/usr/${LIBDIR}/libasound.* rm -f ${DIR}/usr/${LIBDIR}/libcurl.* rm -f ${DIR}/usr/${LIBDIR}/libdvdread.* rm -f ${DIR}/usr/${LIBDIR}/libexiv2.* rm -f ${DIR}/usr/${LIBDIR}/libraw.* rm -f ${DIR}/usr/${LIBDIR}/libraw_r.* rm -f ${DIR}/usr/${LIBDIR}/libtiff.* rm -f ${DIR}/usr/${LIBDIR}/libtiffxx.* # TEST 31 OCT 2020 rm -f ${DIR}/usr/${LIBDIR}/libicu* rm -f ${DIR}/usr/${LIBDIR}/libHalf.* rm -f ${DIR}/usr/${LIBDIR}/libIex-* rm -f ${DIR}/usr/${LIBDIR}/libIexMath-* rm -f ${DIR}/usr/${LIBDIR}/libIlmImf-* rm -f ${DIR}/usr/${LIBDIR}/libIlmImfUtil-* rm -f ${DIR}/usr/${LIBDIR}/libIlmThread-* rm -f ${DIR}/usr/${LIBDIR}/libImath-* rm -f ${DIR}/usr/${LIBDIR}/libpoppler* # TEST 31 OCT 2020 # TEST 16 NOV 2020 rm -f ${DIR}/usr/${LIBDIR}/libisl* # TEST 16 NOV 2020 # Unnecessary here, libidn2 is mandatory in 002-utils rm -f ${DIR}/usr/${LIBDIR}/libidn2.so.* # Not ready for this yet # rm -f ${DIR}/usr/${LIBDIR}/libidn.so.* # rm -f ${DIR}/usr/${LIBDIR}/{libcups,libcupsimage}.* # rm -f ${DIR}/usr/${LIBDIR}/{libjpeg,libturbojpeg,libpng14,libpng16}.* if [ -d ${DIR}/mnt/cdrecorder ]; then rmdir ${DIR}/mnt/cdrecorder; fi if [ -e ${DIR}/etc/rc.d/rc.S.orig ]; then rm ${DIR}/etc/rc.d/rc.S.orig; fi if [ -e ${DIR}/etc/rc.d/rc.M.orig ]; then rm ${DIR}/etc/rc.d/rc.M.orig; fi
#!/usr/bin/env bash # shellcheck disable=SC2181 # # Salt state for downloading, installing and configuring PBIS, # then joining # the instance to Active Directory # ################################################################# PBISPKG="${1:-UNDEF}" INSTPBISVERS="$(rpm --qf '%{version}\n' -qa pbis-open pbis-enterprise)" ISINSTALLED=$(echo "${PBISPKG}" | grep -- "-${INSTPBISVERS}.") if [[ "${INSTPBISVERS}" = "" ]] || [[ "${ISINSTALLED}" = "" ]] then bash "${PBISPKG}" -- --dont-join --legacy install > /dev/null 2>&1 if [[ $? -eq 0 ]] then # There's a slight delay between binaries' install and # availability/readiness of service-components. Setting # static-delay until something more dynamic proves necessary sleep 5 printf "\n" printf "changed=yes comment='Installed RPMs from %s.'\n" "${PBISPKG}" exit 0 else printf "\n" printf "changed=no comment='Installer %s did not run " "${PBISPKG}" printf "as expected.'\n" exit 1 fi else printf "\n" printf "changed=no comment='RPMs from %s already present.'\n" "${PBISPKG}" exit 0 fi
<reponame>renovate-bot/java-optimization /* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/optimization/v1/fleet_routing.proto package com.google.cloud.optimization.v1; /** * * * <pre> * A shipment model contains a set of shipments which must be performed by a * set of vehicles, while minimizing the overall cost, which is the sum of: * * the cost of routing the vehicles (sum of cost per total time, cost per * travel time, and fixed cost over all vehicles). * * the unperformed shipment penalties. * * the cost of the global duration of the shipments * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel} */ public final class ShipmentModel extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel) ShipmentModelOrBuilder { private static final long serialVersionUID = 0L; // Use ShipmentModel.newBuilder() to construct. private ShipmentModel(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ShipmentModel() { shipments_ = java.util.Collections.emptyList(); vehicles_ = java.util.Collections.emptyList(); durationDistanceMatrices_ = java.util.Collections.emptyList(); durationDistanceMatrixSrcTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; durationDistanceMatrixDstTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; transitionAttributes_ = java.util.Collections.emptyList(); shipmentTypeIncompatibilities_ = java.util.Collections.emptyList(); shipmentTypeRequirements_ = java.util.Collections.emptyList(); precedenceRules_ = java.util.Collections.emptyList(); breakRules_ = java.util.Collections.emptyList(); } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new ShipmentModel(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ShipmentModel( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { shipments_ = new java.util.ArrayList<com.google.cloud.optimization.v1.Shipment>(); mutable_bitField0_ |= 0x00000001; } shipments_.add( input.readMessage( com.google.cloud.optimization.v1.Shipment.parser(), extensionRegistry)); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) != 0)) { vehicles_ = new java.util.ArrayList<com.google.cloud.optimization.v1.Vehicle>(); mutable_bitField0_ |= 0x00000002; } vehicles_.add( input.readMessage( com.google.cloud.optimization.v1.Vehicle.parser(), extensionRegistry)); break; } case 32: { bitField0_ |= 0x00000001; maxActiveVehicles_ = input.readInt32(); break; } case 42: { com.google.protobuf.Timestamp.Builder subBuilder = null; if (globalStartTime_ != null) { subBuilder = globalStartTime_.toBuilder(); } globalStartTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(globalStartTime_); globalStartTime_ = subBuilder.buildPartial(); } break; } case 50: { com.google.protobuf.Timestamp.Builder subBuilder = null; if (globalEndTime_ != null) { subBuilder = globalEndTime_.toBuilder(); } globalEndTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(globalEndTime_); globalEndTime_ = subBuilder.buildPartial(); } break; } case 57: { globalDurationCostPerHour_ = input.readDouble(); break; } case 66: { if (!((mutable_bitField0_ & 0x00000008) != 0)) { durationDistanceMatrices_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix>(); mutable_bitField0_ |= 0x00000008; } durationDistanceMatrices_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .parser(), extensionRegistry)); break; } case 74: { java.lang.String s = input.readStringRequireUtf8(); if (!((mutable_bitField0_ & 0x00000010) != 0)) { durationDistanceMatrixSrcTags_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000010; } durationDistanceMatrixSrcTags_.add(s); break; } case 82: { java.lang.String s = input.readStringRequireUtf8(); if (!((mutable_bitField0_ & 0x00000020) != 0)) { durationDistanceMatrixDstTags_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000020; } durationDistanceMatrixDstTags_.add(s); break; } case 90: { if (!((mutable_bitField0_ & 0x00000040) != 0)) { transitionAttributes_ = new java.util.ArrayList< com.google.cloud.optimization.v1.TransitionAttributes>(); mutable_bitField0_ |= 0x00000040; } transitionAttributes_.add( input.readMessage( com.google.cloud.optimization.v1.TransitionAttributes.parser(), extensionRegistry)); break; } case 98: { if (!((mutable_bitField0_ & 0x00000080) != 0)) { shipmentTypeIncompatibilities_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentTypeIncompatibility>(); mutable_bitField0_ |= 0x00000080; } shipmentTypeIncompatibilities_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.parser(), extensionRegistry)); break; } case 106: { if (!((mutable_bitField0_ & 0x00000100) != 0)) { shipmentTypeRequirements_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentTypeRequirement>(); mutable_bitField0_ |= 0x00000100; } shipmentTypeRequirements_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentTypeRequirement.parser(), extensionRegistry)); break; } case 114: { if (!((mutable_bitField0_ & 0x00000200) != 0)) { precedenceRules_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule>(); mutable_bitField0_ |= 0x00000200; } precedenceRules_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.parser(), extensionRegistry)); break; } case 122: { if (!((mutable_bitField0_ & 0x00000400) != 0)) { breakRules_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.BreakRule>(); mutable_bitField0_ |= 0x00000400; } breakRules_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.parser(), extensionRegistry)); break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) != 0)) { shipments_ = java.util.Collections.unmodifiableList(shipments_); } if (((mutable_bitField0_ & 0x00000002) != 0)) { vehicles_ = java.util.Collections.unmodifiableList(vehicles_); } if (((mutable_bitField0_ & 0x00000008) != 0)) { durationDistanceMatrices_ = java.util.Collections.unmodifiableList(durationDistanceMatrices_); } if (((mutable_bitField0_ & 0x00000010) != 0)) { durationDistanceMatrixSrcTags_ = durationDistanceMatrixSrcTags_.getUnmodifiableView(); } if (((mutable_bitField0_ & 0x00000020) != 0)) { durationDistanceMatrixDstTags_ = durationDistanceMatrixDstTags_.getUnmodifiableView(); } if (((mutable_bitField0_ & 0x00000040) != 0)) { transitionAttributes_ = java.util.Collections.unmodifiableList(transitionAttributes_); } if (((mutable_bitField0_ & 0x00000080) != 0)) { shipmentTypeIncompatibilities_ = java.util.Collections.unmodifiableList(shipmentTypeIncompatibilities_); } if (((mutable_bitField0_ & 0x00000100) != 0)) { shipmentTypeRequirements_ = java.util.Collections.unmodifiableList(shipmentTypeRequirements_); } if (((mutable_bitField0_ & 0x00000200) != 0)) { precedenceRules_ = java.util.Collections.unmodifiableList(precedenceRules_); } if (((mutable_bitField0_ & 0x00000400) != 0)) { breakRules_ = java.util.Collections.unmodifiableList(breakRules_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.class, com.google.cloud.optimization.v1.ShipmentModel.Builder.class); } public interface DurationDistanceMatrixOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ java.util.List<com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row> getRowsList(); /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row getRows(int index); /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ int getRowsCount(); /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder> getRowsOrBuilderList(); /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder getRowsOrBuilder(int index); /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return The vehicleStartTag. */ java.lang.String getVehicleStartTag(); /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return The bytes for vehicleStartTag. */ com.google.protobuf.ByteString getVehicleStartTagBytes(); } /** * * * <pre> * Specifies a duration and distance matrix from visit and vehicle start * locations to visit and vehicle end locations. * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix} */ public static final class DurationDistanceMatrix extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) DurationDistanceMatrixOrBuilder { private static final long serialVersionUID = 0L; // Use DurationDistanceMatrix.newBuilder() to construct. private DurationDistanceMatrix(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private DurationDistanceMatrix() { rows_ = java.util.Collections.emptyList(); vehicleStartTag_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new DurationDistanceMatrix(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private DurationDistanceMatrix( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { rows_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .Row>(); mutable_bitField0_ |= 0x00000001; } rows_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row .parser(), extensionRegistry)); break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); vehicleStartTag_ = s; break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) != 0)) { rows_ = java.util.Collections.unmodifiableList(rows_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.class, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder.class); } public interface RowOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ java.util.List<com.google.protobuf.Duration> getDurationsList(); /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ com.google.protobuf.Duration getDurations(int index); /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ int getDurationsCount(); /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ java.util.List<? extends com.google.protobuf.DurationOrBuilder> getDurationsOrBuilderList(); /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ com.google.protobuf.DurationOrBuilder getDurationsOrBuilder(int index); /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return A list containing the meters. */ java.util.List<java.lang.Double> getMetersList(); /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return The count of meters. */ int getMetersCount(); /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @param index The index of the element to return. * @return The meters at the given index. */ double getMeters(int index); } /** * * * <pre> * Specifies a row of the duration and distance matrix. * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row} */ public static final class Row extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) RowOrBuilder { private static final long serialVersionUID = 0L; // Use Row.newBuilder() to construct. private Row(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Row() { durations_ = java.util.Collections.emptyList(); meters_ = emptyDoubleList(); } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Row(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Row( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { durations_ = new java.util.ArrayList<com.google.protobuf.Duration>(); mutable_bitField0_ |= 0x00000001; } durations_.add( input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry)); break; } case 17: { if (!((mutable_bitField0_ & 0x00000002) != 0)) { meters_ = newDoubleList(); mutable_bitField0_ |= 0x00000002; } meters_.addDouble(input.readDouble()); break; } case 18: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000002) != 0) && input.getBytesUntilLimit() > 0) { meters_ = newDoubleList(); mutable_bitField0_ |= 0x00000002; } while (input.getBytesUntilLimit() > 0) { meters_.addDouble(input.readDouble()); } input.popLimit(limit); break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) != 0)) { durations_ = java.util.Collections.unmodifiableList(durations_); } if (((mutable_bitField0_ & 0x00000002) != 0)) { meters_.makeImmutable(); // C } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_Row_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_Row_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.class, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder .class); } public static final int DURATIONS_FIELD_NUMBER = 1; private java.util.List<com.google.protobuf.Duration> durations_; /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ @java.lang.Override public java.util.List<com.google.protobuf.Duration> getDurationsList() { return durations_; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ @java.lang.Override public java.util.List<? extends com.google.protobuf.DurationOrBuilder> getDurationsOrBuilderList() { return durations_; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ @java.lang.Override public int getDurationsCount() { return durations_.size(); } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ @java.lang.Override public com.google.protobuf.Duration getDurations(int index) { return durations_.get(index); } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getDurationsOrBuilder(int index) { return durations_.get(index); } public static final int METERS_FIELD_NUMBER = 2; private com.google.protobuf.Internal.DoubleList meters_; /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return A list containing the meters. */ @java.lang.Override public java.util.List<java.lang.Double> getMetersList() { return meters_; } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return The count of meters. */ public int getMetersCount() { return meters_.size(); } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @param index The index of the element to return. * @return The meters at the given index. */ public double getMeters(int index) { return meters_.getDouble(index); } private int metersMemoizedSerializedSize = -1; private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < durations_.size(); i++) { output.writeMessage(1, durations_.get(i)); } if (getMetersList().size() > 0) { output.writeUInt32NoTag(18); output.writeUInt32NoTag(metersMemoizedSerializedSize); } for (int i = 0; i < meters_.size(); i++) { output.writeDoubleNoTag(meters_.getDouble(i)); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < durations_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, durations_.get(i)); } { int dataSize = 0; dataSize = 8 * getMetersList().size(); size += dataSize; if (!getMetersList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); } metersMemoizedSerializedSize = dataSize; } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row other = (com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) obj; if (!getDurationsList().equals(other.getDurationsList())) return false; if (!getMetersList().equals(other.getMetersList())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getDurationsCount() > 0) { hash = (37 * hash) + DURATIONS_FIELD_NUMBER; hash = (53 * hash) + getDurationsList().hashCode(); } if (getMetersCount() > 0) { hash = (37 * hash) + METERS_FIELD_NUMBER; hash = (53 * hash) + getMetersList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Specifies a row of the duration and distance matrix. * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_Row_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_Row_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.class, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder .class); } // Construct using // com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getDurationsFieldBuilder(); } } @java.lang.Override public Builder clear() { super.clear(); if (durationsBuilder_ == null) { durations_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { durationsBuilder_.clear(); } meters_ = emptyDoubleList(); bitField0_ = (bitField0_ & ~0x00000002); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_Row_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row .getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row build() { com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row buildPartial() { com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row result = new com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row(this); int from_bitField0_ = bitField0_; if (durationsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { durations_ = java.util.Collections.unmodifiableList(durations_); bitField0_ = (bitField0_ & ~0x00000001); } result.durations_ = durations_; } else { result.durations_ = durationsBuilder_.build(); } if (((bitField0_ & 0x00000002) != 0)) { meters_.makeImmutable(); bitField0_ = (bitField0_ & ~0x00000002); } result.meters_ = meters_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) { return mergeFrom( (com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row .getDefaultInstance()) return this; if (durationsBuilder_ == null) { if (!other.durations_.isEmpty()) { if (durations_.isEmpty()) { durations_ = other.durations_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureDurationsIsMutable(); durations_.addAll(other.durations_); } onChanged(); } } else { if (!other.durations_.isEmpty()) { if (durationsBuilder_.isEmpty()) { durationsBuilder_.dispose(); durationsBuilder_ = null; durations_ = other.durations_; bitField0_ = (bitField0_ & ~0x00000001); durationsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getDurationsFieldBuilder() : null; } else { durationsBuilder_.addAllMessages(other.durations_); } } } if (!other.meters_.isEmpty()) { if (meters_.isEmpty()) { meters_ = other.meters_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureMetersIsMutable(); meters_.addAll(other.meters_); } onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List<com.google.protobuf.Duration> durations_ = java.util.Collections.emptyList(); private void ensureDurationsIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { durations_ = new java.util.ArrayList<com.google.protobuf.Duration>(durations_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> durationsBuilder_; /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public java.util.List<com.google.protobuf.Duration> getDurationsList() { if (durationsBuilder_ == null) { return java.util.Collections.unmodifiableList(durations_); } else { return durationsBuilder_.getMessageList(); } } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public int getDurationsCount() { if (durationsBuilder_ == null) { return durations_.size(); } else { return durationsBuilder_.getCount(); } } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public com.google.protobuf.Duration getDurations(int index) { if (durationsBuilder_ == null) { return durations_.get(index); } else { return durationsBuilder_.getMessage(index); } } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder setDurations(int index, com.google.protobuf.Duration value) { if (durationsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDurationsIsMutable(); durations_.set(index, value); onChanged(); } else { durationsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder setDurations( int index, com.google.protobuf.Duration.Builder builderForValue) { if (durationsBuilder_ == null) { ensureDurationsIsMutable(); durations_.set(index, builderForValue.build()); onChanged(); } else { durationsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder addDurations(com.google.protobuf.Duration value) { if (durationsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDurationsIsMutable(); durations_.add(value); onChanged(); } else { durationsBuilder_.addMessage(value); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder addDurations(int index, com.google.protobuf.Duration value) { if (durationsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDurationsIsMutable(); durations_.add(index, value); onChanged(); } else { durationsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder addDurations(com.google.protobuf.Duration.Builder builderForValue) { if (durationsBuilder_ == null) { ensureDurationsIsMutable(); durations_.add(builderForValue.build()); onChanged(); } else { durationsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder addDurations( int index, com.google.protobuf.Duration.Builder builderForValue) { if (durationsBuilder_ == null) { ensureDurationsIsMutable(); durations_.add(index, builderForValue.build()); onChanged(); } else { durationsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder addAllDurations( java.lang.Iterable<? extends com.google.protobuf.Duration> values) { if (durationsBuilder_ == null) { ensureDurationsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, durations_); onChanged(); } else { durationsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder clearDurations() { if (durationsBuilder_ == null) { durations_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { durationsBuilder_.clear(); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public Builder removeDurations(int index) { if (durationsBuilder_ == null) { ensureDurationsIsMutable(); durations_.remove(index); onChanged(); } else { durationsBuilder_.remove(index); } return this; } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public com.google.protobuf.Duration.Builder getDurationsBuilder(int index) { return getDurationsFieldBuilder().getBuilder(index); } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public com.google.protobuf.DurationOrBuilder getDurationsOrBuilder(int index) { if (durationsBuilder_ == null) { return durations_.get(index); } else { return durationsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public java.util.List<? extends com.google.protobuf.DurationOrBuilder> getDurationsOrBuilderList() { if (durationsBuilder_ != null) { return durationsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(durations_); } } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public com.google.protobuf.Duration.Builder addDurationsBuilder() { return getDurationsFieldBuilder() .addBuilder(com.google.protobuf.Duration.getDefaultInstance()); } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public com.google.protobuf.Duration.Builder addDurationsBuilder(int index) { return getDurationsFieldBuilder() .addBuilder(index, com.google.protobuf.Duration.getDefaultInstance()); } /** * * * <pre> * Duration values for a given row. It must have as many elements as * [ShipmentModel.duration_distance_matrix_dst_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_dst_tags]. * </pre> * * <code>repeated .google.protobuf.Duration durations = 1;</code> */ public java.util.List<com.google.protobuf.Duration.Builder> getDurationsBuilderList() { return getDurationsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> getDurationsFieldBuilder() { if (durationsBuilder_ == null) { durationsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( durations_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); durations_ = null; } return durationsBuilder_; } private com.google.protobuf.Internal.DoubleList meters_ = emptyDoubleList(); private void ensureMetersIsMutable() { if (!((bitField0_ & 0x00000002) != 0)) { meters_ = mutableCopy(meters_); bitField0_ |= 0x00000002; } } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return A list containing the meters. */ public java.util.List<java.lang.Double> getMetersList() { return ((bitField0_ & 0x00000002) != 0) ? java.util.Collections.unmodifiableList(meters_) : meters_; } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return The count of meters. */ public int getMetersCount() { return meters_.size(); } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @param index The index of the element to return. * @return The meters at the given index. */ public double getMeters(int index) { return meters_.getDouble(index); } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @param index The index to set the value at. * @param value The meters to set. * @return This builder for chaining. */ public Builder setMeters(int index, double value) { ensureMetersIsMutable(); meters_.setDouble(index, value); onChanged(); return this; } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @param value The meters to add. * @return This builder for chaining. */ public Builder addMeters(double value) { ensureMetersIsMutable(); meters_.addDouble(value); onChanged(); return this; } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @param values The meters to add. * @return This builder for chaining. */ public Builder addAllMeters(java.lang.Iterable<? extends java.lang.Double> values) { ensureMetersIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, meters_); onChanged(); return this; } /** * * * <pre> * Distance values for a given row. If no costs or constraints refer to * distances in the model, this can be left empty; otherwise it must have * as many elements as `durations`. * </pre> * * <code>repeated double meters = 2;</code> * * @return This builder for chaining. */ public Builder clearMeters() { meters_ = emptyDoubleList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row) private static final com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row(); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Row> PARSER = new com.google.protobuf.AbstractParser<Row>() { @java.lang.Override public Row parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Row(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Row> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Row> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public static final int ROWS_FIELD_NUMBER = 1; private java.util.List< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row> rows_; /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row> getRowsList() { return rows_; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder> getRowsOrBuilderList() { return rows_; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ @java.lang.Override public int getRowsCount() { return rows_.size(); } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row getRows( int index) { return rows_.get(index); } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder getRowsOrBuilder(int index) { return rows_.get(index); } public static final int VEHICLE_START_TAG_FIELD_NUMBER = 2; private volatile java.lang.Object vehicleStartTag_; /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return The vehicleStartTag. */ @java.lang.Override public java.lang.String getVehicleStartTag() { java.lang.Object ref = vehicleStartTag_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); vehicleStartTag_ = s; return s; } } /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return The bytes for vehicleStartTag. */ @java.lang.Override public com.google.protobuf.ByteString getVehicleStartTagBytes() { java.lang.Object ref = vehicleStartTag_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); vehicleStartTag_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < rows_.size(); i++) { output.writeMessage(1, rows_.get(i)); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(vehicleStartTag_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, vehicleStartTag_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < rows_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, rows_.get(i)); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(vehicleStartTag_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, vehicleStartTag_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix other = (com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) obj; if (!getRowsList().equals(other.getRowsList())) return false; if (!getVehicleStartTag().equals(other.getVehicleStartTag())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getRowsCount() > 0) { hash = (37 * hash) + ROWS_FIELD_NUMBER; hash = (53 * hash) + getRowsList().hashCode(); } hash = (37 * hash) + VEHICLE_START_TAG_FIELD_NUMBER; hash = (53 * hash) + getVehicleStartTag().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Specifies a duration and distance matrix from visit and vehicle start * locations to visit and vehicle end locations. * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.class, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder .class); } // Construct using // com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getRowsFieldBuilder(); } } @java.lang.Override public Builder clear() { super.clear(); if (rowsBuilder_ == null) { rows_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { rowsBuilder_.clear(); } vehicleStartTag_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_DurationDistanceMatrix_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix build() { com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix buildPartial() { com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix result = new com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix(this); int from_bitField0_ = bitField0_; if (rowsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { rows_ = java.util.Collections.unmodifiableList(rows_); bitField0_ = (bitField0_ & ~0x00000001); } result.rows_ = rows_; } else { result.rows_ = rowsBuilder_.build(); } result.vehicleStartTag_ = vehicleStartTag_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) { return mergeFrom( (com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .getDefaultInstance()) return this; if (rowsBuilder_ == null) { if (!other.rows_.isEmpty()) { if (rows_.isEmpty()) { rows_ = other.rows_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureRowsIsMutable(); rows_.addAll(other.rows_); } onChanged(); } } else { if (!other.rows_.isEmpty()) { if (rowsBuilder_.isEmpty()) { rowsBuilder_.dispose(); rowsBuilder_ = null; rows_ = other.rows_; bitField0_ = (bitField0_ & ~0x00000001); rowsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getRowsFieldBuilder() : null; } else { rowsBuilder_.addAllMessages(other.rows_); } } } if (!other.getVehicleStartTag().isEmpty()) { vehicleStartTag_ = other.vehicleStartTag_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row> rows_ = java.util.Collections.emptyList(); private void ensureRowsIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { rows_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row>(rows_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder> rowsBuilder_; /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row> getRowsList() { if (rowsBuilder_ == null) { return java.util.Collections.unmodifiableList(rows_); } else { return rowsBuilder_.getMessageList(); } } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public int getRowsCount() { if (rowsBuilder_ == null) { return rows_.size(); } else { return rowsBuilder_.getCount(); } } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row getRows( int index) { if (rowsBuilder_ == null) { return rows_.get(index); } else { return rowsBuilder_.getMessage(index); } } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder setRows( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row value) { if (rowsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureRowsIsMutable(); rows_.set(index, value); onChanged(); } else { rowsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder setRows( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder builderForValue) { if (rowsBuilder_ == null) { ensureRowsIsMutable(); rows_.set(index, builderForValue.build()); onChanged(); } else { rowsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder addRows( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row value) { if (rowsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureRowsIsMutable(); rows_.add(value); onChanged(); } else { rowsBuilder_.addMessage(value); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder addRows( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row value) { if (rowsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureRowsIsMutable(); rows_.add(index, value); onChanged(); } else { rowsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder addRows( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder builderForValue) { if (rowsBuilder_ == null) { ensureRowsIsMutable(); rows_.add(builderForValue.build()); onChanged(); } else { rowsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder addRows( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder builderForValue) { if (rowsBuilder_ == null) { ensureRowsIsMutable(); rows_.add(index, builderForValue.build()); onChanged(); } else { rowsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder addAllRows( java.lang.Iterable< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row> values) { if (rowsBuilder_ == null) { ensureRowsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, rows_); onChanged(); } else { rowsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder clearRows() { if (rowsBuilder_ == null) { rows_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { rowsBuilder_.clear(); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public Builder removeRows(int index) { if (rowsBuilder_ == null) { ensureRowsIsMutable(); rows_.remove(index); onChanged(); } else { rowsBuilder_.remove(index); } return this; } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder getRowsBuilder(int index) { return getRowsFieldBuilder().getBuilder(index); } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder getRowsOrBuilder(int index) { if (rowsBuilder_ == null) { return rows_.get(index); } else { return rowsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .RowOrBuilder> getRowsOrBuilderList() { if (rowsBuilder_ != null) { return rowsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(rows_); } } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder addRowsBuilder() { return getRowsFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row .getDefaultInstance()); } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder addRowsBuilder(int index) { return getRowsFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row .getDefaultInstance()); } /** * * * <pre> * Specifies the rows of the duration and distance matrix. It must have as * many elements as [ShipmentModel.duration_distance_matrix_src_tags][google.cloud.optimization.v1.ShipmentModel.duration_distance_matrix_src_tags]. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row rows = 1; * </code> */ public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder> getRowsBuilderList() { return getRowsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.RowOrBuilder> getRowsFieldBuilder() { if (rowsBuilder_ == null) { rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Row.Builder, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .RowOrBuilder>( rows_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); rows_ = null; } return rowsBuilder_; } private java.lang.Object vehicleStartTag_ = ""; /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return The vehicleStartTag. */ public java.lang.String getVehicleStartTag() { java.lang.Object ref = vehicleStartTag_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); vehicleStartTag_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return The bytes for vehicleStartTag. */ public com.google.protobuf.ByteString getVehicleStartTagBytes() { java.lang.Object ref = vehicleStartTag_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); vehicleStartTag_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @param value The vehicleStartTag to set. * @return This builder for chaining. */ public Builder setVehicleStartTag(java.lang.String value) { if (value == null) { throw new NullPointerException(); } vehicleStartTag_ = value; onChanged(); return this; } /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @return This builder for chaining. */ public Builder clearVehicleStartTag() { vehicleStartTag_ = getDefaultInstance().getVehicleStartTag(); onChanged(); return this; } /** * * * <pre> * Tag defining to which vehicles this duration and distance matrix applies. * If empty, this applies to all vehicles, and there can only be a single * matrix. * Each vehicle start must match exactly one matrix, i.e. exactly one of * their `start_tags` field must match the `vehicle_start_tag` of a matrix * (and of that matrix only). * All matrices must have a different `vehicle_start_tag`. * </pre> * * <code>string vehicle_start_tag = 2;</code> * * @param value The bytes for vehicleStartTag to set. * @return This builder for chaining. */ public Builder setVehicleStartTagBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); vehicleStartTag_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix) private static final com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix(); } public static com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<DurationDistanceMatrix> PARSER = new com.google.protobuf.AbstractParser<DurationDistanceMatrix>() { @java.lang.Override public DurationDistanceMatrix parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new DurationDistanceMatrix(input, extensionRegistry); } }; public static com.google.protobuf.Parser<DurationDistanceMatrix> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<DurationDistanceMatrix> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface PrecedenceRuleOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return Whether the firstIndex field is set. */ boolean hasFirstIndex(); /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return The firstIndex. */ int getFirstIndex(); /** * * * <pre> * Indicates if the "first" event is a delivery. * </pre> * * <code>bool first_is_delivery = 3;</code> * * @return The firstIsDelivery. */ boolean getFirstIsDelivery(); /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return Whether the secondIndex field is set. */ boolean hasSecondIndex(); /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return The secondIndex. */ int getSecondIndex(); /** * * * <pre> * Indicates if the "second" event is a delivery. * </pre> * * <code>bool second_is_delivery = 4;</code> * * @return The secondIsDelivery. */ boolean getSecondIsDelivery(); /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> * * @return Whether the offsetDuration field is set. */ boolean hasOffsetDuration(); /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> * * @return The offsetDuration. */ com.google.protobuf.Duration getOffsetDuration(); /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ com.google.protobuf.DurationOrBuilder getOffsetDurationOrBuilder(); } /** * * * <pre> * 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. * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.PrecedenceRule} */ public static final class PrecedenceRule extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) PrecedenceRuleOrBuilder { private static final long serialVersionUID = 0L; // Use PrecedenceRule.newBuilder() to construct. private PrecedenceRule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private PrecedenceRule() {} @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new PrecedenceRule(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PrecedenceRule( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 8: { bitField0_ |= 0x00000001; firstIndex_ = input.readInt32(); break; } case 16: { bitField0_ |= 0x00000002; secondIndex_ = input.readInt32(); break; } case 24: { firstIsDelivery_ = input.readBool(); break; } case 32: { secondIsDelivery_ = input.readBool(); break; } case 42: { com.google.protobuf.Duration.Builder subBuilder = null; if (offsetDuration_ != null) { subBuilder = offsetDuration_.toBuilder(); } offsetDuration_ = input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(offsetDuration_); offsetDuration_ = subBuilder.buildPartial(); } break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_PrecedenceRule_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_PrecedenceRule_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.class, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder.class); } private int bitField0_; public static final int FIRST_INDEX_FIELD_NUMBER = 1; private int firstIndex_; /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return Whether the firstIndex field is set. */ @java.lang.Override public boolean hasFirstIndex() { return ((bitField0_ & 0x00000001) != 0); } /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return The firstIndex. */ @java.lang.Override public int getFirstIndex() { return firstIndex_; } public static final int FIRST_IS_DELIVERY_FIELD_NUMBER = 3; private boolean firstIsDelivery_; /** * * * <pre> * Indicates if the "first" event is a delivery. * </pre> * * <code>bool first_is_delivery = 3;</code> * * @return The firstIsDelivery. */ @java.lang.Override public boolean getFirstIsDelivery() { return firstIsDelivery_; } public static final int SECOND_INDEX_FIELD_NUMBER = 2; private int secondIndex_; /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return Whether the secondIndex field is set. */ @java.lang.Override public boolean hasSecondIndex() { return ((bitField0_ & 0x00000002) != 0); } /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return The secondIndex. */ @java.lang.Override public int getSecondIndex() { return secondIndex_; } public static final int SECOND_IS_DELIVERY_FIELD_NUMBER = 4; private boolean secondIsDelivery_; /** * * * <pre> * Indicates if the "second" event is a delivery. * </pre> * * <code>bool second_is_delivery = 4;</code> * * @return The secondIsDelivery. */ @java.lang.Override public boolean getSecondIsDelivery() { return secondIsDelivery_; } public static final int OFFSET_DURATION_FIELD_NUMBER = 5; private com.google.protobuf.Duration offsetDuration_; /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> * * @return Whether the offsetDuration field is set. */ @java.lang.Override public boolean hasOffsetDuration() { return offsetDuration_ != null; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> * * @return The offsetDuration. */ @java.lang.Override public com.google.protobuf.Duration getOffsetDuration() { return offsetDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : offsetDuration_; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getOffsetDurationOrBuilder() { return getOffsetDuration(); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { output.writeInt32(1, firstIndex_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt32(2, secondIndex_); } if (firstIsDelivery_ != false) { output.writeBool(3, firstIsDelivery_); } if (secondIsDelivery_ != false) { output.writeBool(4, secondIsDelivery_); } if (offsetDuration_ != null) { output.writeMessage(5, getOffsetDuration()); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, firstIndex_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, secondIndex_); } if (firstIsDelivery_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, firstIsDelivery_); } if (secondIsDelivery_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, secondIsDelivery_); } if (offsetDuration_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getOffsetDuration()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule other = (com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) obj; if (hasFirstIndex() != other.hasFirstIndex()) return false; if (hasFirstIndex()) { if (getFirstIndex() != other.getFirstIndex()) return false; } if (getFirstIsDelivery() != other.getFirstIsDelivery()) return false; if (hasSecondIndex() != other.hasSecondIndex()) return false; if (hasSecondIndex()) { if (getSecondIndex() != other.getSecondIndex()) return false; } if (getSecondIsDelivery() != other.getSecondIsDelivery()) return false; if (hasOffsetDuration() != other.hasOffsetDuration()) return false; if (hasOffsetDuration()) { if (!getOffsetDuration().equals(other.getOffsetDuration())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasFirstIndex()) { hash = (37 * hash) + FIRST_INDEX_FIELD_NUMBER; hash = (53 * hash) + getFirstIndex(); } hash = (37 * hash) + FIRST_IS_DELIVERY_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getFirstIsDelivery()); if (hasSecondIndex()) { hash = (37 * hash) + SECOND_INDEX_FIELD_NUMBER; hash = (53 * hash) + getSecondIndex(); } hash = (37 * hash) + SECOND_IS_DELIVERY_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getSecondIsDelivery()); if (hasOffsetDuration()) { hash = (37 * hash) + OFFSET_DURATION_FIELD_NUMBER; hash = (53 * hash) + getOffsetDuration().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * 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. * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.PrecedenceRule} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_PrecedenceRule_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_PrecedenceRule_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.class, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder.class); } // Construct using com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); firstIndex_ = 0; bitField0_ = (bitField0_ & ~0x00000001); firstIsDelivery_ = false; secondIndex_ = 0; bitField0_ = (bitField0_ & ~0x00000002); secondIsDelivery_ = false; if (offsetDurationBuilder_ == null) { offsetDuration_ = null; } else { offsetDuration_ = null; offsetDurationBuilder_ = null; } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_PrecedenceRule_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule build() { com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule buildPartial() { com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule result = new com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { result.firstIndex_ = firstIndex_; to_bitField0_ |= 0x00000001; } result.firstIsDelivery_ = firstIsDelivery_; if (((from_bitField0_ & 0x00000002) != 0)) { result.secondIndex_ = secondIndex_; to_bitField0_ |= 0x00000002; } result.secondIsDelivery_ = secondIsDelivery_; if (offsetDurationBuilder_ == null) { result.offsetDuration_ = offsetDuration_; } else { result.offsetDuration_ = offsetDurationBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) { return mergeFrom((com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.getDefaultInstance()) return this; if (other.hasFirstIndex()) { setFirstIndex(other.getFirstIndex()); } if (other.getFirstIsDelivery() != false) { setFirstIsDelivery(other.getFirstIsDelivery()); } if (other.hasSecondIndex()) { setSecondIndex(other.getSecondIndex()); } if (other.getSecondIsDelivery() != false) { setSecondIsDelivery(other.getSecondIsDelivery()); } if (other.hasOffsetDuration()) { mergeOffsetDuration(other.getOffsetDuration()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private int firstIndex_; /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return Whether the firstIndex field is set. */ @java.lang.Override public boolean hasFirstIndex() { return ((bitField0_ & 0x00000001) != 0); } /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return The firstIndex. */ @java.lang.Override public int getFirstIndex() { return firstIndex_; } /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @param value The firstIndex to set. * @return This builder for chaining. */ public Builder setFirstIndex(int value) { bitField0_ |= 0x00000001; firstIndex_ = value; onChanged(); return this; } /** * * * <pre> * Shipment index of the "first" event. This field must be specified. * </pre> * * <code>optional int32 first_index = 1;</code> * * @return This builder for chaining. */ public Builder clearFirstIndex() { bitField0_ = (bitField0_ & ~0x00000001); firstIndex_ = 0; onChanged(); return this; } private boolean firstIsDelivery_; /** * * * <pre> * Indicates if the "first" event is a delivery. * </pre> * * <code>bool first_is_delivery = 3;</code> * * @return The firstIsDelivery. */ @java.lang.Override public boolean getFirstIsDelivery() { return firstIsDelivery_; } /** * * * <pre> * Indicates if the "first" event is a delivery. * </pre> * * <code>bool first_is_delivery = 3;</code> * * @param value The firstIsDelivery to set. * @return This builder for chaining. */ public Builder setFirstIsDelivery(boolean value) { firstIsDelivery_ = value; onChanged(); return this; } /** * * * <pre> * Indicates if the "first" event is a delivery. * </pre> * * <code>bool first_is_delivery = 3;</code> * * @return This builder for chaining. */ public Builder clearFirstIsDelivery() { firstIsDelivery_ = false; onChanged(); return this; } private int secondIndex_; /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return Whether the secondIndex field is set. */ @java.lang.Override public boolean hasSecondIndex() { return ((bitField0_ & 0x00000002) != 0); } /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return The secondIndex. */ @java.lang.Override public int getSecondIndex() { return secondIndex_; } /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @param value The secondIndex to set. * @return This builder for chaining. */ public Builder setSecondIndex(int value) { bitField0_ |= 0x00000002; secondIndex_ = value; onChanged(); return this; } /** * * * <pre> * Shipment index of the "second" event. This field must be specified. * </pre> * * <code>optional int32 second_index = 2;</code> * * @return This builder for chaining. */ public Builder clearSecondIndex() { bitField0_ = (bitField0_ & ~0x00000002); secondIndex_ = 0; onChanged(); return this; } private boolean secondIsDelivery_; /** * * * <pre> * Indicates if the "second" event is a delivery. * </pre> * * <code>bool second_is_delivery = 4;</code> * * @return The secondIsDelivery. */ @java.lang.Override public boolean getSecondIsDelivery() { return secondIsDelivery_; } /** * * * <pre> * Indicates if the "second" event is a delivery. * </pre> * * <code>bool second_is_delivery = 4;</code> * * @param value The secondIsDelivery to set. * @return This builder for chaining. */ public Builder setSecondIsDelivery(boolean value) { secondIsDelivery_ = value; onChanged(); return this; } /** * * * <pre> * Indicates if the "second" event is a delivery. * </pre> * * <code>bool second_is_delivery = 4;</code> * * @return This builder for chaining. */ public Builder clearSecondIsDelivery() { secondIsDelivery_ = false; onChanged(); return this; } private com.google.protobuf.Duration offsetDuration_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> offsetDurationBuilder_; /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> * * @return Whether the offsetDuration field is set. */ public boolean hasOffsetDuration() { return offsetDurationBuilder_ != null || offsetDuration_ != null; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> * * @return The offsetDuration. */ public com.google.protobuf.Duration getOffsetDuration() { if (offsetDurationBuilder_ == null) { return offsetDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : offsetDuration_; } else { return offsetDurationBuilder_.getMessage(); } } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ public Builder setOffsetDuration(com.google.protobuf.Duration value) { if (offsetDurationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } offsetDuration_ = value; onChanged(); } else { offsetDurationBuilder_.setMessage(value); } return this; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ public Builder setOffsetDuration(com.google.protobuf.Duration.Builder builderForValue) { if (offsetDurationBuilder_ == null) { offsetDuration_ = builderForValue.build(); onChanged(); } else { offsetDurationBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ public Builder mergeOffsetDuration(com.google.protobuf.Duration value) { if (offsetDurationBuilder_ == null) { if (offsetDuration_ != null) { offsetDuration_ = com.google.protobuf.Duration.newBuilder(offsetDuration_) .mergeFrom(value) .buildPartial(); } else { offsetDuration_ = value; } onChanged(); } else { offsetDurationBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ public Builder clearOffsetDuration() { if (offsetDurationBuilder_ == null) { offsetDuration_ = null; onChanged(); } else { offsetDuration_ = null; offsetDurationBuilder_ = null; } return this; } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ public com.google.protobuf.Duration.Builder getOffsetDurationBuilder() { onChanged(); return getOffsetDurationFieldBuilder().getBuilder(); } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ public com.google.protobuf.DurationOrBuilder getOffsetDurationOrBuilder() { if (offsetDurationBuilder_ != null) { return offsetDurationBuilder_.getMessageOrBuilder(); } else { return offsetDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : offsetDuration_; } } /** * * * <pre> * The offset between the "first" and "second" event. It can be negative. * </pre> * * <code>.google.protobuf.Duration offset_duration = 5;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> getOffsetDurationFieldBuilder() { if (offsetDurationBuilder_ == null) { offsetDurationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( getOffsetDuration(), getParentForChildren(), isClean()); offsetDuration_ = null; } return offsetDurationBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel.PrecedenceRule) private static final com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule(); } public static com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<PrecedenceRule> PARSER = new com.google.protobuf.AbstractParser<PrecedenceRule>() { @java.lang.Override public PrecedenceRule parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PrecedenceRule(input, extensionRegistry); } }; public static com.google.protobuf.Parser<PrecedenceRule> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<PrecedenceRule> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } @java.lang.Deprecated public interface BreakRuleOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.optimization.v1.ShipmentModel.BreakRule) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest> getBreakRequestsList(); /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest getBreakRequests( int index); /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ int getBreakRequestsCount(); /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder> getBreakRequestsOrBuilderList(); /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder getBreakRequestsOrBuilder(int index); /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint> getFrequencyConstraintsList(); /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint getFrequencyConstraints(int index); /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ int getFrequencyConstraintsCount(); /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule .FrequencyConstraintOrBuilder> getFrequencyConstraintsOrBuilderList(); /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraintOrBuilder getFrequencyConstraintsOrBuilder(int index); } /** * * * <pre> * Deprecated: Use top level [BreakRule][] instead. * Rules to generate time breaks for a vehicle (e.g. lunch * breaks). A break is a contiguous period of time during which the vehicle * remains idle at its current position and cannot perform any visit. A break * may occur: * * during the travel between two visits (which includes the time right * before or right after a visit, but not in the middle of a visit), in * which case it extends the corresponding transit time between the visits, * * or before the vehicle start (the vehicle may not start in the middle of * a break), in which case it does not affect the vehicle start time. * * or after the vehicle end (ditto, with the vehicle end time). * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.BreakRule} */ @java.lang.Deprecated public static final class BreakRule extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel.BreakRule) BreakRuleOrBuilder { private static final long serialVersionUID = 0L; // Use BreakRule.newBuilder() to construct. private BreakRule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private BreakRule() { breakRequests_ = java.util.Collections.emptyList(); frequencyConstraints_ = java.util.Collections.emptyList(); } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new BreakRule(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private BreakRule( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { breakRequests_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest>(); mutable_bitField0_ |= 0x00000001; } breakRequests_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest .parser(), extensionRegistry)); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) != 0)) { frequencyConstraints_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.BreakRule .FrequencyConstraint>(); mutable_bitField0_ |= 0x00000002; } frequencyConstraints_.add( input.readMessage( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .parser(), extensionRegistry)); break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) != 0)) { breakRequests_ = java.util.Collections.unmodifiableList(breakRequests_); } if (((mutable_bitField0_ & 0x00000002) != 0)) { frequencyConstraints_ = java.util.Collections.unmodifiableList(frequencyConstraints_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.class, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder.class); } public interface BreakRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the earliestStartTime field is set. */ boolean hasEarliestStartTime(); /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The earliestStartTime. */ com.google.protobuf.Timestamp getEarliestStartTime(); /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ com.google.protobuf.TimestampOrBuilder getEarliestStartTimeOrBuilder(); /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the latestStartTime field is set. */ boolean hasLatestStartTime(); /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The latestStartTime. */ com.google.protobuf.Timestamp getLatestStartTime(); /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ com.google.protobuf.TimestampOrBuilder getLatestStartTimeOrBuilder(); /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code>.google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the minDuration field is set. */ boolean hasMinDuration(); /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code>.google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The minDuration. */ com.google.protobuf.Duration getMinDuration(); /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code>.google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ com.google.protobuf.DurationOrBuilder getMinDurationOrBuilder(); } /** * * * <pre> * The sequence of breaks (i.e. their number and order) that apply to each * vehicle must be known beforehand. The repeated `BreakRequest`s define * that sequence, in the order in which they must occur. Their time windows * (`earliest_start_time` / `latest_start_time`) may overlap, but they must * be compatible with the order (this is checked). * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest} */ public static final class BreakRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) BreakRequestOrBuilder { private static final long serialVersionUID = 0L; // Use BreakRequest.newBuilder() to construct. private BreakRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private BreakRequest() {} @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new BreakRequest(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private BreakRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.Timestamp.Builder subBuilder = null; if (earliestStartTime_ != null) { subBuilder = earliestStartTime_.toBuilder(); } earliestStartTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(earliestStartTime_); earliestStartTime_ = subBuilder.buildPartial(); } break; } case 18: { com.google.protobuf.Timestamp.Builder subBuilder = null; if (latestStartTime_ != null) { subBuilder = latestStartTime_.toBuilder(); } latestStartTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(latestStartTime_); latestStartTime_ = subBuilder.buildPartial(); } break; } case 26: { com.google.protobuf.Duration.Builder subBuilder = null; if (minDuration_ != null) { subBuilder = minDuration_.toBuilder(); } minDuration_ = input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(minDuration_); minDuration_ = subBuilder.buildPartial(); } break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_BreakRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_BreakRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.class, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder .class); } public static final int EARLIEST_START_TIME_FIELD_NUMBER = 1; private com.google.protobuf.Timestamp earliestStartTime_; /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the earliestStartTime field is set. */ @java.lang.Override public boolean hasEarliestStartTime() { return earliestStartTime_ != null; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The earliestStartTime. */ @java.lang.Override public com.google.protobuf.Timestamp getEarliestStartTime() { return earliestStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : earliestStartTime_; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getEarliestStartTimeOrBuilder() { return getEarliestStartTime(); } public static final int LATEST_START_TIME_FIELD_NUMBER = 2; private com.google.protobuf.Timestamp latestStartTime_; /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the latestStartTime field is set. */ @java.lang.Override public boolean hasLatestStartTime() { return latestStartTime_ != null; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The latestStartTime. */ @java.lang.Override public com.google.protobuf.Timestamp getLatestStartTime() { return latestStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : latestStartTime_; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getLatestStartTimeOrBuilder() { return getLatestStartTime(); } public static final int MIN_DURATION_FIELD_NUMBER = 3; private com.google.protobuf.Duration minDuration_; /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code>.google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the minDuration field is set. */ @java.lang.Override public boolean hasMinDuration() { return minDuration_ != null; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code>.google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The minDuration. */ @java.lang.Override public com.google.protobuf.Duration getMinDuration() { return minDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : minDuration_; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code>.google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getMinDurationOrBuilder() { return getMinDuration(); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (earliestStartTime_ != null) { output.writeMessage(1, getEarliestStartTime()); } if (latestStartTime_ != null) { output.writeMessage(2, getLatestStartTime()); } if (minDuration_ != null) { output.writeMessage(3, getMinDuration()); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (earliestStartTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEarliestStartTime()); } if (latestStartTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getLatestStartTime()); } if (minDuration_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getMinDuration()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest other = (com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) obj; if (hasEarliestStartTime() != other.hasEarliestStartTime()) return false; if (hasEarliestStartTime()) { if (!getEarliestStartTime().equals(other.getEarliestStartTime())) return false; } if (hasLatestStartTime() != other.hasLatestStartTime()) return false; if (hasLatestStartTime()) { if (!getLatestStartTime().equals(other.getLatestStartTime())) return false; } if (hasMinDuration() != other.hasMinDuration()) return false; if (hasMinDuration()) { if (!getMinDuration().equals(other.getMinDuration())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasEarliestStartTime()) { hash = (37 * hash) + EARLIEST_START_TIME_FIELD_NUMBER; hash = (53 * hash) + getEarliestStartTime().hashCode(); } if (hasLatestStartTime()) { hash = (37 * hash) + LATEST_START_TIME_FIELD_NUMBER; hash = (53 * hash) + getLatestStartTime().hashCode(); } if (hasMinDuration()) { hash = (37 * hash) + MIN_DURATION_FIELD_NUMBER; hash = (53 * hash) + getMinDuration().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * The sequence of breaks (i.e. their number and order) that apply to each * vehicle must be known beforehand. The repeated `BreakRequest`s define * that sequence, in the order in which they must occur. Their time windows * (`earliest_start_time` / `latest_start_time`) may overlap, but they must * be compatible with the order (this is checked). * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_BreakRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_BreakRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.class, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder .class); } // Construct using // com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); if (earliestStartTimeBuilder_ == null) { earliestStartTime_ = null; } else { earliestStartTime_ = null; earliestStartTimeBuilder_ = null; } if (latestStartTimeBuilder_ == null) { latestStartTime_ = null; } else { latestStartTime_ = null; latestStartTimeBuilder_ = null; } if (minDurationBuilder_ == null) { minDuration_ = null; } else { minDuration_ = null; minDurationBuilder_ = null; } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_BreakRequest_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest .getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest build() { com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest buildPartial() { com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest result = new com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest(this); if (earliestStartTimeBuilder_ == null) { result.earliestStartTime_ = earliestStartTime_; } else { result.earliestStartTime_ = earliestStartTimeBuilder_.build(); } if (latestStartTimeBuilder_ == null) { result.latestStartTime_ = latestStartTime_; } else { result.latestStartTime_ = latestStartTimeBuilder_.build(); } if (minDurationBuilder_ == null) { result.minDuration_ = minDuration_; } else { result.minDuration_ = minDurationBuilder_.build(); } onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) { return mergeFrom( (com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest .getDefaultInstance()) return this; if (other.hasEarliestStartTime()) { mergeEarliestStartTime(other.getEarliestStartTime()); } if (other.hasLatestStartTime()) { mergeLatestStartTime(other.getLatestStartTime()); } if (other.hasMinDuration()) { mergeMinDuration(other.getMinDuration()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private com.google.protobuf.Timestamp earliestStartTime_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> earliestStartTimeBuilder_; /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the earliestStartTime field is set. */ public boolean hasEarliestStartTime() { return earliestStartTimeBuilder_ != null || earliestStartTime_ != null; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The earliestStartTime. */ public com.google.protobuf.Timestamp getEarliestStartTime() { if (earliestStartTimeBuilder_ == null) { return earliestStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : earliestStartTime_; } else { return earliestStartTimeBuilder_.getMessage(); } } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setEarliestStartTime(com.google.protobuf.Timestamp value) { if (earliestStartTimeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } earliestStartTime_ = value; onChanged(); } else { earliestStartTimeBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setEarliestStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (earliestStartTimeBuilder_ == null) { earliestStartTime_ = builderForValue.build(); onChanged(); } else { earliestStartTimeBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeEarliestStartTime(com.google.protobuf.Timestamp value) { if (earliestStartTimeBuilder_ == null) { if (earliestStartTime_ != null) { earliestStartTime_ = com.google.protobuf.Timestamp.newBuilder(earliestStartTime_) .mergeFrom(value) .buildPartial(); } else { earliestStartTime_ = value; } onChanged(); } else { earliestStartTimeBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearEarliestStartTime() { if (earliestStartTimeBuilder_ == null) { earliestStartTime_ = null; onChanged(); } else { earliestStartTime_ = null; earliestStartTimeBuilder_ = null; } return this; } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.Timestamp.Builder getEarliestStartTimeBuilder() { onChanged(); return getEarliestStartTimeFieldBuilder().getBuilder(); } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.TimestampOrBuilder getEarliestStartTimeOrBuilder() { if (earliestStartTimeBuilder_ != null) { return earliestStartTimeBuilder_.getMessageOrBuilder(); } else { return earliestStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : earliestStartTime_; } } /** * * * <pre> * Required. Lower bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp earliest_start_time = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> getEarliestStartTimeFieldBuilder() { if (earliestStartTimeBuilder_ == null) { earliestStartTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( getEarliestStartTime(), getParentForChildren(), isClean()); earliestStartTime_ = null; } return earliestStartTimeBuilder_; } private com.google.protobuf.Timestamp latestStartTime_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> latestStartTimeBuilder_; /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the latestStartTime field is set. */ public boolean hasLatestStartTime() { return latestStartTimeBuilder_ != null || latestStartTime_ != null; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The latestStartTime. */ public com.google.protobuf.Timestamp getLatestStartTime() { if (latestStartTimeBuilder_ == null) { return latestStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : latestStartTime_; } else { return latestStartTimeBuilder_.getMessage(); } } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setLatestStartTime(com.google.protobuf.Timestamp value) { if (latestStartTimeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } latestStartTime_ = value; onChanged(); } else { latestStartTimeBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setLatestStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (latestStartTimeBuilder_ == null) { latestStartTime_ = builderForValue.build(); onChanged(); } else { latestStartTimeBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeLatestStartTime(com.google.protobuf.Timestamp value) { if (latestStartTimeBuilder_ == null) { if (latestStartTime_ != null) { latestStartTime_ = com.google.protobuf.Timestamp.newBuilder(latestStartTime_) .mergeFrom(value) .buildPartial(); } else { latestStartTime_ = value; } onChanged(); } else { latestStartTimeBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearLatestStartTime() { if (latestStartTimeBuilder_ == null) { latestStartTime_ = null; onChanged(); } else { latestStartTime_ = null; latestStartTimeBuilder_ = null; } return this; } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.Timestamp.Builder getLatestStartTimeBuilder() { onChanged(); return getLatestStartTimeFieldBuilder().getBuilder(); } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.TimestampOrBuilder getLatestStartTimeOrBuilder() { if (latestStartTimeBuilder_ != null) { return latestStartTimeBuilder_.getMessageOrBuilder(); } else { return latestStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : latestStartTime_; } } /** * * * <pre> * Required. Upper bound (inclusive) on the start of the break. * </pre> * * <code> * .google.protobuf.Timestamp latest_start_time = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> getLatestStartTimeFieldBuilder() { if (latestStartTimeBuilder_ == null) { latestStartTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( getLatestStartTime(), getParentForChildren(), isClean()); latestStartTime_ = null; } return latestStartTimeBuilder_; } private com.google.protobuf.Duration minDuration_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> minDurationBuilder_; /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the minDuration field is set. */ public boolean hasMinDuration() { return minDurationBuilder_ != null || minDuration_ != null; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The minDuration. */ public com.google.protobuf.Duration getMinDuration() { if (minDurationBuilder_ == null) { return minDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : minDuration_; } else { return minDurationBuilder_.getMessage(); } } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMinDuration(com.google.protobuf.Duration value) { if (minDurationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } minDuration_ = value; onChanged(); } else { minDurationBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMinDuration(com.google.protobuf.Duration.Builder builderForValue) { if (minDurationBuilder_ == null) { minDuration_ = builderForValue.build(); onChanged(); } else { minDurationBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeMinDuration(com.google.protobuf.Duration value) { if (minDurationBuilder_ == null) { if (minDuration_ != null) { minDuration_ = com.google.protobuf.Duration.newBuilder(minDuration_) .mergeFrom(value) .buildPartial(); } else { minDuration_ = value; } onChanged(); } else { minDurationBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearMinDuration() { if (minDurationBuilder_ == null) { minDuration_ = null; onChanged(); } else { minDuration_ = null; minDurationBuilder_ = null; } return this; } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.Duration.Builder getMinDurationBuilder() { onChanged(); return getMinDurationFieldBuilder().getBuilder(); } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.DurationOrBuilder getMinDurationOrBuilder() { if (minDurationBuilder_ != null) { return minDurationBuilder_.getMessageOrBuilder(); } else { return minDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : minDuration_; } } /** * * * <pre> * Required. Minimum duration of the break. Must be positive. * </pre> * * <code> * .google.protobuf.Duration min_duration = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> getMinDurationFieldBuilder() { if (minDurationBuilder_ == null) { minDurationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( getMinDuration(), getParentForChildren(), isClean()); minDuration_ = null; } return minDurationBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest) private static final com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest(); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<BreakRequest> PARSER = new com.google.protobuf.AbstractParser<BreakRequest>() { @java.lang.Override public BreakRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new BreakRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<BreakRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<BreakRequest> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface FrequencyConstraintOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the minBreakDuration field is set. */ boolean hasMinBreakDuration(); /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The minBreakDuration. */ com.google.protobuf.Duration getMinBreakDuration(); /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ com.google.protobuf.DurationOrBuilder getMinBreakDurationOrBuilder(); /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the maxInterBreakDuration field is set. */ boolean hasMaxInterBreakDuration(); /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The maxInterBreakDuration. */ com.google.protobuf.Duration getMaxInterBreakDuration(); /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ com.google.protobuf.DurationOrBuilder getMaxInterBreakDurationOrBuilder(); } /** * * * <pre> * One may further constrain the frequency and duration of the breaks * specified above, by enforcing a minimum break frequency, such as * "There must be a break of at least 1 hour every 12 hours". Assuming that * this can be interpreted as "Within any sliding time window of 12h, there * must be at least one break of at least one hour", that example would * translate to the following `FrequencyConstraint`: * ``` * { * min_break_duration { seconds: 3600 } # 1 hour. * max_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11). * } * ``` * The timing and duration of the breaks in the solution will respect all * such constraints, in addition to the time windows and minimum durations * already specified in the `BreakRequest`. * A `FrequencyConstraint` may in practice apply to non-consecutive breaks. * For example, the following schedule honors the "1h every 12h" example: * ``` * 04:00 vehicle start * .. performing travel and visits .. * 09:00 1 hour break * 10:00 end of the break * .. performing travel and visits .. * 12:00 20-min lunch break * 12:20 end of the break * .. performing travel and visits .. * 21:00 1 hour break * 22:00 end of the break * .. performing travel and visits .. * 23:59 vehicle end * ``` * </pre> * * Protobuf type {@code * google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint} */ public static final class FrequencyConstraint extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) FrequencyConstraintOrBuilder { private static final long serialVersionUID = 0L; // Use FrequencyConstraint.newBuilder() to construct. private FrequencyConstraint(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private FrequencyConstraint() {} @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new FrequencyConstraint(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private FrequencyConstraint( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.protobuf.Duration.Builder subBuilder = null; if (minBreakDuration_ != null) { subBuilder = minBreakDuration_.toBuilder(); } minBreakDuration_ = input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(minBreakDuration_); minBreakDuration_ = subBuilder.buildPartial(); } break; } case 18: { com.google.protobuf.Duration.Builder subBuilder = null; if (maxInterBreakDuration_ != null) { subBuilder = maxInterBreakDuration_.toBuilder(); } maxInterBreakDuration_ = input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(maxInterBreakDuration_); maxInterBreakDuration_ = subBuilder.buildPartial(); } break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_FrequencyConstraint_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_FrequencyConstraint_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.class, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder .class); } public static final int MIN_BREAK_DURATION_FIELD_NUMBER = 1; private com.google.protobuf.Duration minBreakDuration_; /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the minBreakDuration field is set. */ @java.lang.Override public boolean hasMinBreakDuration() { return minBreakDuration_ != null; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The minBreakDuration. */ @java.lang.Override public com.google.protobuf.Duration getMinBreakDuration() { return minBreakDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : minBreakDuration_; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getMinBreakDurationOrBuilder() { return getMinBreakDuration(); } public static final int MAX_INTER_BREAK_DURATION_FIELD_NUMBER = 2; private com.google.protobuf.Duration maxInterBreakDuration_; /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the maxInterBreakDuration field is set. */ @java.lang.Override public boolean hasMaxInterBreakDuration() { return maxInterBreakDuration_ != null; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The maxInterBreakDuration. */ @java.lang.Override public com.google.protobuf.Duration getMaxInterBreakDuration() { return maxInterBreakDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : maxInterBreakDuration_; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.protobuf.DurationOrBuilder getMaxInterBreakDurationOrBuilder() { return getMaxInterBreakDuration(); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (minBreakDuration_ != null) { output.writeMessage(1, getMinBreakDuration()); } if (maxInterBreakDuration_ != null) { output.writeMessage(2, getMaxInterBreakDuration()); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (minBreakDuration_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getMinBreakDuration()); } if (maxInterBreakDuration_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 2, getMaxInterBreakDuration()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint other = (com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) obj; if (hasMinBreakDuration() != other.hasMinBreakDuration()) return false; if (hasMinBreakDuration()) { if (!getMinBreakDuration().equals(other.getMinBreakDuration())) return false; } if (hasMaxInterBreakDuration() != other.hasMaxInterBreakDuration()) return false; if (hasMaxInterBreakDuration()) { if (!getMaxInterBreakDuration().equals(other.getMaxInterBreakDuration())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasMinBreakDuration()) { hash = (37 * hash) + MIN_BREAK_DURATION_FIELD_NUMBER; hash = (53 * hash) + getMinBreakDuration().hashCode(); } if (hasMaxInterBreakDuration()) { hash = (37 * hash) + MAX_INTER_BREAK_DURATION_FIELD_NUMBER; hash = (53 * hash) + getMaxInterBreakDuration().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * One may further constrain the frequency and duration of the breaks * specified above, by enforcing a minimum break frequency, such as * "There must be a break of at least 1 hour every 12 hours". Assuming that * this can be interpreted as "Within any sliding time window of 12h, there * must be at least one break of at least one hour", that example would * translate to the following `FrequencyConstraint`: * ``` * { * min_break_duration { seconds: 3600 } # 1 hour. * max_inter_break_duration { seconds: 39600 } # 11 hours (12 - 1 = 11). * } * ``` * The timing and duration of the breaks in the solution will respect all * such constraints, in addition to the time windows and minimum durations * already specified in the `BreakRequest`. * A `FrequencyConstraint` may in practice apply to non-consecutive breaks. * For example, the following schedule honors the "1h every 12h" example: * ``` * 04:00 vehicle start * .. performing travel and visits .. * 09:00 1 hour break * 10:00 end of the break * .. performing travel and visits .. * 12:00 20-min lunch break * 12:20 end of the break * .. performing travel and visits .. * 21:00 1 hour break * 22:00 end of the break * .. performing travel and visits .. * 23:59 vehicle end * ``` * </pre> * * Protobuf type {@code * google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraintOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_FrequencyConstraint_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_FrequencyConstraint_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .class, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .Builder.class); } // Construct using // com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); if (minBreakDurationBuilder_ == null) { minBreakDuration_ = null; } else { minBreakDuration_ = null; minBreakDurationBuilder_ = null; } if (maxInterBreakDurationBuilder_ == null) { maxInterBreakDuration_ = null; } else { maxInterBreakDuration_ = null; maxInterBreakDurationBuilder_ = null; } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_FrequencyConstraint_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint build() { com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint buildPartial() { com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint result = new com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint( this); if (minBreakDurationBuilder_ == null) { result.minBreakDuration_ = minBreakDuration_; } else { result.minBreakDuration_ = minBreakDurationBuilder_.build(); } if (maxInterBreakDurationBuilder_ == null) { result.maxInterBreakDuration_ = maxInterBreakDuration_; } else { result.maxInterBreakDuration_ = maxInterBreakDurationBuilder_.build(); } onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) { return mergeFrom( (com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .getDefaultInstance()) return this; if (other.hasMinBreakDuration()) { mergeMinBreakDuration(other.getMinBreakDuration()); } if (other.hasMaxInterBreakDuration()) { mergeMaxInterBreakDuration(other.getMaxInterBreakDuration()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private com.google.protobuf.Duration minBreakDuration_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> minBreakDurationBuilder_; /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the minBreakDuration field is set. */ public boolean hasMinBreakDuration() { return minBreakDurationBuilder_ != null || minBreakDuration_ != null; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The minBreakDuration. */ public com.google.protobuf.Duration getMinBreakDuration() { if (minBreakDurationBuilder_ == null) { return minBreakDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : minBreakDuration_; } else { return minBreakDurationBuilder_.getMessage(); } } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMinBreakDuration(com.google.protobuf.Duration value) { if (minBreakDurationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } minBreakDuration_ = value; onChanged(); } else { minBreakDurationBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMinBreakDuration(com.google.protobuf.Duration.Builder builderForValue) { if (minBreakDurationBuilder_ == null) { minBreakDuration_ = builderForValue.build(); onChanged(); } else { minBreakDurationBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeMinBreakDuration(com.google.protobuf.Duration value) { if (minBreakDurationBuilder_ == null) { if (minBreakDuration_ != null) { minBreakDuration_ = com.google.protobuf.Duration.newBuilder(minBreakDuration_) .mergeFrom(value) .buildPartial(); } else { minBreakDuration_ = value; } onChanged(); } else { minBreakDurationBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearMinBreakDuration() { if (minBreakDurationBuilder_ == null) { minBreakDuration_ = null; onChanged(); } else { minBreakDuration_ = null; minBreakDurationBuilder_ = null; } return this; } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.Duration.Builder getMinBreakDurationBuilder() { onChanged(); return getMinBreakDurationFieldBuilder().getBuilder(); } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.DurationOrBuilder getMinBreakDurationOrBuilder() { if (minBreakDurationBuilder_ != null) { return minBreakDurationBuilder_.getMessageOrBuilder(); } else { return minBreakDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : minBreakDuration_; } } /** * * * <pre> * Required. Minimum break duration for this constraint. Nonnegative. * See description of `FrequencyConstraint`. * </pre> * * <code> * .google.protobuf.Duration min_break_duration = 1 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> getMinBreakDurationFieldBuilder() { if (minBreakDurationBuilder_ == null) { minBreakDurationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( getMinBreakDuration(), getParentForChildren(), isClean()); minBreakDuration_ = null; } return minBreakDurationBuilder_; } private com.google.protobuf.Duration maxInterBreakDuration_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> maxInterBreakDurationBuilder_; /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the maxInterBreakDuration field is set. */ public boolean hasMaxInterBreakDuration() { return maxInterBreakDurationBuilder_ != null || maxInterBreakDuration_ != null; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The maxInterBreakDuration. */ public com.google.protobuf.Duration getMaxInterBreakDuration() { if (maxInterBreakDurationBuilder_ == null) { return maxInterBreakDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : maxInterBreakDuration_; } else { return maxInterBreakDurationBuilder_.getMessage(); } } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMaxInterBreakDuration(com.google.protobuf.Duration value) { if (maxInterBreakDurationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } maxInterBreakDuration_ = value; onChanged(); } else { maxInterBreakDurationBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setMaxInterBreakDuration( com.google.protobuf.Duration.Builder builderForValue) { if (maxInterBreakDurationBuilder_ == null) { maxInterBreakDuration_ = builderForValue.build(); onChanged(); } else { maxInterBreakDurationBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeMaxInterBreakDuration(com.google.protobuf.Duration value) { if (maxInterBreakDurationBuilder_ == null) { if (maxInterBreakDuration_ != null) { maxInterBreakDuration_ = com.google.protobuf.Duration.newBuilder(maxInterBreakDuration_) .mergeFrom(value) .buildPartial(); } else { maxInterBreakDuration_ = value; } onChanged(); } else { maxInterBreakDurationBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearMaxInterBreakDuration() { if (maxInterBreakDurationBuilder_ == null) { maxInterBreakDuration_ = null; onChanged(); } else { maxInterBreakDuration_ = null; maxInterBreakDurationBuilder_ = null; } return this; } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.Duration.Builder getMaxInterBreakDurationBuilder() { onChanged(); return getMaxInterBreakDurationFieldBuilder().getBuilder(); } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.protobuf.DurationOrBuilder getMaxInterBreakDurationOrBuilder() { if (maxInterBreakDurationBuilder_ != null) { return maxInterBreakDurationBuilder_.getMessageOrBuilder(); } else { return maxInterBreakDuration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : maxInterBreakDuration_; } } /** * * * <pre> * Required. Maximum allowed span of any interval of time in the route that does not * include at least partially a break of `duration &gt;= * min_break_duration`. Must be positive. * </pre> * * <code> * .google.protobuf.Duration max_inter_break_duration = 2 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> getMaxInterBreakDurationFieldBuilder() { if (maxInterBreakDurationBuilder_ == null) { maxInterBreakDurationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( getMaxInterBreakDuration(), getParentForChildren(), isClean()); maxInterBreakDuration_ = null; } return maxInterBreakDurationBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint) private static final com.google.cloud.optimization.v1.ShipmentModel.BreakRule .FrequencyConstraint DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint(); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<FrequencyConstraint> PARSER = new com.google.protobuf.AbstractParser<FrequencyConstraint>() { @java.lang.Override public FrequencyConstraint parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new FrequencyConstraint(input, extensionRegistry); } }; public static com.google.protobuf.Parser<FrequencyConstraint> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<FrequencyConstraint> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public static final int BREAK_REQUESTS_FIELD_NUMBER = 1; private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest> breakRequests_; /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest> getBreakRequestsList() { return breakRequests_; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder> getBreakRequestsOrBuilderList() { return breakRequests_; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ @java.lang.Override public int getBreakRequestsCount() { return breakRequests_.size(); } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest getBreakRequests( int index) { return breakRequests_.get(index); } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder getBreakRequestsOrBuilder(int index) { return breakRequests_.get(index); } public static final int FREQUENCY_CONSTRAINTS_FIELD_NUMBER = 2; private java.util.List< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint> frequencyConstraints_; /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ @java.lang.Override public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint> getFrequencyConstraintsList() { return frequencyConstraints_; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule .FrequencyConstraintOrBuilder> getFrequencyConstraintsOrBuilderList() { return frequencyConstraints_; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ @java.lang.Override public int getFrequencyConstraintsCount() { return frequencyConstraints_.size(); } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint getFrequencyConstraints(int index) { return frequencyConstraints_.get(index); } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraintOrBuilder getFrequencyConstraintsOrBuilder(int index) { return frequencyConstraints_.get(index); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < breakRequests_.size(); i++) { output.writeMessage(1, breakRequests_.get(i)); } for (int i = 0; i < frequencyConstraints_.size(); i++) { output.writeMessage(2, frequencyConstraints_.get(i)); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < breakRequests_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, breakRequests_.get(i)); } for (int i = 0; i < frequencyConstraints_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 2, frequencyConstraints_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel.BreakRule)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel.BreakRule other = (com.google.cloud.optimization.v1.ShipmentModel.BreakRule) obj; if (!getBreakRequestsList().equals(other.getBreakRequestsList())) return false; if (!getFrequencyConstraintsList().equals(other.getFrequencyConstraintsList())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getBreakRequestsCount() > 0) { hash = (37 * hash) + BREAK_REQUESTS_FIELD_NUMBER; hash = (53 * hash) + getBreakRequestsList().hashCode(); } if (getFrequencyConstraintsCount() > 0) { hash = (37 * hash) + FREQUENCY_CONSTRAINTS_FIELD_NUMBER; hash = (53 * hash) + getFrequencyConstraintsList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.optimization.v1.ShipmentModel.BreakRule prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Deprecated: Use top level [BreakRule][] instead. * Rules to generate time breaks for a vehicle (e.g. lunch * breaks). A break is a contiguous period of time during which the vehicle * remains idle at its current position and cannot perform any visit. A break * may occur: * * during the travel between two visits (which includes the time right * before or right after a visit, but not in the middle of a visit), in * which case it extends the corresponding transit time between the visits, * * or before the vehicle start (the vehicle may not start in the middle of * a break), in which case it does not affect the vehicle start time. * * or after the vehicle end (ditto, with the vehicle end time). * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel.BreakRule} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel.BreakRule) com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.class, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder.class); } // Construct using com.google.cloud.optimization.v1.ShipmentModel.BreakRule.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getBreakRequestsFieldBuilder(); getFrequencyConstraintsFieldBuilder(); } } @java.lang.Override public Builder clear() { super.clear(); if (breakRequestsBuilder_ == null) { breakRequests_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { breakRequestsBuilder_.clear(); } if (frequencyConstraintsBuilder_ == null) { frequencyConstraints_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { frequencyConstraintsBuilder_.clear(); } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_BreakRule_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.BreakRule.getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule build() { com.google.cloud.optimization.v1.ShipmentModel.BreakRule result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule buildPartial() { com.google.cloud.optimization.v1.ShipmentModel.BreakRule result = new com.google.cloud.optimization.v1.ShipmentModel.BreakRule(this); int from_bitField0_ = bitField0_; if (breakRequestsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { breakRequests_ = java.util.Collections.unmodifiableList(breakRequests_); bitField0_ = (bitField0_ & ~0x00000001); } result.breakRequests_ = breakRequests_; } else { result.breakRequests_ = breakRequestsBuilder_.build(); } if (frequencyConstraintsBuilder_ == null) { if (((bitField0_ & 0x00000002) != 0)) { frequencyConstraints_ = java.util.Collections.unmodifiableList(frequencyConstraints_); bitField0_ = (bitField0_ & ~0x00000002); } result.frequencyConstraints_ = frequencyConstraints_; } else { result.frequencyConstraints_ = frequencyConstraintsBuilder_.build(); } onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel.BreakRule) { return mergeFrom((com.google.cloud.optimization.v1.ShipmentModel.BreakRule) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.optimization.v1.ShipmentModel.BreakRule other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.BreakRule.getDefaultInstance()) return this; if (breakRequestsBuilder_ == null) { if (!other.breakRequests_.isEmpty()) { if (breakRequests_.isEmpty()) { breakRequests_ = other.breakRequests_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureBreakRequestsIsMutable(); breakRequests_.addAll(other.breakRequests_); } onChanged(); } } else { if (!other.breakRequests_.isEmpty()) { if (breakRequestsBuilder_.isEmpty()) { breakRequestsBuilder_.dispose(); breakRequestsBuilder_ = null; breakRequests_ = other.breakRequests_; bitField0_ = (bitField0_ & ~0x00000001); breakRequestsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getBreakRequestsFieldBuilder() : null; } else { breakRequestsBuilder_.addAllMessages(other.breakRequests_); } } } if (frequencyConstraintsBuilder_ == null) { if (!other.frequencyConstraints_.isEmpty()) { if (frequencyConstraints_.isEmpty()) { frequencyConstraints_ = other.frequencyConstraints_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.addAll(other.frequencyConstraints_); } onChanged(); } } else { if (!other.frequencyConstraints_.isEmpty()) { if (frequencyConstraintsBuilder_.isEmpty()) { frequencyConstraintsBuilder_.dispose(); frequencyConstraintsBuilder_ = null; frequencyConstraints_ = other.frequencyConstraints_; bitField0_ = (bitField0_ & ~0x00000002); frequencyConstraintsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getFrequencyConstraintsFieldBuilder() : null; } else { frequencyConstraintsBuilder_.addAllMessages(other.frequencyConstraints_); } } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel.BreakRule parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel.BreakRule) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest> breakRequests_ = java.util.Collections.emptyList(); private void ensureBreakRequestsIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { breakRequests_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest>( breakRequests_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder> breakRequestsBuilder_; /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest> getBreakRequestsList() { if (breakRequestsBuilder_ == null) { return java.util.Collections.unmodifiableList(breakRequests_); } else { return breakRequestsBuilder_.getMessageList(); } } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public int getBreakRequestsCount() { if (breakRequestsBuilder_ == null) { return breakRequests_.size(); } else { return breakRequestsBuilder_.getCount(); } } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest getBreakRequests( int index) { if (breakRequestsBuilder_ == null) { return breakRequests_.get(index); } else { return breakRequestsBuilder_.getMessage(index); } } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder setBreakRequests( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest value) { if (breakRequestsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureBreakRequestsIsMutable(); breakRequests_.set(index, value); onChanged(); } else { breakRequestsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder setBreakRequests( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder builderForValue) { if (breakRequestsBuilder_ == null) { ensureBreakRequestsIsMutable(); breakRequests_.set(index, builderForValue.build()); onChanged(); } else { breakRequestsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder addBreakRequests( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest value) { if (breakRequestsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureBreakRequestsIsMutable(); breakRequests_.add(value); onChanged(); } else { breakRequestsBuilder_.addMessage(value); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder addBreakRequests( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest value) { if (breakRequestsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureBreakRequestsIsMutable(); breakRequests_.add(index, value); onChanged(); } else { breakRequestsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder addBreakRequests( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder builderForValue) { if (breakRequestsBuilder_ == null) { ensureBreakRequestsIsMutable(); breakRequests_.add(builderForValue.build()); onChanged(); } else { breakRequestsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder addBreakRequests( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder builderForValue) { if (breakRequestsBuilder_ == null) { ensureBreakRequestsIsMutable(); breakRequests_.add(index, builderForValue.build()); onChanged(); } else { breakRequestsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder addAllBreakRequests( java.lang.Iterable< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest> values) { if (breakRequestsBuilder_ == null) { ensureBreakRequestsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, breakRequests_); onChanged(); } else { breakRequestsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder clearBreakRequests() { if (breakRequestsBuilder_ == null) { breakRequests_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { breakRequestsBuilder_.clear(); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public Builder removeBreakRequests(int index) { if (breakRequestsBuilder_ == null) { ensureBreakRequestsIsMutable(); breakRequests_.remove(index); onChanged(); } else { breakRequestsBuilder_.remove(index); } return this; } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder getBreakRequestsBuilder(int index) { return getBreakRequestsFieldBuilder().getBuilder(index); } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder getBreakRequestsOrBuilder(int index) { if (breakRequestsBuilder_ == null) { return breakRequests_.get(index); } else { return breakRequestsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder> getBreakRequestsOrBuilderList() { if (breakRequestsBuilder_ != null) { return breakRequestsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(breakRequests_); } } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder addBreakRequestsBuilder() { return getBreakRequestsFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest .getDefaultInstance()); } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder addBreakRequestsBuilder(int index) { return getBreakRequestsFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest .getDefaultInstance()); } /** * * * <pre> * Sequence of breaks. See the `BreakRequest` message. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest break_requests = 1; * </code> */ public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder> getBreakRequestsBuilderList() { return getBreakRequestsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder> getBreakRequestsFieldBuilder() { if (breakRequestsBuilder_ == null) { breakRequestsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequest.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.BreakRequestOrBuilder>( breakRequests_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); breakRequests_ = null; } return breakRequestsBuilder_; } private java.util.List< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint> frequencyConstraints_ = java.util.Collections.emptyList(); private void ensureFrequencyConstraintsIsMutable() { if (!((bitField0_ & 0x00000002) != 0)) { frequencyConstraints_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint>( frequencyConstraints_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraintOrBuilder> frequencyConstraintsBuilder_; /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint> getFrequencyConstraintsList() { if (frequencyConstraintsBuilder_ == null) { return java.util.Collections.unmodifiableList(frequencyConstraints_); } else { return frequencyConstraintsBuilder_.getMessageList(); } } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public int getFrequencyConstraintsCount() { if (frequencyConstraintsBuilder_ == null) { return frequencyConstraints_.size(); } else { return frequencyConstraintsBuilder_.getCount(); } } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint getFrequencyConstraints(int index) { if (frequencyConstraintsBuilder_ == null) { return frequencyConstraints_.get(index); } else { return frequencyConstraintsBuilder_.getMessage(index); } } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder setFrequencyConstraints( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint value) { if (frequencyConstraintsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.set(index, value); onChanged(); } else { frequencyConstraintsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder setFrequencyConstraints( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder builderForValue) { if (frequencyConstraintsBuilder_ == null) { ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.set(index, builderForValue.build()); onChanged(); } else { frequencyConstraintsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder addFrequencyConstraints( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint value) { if (frequencyConstraintsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.add(value); onChanged(); } else { frequencyConstraintsBuilder_.addMessage(value); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder addFrequencyConstraints( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint value) { if (frequencyConstraintsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.add(index, value); onChanged(); } else { frequencyConstraintsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder addFrequencyConstraints( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder builderForValue) { if (frequencyConstraintsBuilder_ == null) { ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.add(builderForValue.build()); onChanged(); } else { frequencyConstraintsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder addFrequencyConstraints( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder builderForValue) { if (frequencyConstraintsBuilder_ == null) { ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.add(index, builderForValue.build()); onChanged(); } else { frequencyConstraintsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder addAllFrequencyConstraints( java.lang.Iterable< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint> values) { if (frequencyConstraintsBuilder_ == null) { ensureFrequencyConstraintsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, frequencyConstraints_); onChanged(); } else { frequencyConstraintsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder clearFrequencyConstraints() { if (frequencyConstraintsBuilder_ == null) { frequencyConstraints_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { frequencyConstraintsBuilder_.clear(); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public Builder removeFrequencyConstraints(int index) { if (frequencyConstraintsBuilder_ == null) { ensureFrequencyConstraintsIsMutable(); frequencyConstraints_.remove(index); onChanged(); } else { frequencyConstraintsBuilder_.remove(index); } return this; } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder getFrequencyConstraintsBuilder(int index) { return getFrequencyConstraintsFieldBuilder().getBuilder(index); } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraintOrBuilder getFrequencyConstraintsOrBuilder(int index) { if (frequencyConstraintsBuilder_ == null) { return frequencyConstraints_.get(index); } else { return frequencyConstraintsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule .FrequencyConstraintOrBuilder> getFrequencyConstraintsOrBuilderList() { if (frequencyConstraintsBuilder_ != null) { return frequencyConstraintsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(frequencyConstraints_); } } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder addFrequencyConstraintsBuilder() { return getFrequencyConstraintsFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .getDefaultInstance()); } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder addFrequencyConstraintsBuilder(int index) { return getFrequencyConstraintsFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .getDefaultInstance()); } /** * * * <pre> * Several `FrequencyConstraint` may apply. They must all be satisfied by * the `BreakRequest`s of this `BreakRule`. See `FrequencyConstraint`. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint frequency_constraints = 2; * </code> */ public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder> getFrequencyConstraintsBuilderList() { return getFrequencyConstraintsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraintOrBuilder> getFrequencyConstraintsFieldBuilder() { if (frequencyConstraintsBuilder_ == null) { frequencyConstraintsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.FrequencyConstraint .Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRule .FrequencyConstraintOrBuilder>( frequencyConstraints_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); frequencyConstraints_ = null; } return frequencyConstraintsBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel.BreakRule) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel.BreakRule) private static final com.google.cloud.optimization.v1.ShipmentModel.BreakRule DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel.BreakRule(); } public static com.google.cloud.optimization.v1.ShipmentModel.BreakRule getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<BreakRule> PARSER = new com.google.protobuf.AbstractParser<BreakRule>() { @java.lang.Override public BreakRule parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new BreakRule(input, extensionRegistry); } }; public static com.google.protobuf.Parser<BreakRule> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<BreakRule> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.BreakRule getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private int bitField0_; public static final int SHIPMENTS_FIELD_NUMBER = 1; private java.util.List<com.google.cloud.optimization.v1.Shipment> shipments_; /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.Shipment> getShipmentsList() { return shipments_; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ @java.lang.Override public java.util.List<? extends com.google.cloud.optimization.v1.ShipmentOrBuilder> getShipmentsOrBuilderList() { return shipments_; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ @java.lang.Override public int getShipmentsCount() { return shipments_.size(); } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ @java.lang.Override public com.google.cloud.optimization.v1.Shipment getShipments(int index) { return shipments_.get(index); } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentOrBuilder getShipmentsOrBuilder(int index) { return shipments_.get(index); } public static final int VEHICLES_FIELD_NUMBER = 2; private java.util.List<com.google.cloud.optimization.v1.Vehicle> vehicles_; /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.Vehicle> getVehiclesList() { return vehicles_; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ @java.lang.Override public java.util.List<? extends com.google.cloud.optimization.v1.VehicleOrBuilder> getVehiclesOrBuilderList() { return vehicles_; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ @java.lang.Override public int getVehiclesCount() { return vehicles_.size(); } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ @java.lang.Override public com.google.cloud.optimization.v1.Vehicle getVehicles(int index) { return vehicles_.get(index); } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ @java.lang.Override public com.google.cloud.optimization.v1.VehicleOrBuilder getVehiclesOrBuilder(int index) { return vehicles_.get(index); } public static final int MAX_ACTIVE_VEHICLES_FIELD_NUMBER = 4; private int maxActiveVehicles_; /** * * * <pre> * Constrains the maximum number of active vehicles. A vehicle is active if * its route performs at least one shipment. This can be used to limit the * number of routes in the case where there are fewer drivers than * vehicles and that the fleet of vehicles is heterogeneous. The optimization * will then select the best subset of vehicles to use. * Must be strictly positive. * </pre> * * <code>optional int32 max_active_vehicles = 4;</code> * * @return Whether the maxActiveVehicles field is set. */ @java.lang.Override public boolean hasMaxActiveVehicles() { return ((bitField0_ & 0x00000001) != 0); } /** * * * <pre> * Constrains the maximum number of active vehicles. A vehicle is active if * its route performs at least one shipment. This can be used to limit the * number of routes in the case where there are fewer drivers than * vehicles and that the fleet of vehicles is heterogeneous. The optimization * will then select the best subset of vehicles to use. * Must be strictly positive. * </pre> * * <code>optional int32 max_active_vehicles = 4;</code> * * @return The maxActiveVehicles. */ @java.lang.Override public int getMaxActiveVehicles() { return maxActiveVehicles_; } public static final int GLOBAL_START_TIME_FIELD_NUMBER = 5; private com.google.protobuf.Timestamp globalStartTime_; /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> * * @return Whether the globalStartTime field is set. */ @java.lang.Override public boolean hasGlobalStartTime() { return globalStartTime_ != null; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> * * @return The globalStartTime. */ @java.lang.Override public com.google.protobuf.Timestamp getGlobalStartTime() { return globalStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : globalStartTime_; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getGlobalStartTimeOrBuilder() { return getGlobalStartTime(); } public static final int GLOBAL_END_TIME_FIELD_NUMBER = 6; private com.google.protobuf.Timestamp globalEndTime_; /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> * * @return Whether the globalEndTime field is set. */ @java.lang.Override public boolean hasGlobalEndTime() { return globalEndTime_ != null; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> * * @return The globalEndTime. */ @java.lang.Override public com.google.protobuf.Timestamp getGlobalEndTime() { return globalEndTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : globalEndTime_; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ @java.lang.Override public com.google.protobuf.TimestampOrBuilder getGlobalEndTimeOrBuilder() { return getGlobalEndTime(); } public static final int GLOBAL_DURATION_COST_PER_HOUR_FIELD_NUMBER = 7; private double globalDurationCostPerHour_; /** * * * <pre> * The "global duration" of the overall plan is the difference between the * earliest effective start time and the latest effective end time of * all vehicles. Users can assign a cost per hour to that quantity to try * and optimize for earliest job completion, for example. This cost must be in * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. * </pre> * * <code>double global_duration_cost_per_hour = 7;</code> * * @return The globalDurationCostPerHour. */ @java.lang.Override public double getGlobalDurationCostPerHour() { return globalDurationCostPerHour_; } public static final int DURATION_DISTANCE_MATRICES_FIELD_NUMBER = 8; private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix> durationDistanceMatrices_; /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix> getDurationDistanceMatricesList() { return durationDistanceMatrices_; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder> getDurationDistanceMatricesOrBuilderList() { return durationDistanceMatrices_; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ @java.lang.Override public int getDurationDistanceMatricesCount() { return durationDistanceMatrices_.size(); } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix getDurationDistanceMatrices(int index) { return durationDistanceMatrices_.get(index); } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder getDurationDistanceMatricesOrBuilder(int index) { return durationDistanceMatrices_.get(index); } public static final int DURATION_DISTANCE_MATRIX_SRC_TAGS_FIELD_NUMBER = 9; private com.google.protobuf.LazyStringList durationDistanceMatrixSrcTags_; /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @return A list containing the durationDistanceMatrixSrcTags. */ public com.google.protobuf.ProtocolStringList getDurationDistanceMatrixSrcTagsList() { return durationDistanceMatrixSrcTags_; } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @return The count of durationDistanceMatrixSrcTags. */ public int getDurationDistanceMatrixSrcTagsCount() { return durationDistanceMatrixSrcTags_.size(); } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param index The index of the element to return. * @return The durationDistanceMatrixSrcTags at the given index. */ public java.lang.String getDurationDistanceMatrixSrcTags(int index) { return durationDistanceMatrixSrcTags_.get(index); } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param index The index of the value to return. * @return The bytes of the durationDistanceMatrixSrcTags at the given index. */ public com.google.protobuf.ByteString getDurationDistanceMatrixSrcTagsBytes(int index) { return durationDistanceMatrixSrcTags_.getByteString(index); } public static final int DURATION_DISTANCE_MATRIX_DST_TAGS_FIELD_NUMBER = 10; private com.google.protobuf.LazyStringList durationDistanceMatrixDstTags_; /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @return A list containing the durationDistanceMatrixDstTags. */ public com.google.protobuf.ProtocolStringList getDurationDistanceMatrixDstTagsList() { return durationDistanceMatrixDstTags_; } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @return The count of durationDistanceMatrixDstTags. */ public int getDurationDistanceMatrixDstTagsCount() { return durationDistanceMatrixDstTags_.size(); } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param index The index of the element to return. * @return The durationDistanceMatrixDstTags at the given index. */ public java.lang.String getDurationDistanceMatrixDstTags(int index) { return durationDistanceMatrixDstTags_.get(index); } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param index The index of the value to return. * @return The bytes of the durationDistanceMatrixDstTags at the given index. */ public com.google.protobuf.ByteString getDurationDistanceMatrixDstTagsBytes(int index) { return durationDistanceMatrixDstTags_.getByteString(index); } public static final int TRANSITION_ATTRIBUTES_FIELD_NUMBER = 11; private java.util.List<com.google.cloud.optimization.v1.TransitionAttributes> transitionAttributes_; /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.TransitionAttributes> getTransitionAttributesList() { return transitionAttributes_; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ @java.lang.Override public java.util.List<? extends com.google.cloud.optimization.v1.TransitionAttributesOrBuilder> getTransitionAttributesOrBuilderList() { return transitionAttributes_; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ @java.lang.Override public int getTransitionAttributesCount() { return transitionAttributes_.size(); } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.TransitionAttributes getTransitionAttributes(int index) { return transitionAttributes_.get(index); } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.TransitionAttributesOrBuilder getTransitionAttributesOrBuilder(int index) { return transitionAttributes_.get(index); } public static final int SHIPMENT_TYPE_INCOMPATIBILITIES_FIELD_NUMBER = 12; private java.util.List<com.google.cloud.optimization.v1.ShipmentTypeIncompatibility> shipmentTypeIncompatibilities_; /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.ShipmentTypeIncompatibility> getShipmentTypeIncompatibilitiesList() { return shipmentTypeIncompatibilities_; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder> getShipmentTypeIncompatibilitiesOrBuilderList() { return shipmentTypeIncompatibilities_; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ @java.lang.Override public int getShipmentTypeIncompatibilitiesCount() { return shipmentTypeIncompatibilities_.size(); } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentTypeIncompatibility getShipmentTypeIncompatibilities(int index) { return shipmentTypeIncompatibilities_.get(index); } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder getShipmentTypeIncompatibilitiesOrBuilder(int index) { return shipmentTypeIncompatibilities_.get(index); } public static final int SHIPMENT_TYPE_REQUIREMENTS_FIELD_NUMBER = 13; private java.util.List<com.google.cloud.optimization.v1.ShipmentTypeRequirement> shipmentTypeRequirements_; /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.ShipmentTypeRequirement> getShipmentTypeRequirementsList() { return shipmentTypeRequirements_; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ @java.lang.Override public java.util.List<? extends com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder> getShipmentTypeRequirementsOrBuilderList() { return shipmentTypeRequirements_; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ @java.lang.Override public int getShipmentTypeRequirementsCount() { return shipmentTypeRequirements_.size(); } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentTypeRequirement getShipmentTypeRequirements( int index) { return shipmentTypeRequirements_.get(index); } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder getShipmentTypeRequirementsOrBuilder(int index) { return shipmentTypeRequirements_.get(index); } public static final int PRECEDENCE_RULES_FIELD_NUMBER = 14; private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule> precedenceRules_; /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule> getPrecedenceRulesList() { return precedenceRules_; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder> getPrecedenceRulesOrBuilderList() { return precedenceRules_; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ @java.lang.Override public int getPrecedenceRulesCount() { return precedenceRules_.size(); } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule getPrecedenceRules( int index) { return precedenceRules_.get(index); } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder getPrecedenceRulesOrBuilder(int index) { return precedenceRules_.get(index); } public static final int BREAK_RULES_FIELD_NUMBER = 15; private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule> breakRules_; /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Override @java.lang.Deprecated public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule> getBreakRulesList() { return breakRules_; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Override @java.lang.Deprecated public java.util.List<? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder> getBreakRulesOrBuilderList() { return breakRules_; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Override @java.lang.Deprecated public int getBreakRulesCount() { return breakRules_.size(); } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Override @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRule getBreakRules(int index) { return breakRules_.get(index); } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Override @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder getBreakRulesOrBuilder( int index) { return breakRules_.get(index); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < shipments_.size(); i++) { output.writeMessage(1, shipments_.get(i)); } for (int i = 0; i < vehicles_.size(); i++) { output.writeMessage(2, vehicles_.get(i)); } if (((bitField0_ & 0x00000001) != 0)) { output.writeInt32(4, maxActiveVehicles_); } if (globalStartTime_ != null) { output.writeMessage(5, getGlobalStartTime()); } if (globalEndTime_ != null) { output.writeMessage(6, getGlobalEndTime()); } if (java.lang.Double.doubleToRawLongBits(globalDurationCostPerHour_) != 0) { output.writeDouble(7, globalDurationCostPerHour_); } for (int i = 0; i < durationDistanceMatrices_.size(); i++) { output.writeMessage(8, durationDistanceMatrices_.get(i)); } for (int i = 0; i < durationDistanceMatrixSrcTags_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString( output, 9, durationDistanceMatrixSrcTags_.getRaw(i)); } for (int i = 0; i < durationDistanceMatrixDstTags_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString( output, 10, durationDistanceMatrixDstTags_.getRaw(i)); } for (int i = 0; i < transitionAttributes_.size(); i++) { output.writeMessage(11, transitionAttributes_.get(i)); } for (int i = 0; i < shipmentTypeIncompatibilities_.size(); i++) { output.writeMessage(12, shipmentTypeIncompatibilities_.get(i)); } for (int i = 0; i < shipmentTypeRequirements_.size(); i++) { output.writeMessage(13, shipmentTypeRequirements_.get(i)); } for (int i = 0; i < precedenceRules_.size(); i++) { output.writeMessage(14, precedenceRules_.get(i)); } for (int i = 0; i < breakRules_.size(); i++) { output.writeMessage(15, breakRules_.get(i)); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < shipments_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, shipments_.get(i)); } for (int i = 0; i < vehicles_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, vehicles_.get(i)); } if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, maxActiveVehicles_); } if (globalStartTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getGlobalStartTime()); } if (globalEndTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getGlobalEndTime()); } if (java.lang.Double.doubleToRawLongBits(globalDurationCostPerHour_) != 0) { size += com.google.protobuf.CodedOutputStream.computeDoubleSize(7, globalDurationCostPerHour_); } for (int i = 0; i < durationDistanceMatrices_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 8, durationDistanceMatrices_.get(i)); } { int dataSize = 0; for (int i = 0; i < durationDistanceMatrixSrcTags_.size(); i++) { dataSize += computeStringSizeNoTag(durationDistanceMatrixSrcTags_.getRaw(i)); } size += dataSize; size += 1 * getDurationDistanceMatrixSrcTagsList().size(); } { int dataSize = 0; for (int i = 0; i < durationDistanceMatrixDstTags_.size(); i++) { dataSize += computeStringSizeNoTag(durationDistanceMatrixDstTags_.getRaw(i)); } size += dataSize; size += 1 * getDurationDistanceMatrixDstTagsList().size(); } for (int i = 0; i < transitionAttributes_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 11, transitionAttributes_.get(i)); } for (int i = 0; i < shipmentTypeIncompatibilities_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 12, shipmentTypeIncompatibilities_.get(i)); } for (int i = 0; i < shipmentTypeRequirements_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 13, shipmentTypeRequirements_.get(i)); } for (int i = 0; i < precedenceRules_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, precedenceRules_.get(i)); } for (int i = 0; i < breakRules_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(15, breakRules_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.optimization.v1.ShipmentModel)) { return super.equals(obj); } com.google.cloud.optimization.v1.ShipmentModel other = (com.google.cloud.optimization.v1.ShipmentModel) obj; if (!getShipmentsList().equals(other.getShipmentsList())) return false; if (!getVehiclesList().equals(other.getVehiclesList())) return false; if (hasMaxActiveVehicles() != other.hasMaxActiveVehicles()) return false; if (hasMaxActiveVehicles()) { if (getMaxActiveVehicles() != other.getMaxActiveVehicles()) return false; } if (hasGlobalStartTime() != other.hasGlobalStartTime()) return false; if (hasGlobalStartTime()) { if (!getGlobalStartTime().equals(other.getGlobalStartTime())) return false; } if (hasGlobalEndTime() != other.hasGlobalEndTime()) return false; if (hasGlobalEndTime()) { if (!getGlobalEndTime().equals(other.getGlobalEndTime())) return false; } if (java.lang.Double.doubleToLongBits(getGlobalDurationCostPerHour()) != java.lang.Double.doubleToLongBits(other.getGlobalDurationCostPerHour())) return false; if (!getDurationDistanceMatricesList().equals(other.getDurationDistanceMatricesList())) return false; if (!getDurationDistanceMatrixSrcTagsList() .equals(other.getDurationDistanceMatrixSrcTagsList())) return false; if (!getDurationDistanceMatrixDstTagsList() .equals(other.getDurationDistanceMatrixDstTagsList())) return false; if (!getTransitionAttributesList().equals(other.getTransitionAttributesList())) return false; if (!getShipmentTypeIncompatibilitiesList() .equals(other.getShipmentTypeIncompatibilitiesList())) return false; if (!getShipmentTypeRequirementsList().equals(other.getShipmentTypeRequirementsList())) return false; if (!getPrecedenceRulesList().equals(other.getPrecedenceRulesList())) return false; if (!getBreakRulesList().equals(other.getBreakRulesList())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getShipmentsCount() > 0) { hash = (37 * hash) + SHIPMENTS_FIELD_NUMBER; hash = (53 * hash) + getShipmentsList().hashCode(); } if (getVehiclesCount() > 0) { hash = (37 * hash) + VEHICLES_FIELD_NUMBER; hash = (53 * hash) + getVehiclesList().hashCode(); } if (hasMaxActiveVehicles()) { hash = (37 * hash) + MAX_ACTIVE_VEHICLES_FIELD_NUMBER; hash = (53 * hash) + getMaxActiveVehicles(); } if (hasGlobalStartTime()) { hash = (37 * hash) + GLOBAL_START_TIME_FIELD_NUMBER; hash = (53 * hash) + getGlobalStartTime().hashCode(); } if (hasGlobalEndTime()) { hash = (37 * hash) + GLOBAL_END_TIME_FIELD_NUMBER; hash = (53 * hash) + getGlobalEndTime().hashCode(); } hash = (37 * hash) + GLOBAL_DURATION_COST_PER_HOUR_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( java.lang.Double.doubleToLongBits(getGlobalDurationCostPerHour())); if (getDurationDistanceMatricesCount() > 0) { hash = (37 * hash) + DURATION_DISTANCE_MATRICES_FIELD_NUMBER; hash = (53 * hash) + getDurationDistanceMatricesList().hashCode(); } if (getDurationDistanceMatrixSrcTagsCount() > 0) { hash = (37 * hash) + DURATION_DISTANCE_MATRIX_SRC_TAGS_FIELD_NUMBER; hash = (53 * hash) + getDurationDistanceMatrixSrcTagsList().hashCode(); } if (getDurationDistanceMatrixDstTagsCount() > 0) { hash = (37 * hash) + DURATION_DISTANCE_MATRIX_DST_TAGS_FIELD_NUMBER; hash = (53 * hash) + getDurationDistanceMatrixDstTagsList().hashCode(); } if (getTransitionAttributesCount() > 0) { hash = (37 * hash) + TRANSITION_ATTRIBUTES_FIELD_NUMBER; hash = (53 * hash) + getTransitionAttributesList().hashCode(); } if (getShipmentTypeIncompatibilitiesCount() > 0) { hash = (37 * hash) + SHIPMENT_TYPE_INCOMPATIBILITIES_FIELD_NUMBER; hash = (53 * hash) + getShipmentTypeIncompatibilitiesList().hashCode(); } if (getShipmentTypeRequirementsCount() > 0) { hash = (37 * hash) + SHIPMENT_TYPE_REQUIREMENTS_FIELD_NUMBER; hash = (53 * hash) + getShipmentTypeRequirementsList().hashCode(); } if (getPrecedenceRulesCount() > 0) { hash = (37 * hash) + PRECEDENCE_RULES_FIELD_NUMBER; hash = (53 * hash) + getPrecedenceRulesList().hashCode(); } if (getBreakRulesCount() > 0) { hash = (37 * hash) + BREAK_RULES_FIELD_NUMBER; hash = (53 * hash) + getBreakRulesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.optimization.v1.ShipmentModel parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.optimization.v1.ShipmentModel prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * A shipment model contains a set of shipments which must be performed by a * set of vehicles, while minimizing the overall cost, which is the sum of: * * the cost of routing the vehicles (sum of cost per total time, cost per * travel time, and fixed cost over all vehicles). * * the unperformed shipment penalties. * * the cost of the global duration of the shipments * </pre> * * Protobuf type {@code google.cloud.optimization.v1.ShipmentModel} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.optimization.v1.ShipmentModel) com.google.cloud.optimization.v1.ShipmentModelOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.optimization.v1.ShipmentModel.class, com.google.cloud.optimization.v1.ShipmentModel.Builder.class); } // Construct using com.google.cloud.optimization.v1.ShipmentModel.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getShipmentsFieldBuilder(); getVehiclesFieldBuilder(); getDurationDistanceMatricesFieldBuilder(); getTransitionAttributesFieldBuilder(); getShipmentTypeIncompatibilitiesFieldBuilder(); getShipmentTypeRequirementsFieldBuilder(); getPrecedenceRulesFieldBuilder(); getBreakRulesFieldBuilder(); } } @java.lang.Override public Builder clear() { super.clear(); if (shipmentsBuilder_ == null) { shipments_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { shipmentsBuilder_.clear(); } if (vehiclesBuilder_ == null) { vehicles_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { vehiclesBuilder_.clear(); } maxActiveVehicles_ = 0; bitField0_ = (bitField0_ & ~0x00000004); if (globalStartTimeBuilder_ == null) { globalStartTime_ = null; } else { globalStartTime_ = null; globalStartTimeBuilder_ = null; } if (globalEndTimeBuilder_ == null) { globalEndTime_ = null; } else { globalEndTime_ = null; globalEndTimeBuilder_ = null; } globalDurationCostPerHour_ = 0D; if (durationDistanceMatricesBuilder_ == null) { durationDistanceMatrices_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); } else { durationDistanceMatricesBuilder_.clear(); } durationDistanceMatrixSrcTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); durationDistanceMatrixDstTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000020); if (transitionAttributesBuilder_ == null) { transitionAttributes_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000040); } else { transitionAttributesBuilder_.clear(); } if (shipmentTypeIncompatibilitiesBuilder_ == null) { shipmentTypeIncompatibilities_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000080); } else { shipmentTypeIncompatibilitiesBuilder_.clear(); } if (shipmentTypeRequirementsBuilder_ == null) { shipmentTypeRequirements_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); } else { shipmentTypeRequirementsBuilder_.clear(); } if (precedenceRulesBuilder_ == null) { precedenceRules_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000200); } else { precedenceRulesBuilder_.clear(); } if (breakRulesBuilder_ == null) { breakRules_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000400); } else { breakRulesBuilder_.clear(); } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.optimization.v1.FleetRoutingProto .internal_static_google_cloud_optimization_v1_ShipmentModel_descriptor; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel getDefaultInstanceForType() { return com.google.cloud.optimization.v1.ShipmentModel.getDefaultInstance(); } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel build() { com.google.cloud.optimization.v1.ShipmentModel result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel buildPartial() { com.google.cloud.optimization.v1.ShipmentModel result = new com.google.cloud.optimization.v1.ShipmentModel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (shipmentsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { shipments_ = java.util.Collections.unmodifiableList(shipments_); bitField0_ = (bitField0_ & ~0x00000001); } result.shipments_ = shipments_; } else { result.shipments_ = shipmentsBuilder_.build(); } if (vehiclesBuilder_ == null) { if (((bitField0_ & 0x00000002) != 0)) { vehicles_ = java.util.Collections.unmodifiableList(vehicles_); bitField0_ = (bitField0_ & ~0x00000002); } result.vehicles_ = vehicles_; } else { result.vehicles_ = vehiclesBuilder_.build(); } if (((from_bitField0_ & 0x00000004) != 0)) { result.maxActiveVehicles_ = maxActiveVehicles_; to_bitField0_ |= 0x00000001; } if (globalStartTimeBuilder_ == null) { result.globalStartTime_ = globalStartTime_; } else { result.globalStartTime_ = globalStartTimeBuilder_.build(); } if (globalEndTimeBuilder_ == null) { result.globalEndTime_ = globalEndTime_; } else { result.globalEndTime_ = globalEndTimeBuilder_.build(); } result.globalDurationCostPerHour_ = globalDurationCostPerHour_; if (durationDistanceMatricesBuilder_ == null) { if (((bitField0_ & 0x00000008) != 0)) { durationDistanceMatrices_ = java.util.Collections.unmodifiableList(durationDistanceMatrices_); bitField0_ = (bitField0_ & ~0x00000008); } result.durationDistanceMatrices_ = durationDistanceMatrices_; } else { result.durationDistanceMatrices_ = durationDistanceMatricesBuilder_.build(); } if (((bitField0_ & 0x00000010) != 0)) { durationDistanceMatrixSrcTags_ = durationDistanceMatrixSrcTags_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000010); } result.durationDistanceMatrixSrcTags_ = durationDistanceMatrixSrcTags_; if (((bitField0_ & 0x00000020) != 0)) { durationDistanceMatrixDstTags_ = durationDistanceMatrixDstTags_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000020); } result.durationDistanceMatrixDstTags_ = durationDistanceMatrixDstTags_; if (transitionAttributesBuilder_ == null) { if (((bitField0_ & 0x00000040) != 0)) { transitionAttributes_ = java.util.Collections.unmodifiableList(transitionAttributes_); bitField0_ = (bitField0_ & ~0x00000040); } result.transitionAttributes_ = transitionAttributes_; } else { result.transitionAttributes_ = transitionAttributesBuilder_.build(); } if (shipmentTypeIncompatibilitiesBuilder_ == null) { if (((bitField0_ & 0x00000080) != 0)) { shipmentTypeIncompatibilities_ = java.util.Collections.unmodifiableList(shipmentTypeIncompatibilities_); bitField0_ = (bitField0_ & ~0x00000080); } result.shipmentTypeIncompatibilities_ = shipmentTypeIncompatibilities_; } else { result.shipmentTypeIncompatibilities_ = shipmentTypeIncompatibilitiesBuilder_.build(); } if (shipmentTypeRequirementsBuilder_ == null) { if (((bitField0_ & 0x00000100) != 0)) { shipmentTypeRequirements_ = java.util.Collections.unmodifiableList(shipmentTypeRequirements_); bitField0_ = (bitField0_ & ~0x00000100); } result.shipmentTypeRequirements_ = shipmentTypeRequirements_; } else { result.shipmentTypeRequirements_ = shipmentTypeRequirementsBuilder_.build(); } if (precedenceRulesBuilder_ == null) { if (((bitField0_ & 0x00000200) != 0)) { precedenceRules_ = java.util.Collections.unmodifiableList(precedenceRules_); bitField0_ = (bitField0_ & ~0x00000200); } result.precedenceRules_ = precedenceRules_; } else { result.precedenceRules_ = precedenceRulesBuilder_.build(); } if (breakRulesBuilder_ == null) { if (((bitField0_ & 0x00000400) != 0)) { breakRules_ = java.util.Collections.unmodifiableList(breakRules_); bitField0_ = (bitField0_ & ~0x00000400); } result.breakRules_ = breakRules_; } else { result.breakRules_ = breakRulesBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.optimization.v1.ShipmentModel) { return mergeFrom((com.google.cloud.optimization.v1.ShipmentModel) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.optimization.v1.ShipmentModel other) { if (other == com.google.cloud.optimization.v1.ShipmentModel.getDefaultInstance()) return this; if (shipmentsBuilder_ == null) { if (!other.shipments_.isEmpty()) { if (shipments_.isEmpty()) { shipments_ = other.shipments_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureShipmentsIsMutable(); shipments_.addAll(other.shipments_); } onChanged(); } } else { if (!other.shipments_.isEmpty()) { if (shipmentsBuilder_.isEmpty()) { shipmentsBuilder_.dispose(); shipmentsBuilder_ = null; shipments_ = other.shipments_; bitField0_ = (bitField0_ & ~0x00000001); shipmentsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getShipmentsFieldBuilder() : null; } else { shipmentsBuilder_.addAllMessages(other.shipments_); } } } if (vehiclesBuilder_ == null) { if (!other.vehicles_.isEmpty()) { if (vehicles_.isEmpty()) { vehicles_ = other.vehicles_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureVehiclesIsMutable(); vehicles_.addAll(other.vehicles_); } onChanged(); } } else { if (!other.vehicles_.isEmpty()) { if (vehiclesBuilder_.isEmpty()) { vehiclesBuilder_.dispose(); vehiclesBuilder_ = null; vehicles_ = other.vehicles_; bitField0_ = (bitField0_ & ~0x00000002); vehiclesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getVehiclesFieldBuilder() : null; } else { vehiclesBuilder_.addAllMessages(other.vehicles_); } } } if (other.hasMaxActiveVehicles()) { setMaxActiveVehicles(other.getMaxActiveVehicles()); } if (other.hasGlobalStartTime()) { mergeGlobalStartTime(other.getGlobalStartTime()); } if (other.hasGlobalEndTime()) { mergeGlobalEndTime(other.getGlobalEndTime()); } if (other.getGlobalDurationCostPerHour() != 0D) { setGlobalDurationCostPerHour(other.getGlobalDurationCostPerHour()); } if (durationDistanceMatricesBuilder_ == null) { if (!other.durationDistanceMatrices_.isEmpty()) { if (durationDistanceMatrices_.isEmpty()) { durationDistanceMatrices_ = other.durationDistanceMatrices_; bitField0_ = (bitField0_ & ~0x00000008); } else { ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.addAll(other.durationDistanceMatrices_); } onChanged(); } } else { if (!other.durationDistanceMatrices_.isEmpty()) { if (durationDistanceMatricesBuilder_.isEmpty()) { durationDistanceMatricesBuilder_.dispose(); durationDistanceMatricesBuilder_ = null; durationDistanceMatrices_ = other.durationDistanceMatrices_; bitField0_ = (bitField0_ & ~0x00000008); durationDistanceMatricesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getDurationDistanceMatricesFieldBuilder() : null; } else { durationDistanceMatricesBuilder_.addAllMessages(other.durationDistanceMatrices_); } } } if (!other.durationDistanceMatrixSrcTags_.isEmpty()) { if (durationDistanceMatrixSrcTags_.isEmpty()) { durationDistanceMatrixSrcTags_ = other.durationDistanceMatrixSrcTags_; bitField0_ = (bitField0_ & ~0x00000010); } else { ensureDurationDistanceMatrixSrcTagsIsMutable(); durationDistanceMatrixSrcTags_.addAll(other.durationDistanceMatrixSrcTags_); } onChanged(); } if (!other.durationDistanceMatrixDstTags_.isEmpty()) { if (durationDistanceMatrixDstTags_.isEmpty()) { durationDistanceMatrixDstTags_ = other.durationDistanceMatrixDstTags_; bitField0_ = (bitField0_ & ~0x00000020); } else { ensureDurationDistanceMatrixDstTagsIsMutable(); durationDistanceMatrixDstTags_.addAll(other.durationDistanceMatrixDstTags_); } onChanged(); } if (transitionAttributesBuilder_ == null) { if (!other.transitionAttributes_.isEmpty()) { if (transitionAttributes_.isEmpty()) { transitionAttributes_ = other.transitionAttributes_; bitField0_ = (bitField0_ & ~0x00000040); } else { ensureTransitionAttributesIsMutable(); transitionAttributes_.addAll(other.transitionAttributes_); } onChanged(); } } else { if (!other.transitionAttributes_.isEmpty()) { if (transitionAttributesBuilder_.isEmpty()) { transitionAttributesBuilder_.dispose(); transitionAttributesBuilder_ = null; transitionAttributes_ = other.transitionAttributes_; bitField0_ = (bitField0_ & ~0x00000040); transitionAttributesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getTransitionAttributesFieldBuilder() : null; } else { transitionAttributesBuilder_.addAllMessages(other.transitionAttributes_); } } } if (shipmentTypeIncompatibilitiesBuilder_ == null) { if (!other.shipmentTypeIncompatibilities_.isEmpty()) { if (shipmentTypeIncompatibilities_.isEmpty()) { shipmentTypeIncompatibilities_ = other.shipmentTypeIncompatibilities_; bitField0_ = (bitField0_ & ~0x00000080); } else { ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.addAll(other.shipmentTypeIncompatibilities_); } onChanged(); } } else { if (!other.shipmentTypeIncompatibilities_.isEmpty()) { if (shipmentTypeIncompatibilitiesBuilder_.isEmpty()) { shipmentTypeIncompatibilitiesBuilder_.dispose(); shipmentTypeIncompatibilitiesBuilder_ = null; shipmentTypeIncompatibilities_ = other.shipmentTypeIncompatibilities_; bitField0_ = (bitField0_ & ~0x00000080); shipmentTypeIncompatibilitiesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getShipmentTypeIncompatibilitiesFieldBuilder() : null; } else { shipmentTypeIncompatibilitiesBuilder_.addAllMessages( other.shipmentTypeIncompatibilities_); } } } if (shipmentTypeRequirementsBuilder_ == null) { if (!other.shipmentTypeRequirements_.isEmpty()) { if (shipmentTypeRequirements_.isEmpty()) { shipmentTypeRequirements_ = other.shipmentTypeRequirements_; bitField0_ = (bitField0_ & ~0x00000100); } else { ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.addAll(other.shipmentTypeRequirements_); } onChanged(); } } else { if (!other.shipmentTypeRequirements_.isEmpty()) { if (shipmentTypeRequirementsBuilder_.isEmpty()) { shipmentTypeRequirementsBuilder_.dispose(); shipmentTypeRequirementsBuilder_ = null; shipmentTypeRequirements_ = other.shipmentTypeRequirements_; bitField0_ = (bitField0_ & ~0x00000100); shipmentTypeRequirementsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getShipmentTypeRequirementsFieldBuilder() : null; } else { shipmentTypeRequirementsBuilder_.addAllMessages(other.shipmentTypeRequirements_); } } } if (precedenceRulesBuilder_ == null) { if (!other.precedenceRules_.isEmpty()) { if (precedenceRules_.isEmpty()) { precedenceRules_ = other.precedenceRules_; bitField0_ = (bitField0_ & ~0x00000200); } else { ensurePrecedenceRulesIsMutable(); precedenceRules_.addAll(other.precedenceRules_); } onChanged(); } } else { if (!other.precedenceRules_.isEmpty()) { if (precedenceRulesBuilder_.isEmpty()) { precedenceRulesBuilder_.dispose(); precedenceRulesBuilder_ = null; precedenceRules_ = other.precedenceRules_; bitField0_ = (bitField0_ & ~0x00000200); precedenceRulesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getPrecedenceRulesFieldBuilder() : null; } else { precedenceRulesBuilder_.addAllMessages(other.precedenceRules_); } } } if (breakRulesBuilder_ == null) { if (!other.breakRules_.isEmpty()) { if (breakRules_.isEmpty()) { breakRules_ = other.breakRules_; bitField0_ = (bitField0_ & ~0x00000400); } else { ensureBreakRulesIsMutable(); breakRules_.addAll(other.breakRules_); } onChanged(); } } else { if (!other.breakRules_.isEmpty()) { if (breakRulesBuilder_.isEmpty()) { breakRulesBuilder_.dispose(); breakRulesBuilder_ = null; breakRules_ = other.breakRules_; bitField0_ = (bitField0_ & ~0x00000400); breakRulesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getBreakRulesFieldBuilder() : null; } else { breakRulesBuilder_.addAllMessages(other.breakRules_); } } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.optimization.v1.ShipmentModel parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.optimization.v1.ShipmentModel) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.util.List<com.google.cloud.optimization.v1.Shipment> shipments_ = java.util.Collections.emptyList(); private void ensureShipmentsIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { shipments_ = new java.util.ArrayList<com.google.cloud.optimization.v1.Shipment>(shipments_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.Shipment, com.google.cloud.optimization.v1.Shipment.Builder, com.google.cloud.optimization.v1.ShipmentOrBuilder> shipmentsBuilder_; /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public java.util.List<com.google.cloud.optimization.v1.Shipment> getShipmentsList() { if (shipmentsBuilder_ == null) { return java.util.Collections.unmodifiableList(shipments_); } else { return shipmentsBuilder_.getMessageList(); } } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public int getShipmentsCount() { if (shipmentsBuilder_ == null) { return shipments_.size(); } else { return shipmentsBuilder_.getCount(); } } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public com.google.cloud.optimization.v1.Shipment getShipments(int index) { if (shipmentsBuilder_ == null) { return shipments_.get(index); } else { return shipmentsBuilder_.getMessage(index); } } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder setShipments(int index, com.google.cloud.optimization.v1.Shipment value) { if (shipmentsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentsIsMutable(); shipments_.set(index, value); onChanged(); } else { shipmentsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder setShipments( int index, com.google.cloud.optimization.v1.Shipment.Builder builderForValue) { if (shipmentsBuilder_ == null) { ensureShipmentsIsMutable(); shipments_.set(index, builderForValue.build()); onChanged(); } else { shipmentsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder addShipments(com.google.cloud.optimization.v1.Shipment value) { if (shipmentsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentsIsMutable(); shipments_.add(value); onChanged(); } else { shipmentsBuilder_.addMessage(value); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder addShipments(int index, com.google.cloud.optimization.v1.Shipment value) { if (shipmentsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentsIsMutable(); shipments_.add(index, value); onChanged(); } else { shipmentsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder addShipments(com.google.cloud.optimization.v1.Shipment.Builder builderForValue) { if (shipmentsBuilder_ == null) { ensureShipmentsIsMutable(); shipments_.add(builderForValue.build()); onChanged(); } else { shipmentsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder addShipments( int index, com.google.cloud.optimization.v1.Shipment.Builder builderForValue) { if (shipmentsBuilder_ == null) { ensureShipmentsIsMutable(); shipments_.add(index, builderForValue.build()); onChanged(); } else { shipmentsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder addAllShipments( java.lang.Iterable<? extends com.google.cloud.optimization.v1.Shipment> values) { if (shipmentsBuilder_ == null) { ensureShipmentsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, shipments_); onChanged(); } else { shipmentsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder clearShipments() { if (shipmentsBuilder_ == null) { shipments_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { shipmentsBuilder_.clear(); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public Builder removeShipments(int index) { if (shipmentsBuilder_ == null) { ensureShipmentsIsMutable(); shipments_.remove(index); onChanged(); } else { shipmentsBuilder_.remove(index); } return this; } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public com.google.cloud.optimization.v1.Shipment.Builder getShipmentsBuilder(int index) { return getShipmentsFieldBuilder().getBuilder(index); } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public com.google.cloud.optimization.v1.ShipmentOrBuilder getShipmentsOrBuilder(int index) { if (shipmentsBuilder_ == null) { return shipments_.get(index); } else { return shipmentsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public java.util.List<? extends com.google.cloud.optimization.v1.ShipmentOrBuilder> getShipmentsOrBuilderList() { if (shipmentsBuilder_ != null) { return shipmentsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(shipments_); } } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public com.google.cloud.optimization.v1.Shipment.Builder addShipmentsBuilder() { return getShipmentsFieldBuilder() .addBuilder(com.google.cloud.optimization.v1.Shipment.getDefaultInstance()); } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public com.google.cloud.optimization.v1.Shipment.Builder addShipmentsBuilder(int index) { return getShipmentsFieldBuilder() .addBuilder(index, com.google.cloud.optimization.v1.Shipment.getDefaultInstance()); } /** * * * <pre> * Set of shipments which must be performed in the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.Shipment shipments = 1;</code> */ public java.util.List<com.google.cloud.optimization.v1.Shipment.Builder> getShipmentsBuilderList() { return getShipmentsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.Shipment, com.google.cloud.optimization.v1.Shipment.Builder, com.google.cloud.optimization.v1.ShipmentOrBuilder> getShipmentsFieldBuilder() { if (shipmentsBuilder_ == null) { shipmentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.Shipment, com.google.cloud.optimization.v1.Shipment.Builder, com.google.cloud.optimization.v1.ShipmentOrBuilder>( shipments_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); shipments_ = null; } return shipmentsBuilder_; } private java.util.List<com.google.cloud.optimization.v1.Vehicle> vehicles_ = java.util.Collections.emptyList(); private void ensureVehiclesIsMutable() { if (!((bitField0_ & 0x00000002) != 0)) { vehicles_ = new java.util.ArrayList<com.google.cloud.optimization.v1.Vehicle>(vehicles_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.Vehicle, com.google.cloud.optimization.v1.Vehicle.Builder, com.google.cloud.optimization.v1.VehicleOrBuilder> vehiclesBuilder_; /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public java.util.List<com.google.cloud.optimization.v1.Vehicle> getVehiclesList() { if (vehiclesBuilder_ == null) { return java.util.Collections.unmodifiableList(vehicles_); } else { return vehiclesBuilder_.getMessageList(); } } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public int getVehiclesCount() { if (vehiclesBuilder_ == null) { return vehicles_.size(); } else { return vehiclesBuilder_.getCount(); } } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public com.google.cloud.optimization.v1.Vehicle getVehicles(int index) { if (vehiclesBuilder_ == null) { return vehicles_.get(index); } else { return vehiclesBuilder_.getMessage(index); } } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder setVehicles(int index, com.google.cloud.optimization.v1.Vehicle value) { if (vehiclesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureVehiclesIsMutable(); vehicles_.set(index, value); onChanged(); } else { vehiclesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder setVehicles( int index, com.google.cloud.optimization.v1.Vehicle.Builder builderForValue) { if (vehiclesBuilder_ == null) { ensureVehiclesIsMutable(); vehicles_.set(index, builderForValue.build()); onChanged(); } else { vehiclesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder addVehicles(com.google.cloud.optimization.v1.Vehicle value) { if (vehiclesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureVehiclesIsMutable(); vehicles_.add(value); onChanged(); } else { vehiclesBuilder_.addMessage(value); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder addVehicles(int index, com.google.cloud.optimization.v1.Vehicle value) { if (vehiclesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureVehiclesIsMutable(); vehicles_.add(index, value); onChanged(); } else { vehiclesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder addVehicles(com.google.cloud.optimization.v1.Vehicle.Builder builderForValue) { if (vehiclesBuilder_ == null) { ensureVehiclesIsMutable(); vehicles_.add(builderForValue.build()); onChanged(); } else { vehiclesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder addVehicles( int index, com.google.cloud.optimization.v1.Vehicle.Builder builderForValue) { if (vehiclesBuilder_ == null) { ensureVehiclesIsMutable(); vehicles_.add(index, builderForValue.build()); onChanged(); } else { vehiclesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder addAllVehicles( java.lang.Iterable<? extends com.google.cloud.optimization.v1.Vehicle> values) { if (vehiclesBuilder_ == null) { ensureVehiclesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, vehicles_); onChanged(); } else { vehiclesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder clearVehicles() { if (vehiclesBuilder_ == null) { vehicles_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { vehiclesBuilder_.clear(); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public Builder removeVehicles(int index) { if (vehiclesBuilder_ == null) { ensureVehiclesIsMutable(); vehicles_.remove(index); onChanged(); } else { vehiclesBuilder_.remove(index); } return this; } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public com.google.cloud.optimization.v1.Vehicle.Builder getVehiclesBuilder(int index) { return getVehiclesFieldBuilder().getBuilder(index); } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public com.google.cloud.optimization.v1.VehicleOrBuilder getVehiclesOrBuilder(int index) { if (vehiclesBuilder_ == null) { return vehicles_.get(index); } else { return vehiclesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public java.util.List<? extends com.google.cloud.optimization.v1.VehicleOrBuilder> getVehiclesOrBuilderList() { if (vehiclesBuilder_ != null) { return vehiclesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(vehicles_); } } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public com.google.cloud.optimization.v1.Vehicle.Builder addVehiclesBuilder() { return getVehiclesFieldBuilder() .addBuilder(com.google.cloud.optimization.v1.Vehicle.getDefaultInstance()); } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public com.google.cloud.optimization.v1.Vehicle.Builder addVehiclesBuilder(int index) { return getVehiclesFieldBuilder() .addBuilder(index, com.google.cloud.optimization.v1.Vehicle.getDefaultInstance()); } /** * * * <pre> * Set of vehicles which can be used to perform visits. * </pre> * * <code>repeated .google.cloud.optimization.v1.Vehicle vehicles = 2;</code> */ public java.util.List<com.google.cloud.optimization.v1.Vehicle.Builder> getVehiclesBuilderList() { return getVehiclesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.Vehicle, com.google.cloud.optimization.v1.Vehicle.Builder, com.google.cloud.optimization.v1.VehicleOrBuilder> getVehiclesFieldBuilder() { if (vehiclesBuilder_ == null) { vehiclesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.Vehicle, com.google.cloud.optimization.v1.Vehicle.Builder, com.google.cloud.optimization.v1.VehicleOrBuilder>( vehicles_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); vehicles_ = null; } return vehiclesBuilder_; } private int maxActiveVehicles_; /** * * * <pre> * Constrains the maximum number of active vehicles. A vehicle is active if * its route performs at least one shipment. This can be used to limit the * number of routes in the case where there are fewer drivers than * vehicles and that the fleet of vehicles is heterogeneous. The optimization * will then select the best subset of vehicles to use. * Must be strictly positive. * </pre> * * <code>optional int32 max_active_vehicles = 4;</code> * * @return Whether the maxActiveVehicles field is set. */ @java.lang.Override public boolean hasMaxActiveVehicles() { return ((bitField0_ & 0x00000004) != 0); } /** * * * <pre> * Constrains the maximum number of active vehicles. A vehicle is active if * its route performs at least one shipment. This can be used to limit the * number of routes in the case where there are fewer drivers than * vehicles and that the fleet of vehicles is heterogeneous. The optimization * will then select the best subset of vehicles to use. * Must be strictly positive. * </pre> * * <code>optional int32 max_active_vehicles = 4;</code> * * @return The maxActiveVehicles. */ @java.lang.Override public int getMaxActiveVehicles() { return maxActiveVehicles_; } /** * * * <pre> * Constrains the maximum number of active vehicles. A vehicle is active if * its route performs at least one shipment. This can be used to limit the * number of routes in the case where there are fewer drivers than * vehicles and that the fleet of vehicles is heterogeneous. The optimization * will then select the best subset of vehicles to use. * Must be strictly positive. * </pre> * * <code>optional int32 max_active_vehicles = 4;</code> * * @param value The maxActiveVehicles to set. * @return This builder for chaining. */ public Builder setMaxActiveVehicles(int value) { bitField0_ |= 0x00000004; maxActiveVehicles_ = value; onChanged(); return this; } /** * * * <pre> * Constrains the maximum number of active vehicles. A vehicle is active if * its route performs at least one shipment. This can be used to limit the * number of routes in the case where there are fewer drivers than * vehicles and that the fleet of vehicles is heterogeneous. The optimization * will then select the best subset of vehicles to use. * Must be strictly positive. * </pre> * * <code>optional int32 max_active_vehicles = 4;</code> * * @return This builder for chaining. */ public Builder clearMaxActiveVehicles() { bitField0_ = (bitField0_ & ~0x00000004); maxActiveVehicles_ = 0; onChanged(); return this; } private com.google.protobuf.Timestamp globalStartTime_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> globalStartTimeBuilder_; /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> * * @return Whether the globalStartTime field is set. */ public boolean hasGlobalStartTime() { return globalStartTimeBuilder_ != null || globalStartTime_ != null; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> * * @return The globalStartTime. */ public com.google.protobuf.Timestamp getGlobalStartTime() { if (globalStartTimeBuilder_ == null) { return globalStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : globalStartTime_; } else { return globalStartTimeBuilder_.getMessage(); } } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ public Builder setGlobalStartTime(com.google.protobuf.Timestamp value) { if (globalStartTimeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } globalStartTime_ = value; onChanged(); } else { globalStartTimeBuilder_.setMessage(value); } return this; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ public Builder setGlobalStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (globalStartTimeBuilder_ == null) { globalStartTime_ = builderForValue.build(); onChanged(); } else { globalStartTimeBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ public Builder mergeGlobalStartTime(com.google.protobuf.Timestamp value) { if (globalStartTimeBuilder_ == null) { if (globalStartTime_ != null) { globalStartTime_ = com.google.protobuf.Timestamp.newBuilder(globalStartTime_) .mergeFrom(value) .buildPartial(); } else { globalStartTime_ = value; } onChanged(); } else { globalStartTimeBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ public Builder clearGlobalStartTime() { if (globalStartTimeBuilder_ == null) { globalStartTime_ = null; onChanged(); } else { globalStartTime_ = null; globalStartTimeBuilder_ = null; } return this; } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ public com.google.protobuf.Timestamp.Builder getGlobalStartTimeBuilder() { onChanged(); return getGlobalStartTimeFieldBuilder().getBuilder(); } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ public com.google.protobuf.TimestampOrBuilder getGlobalStartTimeOrBuilder() { if (globalStartTimeBuilder_ != null) { return globalStartTimeBuilder_.getMessageOrBuilder(); } else { return globalStartTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : globalStartTime_; } } /** * * * <pre> * Global start and end time of the model: no times outside of this range * can be considered valid. * The model's time span must be less than a year, i.e. the `global_end_time` * and the `global_start_time` must be within 31536000 seconds of each other. * When using `cost_per_*hour` fields, you might want to set this window to a * smaller interval to increase performance (eg. if you model a single day, * you should set the global time limits to that day). * If unset, 00:00:00 UTC, January 1, 1970 (i.e. seconds: 0, nanos: 0) is used * as default. * </pre> * * <code>.google.protobuf.Timestamp global_start_time = 5;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> getGlobalStartTimeFieldBuilder() { if (globalStartTimeBuilder_ == null) { globalStartTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( getGlobalStartTime(), getParentForChildren(), isClean()); globalStartTime_ = null; } return globalStartTimeBuilder_; } private com.google.protobuf.Timestamp globalEndTime_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> globalEndTimeBuilder_; /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> * * @return Whether the globalEndTime field is set. */ public boolean hasGlobalEndTime() { return globalEndTimeBuilder_ != null || globalEndTime_ != null; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> * * @return The globalEndTime. */ public com.google.protobuf.Timestamp getGlobalEndTime() { if (globalEndTimeBuilder_ == null) { return globalEndTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : globalEndTime_; } else { return globalEndTimeBuilder_.getMessage(); } } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ public Builder setGlobalEndTime(com.google.protobuf.Timestamp value) { if (globalEndTimeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } globalEndTime_ = value; onChanged(); } else { globalEndTimeBuilder_.setMessage(value); } return this; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ public Builder setGlobalEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { if (globalEndTimeBuilder_ == null) { globalEndTime_ = builderForValue.build(); onChanged(); } else { globalEndTimeBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ public Builder mergeGlobalEndTime(com.google.protobuf.Timestamp value) { if (globalEndTimeBuilder_ == null) { if (globalEndTime_ != null) { globalEndTime_ = com.google.protobuf.Timestamp.newBuilder(globalEndTime_) .mergeFrom(value) .buildPartial(); } else { globalEndTime_ = value; } onChanged(); } else { globalEndTimeBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ public Builder clearGlobalEndTime() { if (globalEndTimeBuilder_ == null) { globalEndTime_ = null; onChanged(); } else { globalEndTime_ = null; globalEndTimeBuilder_ = null; } return this; } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ public com.google.protobuf.Timestamp.Builder getGlobalEndTimeBuilder() { onChanged(); return getGlobalEndTimeFieldBuilder().getBuilder(); } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ public com.google.protobuf.TimestampOrBuilder getGlobalEndTimeOrBuilder() { if (globalEndTimeBuilder_ != null) { return globalEndTimeBuilder_.getMessageOrBuilder(); } else { return globalEndTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : globalEndTime_; } } /** * * * <pre> * If unset, 00:00:00 UTC, January 1, 1971 (i.e. seconds: 31536000, nanos: 0) * is used as default. * </pre> * * <code>.google.protobuf.Timestamp global_end_time = 6;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> getGlobalEndTimeFieldBuilder() { if (globalEndTimeBuilder_ == null) { globalEndTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( getGlobalEndTime(), getParentForChildren(), isClean()); globalEndTime_ = null; } return globalEndTimeBuilder_; } private double globalDurationCostPerHour_; /** * * * <pre> * The "global duration" of the overall plan is the difference between the * earliest effective start time and the latest effective end time of * all vehicles. Users can assign a cost per hour to that quantity to try * and optimize for earliest job completion, for example. This cost must be in * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. * </pre> * * <code>double global_duration_cost_per_hour = 7;</code> * * @return The globalDurationCostPerHour. */ @java.lang.Override public double getGlobalDurationCostPerHour() { return globalDurationCostPerHour_; } /** * * * <pre> * The "global duration" of the overall plan is the difference between the * earliest effective start time and the latest effective end time of * all vehicles. Users can assign a cost per hour to that quantity to try * and optimize for earliest job completion, for example. This cost must be in * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. * </pre> * * <code>double global_duration_cost_per_hour = 7;</code> * * @param value The globalDurationCostPerHour to set. * @return This builder for chaining. */ public Builder setGlobalDurationCostPerHour(double value) { globalDurationCostPerHour_ = value; onChanged(); return this; } /** * * * <pre> * The "global duration" of the overall plan is the difference between the * earliest effective start time and the latest effective end time of * all vehicles. Users can assign a cost per hour to that quantity to try * and optimize for earliest job completion, for example. This cost must be in * the same unit as [Shipment.penalty_cost][google.cloud.optimization.v1.Shipment.penalty_cost]. * </pre> * * <code>double global_duration_cost_per_hour = 7;</code> * * @return This builder for chaining. */ public Builder clearGlobalDurationCostPerHour() { globalDurationCostPerHour_ = 0D; onChanged(); return this; } private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix> durationDistanceMatrices_ = java.util.Collections.emptyList(); private void ensureDurationDistanceMatricesIsMutable() { if (!((bitField0_ & 0x00000008) != 0)) { durationDistanceMatrices_ = new java.util.ArrayList< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix>( durationDistanceMatrices_); bitField0_ |= 0x00000008; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder> durationDistanceMatricesBuilder_; /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix> getDurationDistanceMatricesList() { if (durationDistanceMatricesBuilder_ == null) { return java.util.Collections.unmodifiableList(durationDistanceMatrices_); } else { return durationDistanceMatricesBuilder_.getMessageList(); } } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public int getDurationDistanceMatricesCount() { if (durationDistanceMatricesBuilder_ == null) { return durationDistanceMatrices_.size(); } else { return durationDistanceMatricesBuilder_.getCount(); } } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix getDurationDistanceMatrices(int index) { if (durationDistanceMatricesBuilder_ == null) { return durationDistanceMatrices_.get(index); } else { return durationDistanceMatricesBuilder_.getMessage(index); } } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder setDurationDistanceMatrices( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix value) { if (durationDistanceMatricesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.set(index, value); onChanged(); } else { durationDistanceMatricesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder setDurationDistanceMatrices( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder builderForValue) { if (durationDistanceMatricesBuilder_ == null) { ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.set(index, builderForValue.build()); onChanged(); } else { durationDistanceMatricesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder addDurationDistanceMatrices( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix value) { if (durationDistanceMatricesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.add(value); onChanged(); } else { durationDistanceMatricesBuilder_.addMessage(value); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder addDurationDistanceMatrices( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix value) { if (durationDistanceMatricesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.add(index, value); onChanged(); } else { durationDistanceMatricesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder addDurationDistanceMatrices( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder builderForValue) { if (durationDistanceMatricesBuilder_ == null) { ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.add(builderForValue.build()); onChanged(); } else { durationDistanceMatricesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder addDurationDistanceMatrices( int index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder builderForValue) { if (durationDistanceMatricesBuilder_ == null) { ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.add(index, builderForValue.build()); onChanged(); } else { durationDistanceMatricesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder addAllDurationDistanceMatrices( java.lang.Iterable< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix> values) { if (durationDistanceMatricesBuilder_ == null) { ensureDurationDistanceMatricesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, durationDistanceMatrices_); onChanged(); } else { durationDistanceMatricesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder clearDurationDistanceMatrices() { if (durationDistanceMatricesBuilder_ == null) { durationDistanceMatrices_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); onChanged(); } else { durationDistanceMatricesBuilder_.clear(); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public Builder removeDurationDistanceMatrices(int index) { if (durationDistanceMatricesBuilder_ == null) { ensureDurationDistanceMatricesIsMutable(); durationDistanceMatrices_.remove(index); onChanged(); } else { durationDistanceMatricesBuilder_.remove(index); } return this; } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder getDurationDistanceMatricesBuilder(int index) { return getDurationDistanceMatricesFieldBuilder().getBuilder(index); } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder getDurationDistanceMatricesOrBuilder(int index) { if (durationDistanceMatricesBuilder_ == null) { return durationDistanceMatrices_.get(index); } else { return durationDistanceMatricesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder> getDurationDistanceMatricesOrBuilderList() { if (durationDistanceMatricesBuilder_ != null) { return durationDistanceMatricesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(durationDistanceMatrices_); } } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder addDurationDistanceMatricesBuilder() { return getDurationDistanceMatricesFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .getDefaultInstance()); } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder addDurationDistanceMatricesBuilder(int index) { return getDurationDistanceMatricesFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix .getDefaultInstance()); } /** * * * <pre> * Specifies duration and distance matrices used in the model. If this field * is empty, Google Maps or geodesic distances will be used instead, depending * on the value of the `use_geodesic_distances` field. If it is not empty, * `use_geodesic_distances` cannot be true and neither * `duration_distance_matrix_src_tags` nor `duration_distance_matrix_dst_tags` * can be empty. * Usage examples: * * There are two locations: locA and locB. * * 1 vehicle starting its route at locA and ending it at locA. * * 1 pickup visit request at locB. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locA" } * shipments { pickups { tags: "locB" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_dst_tags: "locA" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrices { * rows { # from: locA * durations { seconds: 0 } meters: 0 # to: locA * durations { seconds: 100 } meters: 1000 # to: locB * } * rows { # from: locB * durations { seconds: 102 } meters: 990 # to: locA * durations { seconds: 0 } meters: 0 # to: locB * } * } * } * ``` * * There are three locations: locA, locB and locC. * * 1 vehicle starting its route at locA and ending it at locB, using * matrix "fast". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "slow". * * 1 vehicle starting its route at locB and ending it at locB, using * matrix "fast". * * 1 pickup visit request at locC. * ``` * model { * vehicles { start_tags: "locA" end_tags: "locB" start_tags: "fast" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "slow" } * vehicles { start_tags: "locB" end_tags: "locB" start_tags: "fast" } * shipments { pickups { tags: "locC" } } * duration_distance_matrix_src_tags: "locA" * duration_distance_matrix_src_tags: "locB" * duration_distance_matrix_src_tags: "locC" * duration_distance_matrix_dst_tags: "locB" * duration_distance_matrix_dst_tags: "locC" * duration_distance_matrices { * vehicle_start_tag: "fast" * rows { # from: locA * durations { seconds: 1000 } meters: 2000 # to: locB * durations { seconds: 600 } meters: 1000 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 700 } meters: 1200 # to: locC * } * rows { # from: locC * durations { seconds: 702 } meters: 1190 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * duration_distance_matrices { * vehicle_start_tag: "slow" * rows { # from: locA * durations { seconds: 1800 } meters: 2001 # to: locB * durations { seconds: 900 } meters: 1002 # to: locC * } * rows { # from: locB * durations { seconds: 0 } meters: 0 # to: locB * durations { seconds: 1000 } meters: 1202 # to: locC * } * rows { # from: locC * durations { seconds: 1001 } meters: 1195 # to: locB * durations { seconds: 0 } meters: 0 # to: locC * } * } * } * ``` * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix duration_distance_matrices = 8; * </code> */ public java.util.List< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder> getDurationDistanceMatricesBuilderList() { return getDurationDistanceMatricesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder> getDurationDistanceMatricesFieldBuilder() { if (durationDistanceMatricesBuilder_ == null) { durationDistanceMatricesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrix.Builder, com.google.cloud.optimization.v1.ShipmentModel.DurationDistanceMatrixOrBuilder>( durationDistanceMatrices_, ((bitField0_ & 0x00000008) != 0), getParentForChildren(), isClean()); durationDistanceMatrices_ = null; } return durationDistanceMatricesBuilder_; } private com.google.protobuf.LazyStringList durationDistanceMatrixSrcTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureDurationDistanceMatrixSrcTagsIsMutable() { if (!((bitField0_ & 0x00000010) != 0)) { durationDistanceMatrixSrcTags_ = new com.google.protobuf.LazyStringArrayList(durationDistanceMatrixSrcTags_); bitField0_ |= 0x00000010; } } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @return A list containing the durationDistanceMatrixSrcTags. */ public com.google.protobuf.ProtocolStringList getDurationDistanceMatrixSrcTagsList() { return durationDistanceMatrixSrcTags_.getUnmodifiableView(); } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @return The count of durationDistanceMatrixSrcTags. */ public int getDurationDistanceMatrixSrcTagsCount() { return durationDistanceMatrixSrcTags_.size(); } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param index The index of the element to return. * @return The durationDistanceMatrixSrcTags at the given index. */ public java.lang.String getDurationDistanceMatrixSrcTags(int index) { return durationDistanceMatrixSrcTags_.get(index); } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param index The index of the value to return. * @return The bytes of the durationDistanceMatrixSrcTags at the given index. */ public com.google.protobuf.ByteString getDurationDistanceMatrixSrcTagsBytes(int index) { return durationDistanceMatrixSrcTags_.getByteString(index); } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param index The index to set the value at. * @param value The durationDistanceMatrixSrcTags to set. * @return This builder for chaining. */ public Builder setDurationDistanceMatrixSrcTags(int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatrixSrcTagsIsMutable(); durationDistanceMatrixSrcTags_.set(index, value); onChanged(); return this; } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param value The durationDistanceMatrixSrcTags to add. * @return This builder for chaining. */ public Builder addDurationDistanceMatrixSrcTags(java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatrixSrcTagsIsMutable(); durationDistanceMatrixSrcTags_.add(value); onChanged(); return this; } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param values The durationDistanceMatrixSrcTags to add. * @return This builder for chaining. */ public Builder addAllDurationDistanceMatrixSrcTags( java.lang.Iterable<java.lang.String> values) { ensureDurationDistanceMatrixSrcTagsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, durationDistanceMatrixSrcTags_); onChanged(); return this; } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @return This builder for chaining. */ public Builder clearDurationDistanceMatrixSrcTags() { durationDistanceMatrixSrcTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); onChanged(); return this; } /** * * * <pre> * Tags defining the sources of the duration and distance matrices; * `duration_distance_matrices(i).rows(j)` defines durations and distances * from visits with tag `duration_distance_matrix_src_tags(j)` to other visits * in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_src_tags = 9;</code> * * @param value The bytes of the durationDistanceMatrixSrcTags to add. * @return This builder for chaining. */ public Builder addDurationDistanceMatrixSrcTagsBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); ensureDurationDistanceMatrixSrcTagsIsMutable(); durationDistanceMatrixSrcTags_.add(value); onChanged(); return this; } private com.google.protobuf.LazyStringList durationDistanceMatrixDstTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureDurationDistanceMatrixDstTagsIsMutable() { if (!((bitField0_ & 0x00000020) != 0)) { durationDistanceMatrixDstTags_ = new com.google.protobuf.LazyStringArrayList(durationDistanceMatrixDstTags_); bitField0_ |= 0x00000020; } } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @return A list containing the durationDistanceMatrixDstTags. */ public com.google.protobuf.ProtocolStringList getDurationDistanceMatrixDstTagsList() { return durationDistanceMatrixDstTags_.getUnmodifiableView(); } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @return The count of durationDistanceMatrixDstTags. */ public int getDurationDistanceMatrixDstTagsCount() { return durationDistanceMatrixDstTags_.size(); } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param index The index of the element to return. * @return The durationDistanceMatrixDstTags at the given index. */ public java.lang.String getDurationDistanceMatrixDstTags(int index) { return durationDistanceMatrixDstTags_.get(index); } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param index The index of the value to return. * @return The bytes of the durationDistanceMatrixDstTags at the given index. */ public com.google.protobuf.ByteString getDurationDistanceMatrixDstTagsBytes(int index) { return durationDistanceMatrixDstTags_.getByteString(index); } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param index The index to set the value at. * @param value The durationDistanceMatrixDstTags to set. * @return This builder for chaining. */ public Builder setDurationDistanceMatrixDstTags(int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatrixDstTagsIsMutable(); durationDistanceMatrixDstTags_.set(index, value); onChanged(); return this; } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param value The durationDistanceMatrixDstTags to add. * @return This builder for chaining. */ public Builder addDurationDistanceMatrixDstTags(java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureDurationDistanceMatrixDstTagsIsMutable(); durationDistanceMatrixDstTags_.add(value); onChanged(); return this; } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param values The durationDistanceMatrixDstTags to add. * @return This builder for chaining. */ public Builder addAllDurationDistanceMatrixDstTags( java.lang.Iterable<java.lang.String> values) { ensureDurationDistanceMatrixDstTagsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, durationDistanceMatrixDstTags_); onChanged(); return this; } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @return This builder for chaining. */ public Builder clearDurationDistanceMatrixDstTags() { durationDistanceMatrixDstTags_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000020); onChanged(); return this; } /** * * * <pre> * Tags defining the destinations of the duration and distance matrices; * `duration_distance_matrices(i).rows(j).durations(k)` (resp. * `duration_distance_matrices(i).rows(j).meters(k))` defines the duration * (resp. the distance) of the travel from visits with tag * `duration_distance_matrix_src_tags(j)` to visits with tag * `duration_distance_matrix_dst_tags(k)` in matrix i. * Tags correspond to * [VisitRequest.tags][google.cloud.optimization.v1.Shipment.VisitRequest.tags] * or [Vehicle.start_tags][google.cloud.optimization.v1.Vehicle.start_tags]. * A given `VisitRequest` or `Vehicle` must match exactly one tag in this * field. Note that a `Vehicle`'s source, destination and matrix tags may be * the same; similarly a `VisitRequest`'s source and destination tags may be * the same. All tags must be different and cannot be empty strings. If this * field is not empty, then `duration_distance_matrices` must not be empty. * </pre> * * <code>repeated string duration_distance_matrix_dst_tags = 10;</code> * * @param value The bytes of the durationDistanceMatrixDstTags to add. * @return This builder for chaining. */ public Builder addDurationDistanceMatrixDstTagsBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); ensureDurationDistanceMatrixDstTagsIsMutable(); durationDistanceMatrixDstTags_.add(value); onChanged(); return this; } private java.util.List<com.google.cloud.optimization.v1.TransitionAttributes> transitionAttributes_ = java.util.Collections.emptyList(); private void ensureTransitionAttributesIsMutable() { if (!((bitField0_ & 0x00000040) != 0)) { transitionAttributes_ = new java.util.ArrayList<com.google.cloud.optimization.v1.TransitionAttributes>( transitionAttributes_); bitField0_ |= 0x00000040; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.TransitionAttributes, com.google.cloud.optimization.v1.TransitionAttributes.Builder, com.google.cloud.optimization.v1.TransitionAttributesOrBuilder> transitionAttributesBuilder_; /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public java.util.List<com.google.cloud.optimization.v1.TransitionAttributes> getTransitionAttributesList() { if (transitionAttributesBuilder_ == null) { return java.util.Collections.unmodifiableList(transitionAttributes_); } else { return transitionAttributesBuilder_.getMessageList(); } } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public int getTransitionAttributesCount() { if (transitionAttributesBuilder_ == null) { return transitionAttributes_.size(); } else { return transitionAttributesBuilder_.getCount(); } } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public com.google.cloud.optimization.v1.TransitionAttributes getTransitionAttributes( int index) { if (transitionAttributesBuilder_ == null) { return transitionAttributes_.get(index); } else { return transitionAttributesBuilder_.getMessage(index); } } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder setTransitionAttributes( int index, com.google.cloud.optimization.v1.TransitionAttributes value) { if (transitionAttributesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTransitionAttributesIsMutable(); transitionAttributes_.set(index, value); onChanged(); } else { transitionAttributesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder setTransitionAttributes( int index, com.google.cloud.optimization.v1.TransitionAttributes.Builder builderForValue) { if (transitionAttributesBuilder_ == null) { ensureTransitionAttributesIsMutable(); transitionAttributes_.set(index, builderForValue.build()); onChanged(); } else { transitionAttributesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder addTransitionAttributes( com.google.cloud.optimization.v1.TransitionAttributes value) { if (transitionAttributesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTransitionAttributesIsMutable(); transitionAttributes_.add(value); onChanged(); } else { transitionAttributesBuilder_.addMessage(value); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder addTransitionAttributes( int index, com.google.cloud.optimization.v1.TransitionAttributes value) { if (transitionAttributesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTransitionAttributesIsMutable(); transitionAttributes_.add(index, value); onChanged(); } else { transitionAttributesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder addTransitionAttributes( com.google.cloud.optimization.v1.TransitionAttributes.Builder builderForValue) { if (transitionAttributesBuilder_ == null) { ensureTransitionAttributesIsMutable(); transitionAttributes_.add(builderForValue.build()); onChanged(); } else { transitionAttributesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder addTransitionAttributes( int index, com.google.cloud.optimization.v1.TransitionAttributes.Builder builderForValue) { if (transitionAttributesBuilder_ == null) { ensureTransitionAttributesIsMutable(); transitionAttributes_.add(index, builderForValue.build()); onChanged(); } else { transitionAttributesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder addAllTransitionAttributes( java.lang.Iterable<? extends com.google.cloud.optimization.v1.TransitionAttributes> values) { if (transitionAttributesBuilder_ == null) { ensureTransitionAttributesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, transitionAttributes_); onChanged(); } else { transitionAttributesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder clearTransitionAttributes() { if (transitionAttributesBuilder_ == null) { transitionAttributes_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000040); onChanged(); } else { transitionAttributesBuilder_.clear(); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public Builder removeTransitionAttributes(int index) { if (transitionAttributesBuilder_ == null) { ensureTransitionAttributesIsMutable(); transitionAttributes_.remove(index); onChanged(); } else { transitionAttributesBuilder_.remove(index); } return this; } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public com.google.cloud.optimization.v1.TransitionAttributes.Builder getTransitionAttributesBuilder(int index) { return getTransitionAttributesFieldBuilder().getBuilder(index); } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public com.google.cloud.optimization.v1.TransitionAttributesOrBuilder getTransitionAttributesOrBuilder(int index) { if (transitionAttributesBuilder_ == null) { return transitionAttributes_.get(index); } else { return transitionAttributesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public java.util.List<? extends com.google.cloud.optimization.v1.TransitionAttributesOrBuilder> getTransitionAttributesOrBuilderList() { if (transitionAttributesBuilder_ != null) { return transitionAttributesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(transitionAttributes_); } } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public com.google.cloud.optimization.v1.TransitionAttributes.Builder addTransitionAttributesBuilder() { return getTransitionAttributesFieldBuilder() .addBuilder(com.google.cloud.optimization.v1.TransitionAttributes.getDefaultInstance()); } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public com.google.cloud.optimization.v1.TransitionAttributes.Builder addTransitionAttributesBuilder(int index) { return getTransitionAttributesFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.TransitionAttributes.getDefaultInstance()); } /** * * * <pre> * Transition attributes added to the model. * </pre> * * <code>repeated .google.cloud.optimization.v1.TransitionAttributes transition_attributes = 11; * </code> */ public java.util.List<com.google.cloud.optimization.v1.TransitionAttributes.Builder> getTransitionAttributesBuilderList() { return getTransitionAttributesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.TransitionAttributes, com.google.cloud.optimization.v1.TransitionAttributes.Builder, com.google.cloud.optimization.v1.TransitionAttributesOrBuilder> getTransitionAttributesFieldBuilder() { if (transitionAttributesBuilder_ == null) { transitionAttributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.TransitionAttributes, com.google.cloud.optimization.v1.TransitionAttributes.Builder, com.google.cloud.optimization.v1.TransitionAttributesOrBuilder>( transitionAttributes_, ((bitField0_ & 0x00000040) != 0), getParentForChildren(), isClean()); transitionAttributes_ = null; } return transitionAttributesBuilder_; } private java.util.List<com.google.cloud.optimization.v1.ShipmentTypeIncompatibility> shipmentTypeIncompatibilities_ = java.util.Collections.emptyList(); private void ensureShipmentTypeIncompatibilitiesIsMutable() { if (!((bitField0_ & 0x00000080) != 0)) { shipmentTypeIncompatibilities_ = new java.util.ArrayList<com.google.cloud.optimization.v1.ShipmentTypeIncompatibility>( shipmentTypeIncompatibilities_); bitField0_ |= 0x00000080; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentTypeIncompatibility, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder, com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder> shipmentTypeIncompatibilitiesBuilder_; /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentTypeIncompatibility> getShipmentTypeIncompatibilitiesList() { if (shipmentTypeIncompatibilitiesBuilder_ == null) { return java.util.Collections.unmodifiableList(shipmentTypeIncompatibilities_); } else { return shipmentTypeIncompatibilitiesBuilder_.getMessageList(); } } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public int getShipmentTypeIncompatibilitiesCount() { if (shipmentTypeIncompatibilitiesBuilder_ == null) { return shipmentTypeIncompatibilities_.size(); } else { return shipmentTypeIncompatibilitiesBuilder_.getCount(); } } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeIncompatibility getShipmentTypeIncompatibilities(int index) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { return shipmentTypeIncompatibilities_.get(index); } else { return shipmentTypeIncompatibilitiesBuilder_.getMessage(index); } } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder setShipmentTypeIncompatibilities( int index, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility value) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.set(index, value); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder setShipmentTypeIncompatibilities( int index, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder builderForValue) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.set(index, builderForValue.build()); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder addShipmentTypeIncompatibilities( com.google.cloud.optimization.v1.ShipmentTypeIncompatibility value) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.add(value); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.addMessage(value); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder addShipmentTypeIncompatibilities( int index, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility value) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.add(index, value); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder addShipmentTypeIncompatibilities( com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder builderForValue) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.add(builderForValue.build()); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder addShipmentTypeIncompatibilities( int index, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder builderForValue) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.add(index, builderForValue.build()); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder addAllShipmentTypeIncompatibilities( java.lang.Iterable<? extends com.google.cloud.optimization.v1.ShipmentTypeIncompatibility> values) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { ensureShipmentTypeIncompatibilitiesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, shipmentTypeIncompatibilities_); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder clearShipmentTypeIncompatibilities() { if (shipmentTypeIncompatibilitiesBuilder_ == null) { shipmentTypeIncompatibilities_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000080); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.clear(); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public Builder removeShipmentTypeIncompatibilities(int index) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { ensureShipmentTypeIncompatibilitiesIsMutable(); shipmentTypeIncompatibilities_.remove(index); onChanged(); } else { shipmentTypeIncompatibilitiesBuilder_.remove(index); } return this; } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder getShipmentTypeIncompatibilitiesBuilder(int index) { return getShipmentTypeIncompatibilitiesFieldBuilder().getBuilder(index); } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder getShipmentTypeIncompatibilitiesOrBuilder(int index) { if (shipmentTypeIncompatibilitiesBuilder_ == null) { return shipmentTypeIncompatibilities_.get(index); } else { return shipmentTypeIncompatibilitiesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder> getShipmentTypeIncompatibilitiesOrBuilderList() { if (shipmentTypeIncompatibilitiesBuilder_ != null) { return shipmentTypeIncompatibilitiesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(shipmentTypeIncompatibilities_); } } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder addShipmentTypeIncompatibilitiesBuilder() { return getShipmentTypeIncompatibilitiesFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.getDefaultInstance()); } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder addShipmentTypeIncompatibilitiesBuilder(int index) { return getShipmentTypeIncompatibilitiesFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.getDefaultInstance()); } /** * * * <pre> * Sets of incompatible shipment_types (see `ShipmentTypeIncompatibility`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeIncompatibility shipment_type_incompatibilities = 12; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder> getShipmentTypeIncompatibilitiesBuilderList() { return getShipmentTypeIncompatibilitiesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentTypeIncompatibility, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder, com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder> getShipmentTypeIncompatibilitiesFieldBuilder() { if (shipmentTypeIncompatibilitiesBuilder_ == null) { shipmentTypeIncompatibilitiesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentTypeIncompatibility, com.google.cloud.optimization.v1.ShipmentTypeIncompatibility.Builder, com.google.cloud.optimization.v1.ShipmentTypeIncompatibilityOrBuilder>( shipmentTypeIncompatibilities_, ((bitField0_ & 0x00000080) != 0), getParentForChildren(), isClean()); shipmentTypeIncompatibilities_ = null; } return shipmentTypeIncompatibilitiesBuilder_; } private java.util.List<com.google.cloud.optimization.v1.ShipmentTypeRequirement> shipmentTypeRequirements_ = java.util.Collections.emptyList(); private void ensureShipmentTypeRequirementsIsMutable() { if (!((bitField0_ & 0x00000100) != 0)) { shipmentTypeRequirements_ = new java.util.ArrayList<com.google.cloud.optimization.v1.ShipmentTypeRequirement>( shipmentTypeRequirements_); bitField0_ |= 0x00000100; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentTypeRequirement, com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder, com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder> shipmentTypeRequirementsBuilder_; /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentTypeRequirement> getShipmentTypeRequirementsList() { if (shipmentTypeRequirementsBuilder_ == null) { return java.util.Collections.unmodifiableList(shipmentTypeRequirements_); } else { return shipmentTypeRequirementsBuilder_.getMessageList(); } } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public int getShipmentTypeRequirementsCount() { if (shipmentTypeRequirementsBuilder_ == null) { return shipmentTypeRequirements_.size(); } else { return shipmentTypeRequirementsBuilder_.getCount(); } } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeRequirement getShipmentTypeRequirements( int index) { if (shipmentTypeRequirementsBuilder_ == null) { return shipmentTypeRequirements_.get(index); } else { return shipmentTypeRequirementsBuilder_.getMessage(index); } } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder setShipmentTypeRequirements( int index, com.google.cloud.optimization.v1.ShipmentTypeRequirement value) { if (shipmentTypeRequirementsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.set(index, value); onChanged(); } else { shipmentTypeRequirementsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder setShipmentTypeRequirements( int index, com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder builderForValue) { if (shipmentTypeRequirementsBuilder_ == null) { ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.set(index, builderForValue.build()); onChanged(); } else { shipmentTypeRequirementsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder addShipmentTypeRequirements( com.google.cloud.optimization.v1.ShipmentTypeRequirement value) { if (shipmentTypeRequirementsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.add(value); onChanged(); } else { shipmentTypeRequirementsBuilder_.addMessage(value); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder addShipmentTypeRequirements( int index, com.google.cloud.optimization.v1.ShipmentTypeRequirement value) { if (shipmentTypeRequirementsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.add(index, value); onChanged(); } else { shipmentTypeRequirementsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder addShipmentTypeRequirements( com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder builderForValue) { if (shipmentTypeRequirementsBuilder_ == null) { ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.add(builderForValue.build()); onChanged(); } else { shipmentTypeRequirementsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder addShipmentTypeRequirements( int index, com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder builderForValue) { if (shipmentTypeRequirementsBuilder_ == null) { ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.add(index, builderForValue.build()); onChanged(); } else { shipmentTypeRequirementsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder addAllShipmentTypeRequirements( java.lang.Iterable<? extends com.google.cloud.optimization.v1.ShipmentTypeRequirement> values) { if (shipmentTypeRequirementsBuilder_ == null) { ensureShipmentTypeRequirementsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, shipmentTypeRequirements_); onChanged(); } else { shipmentTypeRequirementsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder clearShipmentTypeRequirements() { if (shipmentTypeRequirementsBuilder_ == null) { shipmentTypeRequirements_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); onChanged(); } else { shipmentTypeRequirementsBuilder_.clear(); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public Builder removeShipmentTypeRequirements(int index) { if (shipmentTypeRequirementsBuilder_ == null) { ensureShipmentTypeRequirementsIsMutable(); shipmentTypeRequirements_.remove(index); onChanged(); } else { shipmentTypeRequirementsBuilder_.remove(index); } return this; } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder getShipmentTypeRequirementsBuilder(int index) { return getShipmentTypeRequirementsFieldBuilder().getBuilder(index); } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder getShipmentTypeRequirementsOrBuilder(int index) { if (shipmentTypeRequirementsBuilder_ == null) { return shipmentTypeRequirements_.get(index); } else { return shipmentTypeRequirementsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder> getShipmentTypeRequirementsOrBuilderList() { if (shipmentTypeRequirementsBuilder_ != null) { return shipmentTypeRequirementsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(shipmentTypeRequirements_); } } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder addShipmentTypeRequirementsBuilder() { return getShipmentTypeRequirementsFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentTypeRequirement.getDefaultInstance()); } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder addShipmentTypeRequirementsBuilder(int index) { return getShipmentTypeRequirementsFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentTypeRequirement.getDefaultInstance()); } /** * * * <pre> * Sets of `shipment_type` requirements (see `ShipmentTypeRequirement`). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentTypeRequirement shipment_type_requirements = 13; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder> getShipmentTypeRequirementsBuilderList() { return getShipmentTypeRequirementsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentTypeRequirement, com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder, com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder> getShipmentTypeRequirementsFieldBuilder() { if (shipmentTypeRequirementsBuilder_ == null) { shipmentTypeRequirementsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentTypeRequirement, com.google.cloud.optimization.v1.ShipmentTypeRequirement.Builder, com.google.cloud.optimization.v1.ShipmentTypeRequirementOrBuilder>( shipmentTypeRequirements_, ((bitField0_ & 0x00000100) != 0), getParentForChildren(), isClean()); shipmentTypeRequirements_ = null; } return shipmentTypeRequirementsBuilder_; } private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule> precedenceRules_ = java.util.Collections.emptyList(); private void ensurePrecedenceRulesIsMutable() { if (!((bitField0_ & 0x00000200) != 0)) { precedenceRules_ = new java.util.ArrayList<com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule>( precedenceRules_); bitField0_ |= 0x00000200; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder> precedenceRulesBuilder_; /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule> getPrecedenceRulesList() { if (precedenceRulesBuilder_ == null) { return java.util.Collections.unmodifiableList(precedenceRules_); } else { return precedenceRulesBuilder_.getMessageList(); } } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public int getPrecedenceRulesCount() { if (precedenceRulesBuilder_ == null) { return precedenceRules_.size(); } else { return precedenceRulesBuilder_.getCount(); } } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule getPrecedenceRules( int index) { if (precedenceRulesBuilder_ == null) { return precedenceRules_.get(index); } else { return precedenceRulesBuilder_.getMessage(index); } } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder setPrecedenceRules( int index, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule value) { if (precedenceRulesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensurePrecedenceRulesIsMutable(); precedenceRules_.set(index, value); onChanged(); } else { precedenceRulesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder setPrecedenceRules( int index, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder builderForValue) { if (precedenceRulesBuilder_ == null) { ensurePrecedenceRulesIsMutable(); precedenceRules_.set(index, builderForValue.build()); onChanged(); } else { precedenceRulesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder addPrecedenceRules( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule value) { if (precedenceRulesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensurePrecedenceRulesIsMutable(); precedenceRules_.add(value); onChanged(); } else { precedenceRulesBuilder_.addMessage(value); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder addPrecedenceRules( int index, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule value) { if (precedenceRulesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensurePrecedenceRulesIsMutable(); precedenceRules_.add(index, value); onChanged(); } else { precedenceRulesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder addPrecedenceRules( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder builderForValue) { if (precedenceRulesBuilder_ == null) { ensurePrecedenceRulesIsMutable(); precedenceRules_.add(builderForValue.build()); onChanged(); } else { precedenceRulesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder addPrecedenceRules( int index, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder builderForValue) { if (precedenceRulesBuilder_ == null) { ensurePrecedenceRulesIsMutable(); precedenceRules_.add(index, builderForValue.build()); onChanged(); } else { precedenceRulesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder addAllPrecedenceRules( java.lang.Iterable<? extends com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule> values) { if (precedenceRulesBuilder_ == null) { ensurePrecedenceRulesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, precedenceRules_); onChanged(); } else { precedenceRulesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder clearPrecedenceRules() { if (precedenceRulesBuilder_ == null) { precedenceRules_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000200); onChanged(); } else { precedenceRulesBuilder_.clear(); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public Builder removePrecedenceRules(int index) { if (precedenceRulesBuilder_ == null) { ensurePrecedenceRulesIsMutable(); precedenceRules_.remove(index); onChanged(); } else { precedenceRulesBuilder_.remove(index); } return this; } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder getPrecedenceRulesBuilder(int index) { return getPrecedenceRulesFieldBuilder().getBuilder(index); } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder getPrecedenceRulesOrBuilder(int index) { if (precedenceRulesBuilder_ == null) { return precedenceRules_.get(index); } else { return precedenceRulesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder> getPrecedenceRulesOrBuilderList() { if (precedenceRulesBuilder_ != null) { return precedenceRulesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(precedenceRules_); } } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder addPrecedenceRulesBuilder() { return getPrecedenceRulesFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.getDefaultInstance()); } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder addPrecedenceRulesBuilder(int index) { return getPrecedenceRulesFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.getDefaultInstance()); } /** * * * <pre> * Set of precedence rules which must be enforced in the model. * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.PrecedenceRule precedence_rules = 14; * </code> */ public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder> getPrecedenceRulesBuilderList() { return getPrecedenceRulesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder> getPrecedenceRulesFieldBuilder() { if (precedenceRulesBuilder_ == null) { precedenceRulesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRule.Builder, com.google.cloud.optimization.v1.ShipmentModel.PrecedenceRuleOrBuilder>( precedenceRules_, ((bitField0_ & 0x00000200) != 0), getParentForChildren(), isClean()); precedenceRules_ = null; } return precedenceRulesBuilder_; } private java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule> breakRules_ = java.util.Collections.emptyList(); private void ensureBreakRulesIsMutable() { if (!((bitField0_ & 0x00000400) != 0)) { breakRules_ = new java.util.ArrayList<com.google.cloud.optimization.v1.ShipmentModel.BreakRule>( breakRules_); bitField0_ |= 0x00000400; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder> breakRulesBuilder_; /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule> getBreakRulesList() { if (breakRulesBuilder_ == null) { return java.util.Collections.unmodifiableList(breakRules_); } else { return breakRulesBuilder_.getMessageList(); } } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public int getBreakRulesCount() { if (breakRulesBuilder_ == null) { return breakRules_.size(); } else { return breakRulesBuilder_.getCount(); } } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRule getBreakRules(int index) { if (breakRulesBuilder_ == null) { return breakRules_.get(index); } else { return breakRulesBuilder_.getMessage(index); } } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder setBreakRules( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule value) { if (breakRulesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureBreakRulesIsMutable(); breakRules_.set(index, value); onChanged(); } else { breakRulesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder setBreakRules( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder builderForValue) { if (breakRulesBuilder_ == null) { ensureBreakRulesIsMutable(); breakRules_.set(index, builderForValue.build()); onChanged(); } else { breakRulesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder addBreakRules(com.google.cloud.optimization.v1.ShipmentModel.BreakRule value) { if (breakRulesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureBreakRulesIsMutable(); breakRules_.add(value); onChanged(); } else { breakRulesBuilder_.addMessage(value); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder addBreakRules( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule value) { if (breakRulesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureBreakRulesIsMutable(); breakRules_.add(index, value); onChanged(); } else { breakRulesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder addBreakRules( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder builderForValue) { if (breakRulesBuilder_ == null) { ensureBreakRulesIsMutable(); breakRules_.add(builderForValue.build()); onChanged(); } else { breakRulesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder addBreakRules( int index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder builderForValue) { if (breakRulesBuilder_ == null) { ensureBreakRulesIsMutable(); breakRules_.add(index, builderForValue.build()); onChanged(); } else { breakRulesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder addAllBreakRules( java.lang.Iterable<? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRule> values) { if (breakRulesBuilder_ == null) { ensureBreakRulesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, breakRules_); onChanged(); } else { breakRulesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder clearBreakRules() { if (breakRulesBuilder_ == null) { breakRules_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000400); onChanged(); } else { breakRulesBuilder_.clear(); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public Builder removeBreakRules(int index) { if (breakRulesBuilder_ == null) { ensureBreakRulesIsMutable(); breakRules_.remove(index); onChanged(); } else { breakRulesBuilder_.remove(index); } return this; } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder getBreakRulesBuilder( int index) { return getBreakRulesFieldBuilder().getBuilder(index); } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder getBreakRulesOrBuilder( int index) { if (breakRulesBuilder_ == null) { return breakRules_.get(index); } else { return breakRulesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public java.util.List< ? extends com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder> getBreakRulesOrBuilderList() { if (breakRulesBuilder_ != null) { return breakRulesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(breakRules_); } } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder addBreakRulesBuilder() { return getBreakRulesFieldBuilder() .addBuilder( com.google.cloud.optimization.v1.ShipmentModel.BreakRule.getDefaultInstance()); } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder addBreakRulesBuilder( int index) { return getBreakRulesFieldBuilder() .addBuilder( index, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.getDefaultInstance()); } /** * * * <pre> * Deprecated: No longer used. * Set of break rules used in the model. * Each vehicle specifies the `BreakRule` that applies to it via the * [Vehicle.break_rule_indices][google.cloud.optimization.v1.Vehicle.break_rule_indices] field (which must be a singleton). * </pre> * * <code> * repeated .google.cloud.optimization.v1.ShipmentModel.BreakRule break_rules = 15 [deprecated = true]; * </code> */ @java.lang.Deprecated public java.util.List<com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder> getBreakRulesBuilderList() { return getBreakRulesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder> getBreakRulesFieldBuilder() { if (breakRulesBuilder_ == null) { breakRulesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.optimization.v1.ShipmentModel.BreakRule, com.google.cloud.optimization.v1.ShipmentModel.BreakRule.Builder, com.google.cloud.optimization.v1.ShipmentModel.BreakRuleOrBuilder>( breakRules_, ((bitField0_ & 0x00000400) != 0), getParentForChildren(), isClean()); breakRules_ = null; } return breakRulesBuilder_; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.optimization.v1.ShipmentModel) } // @@protoc_insertion_point(class_scope:google.cloud.optimization.v1.ShipmentModel) private static final com.google.cloud.optimization.v1.ShipmentModel DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.optimization.v1.ShipmentModel(); } public static com.google.cloud.optimization.v1.ShipmentModel getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ShipmentModel> PARSER = new com.google.protobuf.AbstractParser<ShipmentModel>() { @java.lang.Override public ShipmentModel parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ShipmentModel(input, extensionRegistry); } }; public static com.google.protobuf.Parser<ShipmentModel> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ShipmentModel> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.optimization.v1.ShipmentModel getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
<reponame>jbcarta/hackaton_galicia var mongoose = require('mongoose'); var Schema = mongoose.Schema; var schema = new Schema({ country: {type: String, required: true}, state: {type: String, required: true} }); module.exports = mongoose.model('loc_states', schema);
package auth; import java.net.Authenticator; import java.net.PasswordAuthentication; public class cseAuthenticator extends Authenticator { private String username; private String password; public cseAuthenticator(String username, String password) { super(); this.username = username; this.password = password; } public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }
<filename>src/main/scala/qualification2016/b/RevengePancakes.scala package qualification2016.b import java.io.{BufferedReader, FileInputStream, InputStreamReader, PrintWriter} /* https://code.google.com/codejam/contest/6254486/dashboard#s=p1 */ object RevengePancakes { def main(args: Array[String]): Unit = { val out = new PrintWriter("src/main/scala/qualification2016/b/B-large-practice.out") val in = new BufferedReader(new InputStreamReader(new FileInputStream("src/main/scala/qualification2016/b/B-large-practice.in"))) val numTests = Integer.parseInt(in.readLine()) (1 to numTests).foreach(i => out.println("Case #" + i.toString + ": " + solve(in))) in.close() out.close() def solve(in: BufferedReader): String = { var pancakes: String = in.readLine() var flipCount: Int = 0 var position: Int = pancakes.length - 1 while (position >= 0) { if (pancakes(position) == '-') { pancakes = flip(pancakes, position) flipCount = flipCount + 1 } position = position - 1 } flipCount.toString } def flip(pancakes: String, position: Int): String = { var aux = pancakes.slice(0, position + 1).map(_ match { case '+' => '-' case '-' => '+' }) var result = aux + pancakes.substring(position+1,pancakes.length) result } } }
<reponame>saiive/whale import { Database } from '@src/module.database/database' import { Test } from '@nestjs/testing' import { MemoryDatabaseModule } from '@src/module.database/provider.memory/module' import { LevelDatabase } from '@src/module.database/provider.level/level.database' import { ScriptActivityMapper, ScriptActivityType } from '@src/module.model/script.activity' import { HexEncoder } from '@src/module.model/_hex.encoder' let database: Database let mapper: ScriptActivityMapper beforeAll(async () => { const app = await Test.createTestingModule({ imports: [MemoryDatabaseModule], providers: [ScriptActivityMapper] }).compile() database = app.get<Database>(Database) mapper = app.get<ScriptActivityMapper>(ScriptActivityMapper) }) beforeEach(async () => { async function put (hex: string, height: number, type: ScriptActivityType, txid: string, n: number): Promise<void> { await mapper.put({ id: HexEncoder.encodeHeight(height) + ScriptActivityMapper.typeAsHex(type) + txid + HexEncoder.encodeVoutIndex(n), hid: HexEncoder.asSHA256(hex), block: { hash: '', height: height, time: 0, medianTime: 0 }, script: { hex: hex, type: '' }, txid: txid, type: type, typeHex: ScriptActivityMapper.typeAsHex(type), value: '1.00' }) } const hex = '1600140e7c0ab18b305bc987a266dc06de26fcfab4b56a' function randomTxid (): string { return (Math.random() * 9999999999999999).toString(16).padStart(64, '0') } await put(hex, 0, 'vin', randomTxid(), 0) await put(hex, 0, 'vout', randomTxid(), 1) await put(hex, 1, 'vin', randomTxid(), 0) await put(hex, 1, 'vout', randomTxid(), 1) }) afterEach(async () => { await (database as LevelDatabase).clear() }) it('should query', async () => { const hex = '1600140e7c0ab18b305bc987a266dc06de26fcfab4b56a' const hid = HexEncoder.asSHA256(hex) const list = await mapper.query(hid, 10) expect(list.length).toStrictEqual(4) expect(list[0].block.height).toStrictEqual(1) expect(list[0].typeHex).toStrictEqual('01') expect(list[1].block.height).toStrictEqual(1) expect(list[1].typeHex).toStrictEqual('00') expect(list[2].block.height).toStrictEqual(0) expect(list[2].typeHex).toStrictEqual('01') expect(list[3].block.height).toStrictEqual(0) expect(list[3].typeHex).toStrictEqual('00') }) it('should delete', async () => { const hex = '1600140e7c0ab18b305bc987a266dc06de26fcfab4b56a' const hid = HexEncoder.asSHA256(hex) const list = await mapper.query(hid, 10) await mapper.delete(list[0].id) const deleted = await mapper.query(hid, 10) expect(deleted.length).toStrictEqual(3) })
<reponame>oueya1479/OpenOLAT /** * <a href="http://www.openolat.org"> * OpenOLAT - Online Learning and Training</a><br> * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at the * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> * <p> * Unless required by applicable law or agreed to in writing,<br> * software distributed under the License is distributed on an "AS IS" BASIS, <br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> * See the License for the specific language governing permissions and <br> * limitations under the License. * <p> * Initial code contributed and copyrighted by<br> * frentix GmbH, http://www.frentix.com * <p> */ package org.olat.course.nodes.edusharing.ui; import static org.olat.core.gui.components.util.SelectionValues.entry; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.elements.FormLink; import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement; import org.olat.core.gui.components.form.flexible.elements.SingleSelection; import org.olat.core.gui.components.form.flexible.elements.StaticTextElement; import org.olat.core.gui.components.form.flexible.impl.FormBasicController; import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.stack.BreadcrumbPanel; import org.olat.core.gui.components.util.SelectionValues; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.core.gui.translator.TranslatorHelper; import org.olat.core.util.StringHelper; import org.olat.course.editor.NodeEditController; import org.olat.course.nodes.EdusharingCourseNode; import org.olat.modules.ModuleConfiguration; import org.olat.modules.edusharing.EdusharingHtmlElement; import org.olat.modules.edusharing.EdusharingUsage; import org.olat.modules.edusharing.model.SearchResult; import org.olat.modules.edusharing.ui.EdusharingSearchController; import org.olat.modules.edusharing.ui.EdusharingSearchController.SearchEvent; import org.olat.repository.RepositoryEntry; /** * * Initial date: 20 May 2020<br> * @author uhensler, <EMAIL>, http://www.frentix.com * */ public class EdusharingConfigController extends FormBasicController { private final String[] SHOW_KEYS = new String [] { "edit.show" }; private StaticTextElement noItemEl; private FormLink previewLink; private FormLink selectLink; private FormLink replaceLink; private SingleSelection versionEl; private MultipleSelectionElement licenseEl; private MultipleSelectionElement metadataEl; private String[] showValues; private final BreadcrumbPanel stackPanel; private CloseableModalController cmc; private EdusharingSearchController searchCtrl; private EdusharingRunController previewCtrl; private final EdusharingCourseNode courseNode; private final ModuleConfiguration config; private final RepositoryEntry courseEntry; public EdusharingConfigController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, EdusharingCourseNode courseNode, RepositoryEntry courseEntry) { super(ureq, wControl); this.stackPanel = stackPanel; this.courseNode = courseNode; this.config = courseNode.getModuleConfiguration(); this.courseEntry = courseEntry; this.showValues = TranslatorHelper.translateAll(getTranslator(), SHOW_KEYS); initForm(ureq); } @Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { setFormTitle("edit.title"); setFormContextHelp("Knowledge Transfer#_edusharing"); noItemEl = uifactory.addStaticTextElement("edit.no.item", "edit.no.item", translate("edit.no.item.text"), formLayout); previewLink = uifactory.addFormLink("edit.preview", "", translate("edit.preview"), formLayout, Link.NONTRANSLATED); previewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_preview"); FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); buttonsCont.setRootForm(mainForm); formLayout.add(buttonsCont); selectLink = uifactory.addFormLink("edit.select", buttonsCont, "btn btn-default o_xsmall"); replaceLink = uifactory.addFormLink("edit.replace", buttonsCont, "btn btn-default o_xsmall"); SelectionValues versionKV = new SelectionValues(); versionKV.add(entry(EdusharingCourseNode.CONFIG_VERSION_VALUE_CURRENT, translate("edit.version.current"))); versionKV.add(entry(EdusharingCourseNode.CONFIG_VERSION_VALUE_LATEST, translate("edit.version.latest"))); versionEl = uifactory.addRadiosHorizontal("edit.version", formLayout, versionKV.keys(), versionKV.values()); versionEl.addActionListener(FormEvent.ONCHANGE); String version = config.getStringValue(EdusharingCourseNode.CONFIG_VERSION, EdusharingCourseNode.CONFIG_VERSION_VALUE_CURRENT); versionEl.select(version, true); licenseEl = uifactory.addCheckboxesHorizontal("edit.show.license", formLayout, SHOW_KEYS, showValues); licenseEl.addActionListener(FormEvent.ONCHANGE); licenseEl.select(licenseEl.getKey(0), config.getBooleanSafe(EdusharingCourseNode.CONFIG_SHOW_LICENSE)); metadataEl = uifactory.addCheckboxesHorizontal("edit.show.metadata", formLayout, SHOW_KEYS, showValues); metadataEl.addActionListener(FormEvent.ONCHANGE); metadataEl.select(metadataEl.getKey(0), config.getBooleanSafe(EdusharingCourseNode.CONFIG_SHOW_METADATA)); updateUI(); } private void updateUI() { boolean hasItem = config.has(EdusharingCourseNode.CONFIG_IDENTIFIER); noItemEl.setVisible(!hasItem); String title = config.getStringValue(EdusharingCourseNode.CONFIG_ES_TITLE, "no title"); previewLink.setI18nKey(title); previewLink.setVisible(hasItem); selectLink.setVisible(!hasItem); replaceLink.setVisible(hasItem); } @Override protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if (source == selectLink || source == replaceLink) { doSearch(ureq); } else if (source == versionEl || source == licenseEl || source == metadataEl) { doSetConfig(ureq); } else if (source == previewLink) { doPreview(ureq); } super.formInnerEvent(ureq, source, event); } @Override protected void event(UserRequest ureq, Controller source, Event event) { if (searchCtrl == source) { if (event instanceof SearchEvent) { SearchEvent se = (SearchEvent)event; doSetSearchResult(ureq, se.getSearchResult()); } cmc.deactivate(); cleanUp(); } else if (cmc == source) { cleanUp(); } super.event(ureq, source, event); } private void cleanUp() { removeAsListenerAndDispose(searchCtrl); removeAsListenerAndDispose(cmc); searchCtrl = null; cmc = null; } @Override protected void formOK(UserRequest ureq) { // } private void doSearch(UserRequest ureq) { searchCtrl = new EdusharingSearchController(ureq, getWindowControl()); listenTo(searchCtrl); cmc = new CloseableModalController(getWindowControl(), "close", searchCtrl.getInitialComponent(), true, null); listenTo(cmc); cmc.activate(); } private void doSetSearchResult(UserRequest ureq, SearchResult searchResult) { if (searchResult != null) { String identifier = courseNode.createIdentifier(); /** * The usage is already here created. It would be more right on the publish process, * but because there is no identity we create it here and delete the unnecessary * usages on the publish process. */ EdusharingHtmlElement edusharingHtmlElement = createEdusharingHtmlElement(identifier, searchResult); EdusharingUsage usage = courseNode.getOrCreateUsage(courseEntry, courseNode.getIdent(), edusharingHtmlElement, getIdentity()); if (usage != null) { doSetSearchResultConfig(identifier, searchResult); updateUI(); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } else { showError("error.selection.failed"); } } else { showError("error.selection.failed"); } } private EdusharingHtmlElement createEdusharingHtmlElement(String identifier, SearchResult searchResult) { String objectUrl = searchResult.getObjectUrl(); EdusharingHtmlElement element = new EdusharingHtmlElement(identifier, objectUrl); element.setVersion(searchResult.getWindowVersion()); element.setMimeType(searchResult.getMimeType()); element.setMediaType(searchResult.getMediaType()); if (searchResult.getWindowWidth() != null) { element.setWidth(searchResult.getWindowWidth().toString()); } if (searchResult.getWindowHight() != null) { element.setHight(searchResult.getWindowHight().toString()); } return element; } private void doSetSearchResultConfig(String identifier, SearchResult searchResult) { config.set(EdusharingCourseNode.CONFIG_IDENTIFIER, identifier); config.setStringValue(EdusharingCourseNode.CONFIG_ES_OBJECT_URL, searchResult.getObjectUrl()); config.setStringValue(EdusharingCourseNode.CONFIG_ES_TITLE, searchResult.getTitle()); if (StringHelper.containsNonWhitespace(searchResult.getMimeType())) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_MIME_TYPE, searchResult.getMimeType()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_MIME_TYPE); } if (StringHelper.containsNonWhitespace(searchResult.getMediaType())) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_MEDIA_TYPE, searchResult.getMediaType()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_MEDIA_TYPE); } if (StringHelper.containsNonWhitespace(searchResult.getResourceType())) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_RESOURCE_TYPE, searchResult.getResourceType()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_RESOURCE_TYPE); } if (StringHelper.containsNonWhitespace(searchResult.getRepoType())) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_REPO_TYPE, searchResult.getRepoType()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_REPO_TYPE); } if (StringHelper.containsNonWhitespace(searchResult.getResourceVersion())) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_RESOURCE_VERSION, searchResult.getResourceVersion()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_RESOURCE_VERSION); } if (searchResult.getWindowHight() != null) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_WINDOW_HEIGHT, searchResult.getWindowHight().toString()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_WINDOW_HEIGHT); } if (searchResult.getWindowWidth() != null) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_WINDOW_WIDTH, searchResult.getWindowWidth().toString()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_WINDOW_WIDTH); } if (searchResult.getRatio() != null) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_RATIO, String.valueOf(searchResult.getRatio().doubleValue())); } else { config.remove(EdusharingCourseNode.CONFIG_ES_RATIO); } if (StringHelper.containsNonWhitespace(searchResult.getWindowVersion())) { config.setStringValue(EdusharingCourseNode.CONFIG_ES_WINDOW_VERISON, searchResult.getWindowVersion()); } else { config.remove(EdusharingCourseNode.CONFIG_ES_WINDOW_VERISON); } } private void doSetConfig(UserRequest ureq) { String version = versionEl.isOneSelected() ? versionEl.getSelectedKey() : EdusharingCourseNode.CONFIG_VERSION_VALUE_CURRENT; config.setStringValue(EdusharingCourseNode.CONFIG_VERSION, version); config.setBooleanEntry(EdusharingCourseNode.CONFIG_SHOW_LICENSE, licenseEl.isAtLeastSelected(1)); config.setBooleanEntry(EdusharingCourseNode.CONFIG_SHOW_METADATA, metadataEl.isAtLeastSelected(1)); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } private void doPreview(UserRequest ureq) { removeAsListenerAndDispose(previewCtrl); previewCtrl = new EdusharingRunController(ureq, getWindowControl(), courseNode); listenTo(previewCtrl); stackPanel.pushController(translate("preview"), previewCtrl); } }
<filename>lib/AdManager.ts ///<reference path='refs.ts'/> module TDev.RT { export module AdManager { export var initialize = (el: HTMLElement) => { el.setChildren([HTML.mkA('', Cloud.getServiceUrl() + '/help/advertisement', '_blank', 'Learn how to display Ads in your apps!')]); } } }
<reponame>leongaban/redux-saga-exchange export { default as OperationHistory } from './OperationHistory/OperationHistory'; export { default as MOperationHistory } from './OperationHistory/mobile/MOperationHistory'; export { default as Header } from './Header/Header';
def generate_style_transfer_command(target: str, output_prefix: str, width: int, vgg_weights: str) -> str: command = f"{target} {target} {target} " \ f"out/{output_prefix}-texturized/{output_prefix}-Bp " \ f"--analogy-layers='conv3_1,conv4_1' " \ f"--scales=3 --analogy-w=0 " \ f"--mode=brute --patch-size=3 " \ f"--width={width} " \ f"--vgg-weights={vgg_weights} --output-full" return command
#!/bin/sh set -e ME=$(basename $0) auto_envsubst() { local template_dir="${NGINX_ENVSUBST_TEMPLATE_DIR:-/etc/nginx/templates}" local suffix="${NGINX_ENVSUBST_TEMPLATE_SUFFIX:-.template}" local output_dir="${NGINX_ENVSUBST_OUTPUT_DIR:-/etc/nginx/conf.d}" local template defined_envs relative_path output_path subdir defined_envs=$(printf '${%s} ' $(env | cut -d= -f1)) [ -d "$template_dir" ] || return 0 if [ ! -w "$output_dir" ]; then echo >&3 "$ME: ERROR: $template_dir exists, but $output_dir is not writable" return 0 fi find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do relative_path="${template#$template_dir/}" output_path="$output_dir/${relative_path%$suffix}" subdir=$(dirname "$relative_path") # create a subdirectory where the template file exists mkdir -p "$output_dir/$subdir" echo >&3 "$ME: Running envsubst on $template to $output_path" envsubst "$defined_envs" < "$template" > "$output_path" done } auto_envsubst exit 0
#!/bin/bash echo "" # see background_downloadBlockchain.md for info # why there are two torrent files ## get basic info source /home/admin/raspiblitz.info # make sure rtorrent is available sudo apt-get install rtorrent -y echo "" echo "" echo "*** Torrent Files ***" # torrent files that are available # in directory /home.admin/assets/ # WITHOUT THE '.torrent' ENDING bitcoinBase="raspiblitz-bitcoin1-2018-10-13-base" bitcoinUpdate="raspiblitz-bitcoin1-2019-01-16-update" litecoinBase="raspiblitz-litecoin1-2018-11-18-base" litecoinUpdate="raspiblitz-litecoin1-2018-11-18-update" # set final based on selected network baseTorrentFile=${bitcoinBase} updateTorrentFile=${bitcoinUpdate} if [ "$network" = "litecoin" ]; then baseTorrentFile=${litecoinBase} updateTorrentFile=${litecoinUpdate} fi echo "base : ${baseTorrentFile}" echo "update : ${updateTorrentFile}" sleep 1 targetDir="/mnt/hdd/torrent" sessionDir="/home/admin/.rtorrent.session" sudo mkdir ${sessionDir} 2>/dev/null ############################## # CHECK TORRENT 1 "BLOCKCHAIN" ############################## echo "*** checking torrent 1: base blockchain" torrentComplete1=$(cat ${sessionDir}/blockchain/*.torrent.rtorrent | grep ':completei1' -c) echo "torrentComplete1(${torrentComplete1})" if [ ${torrentComplete1} -eq 0 ]; then # check if screen session for this torrent isRunning1=$( screen -S blockchain -ls | grep "blockchain" -c ) echo "isRunning1(${isRunning1})" if [ ${isRunning1} -eq 0 ]; then # start torrent download in screen session echo "starting torrent: blockchain" command1="sudo rtorrent -n -d ${targetDir} -s ${sessionDir}/blockchain/ /home/admin/assets/${baseTorrentFile}.torrent" sudo mkdir ${targetDir} 2>/dev/null sudo mkdir ${sessionDir}/blockchain/ 2>/dev/null screenCommand="screen -S blockchain -L screen.log -dm ${command1}" echo "${screenCommand}" bash -c "${screenCommand}" fi fi sleep 2 ############################## # CHECK TORRENT 2 "UPDATE" ############################## echo "*** checking torrent 2: update blockchain" torrentComplete2=$(cat ${sessionDir}/update/*.torrent.rtorrent | grep ':completei1' -c) echo "torrentComplete2(${torrentComplete2})" if [ ${torrentComplete2} -eq 0 ]; then # check if screen session for this torrent isRunning2=$( screen -S update -ls | grep "update" -c ) echo "isRunning2(${isRunning2})" if [ ${isRunning2} -eq 0 ]; then # start torrent download in screen session echo "starting torrent: update" command2="sudo rtorrent -n -d ${targetDir} -s ${sessionDir}/update/ /home/admin/assets/${updateTorrentFile}.torrent" sudo mkdir ${targetDir} 2>/dev/null sudo mkdir ${sessionDir}/update/ 2>/dev/null screenCommand="screen -S update -L screen.log -dm ${command2}" echo "${screenCommand}" bash -c "${screenCommand}" fi fi sleep 2 ############################## # MONITOR PROGRESS ############################## sleep 3 # monitor screen session screenDump1="... started ..." screenDump2="... started ..." torrentComplete1=0 torrentComplete2=0 while : do # display info screen clear echo "****************************************************" echo "Monitoring Screen Session: Torrent base+update" echo "NOTICE: This can take multiple hours or days !!" echo "Its OK to close terminal now and SSH back in later." echo "If u see the torrents 100% downloaded and verified," echo "press X to continue. Also press x to abort download" echo "before 100% if you want to switch to another option." echo "****************************************************" echo "" # display torrent 1 info echo "*** 1) Status Torrent 'blockchain':" torrentComplete1=$(cat ${sessionDir}/blockchain/*.torrent.rtorrent | grep ':completei1' -c) if [ ${torrentComplete1} -eq 0 ]; then screen -S blockchain -X hardcopy .blockchain.out newScreenDump=$(cat .blockchain.out | head -6 | tail -3 ) if [ ${#newScreenDump} -gt 0 ]; then screenDump1=$newScreenDump fi echo "$screenDump1" else echo "Completed" fi echo "" # display torrent 2 info echo "*** 2) Status Torrent 'update':" torrentComplete2=$(cat ${sessionDir}/update/*.torrent.rtorrent | grep ':completei1' -c) if [ ${torrentComplete2} -eq 0 ]; then screen -S update -X hardcopy .update.out newScreenDump=$(cat .update.out| head -6 | tail -3 ) if [ ${#newScreenDump} -gt 0 ]; then screenDump2=$newScreenDump fi echo "$screenDump2" else echo "Completed" fi echo "" # check if both torrents completed if [ ${torrentComplete1} -eq 1 ]; then if [ ${torrentComplete2} -eq 1 ]; then echo "OK - all torrents finished" break fi fi # wait 2 seconds for key input read -n 1 -t 2 keyPressed # check if user wants to abort session if [ "${keyPressed}" = "x" ]; then echo "" echo "Aborting" break fi done # clean up rm -f .blockchain.out rm -f .update.out ############################## # AFTER PARTY & CLEAN UP ############################## # quit session1 isRunning=$( screen -S blockchain -ls | grep "blockchain" -c ) if [ ${isRunning} -eq 1 ]; then # get the PID of screen session sessionPID=$(screen -ls | grep "blockchain" | cut -d "." -f1 | xargs) echo "killing screen session PID(${sessionPID})" # kill all child processes of screen sceesion sudo pkill -P ${sessionPID} echo "proccesses killed" sleep 3 # tell the screen session to quit and wait a bit screen -S blockchain -X quit 1>/dev/null sleep 3 echo "cleaning screen" screen -wipe 1>/dev/null sleep 3 fi # quit session2 isRunning=$( screen -S update -ls | grep "update" -c ) if [ ${isRunning} -eq 1 ]; then # get the PID of screen session sessionPID=$(screen -ls | grep "update" | cut -d "." -f1 | xargs) echo "killing screen session PID(${sessionPID})" # kill all child processes of screen sceesion sudo pkill -P ${sessionPID} echo "proccesses killed" sleep 3 # tell the screen session to quit and wait a bit screen -S update -X quit 1>/dev/null sleep 3 echo "cleaning screen" screen -wipe 1>/dev/null sleep 3 fi # check torrent success echo "" echo "*** Torrent Data Check ***" torrentError=0 torrentComplete1=$(cat ${sessionDir}/blockchain/*.torrent.rtorrent | grep ':completei1' -c) torrentComplete2=$(cat ${sessionDir}/update/*.torrent.rtorrent | grep ':completei1' -c) if [ ${torrentComplete1} -eq 0 ]; then torrentError=1 fi if [ ${torrentComplete2} -eq 0 ]; then torrentError=2 fi # the path torrent was download to targetPath1="${targetDir}/${baseTorrentFile}" targetPath2="${targetDir}/${updateTorrentFile}" # check that path exists contentPath1=$(sudo ls ${targetPath1} 2>/dev/null) contentPath2=$(sudo ls ${targetPath2} 2>/dev/null) if [ ${#contentPath1} -eq 0 ]; then torrentError=3 fi if [ ${#contentPath2} -eq 0 ]; then torrentError=4 fi if [ ${torrentError} -gt 0 ]; then # User Cancel --> Torrent incomplete sleep 3 echo -ne '\007' dialog --title " WARNING (${torrentError})" --yesno "The Torrent download failed or is not complete - maybe try FTP download next time. Do you want keep already downloaded torrent data?" 8 57 response=$? case $response in 1) sudo rm -rf ${targetDir}; sudo rm -rf ${sessionDir} ;; esac ./00mainMenu.sh exit 1; fi # if setup was done - remove old data if [ "${setupStep}" = "100" ]; then echo "stopping servcies ..." sudo systemctl stop lnd sudo systemctl stop ${network}d sudo systemctl disable ${network}d sudo cp -f /mnt/hdd/${network}/${network}.conf /home/admin/assets/${network}.conf sudo rm -rfv /mnt/hdd/${network}/* 2>/dev/null fi # Download worked / just move, copy on USB2 >4h echo "" echo "*** Moving Files ***" date +%s echo "can take some minutes... please wait" sudo mkdir /mnt/hdd/${network} 2>/dev/null sudo mv ${targetPath1}/* /mnt/hdd/${network}/ sudo cp -r ${targetPath2}/* /mnt/hdd/${network}/ sudo rm -r ${targetDir} echo "OK" date +%s if [ "${setupStep}" = "100" ]; then sudo cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf sudo chown -R bitcoin:bitcoin /mnt/hdd/${network}/ sudo systemctl enable ${network}d echo "DONE - reboot needed: sudo shutdown -r now" else # set SetupState sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info # continue setup ./60finishHDD.sh fi
<reponame>afshinsadeghi/DBPediaDownloder import os from time import sleep import requests querysub0 = 'https://linkeddata1.calcul.u-psud.fr/sparql?default-graph-uri=&query=construct%7B+%3Fs+%3Fp+%3Fo%7D+where+%7B+%0D%0Aselect+distinct+%3Fs+%3Fp+%3Fo+where+%7B%0D%0A%7B%0D%0A%3Fs1+++%3Chttp%3A%2F%2Fyago-knowledge.org%2Fresource%2FactedIn%3E+++%3Fs+.%0D%0A%3Fs2+++%3Chttp%3A%2F%2Fyago-knowledge.org%2Fresource%2Fdirected%3E+++%3Fs+.%0D%0A%3Fs+++%3Fp+++%3Fo.%0D%0A%7D+Union%7B%0D%0A%3Fs+++%3Chttp%3A%2F%2Fyago-knowledge.org%2Fresource%2FactedIn%3E+++%3Fs3+.%0D%0A%3Fs4+++%3Chttp%3A%2F%2Fyago-knowledge.org%2Fresource%2Fdirected%3E+++%3Fs3+.%0D%0A%3Fs+++%3Fp+++%3Fo.%0D%0A%7D+Union%7B%0D%0A%3Fs7+++%3Chttp%3A%2F%2Fyago-knowledge.org%2Fresource%2FactedIn%3E+++%3Fs5+.%0D%0A%3Fs+++%3Chttp%3A%2F%2Fyago-knowledge.org%2Fresource%2Fdirected%3E+++%3Fs5+.%0D%0A%3Fs+++%3Fp+++%3Fo.%7D+%0D%0A%7D%0D%0ALimit+10000+offset+' querysub1 = '+%7D%0D%0A&format=text%2Fplain&timeout=0' def download_big_file(counter): link = querysub0 + str(counter * 10000) + querysub1 local_filename = "YagoMovie" + str(counter) + ".nt" r = requests.get(link, stream=True) with open(local_filename, 'wb') as f: for chunk in r.iter_content(chunk_size=1024): if chunk: # filter out keep-alive new chunks f.write(chunk) print local_filename, " is downloaded." for counter in range(1, 700, 1): sleep(10) # sleep so to let the server breath download_big_file(counter) print "making yagoMovies.nt ..." os.system('find . -name "*.nt" -size -15 -delete') os.system("cat *.nt > a.ntt") os.system("rm *.nt") os.system("mv a.ntt yagoMovies.nt") print "yagoMovies.nt is created. have fun!"
def pourLiquid(num_arr, dep_tmp_set, pour_elev, global_set): """ Simulates pouring the specified amount of liquid into the containers indicated by dep_tmp_set. Args: num_arr: List representing the liquid levels in containers. dep_tmp_set: Set of indices indicating the containers to be filled with liquid. pour_elev: Amount of liquid to be poured. global_set: Set keeping track of all containers that have been filled with liquid. Returns: Updated num_arr and global_set after simulating the pouring of liquid. """ if dep_tmp_set: for item in dep_tmp_set: num_arr[item] = pour_elev global_set.add(item) return num_arr, global_set
<gh_stars>10-100 import React from 'react'; import Img, { Svg } from 'react-optimized-image'; const imageName = 'image'; export default () => ( <div> <Svg src={require('./' + imageName + '.svg')} /> <Img src={require('./' + imageName + '.png')} webp /> </div> );
#! /usr/bin/env bash set -eu # MLRMBO WORKFLOW # Main entry point for mlrMBO workflow # See README.md for more information # Autodetect this workflow directory export EMEWS_PROJECT_ROOT=$( cd $( dirname $0 )/.. ; /bin/pwd ) export WORKFLOWS_ROOT=$( cd $EMEWS_PROJECT_ROOT/.. ; /bin/pwd ) if [[ ! -d $EMEWS_PROJECT_ROOT/../../../Benchmarks ]] then echo "Could not find Benchmarks in: $EMEWS_PROJECT_ROOT/../../../Benchmarks" exit 1 fi BENCHMARKS_DEFAULT=$( cd $EMEWS_PROJECT_ROOT/../../../Benchmarks ; /bin/pwd ) export BENCHMARKS_ROOT=${BENCHMARKS_ROOT:-${BENCHMARKS_DEFAULT}} BENCHMARKS_DIR_BASE=$BENCHMARKS_ROOT/Pilot1/P1B1:$BENCHMARKS_ROOT/Pilot1/Attn1:$BENCHMARKS_ROOT/Pilot1/NT3:$BENCHMARKS_ROOT/examples/ADRP # :$BENCHMARKS_ROOT/Pilot1/P1B1:$BENCHMARKS_ROOT/Pilot1/Combo:$BENCHMARKS_ROOT/Pilot2/P2B1:$BENCHMARKS_ROOT/Pilot3/P3B1:$BENCHMARKS_ROOT/Pilot3/P3B3:$BENCHMARKS_ROOT/Pilot3/P3B4 export BENCHMARK_TIMEOUT export BENCHMARK_DIR=${BENCHMARK_DIR:-$BENCHMARKS_DIR_BASE} SCRIPT_NAME=$(basename $0) # Source some utility functions used by EMEWS in this script source $WORKFLOWS_ROOT/common/sh/utils.sh #source "${EMEWS_PROJECT_ROOT}/etc/emews_utils.sh" - moved to utils.sh # Uncomment to turn on Swift/T logging. Can also set TURBINE_LOG, # TURBINE_DEBUG, and ADLB_DEBUG to 0 to turn off logging. # Do not commit with logging enabled, users have run out of disk space # export TURBINE_LOG=1 TURBINE_DEBUG=1 ADLB_DEBUG=1 usage() { echo "workflow.sh: usage: workflow.sh SITE EXPID CFG_SYS CFG_PRM MODEL_NAME" } if (( ${#} != 5 )) then usage exit 1 fi if ! { get_site $1 # Sets SITE get_expid $2 # Sets EXPID get_cfg_sys $3 get_cfg_prm $4 MODEL_NAME=$5 } then usage exit 1 fi echo "Running "$MODEL_NAME "workflow" # Set PYTHONPATH for BENCHMARK related stuff PYTHONPATH+=:$BENCHMARK_DIR:$BENCHMARKS_ROOT/common source_site env $SITE source_site sched $SITE PYTHONPATH+=:$WORKFLOWS_ROOT/common/python # needed for model_runner and logs if [[ ${EQR:-} == "" ]] then abort "The site '$SITE' did not set the location of EQ/R: this will not work!" fi export TURBINE_JOBNAME="JOB:${EXPID}" RESTART_FILE_ARG="" if [[ ${RESTART_FILE:-} != "" ]] then RESTART_FILE_ARG="--restart_file=$RESTART_FILE" fi RESTART_NUMBER_ARG="" if [[ ${RESTART_NUMBER:-} != "" ]] then RESTART_NUMBER_ARG="--restart_number=$RESTART_NUMBER" fi R_FILE_ARG="" if [[ ${R_FILE:-} == "" ]] then R_FILE="mlrMBO1.R" fi R_FILE_ARG="--r_file=$R_FILE" CMD_LINE_ARGS=( -param_set_file=$PARAM_SET_FILE -mb=$MAX_BUDGET -ds=$DESIGN_SIZE -pp=$PROPOSE_POINTS -it=$MAX_ITERATIONS -exp_id=$EXPID -benchmark_timeout=$BENCHMARK_TIMEOUT -site=$SITE $RESTART_FILE_ARG $RESTART_NUMBER_ARG $R_FILE_ARG ) USER_VARS=( $CMD_LINE_ARGS ) # log variables and script to to TURBINE_OUTPUT directory log_script #Store scripts to provenance #copy the configuration files and R file (for mlrMBO params) to TURBINE_OUTPUT cp $WORKFLOWS_ROOT/common/R/$R_FILE $PARAM_SET_FILE $CFG_SYS $CFG_PRM $TURBINE_OUTPUT # Make run directory in advance to reduce contention mkdir -pv $TURBINE_OUTPUT/run # Allow the user to set an objective function OBJ_DIR=${OBJ_DIR:-$WORKFLOWS_ROOT/common/swift} OBJ_MODULE=${OBJ_MODULE:-obj_$SWIFT_IMPL} # This is used by the obj_app objective function # Andrew: Allows for custom model.sh file, if that's desired export MODEL_SH=${MODEL_SH:-$WORKFLOWS_ROOT/common/sh/model.sh} WAIT_ARG="" if (( ${WAIT:-0} )) then WAIT_ARG="-t w" echo "Turbine will wait for job completion." fi # Use for Summit (LSF needs two %) if [[ ${SITE:-} == "summit" ]] then export TURBINE_STDOUT="$TURBINE_OUTPUT/out/out-%%r.txt" else export TURBINE_STDOUT="$TURBINE_OUTPUT/out/out-%r.txt" fi mkdir -pv $TURBINE_OUTPUT/out #swift-t -n $PROCS \ # -o $TURBINE_OUTPUT/workflow.tic \ if [[ ${MACHINE:-} == "" ]] then STDOUT=$TURBINE_OUTPUT/output.txt # The turbine-output link is only created on scheduled systems, # so if running locally, we create it here so the test*.sh wrappers # can find it [[ -L turbine-output ]] && rm turbine-output ln -s $TURBINE_OUTPUT turbine-output else # When running on a scheduled system, Swift/T automatically redirects # stdout to the turbine-output directory. This will just be for # warnings or unusual messages STDOUT="" fi swift-t -O 0 -n $PROCS \ ${MACHINE:-} \ -p -I $EQR -r $EQR \ -I $OBJ_DIR \ -i $OBJ_MODULE \ -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH \ -e TURBINE_RESIDENT_WORK_WORKERS=$TURBINE_RESIDENT_WORK_WORKERS \ -e RESIDENT_WORK_RANKS=$RESIDENT_WORK_RANKS \ -e BENCHMARKS_ROOT \ -e EMEWS_PROJECT_ROOT \ $( python_envs ) \ -e TURBINE_OUTPUT=$TURBINE_OUTPUT \ -e OBJ_RETURN \ -e MODEL_PYTHON_SCRIPT=${MODEL_PYTHON_SCRIPT:-} \ -e MODEL_PYTHON_DIR=${MODEL_PYTHON_DIR:-} \ -e MODEL_SH \ -e MODEL_NAME \ -e SITE \ -e BENCHMARK_TIMEOUT \ -e SH_TIMEOUT \ -e TURBINE_STDOUT \ -e IGNORE_ERRORS \ $WAIT_ARG \ $EMEWS_PROJECT_ROOT/swift/workflow.swift ${CMD_LINE_ARGS[@]} |& \ tee $STDOUT if (( ${PIPESTATUS[0]} )) then echo "workflow.sh: swift-t exited with error!" exit 1 fi # echo "EXIT CODE: 0" | tee -a $STDOUT # Andrew: Needed this so that script to monitor job worked properly (queue_wait... function in utils.sh?) echo $TURBINE_OUTPUT > turbine-directory.txt
var searchData= [ ['file_5fgenerator_2ehpp_0',['file_generator.hpp',['../file__generator_8hpp.html',1,'']]] ];
const omit = require('lodash/omit'); const Repetition = require('../models/Repetition'); const EventsHelper = require('./events'); const { CompaniDate } = require('./dates/companiDates'); const { FIELDS_NOT_APPLICABLE_TO_REPETITION } = require('./constants'); exports.updateRepetitions = async (eventPayload, parentId) => { const repetition = await Repetition.findOne({ parentId }).lean(); if (!repetition) return; const payloadStartHour = CompaniDate(eventPayload.startDate).getUnits(['hour', 'minute']); const payloadEndHour = CompaniDate(eventPayload.endDate).getUnits(['hour', 'minute']); const startDate = CompaniDate(repetition.startDate).set(payloadStartHour).toISO(); const endDate = CompaniDate(repetition.endDate).set(payloadEndHour).toISO(); const repetitionPayload = { ...omit(eventPayload, ['_id']), startDate, endDate }; const payload = EventsHelper.formatEditionPayload(repetition, repetitionPayload, false); await Repetition.findOneAndUpdate({ parentId }, payload); }; exports.formatPayloadForRepetitionCreation = (event, payload, companyId) => ({ ...omit(payload, FIELDS_NOT_APPLICABLE_TO_REPETITION), company: companyId, repetition: { ...payload.repetition, parentId: event._id }, });
import { Test, TestingModule } from '@nestjs/testing'; import { AsistenciaService } from './asistencia.service'; describe('AsistenciaService', () => { let service: AsistenciaService; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ providers: [AsistenciaService], }).compile(); service = module.get<AsistenciaService>(AsistenciaService); }); it('should be defined', () => { expect(service).toBeDefined(); }); });
#!/bin/sh # shellcheck disable=SC2103 export CC=/usr/bin/gcc-10 && export CXX=/usr/bin/g++-10 && cd imageMagick && cat im7.10.tar.* > im7.10-linux-source.tar && tar xvf im7.10-linux-source.tar && cd ImageMagick-7.0.10 && ./configure --with-quantum-depth=8 --enable-hdri=no --with-x=no --with-utilities=no && sudo make install && cd ../../ && rm -rf Release/ && cd Fronter && ./build_linux.sh && mv Release ../ && cd ../ImperatorToCK3 && rm -rf build && rm -rf Release-Linux && cmake -H. -Bbuild && cmake --build build -- -j3 && mv Release-Linux ../Release/ImperatorToCK3 && cd .. && cp ImperatorToCK3/Data_Files/*yml Release/Configuration/ && cp ImperatorToCK3/Data_Files/fronter*txt Release/Configuration/ && tar -cjf ImperatorToCK3-dev-release.tar.bz2 Release
<filename>forge/dist/core/Search.d.ts<gh_stars>0 import { NamedPlugin } from "./NamedPlugin"; import { IForgePipeline } from "./ForgeTransform"; export declare class Search { private globalPlugins; constructor(globalPlugins: Array<NamedPlugin>); /** * Find a plugin from the perspective of a Transform * * @param name The name of the plugin * @param transform The tansform */ findPlugin(name: string, transform: IForgePipeline): NamedPlugin | import("..").IPlugin | undefined; }
<gh_stars>100-1000 #pragma once #include "Core/Assembler.h" int runFromCommandLine(const std::vector<std::wstring>& arguments, ArmipsArguments settings = {});
parallel --jobs 6 < ./results/exp_iterations/run-4/lustre_4n_6t_6d_1000f_617m_5i/jobs/jobs_n2.txt
<filename>swagger/src/main/java/io/swagger/oas/annotations/Hidden.java package io.swagger.oas.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(value={ElementType.METHOD,ElementType.TYPE,ElementType.FIELD}) @Retention(value=RetentionPolicy.RUNTIME) public @interface Hidden { }
from django.urls import path #from .views import HomePageView from . import views urlpatterns = [ # path('',views.login,name='login'), path('register/', views.register, name = 'register'), path('home/', views.student, name='student'), path('home/courses', views.courses, name='courses'), path('home/show_assignment', views.show_attendance, name='show_assignment'), path('home/attendence',views.show_attendence, name='show_attendence'), path('home/show_warnings',views.show_warnings, name='show_warnings'), path('home/result',views.result, name='marks'), path('home/fee',views.fee, name='fee'), path('home/profile',views.student_profile, name='student_profile'), path('home/profile/<slug:student>/update',views.update_student_profile, name='update_student_profile'), path('logout/', views.logout, name='logOut'), ]
import { CATEGORY_ID, PROVIDE_CATEGORY_ID, PROVIDE_USER_ID, USER_ID } from '@example/constants'; import { article, IArticle } from '@example/services/article'; import createSliceState from './common/createSliceState'; export default createSliceState({ name: 'templateList', initialState: [] as IArticle[], reducers: { set: (state, action) => state, }, effects: { fetch: async (state) => { // Provided template const data = await article.getArticleList({ userId: PROVIDE_USER_ID, categoryId: PROVIDE_CATEGORY_ID, page: 1, size: 1000 }); // Visitor data const data2 = await article.getArticleList({ userId: USER_ID, categoryId: CATEGORY_ID, page: 1, size: 1000 }); const list = [...data.list, ...data2.list]; list.sort((a, b) => a.updated_at > b.updated_at ? -1 : 1); return list; } } });
# ex: set sts=4 ts=4 sw=4 noet: # -*- coding: utf-8 -*- # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """ """ from unittest.mock import patch from datalad.config import ConfigManager from datalad.distribution.dataset import Dataset from ..credman import ( CredentialManager, _get_cred_cfg_var, ) from datalad.support.keyring_ import MemoryKeyring from datalad.tests.utils import ( assert_in, assert_not_in, assert_raises, eq_, neq_, patch_config, with_tempfile, ) def test_credmanager(): # we want all tests to bypass the actual system keyring with patch('datalad.support.keyring_.keyring', MemoryKeyring()): check_credmanager() def check_credmanager(): cfg = ConfigManager() credman = CredentialManager(cfg) # doesn't work with thing air assert_raises(ValueError, credman.get) eq_(credman.get('donotexiststest'), None) eq_(credman.get(crazy='empty'), None) # smoke test for legacy credential retrieval code eq_(credman.get('donotexiststest', type='user_password'), None) # does not fiddle with a secret that is readily provided eq_(credman.get('dummy', secret='mike', _type_hint='token'), dict(type='token', secret='mike')) # no instructions what to do, no legacy entry, nothing was changed # but the secret was written to the keystore eq_(credman.set('mycred', secret='some'), dict(secret='some')) # redo but with timestep setprops = credman.set('lastusedcred', _lastused=True, secret='some') assert_in('last-used', setprops) # now re-set, based on the retrieved info, but update the timestamp setprops_new = credman.set('lastusedcred', _lastused=True, **credman.get('lastusedcred')) # must have updated 'last-used' neq_(setprops['last-used'], setprops_new['last-used']) # first property store attempt eq_(credman.set('changed', secret='some', prop='val'), dict(secret='some', prop='val')) # second, no changing the secret, but changing the prop, albeit with # the same value, change report should be empty eq_(credman.set('changed', prop='val'), dict()) # change secret, with value pulled from config try: cfg.set('datalad.credential.changed.secret', 'envsec', scope='override') eq_(credman.set('changed', secret=None), dict(secret='envsec')) finally: cfg.unset('datalad.credential.changed.secret', scope='override') # remove non-existing property, secret not report, because unchanged eq_(credman.set('mycred', dummy=None), dict(dummy=None)) assert_not_in(_get_cred_cfg_var("mycred", "dummy"), cfg) # set property eq_(credman.set('mycred', dummy='good', this='that'), dict(dummy='good', this='that')) # ensure set eq_(credman.get('mycred'), dict(dummy='good', this='that', secret='some')) # remove individual property eq_(credman.set('mycred', dummy=None), dict(dummy=None)) # ensure removal eq_(credman.get('mycred'), dict(this='that', secret='some')) # test full query and constrained query q = list(credman.query_()) eq_(len(q), 3) # now query for one of the creds created above q = list(credman.query_(prop='val')) eq_(len(q), 1) eq_(q[0][0], 'changed') eq_(q[0][1]['prop'], 'val') # and now a query with no match q = list(credman.query_(prop='val', funky='town')) eq_(len(q), 0) # remove complete credential credman.remove('mycred') eq_(credman.get('mycred'), None) @with_tempfile def test_credman_local(path): ds = Dataset(path).create(result_renderer='disabled') credman = CredentialManager(ds.config) # deposit a credential into the dataset's config, and die trying to # remove it ds.config.set('datalad.credential.stupid.secret', 'really', scope='branch') assert_raises(RuntimeError, credman.remove, 'stupid') # but it manages for the local scope ds.config.set('datalad.credential.notstupid.secret', 'really', scope='local') credman.remove('notstupid') def test_query(): # we want all tests to bypass the actual system keyring with patch('datalad.support.keyring_.keyring', MemoryKeyring()): check_query() def check_query(): cfg = ConfigManager() credman = CredentialManager(cfg) # set a bunch of credentials with a common realm AND timestamp for i in range(3): credman.set( f'cred.{i}', _lastused=True, secret=f'diff{i}', realm='http://ex.com/login', ) # now a credential with the common realm, but without a timestamp credman.set( 'cred.no.time', _lastused=False, secret='notime', realm='http://ex.com/login', ) # and the most recent one (with timestamp) is an unrelated one credman.set('unrelated', _lastused=True, secret='unrelated') # now we want all credentials that match the realm, sorted by # last-used timestamp -- most recent first slist = credman.query(realm='http://ex.com/login', _sortby='last-used') eq_(['cred.2', 'cred.1', 'cred.0', 'cred.no.time'], [i[0] for i in slist]) # same now, but least recent first, importantly no timestamp stays last slist = credman.query(realm='http://ex.com/login', _sortby='last-used', _reverse=False) eq_(['cred.0', 'cred.1', 'cred.2', 'cred.no.time'], [i[0] for i in slist])
"""Module to run a basic decision tree model Author(s): <NAME> (<EMAIL>) <NAME> (<EMAIL>) """ import logging import datetime from sklearn.base import is_classifier from sklearn.model_selection import GridSearchCV from sklearn.metrics import f1_score from sklearn.metrics import recall_score from sklearn.metrics import precision_score from sklearn.metrics import accuracy_score from sklearn.metrics import auc from primrose.readers.dill_reader import DillReader from primrose.models.sklearn_model import SklearnModel class SklearnClassifierModel(SklearnModel): @staticmethod def necessary_config(node_config): """Return a list of necessary configuration keys Args: node_config (dict): set of parameters / attributes for the node Notes: model_parameters (dict): parameters that mirror the sklearn kwargs for the user's model mode: train, eval or predict (see AbstractModel) sklearn_classifier_name: sklearn submodule and model name (submodule.model_name) of the user's model grid_search_scoring: scoring function name from sklearn CV docs cv_folds: number of CV folds Returns: set of required keys """ return set( [ "model_parameters", "mode", "sklearn_classifier_name", "grid_search_scoring", "cv_folds", ] ) def train_model(self, data_object): """train the model using CV, according to user specified options Args: data_object (DataObject): instance of DataObject Returns: Nothing """ X_train, y_train, X_test, y_test = self._get_data(data_object) logging.info("Fitting model") self.model = SklearnModel._instantiate_model( self.node_config["sklearn_classifier_name"], args=None ) self.model = GridSearchCV( self.model, self.node_config["model_parameters"], n_jobs=-1, scoring=self.node_config["grid_search_scoring"], verbose=2, cv=self.node_config["cv_folds"], refit=True, ) self.model.fit(X_train, y_train) data_object.add(self, self.model.best_estimator_, "model") return data_object def eval_model(self, data_object): """Evaluate model perfomance on a labeled testing dataset Returns: data_object (DataObject): instance of DataObject """ if self.model is None: self.model = self.load_model(data_object) logging.info("Evaluating model performance on testing data") X_train, y_train, X_test, y_test = self._get_data(data_object) model_predictions = self.model.predict(X_test) model_probability = self.model.predict_proba(X_test) model_predictions = model_predictions.astype(int) model_f1 = f1_score(y_test, model_predictions, labels=None, pos_label=1) recall = recall_score(y_test, model_predictions, labels=None, pos_label=1) prec = precision_score(y_test, model_predictions, labels=None, pos_label=1) accuracy = accuracy_score(y_test, model_predictions) logging.info( "positive class fraction: {}".format(float(sum(y_test)) / len(y_test)) ) logging.info( "positive class predicted fraction: {}".format( float(sum(model_predictions)) / len(y_test) ) ) logging.info( "f1: {}, recall: {}, precision: {}, accuracy: {}".format( model_f1, recall, prec, accuracy ) ) roc_auc = self._get_roc_score(y_test, model_probability) logging.info("AUC: {}".format(roc_auc)) # write performance and timing information to scores attribute self.scores["auc"] = roc_auc self.scores["f1"] = model_f1 self.scores["recall"] = recall # Recall=TP/(TP+FN) self.scores["precision"] = prec # Precison=TP/(TP+FP) self.scores["positive_class_fraction"] = float(sum(y_test)) / len(y_test) self.scores["predicted_class_fraction"] = float(sum(model_predictions)) / len( y_test ) self.scores["eval_time"] = datetime.datetime.now() return data_object def predict(self, data_object): """Make distance-based predictions using the prebuilt matrix Args: data_object: DataObject instance load_model: load model object from gcs or not Returns: data_object with prediction data added """ if self.model is None: self.model = self.load_model(data_object) X_train, y_train, X_test, y_test = self._get_data(data_object) predictions = self.model.predict(X_test) # get the upstream target_encoder if it exists data = data_object.get_filtered_upstream_data( self.instance_name, filter_for_key="target_encoder" ) if data: if "target_encoder" in data: logging.info("Reversing label encoding") predictions = data["target_encoder"].inverse_transform(predictions) # get original data frame and tack on column of predictions data_out = X_test data_out["predictions"] = predictions data_object.add(self, data_out, "predictions") return data_object
#!/usr/bin/env bash LOOP_NUM=15 #default=64; >=8,<=128 CACHE_SIZE=1k SNAP_SIZE=512 #IMAGE_FILE_NUM=3 #IMAGE_FILE_SIZE=512 mkdir -p /root/blocks echo "creating a cache device for this computer node ..." dd if=/dev/zero of=/root/blocks/cache.blk bs=1M count=$CACHE_SIZE losetup -d /dev/loop0 losetup /dev/loop0 /root/blocks/cache.blk echo "create the cache device completed!" echo "creating snapshot devices ..." modprobe loop max_loop=$LOOP_NUM for i in $(seq 8 $(($LOOP_NUM-1))); do mknod -m 660 /dev/loop$i b 7 $i done for i in $(seq 1 $LOOP_NUM); do dd if=/dev/zero of=/root/blocks/snapshot$i.blk bs=1M count=$SNAP_SIZE done echo "create snapshot devices completed!" :<<note echo "creating image files for test on this image server ..." for i in $(seq 1 $IMAGE_FILE_NUM); do dd if=/dev/zero of=/root/blocks/image$i.blk bs=1M count=$IMAGE_FILE_SIZE done echo "create image files completed!" note
URL="http://dict.youdao.com/fsearch" PARAMS="&keyfrom=mac.main&client=macdict&le=eng" PHONETIC_TAG_REGEX="<[/]*phonetic-symbol>" PHONETIC_REGEX="$PHONETIC_TAG_REGEX.*$PHONETIC_TAG_REGEX" CONTENT_TAG_REGEX="<[/]*content>" CONTENT_REGEX="$CONTENT_TAG_REGEX.*$CONTENT_TAG_REGEX" TRANS_REGEX="<[/]*trans>.*<[/]*trans>" PLACEHOLDER="无搜索结果" QUERY=$1 response=$(curl -Gd "q=$QUERY$PARAMS" $URL) phonetic=$(echo `echo "$response" | grep $PHONETIC_REGEX` | sed "s/${PHONETIC_TAG_REGEX}//g") content=$(echo `echo "$response" | grep $CONTENT_REGEX` | sed -e 's/<translation><content><\!\[CDATA\[//g' -e 's/\]\]><\/content><\/translation>//g') webTrans=$(echo `echo "$response" | grep $TRANS_REGEX` | sed -e 's/<trans><value><\!\[CDATA\[//g' -e 's/\]\]><\/value><\/trans>/;/g') if [ -z "$phonetic" ]; then phonetic="没提供音标" fi if [ -z "$content" ]; then content=$PLACEHOLDER fi if [ -z "$webTrans" ]; then webTrans=$PLACEHOLDER fi cat << EOB { "items": [ { "title": "音标", "subtitle": "$phonetic", }, { "title": "释义", "subtitle": "$content" }, { "title": "网路释义", "subtitle": "$webTrans" } ] } EOB
#include <stdlib.h> #include <stdio.h> typedef struct S { char* name; int age; } S; S* newS(char* name, int age) { S* ret = malloc(sizeof(S)); ret->name = name; ret->age = age; return ret; } void showS(S* s) { printf("s->name : %s\n", s->name); printf("s->age : %d\n", s->age); }
import java.util.Random; public class RandomNumberExample { public static void main(String[] args) { Random random = new Random(); for (int i = 0; i < 10; i++) { System.out.println(random.nextInt()); } } }
<reponame>Taher-Ghaleb/counter_culture class SimpleReview < Review counter_culture :product end
<reponame>goldstar0415/Expo-AR-Game<filename>client/src/components/ScoreBadge.js // @flow import PropTypes from 'prop-types'; import React, { PureComponent } from 'react'; import { Image, Text, View } from 'react-native'; import Assets from '../Assets'; export default class ScoreBadge extends PureComponent { static propTypes = { style: View.propTypes.style, children: View.propTypes.children, color: PropTypes.string.isRequired, }; static defaultProps = { style: {}, children: null, }; render() { const { style, children, color } = this.props; return ( <View style={[ { borderRadius: 20, backgroundColor: '#4630eb', flexDirection: 'row', justifyContent: 'center', alignItems: 'center', paddingHorizontal: 8, paddingVertical: 6, }, style, ]} > <Image source={Assets.images['expoBadge.png']} style={{ marginRight: 12, resizeMode: 'contain', tintColor: color, width: 20, height: 20, aspectRatio: 1, }} /> <Text style={{ fontWeight: 'bold', fontSize: 16, marginRight: 6, color, }} > {children} </Text> </View> ); } }
#!/usr/bin/env bash # Copyright 2021 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -o errexit set -o nounset set -o pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd -P)" cd "${REPO_ROOT}" make -C kettle test
<reponame>tomekb530/tbot module.exports = client =>{ new client.Event("ready",()=>{ client.log("Logged in!") }) }
#!/usr/bin/env bash DATA_DIR="../../../data/thumos14/" if [[ ! -d "${DATA_DIR}" ]]; then echo "${DATA_DIR} does not exist. Creating"; mkdir -p ${DATA_DIR} fi cd ${DATA_DIR} wget https://storage.googleapis.com/thumos14_files/TH14_validation_set_mp4.zip wget https://storage.googleapis.com/thumos14_files/TH14_Test_set_mp4.zip if [ ! -d "./videos/val" ]; then mkdir -p ./videos/val fi unzip -j TH14_validation_set_mp4.zip -d videos/val if [ ! -d "./videos/test" ]; then mkdir -p ./videos/test fi unzip -P "THUMOS14_REGISTERED" -j TH14_Test_set_mp4.zip -d videos/test cd "../../tools/data/thumos14/"
<reponame>chenzhe555/wit import HttpRequest from 'mp-cz-request'; export default class WXRequest extends HttpRequest { }
<reponame>guilhermemcardoso/FruitMap<gh_stars>1-10 import React, {useState} from 'react'; import {Switch} from 'react-native'; import {primaryLight} from '~/themes/index'; const NotificationSwitch = () => { const [value, setValue] = useState(true); return ( <Switch value={value} onValueChange={setValue} trackColor={{true: primaryLight}} /> ); }; export default NotificationSwitch;
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ic_assistant = void 0; var ic_assistant = { "viewBox": "0 0 24 24", "children": [{ "name": "path", "attribs": { "d": "M0 0h24v24H0z", "fill": "none" }, "children": [] }, { "name": "path", "attribs": { "d": "M19 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h4l3 3 3-3h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-5.12 10.88L12 17l-1.88-4.12L6 11l4.12-1.88L12 5l1.88 4.12L18 11l-4.12 1.88z" }, "children": [] }] }; exports.ic_assistant = ic_assistant;
<gh_stars>1-10 package com.cannolicatfish.rankine.entities.goals; import com.cannolicatfish.rankine.init.RankineTags; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.pattern.BlockStateMatcher; import net.minecraft.entity.MobEntity; import net.minecraft.entity.ai.goal.Goal; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.EnumSet; import java.util.function.Predicate; public class EatGrassGoalModified extends Goal { private static final Predicate<BlockState> IS_GRASS = (blockState -> blockState.getBlock().isIn(RankineTags.Blocks.GRASS)); /** The entity owner of this AITask */ private final MobEntity grassEaterEntity; /** The world the grass eater entity is eating from */ private final World entityWorld; /** Number of ticks since the entity started to eat grass */ private int eatingGrassTimer; public EatGrassGoalModified(MobEntity grassEaterEntityIn) { this.grassEaterEntity = grassEaterEntityIn; this.entityWorld = grassEaterEntityIn.world; this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK, Goal.Flag.JUMP)); } /** * Returns whether execution should begin. You can also read and cache any state necessary for execution in this * method as well. */ public boolean shouldExecute() { if (this.grassEaterEntity.getRNG().nextInt(this.grassEaterEntity.isChild() ? 50 : 1000) != 0) { return false; } else { BlockPos blockpos = this.grassEaterEntity.getPosition(); if (IS_GRASS.test(this.entityWorld.getBlockState(blockpos))) { return true; } else { return this.entityWorld.getBlockState(blockpos.down()).matchesBlock(Blocks.GRASS_BLOCK); } } } /** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.eatingGrassTimer = 40; this.entityWorld.setEntityState(this.grassEaterEntity, (byte)10); this.grassEaterEntity.getNavigator().clearPath(); } /** * Reset the task's internal state. Called when this task is interrupted by another one */ public void resetTask() { this.eatingGrassTimer = 0; } /** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean shouldContinueExecuting() { return this.eatingGrassTimer > 0; } /** * Number of ticks since the entity started to eat grass */ public int getEatingGrassTimer() { return this.eatingGrassTimer; } /** * Keep ticking a continuous task that has already been started */ public void tick() { this.eatingGrassTimer = Math.max(0, this.eatingGrassTimer - 1); if (this.eatingGrassTimer == 4) { BlockPos blockpos = this.grassEaterEntity.getPosition(); if (IS_GRASS.test(this.entityWorld.getBlockState(blockpos))) { if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.entityWorld, this.grassEaterEntity)) { this.entityWorld.destroyBlock(blockpos, false); } this.grassEaterEntity.eatGrassBonus(); } else { BlockPos blockpos1 = blockpos.down(); if (this.entityWorld.getBlockState(blockpos1).matchesBlock(Blocks.GRASS_BLOCK)) { if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.entityWorld, this.grassEaterEntity)) { this.entityWorld.playEvent(2001, blockpos1, Block.getStateId(Blocks.GRASS_BLOCK.getDefaultState())); this.entityWorld.setBlockState(blockpos1, Blocks.DIRT.getDefaultState(), 2); } this.grassEaterEntity.eatGrassBonus(); } } } } }
void swap (int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; }
<reponame>donjar/iidx-12 require 'test_helper' class ChartsControllerTest < ActionDispatch::IntegrationTest setup do @chart = charts(:one) end test 'should get index' do get charts_url assert_response :success end test 'should get new' do get new_chart_url assert_response :success end test 'should create chart' do assert_difference('Chart.count') do post charts_url, params: { chart: { clear: @chart.clear, description: @chart.description, diff: @chart.diff, gimmicks: @chart.gimmicks, hc_level: @chart.hc_level, miss: @chart.miss, nc_level: @chart.nc_level, notes: @chart.notes, score: @chart.score, songid: @chart.songid, target_clear: @chart.target_clear, target_priority: @chart.target_priority, title: @chart.title, version: @chart.version } } end assert_redirected_to chart_url(Chart.last) end test 'should show chart' do get chart_url(@chart) assert_response :success end test 'should get edit' do get edit_chart_url(@chart) assert_response :success end test 'should update chart' do patch chart_url(@chart), params: { chart: { clear: @chart.clear, description: @chart.description, diff: @chart.diff, gimmicks: @chart.gimmicks, hc_level: @chart.hc_level, miss: @chart.miss, nc_level: @chart.nc_level, notes: @chart.notes, score: @chart.score, songid: @chart.songid, target_clear: @chart.target_clear, target_priority: @chart.target_priority, title: @chart.title, version: @chart.version } } assert_redirected_to chart_url(@chart) end test 'should destroy chart' do assert_difference('Chart.count', -1) do delete chart_url(@chart) end assert_redirected_to charts_url end end
#!/bin/sh ############################################################################## ## ## ## This is a template for writing Subversion bug reproduction scripts. ## ## ## ## It creates a repository containing the standard Greek Tree (see ## ## http://svn.collab.net/repos/svn/trunk/subversion/tests/greek-tree.txt) ## ## and checks out a working copy containing that tree. Please adjust ## ## this script however you need to to demonstrate your bug. When it's ## ## ready, post the bug report to dev@subversion.tigris.org -- after ## ## reading http://subversion.tigris.org/bugs.html, of course. ## ## ## ############################################################################## # You might need to adjust these lines to point to your # compiled-from-source Subversion binaries, if using those: SVN=`which svn` SVNSERVE=`which svnserve` SVNADMIN=`which svnadmin` # Select an access method. If svn://, the svnserve setup is # handled automagically by this script; but if http://, then # you'll have to configure it yourself first. # # URL=http://localhost/SOMETHING/repos # URL=svn://localhost/repos URL=file:///`pwd`/repos rm -rf repos wc import-me ${SVNADMIN} create repos # These are for svnserve only. echo "[general]" > repos/conf/svnserve.conf echo "anon-access = write" >> repos/conf/svnserve.conf echo "auth-access = write" >> repos/conf/svnserve.conf # The server will only be contacted if $URL is svn://foo, of course. ${SVNSERVE} --pid-file svnserve-pid -d -r `pwd` # And put the kill command in a file, in case need to run it manually. echo "kill -9 `cat svnserve-pid`" > k chmod a+rwx k echo "### Making a Greek Tree for import..." mkdir import-me mkdir import-me/trunk mkdir import-me/tags mkdir import-me/branches mkdir import-me/trunk/A mkdir import-me/trunk/A/B/ mkdir import-me/trunk/A/C/ mkdir import-me/trunk/A/D/ mkdir import-me/trunk/A/B/E/ mkdir import-me/trunk/A/B/F/ mkdir import-me/trunk/A/D/G/ mkdir import-me/trunk/A/D/H/ echo "This is the file 'iota'." > import-me/trunk/iota echo "This is the file 'A/mu'." > import-me/trunk/A/mu echo "This is the file 'A/B/lambda'." > import-me/trunk/A/B/lambda echo "This is the file 'A/B/E/alpha'." > import-me/trunk/A/B/E/alpha echo "This is the file 'A/B/E/beta'." > import-me/trunk/A/B/E/beta echo "This is the file 'A/D/gamma'." > import-me/trunk/A/D/gamma echo "This is the file 'A/D/G/pi'." > import-me/trunk/A/D/G/pi echo "This is the file 'A/D/G/rho'." > import-me/trunk/A/D/G/rho echo "This is the file 'A/D/G/tau'." > import-me/trunk/A/D/G/tau echo "This is the file 'A/D/H/chi'." > import-me/trunk/A/D/H/chi echo "This is the file 'A/D/H/omega'." > import-me/trunk/A/D/H/omega echo "This is the file 'A/D/H/psi'." > import-me/trunk/A/D/H/psi echo "### Done." echo "" echo "### Importing it..." (cd import-me; ${SVN} import -q -m "Initial import." ${URL}) echo "### Done." echo "" ${SVN} co -q ${URL}/trunk wc cd wc echo "### This is where your reproduction recipe goes. ###" cd .. # Put kill command in a file, in case need to run it manually. echo "kill -9 `cat svnserve-pid`" > k chmod a+rwx k ./k
<filename>src/main/java/com/vodafone/garage/dto/VehicleModel.java package com.vodafone.garage.dto; import lombok.*; import javax.validation.constraints.NotNull; @AllArgsConstructor @NoArgsConstructor @Getter @Setter @Builder public class VehicleModel { @NotNull(message = "vehicleType can not be null.") private VehicleTypesEnum vehicleType; @NotNull(message = "plateNo can not be null.") private String plateNo; @NotNull(message = "color can not be null.") private String color; @Override public String toString() { return plateNo+" "+color; } }
<gh_stars>1-10 package net.community.chest.io.encode.qp; import java.io.IOException; import java.io.InputStream; import net.community.chest.io.encode.hex.Hex; import net.community.chest.io.input.InputStreamEmbedder; /** * Helper class that reads from a quoted-printable input stream and * returns decoded data * @author lyorg * 04/03/2004 */ public class QPDecodeInputStream extends InputStreamEmbedder { private final int _nOptions; /** * Base constructor * @param ist "real" input stream assumed to contain QP data * @param nOptions decoding options * @param realClose if TRUE then call to {@link #close()} also closes * the underlying stream * @see QuotedPrintable#DECOPT_UNDERLINE_AS_SPACE * @see QuotedPrintable#DECOPT_THROW_EXCEPTION */ public QPDecodeInputStream (InputStream ist, int nOptions, boolean realClose) { super(ist, realClose); _nOptions = nOptions; } /** * Simple constructor - throws exceptions if non-QP data found * @param ist "real" input stream assumed to contain QP data * @param realClose if TRUE then call to {@link #close()} also closes * the underlying stream */ public QPDecodeInputStream (InputStream ist, boolean realClose) { this(ist, QuotedPrintable.DECOPT_THROW_EXCEPTION, realClose); } /* * @see java.io.InputStream#read() */ @Override public int read () throws IOException { if (null == this.in) return (-1); for (int nRead=0; ; nRead++) { int c=this.in.read(); if (c != QuotedPrintable.QPDELIM) // if this is NOT the Q-P delimiter, then return it as-is { if (('_' == c) && (QuotedPrintable.DECOPT_UNDERLINE_AS_SPACE == (_nOptions & QuotedPrintable.DECOPT_UNDERLINE_AS_SPACE))) return ' '; else return c; } // we read a '=' - check what comes next if ((-1) == (c=this.in.read())) return (-1); // skip soft CR-LF if ('\r' == c) { if ((c=this.in.read()) != '\n') { if (QuotedPrintable.DECOPT_THROW_EXCEPTION == (_nOptions & QuotedPrintable.DECOPT_THROW_EXCEPTION)) throw new IOException("Missing LF in soft line break after " + nRead + " characters"); else return c; } continue; // skip the LF } else if ('\n' == c) continue; final int hiChar=c, loChar=this.in.read(); if (((-1) == hiChar) || ((-1) == loChar)) { if (QuotedPrintable.DECOPT_THROW_EXCEPTION == (_nOptions & QuotedPrintable.DECOPT_THROW_EXCEPTION)) throw new IllegalStateException("bad/illegal QP encoding after " + nRead + " characters"); else return QuotedPrintable.QPDELIM; } else return (Hex.rebuild((char) hiChar, (char) loChar) & 0x00FF); } } /* * @see java.io.InputStream#skip(long) */ @Override public long skip (long n) throws IOException { if (n <= 0) return 0; for (long p=0; p < n; p++) if ((-1) == read()) return p; // this point is reached if end of input not reached before N characters read return n; } }
import requests from bs4 import BeautifulSoup url = "http://www.imdb.com/search/title?count=10&sort=user_rating,desc" page = requests.get(url) soup = BeautifulSoup(page.content, 'html.parser') title_list = soup.find_all('div', {'class': 'lister-item-content'}) for title in title_list: # get title movie_title = title.h3.a.get_text() # get score score = title.find('span', {'class': 'value'}).get_text() print(movie_title + ': ' + score)
package me.legit.api.game.igloo.decoration; import com.google.api.core.ApiFuture; import com.google.cloud.firestore.DocumentReference; import com.google.cloud.firestore.DocumentSnapshot; import com.google.cloud.firestore.Firestore; import com.google.cloud.firestore.WriteResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseToken; import io.javalin.http.Context; import io.javalin.http.Handler; import io.sentry.Sentry; import io.sentry.event.UserBuilder; import me.legit.APICore; import org.jetbrains.annotations.NotNull; import java.util.Base64; import java.util.Map; public class DeleteDecoration implements Handler { public DeleteDecoration() { } @Override public void handle(@NotNull Context ctx) throws Exception { ctx.contentType("application/json"); String encodedToken = ctx.header("Authorization").split("Basic ")[1].split(", GAE")[0]; String token = new String(Base64.getDecoder().decode(encodedToken)).split(":")[0]; boolean checkRevoked = true; FirebaseToken decodedToken = FirebaseAuth.getInstance().verifyIdTokenAsync(token, checkRevoked).get(); String uid = decodedToken.getUid(); Sentry.getContext().setUser(new UserBuilder().setId(uid).build()); APICore.getLogger().info("Successfully verified and decoded ID token for user: " + uid + " (DeleteDecoration)"); String decorationId = ctx.pathParam("id"); Firestore db = APICore.getDatabaseManager().firebase().getFirestore(); DocumentReference docRef = db.collection("users").document(uid); ApiFuture<DocumentSnapshot> future = docRef.get(); DocumentSnapshot document = future.get(); if (document.exists()) { Map<String, Object> decorationInventoryMap = (Map<String, Object>) document.get("decorationInventory"); if (decorationInventoryMap != null) { decorationInventoryMap.remove(decorationId); ApiFuture<WriteResult> updateDecorations = docRef.update("decorationInventory", decorationInventoryMap); APICore.getLogger().info("Deleted decoration " + decorationId + " for user " + uid + " at: " + updateDecorations.get().getUpdateTime()); } } } }
def label_classifier(attributes): if attributes["height"] > 40 and attributes["length"] > 75 and attributes["weight"] > 10: return "large" elif attributes["height"] > 20 and attributes["length"] > 30 and attributes["weight"] > 1: return "medium" else: return "small"
#!/bin/bash TMP_FOLDER=$(mktemp -d) CONFIG_FILE='crowdcoin.conf' CONFIGFOLDER='/root/.crowdcoinbrain' COIN_DAEMON='crowdcoind' COIN_VERSION='v2.0.0' COIN_CLI='crowdcoin-cli' COIN_PATH='/usr/local/bin/' COIN_REPO='https://github.com/crowdcoinChain/Crowdcoin.git' COIN_TGZ='https://github.com/crowdcoinChain/Crowdcoin/releases/download/2.0.0/Crowdcoin_command_line_binaries_linux_2.0.0.tar.gz' COIN_BINDIR='Crowdcoin_command_line_binaries_linux_2.0.0' COIN_ZIP=$(echo $COIN_TGZ | awk -F'/' '{print $NF}') SENTINEL_REPO='https://github.com/crowdcoinChain/sentinelLinux.git' #COIN_BOOTSTRAP='XX' COIN_NAME='crowdcoin' COIN_PORT=8585 RPC_PORT=11998 NODEIP=$(curl -s4 icanhazip.com) BLUE="\033[0;34m" YELLOW="\033[0;33m" CYAN="\033[0;36m" PURPLE="\033[0;35m" RED='\033[0;31m' GREEN="\033[0;32m" NC='\033[0m' MAG='\e[1;35m' purgeOldInstallation() { echo -e "${GREEN}Searching and removing old $COIN_NAME files and configurations${NC}" #kill wallet daemon systemctl stop $COIN_NAME.service > /dev/null 2>&1 sudo killall $COIN_DAEMON > /dev/null 2>&1 #remove old ufw port allow sudo ufw delete allow 8585/tcp > /dev/null 2>&1 #remove old files rm /root/$CONFIGFOLDER/bootstrap.dat.old > /dev/null 2>&1 cd /usr/local/bin && sudo rm $COIN_CLI $COIN_DAEMON > /dev/null 2>&1 && cd cd /usr/bin && sudo rm $COIN_CLI $COIN_DAEMON > /dev/null 2>&1 && cd sudo rm -rf ~/$CONFIGFOLDER > /dev/null 2>&1 #remove binaries and Crowdcoin utilities cd /usr/local/bin && sudo rm crowdcoin-cli crowdcoin-tx crowdcoind > /dev/null 2>&1 && cd } function install_sentinel() { echo -e "${GREEN}Installing sentinel${NC}" apt-get -y install python-virtualenv virtualenv >/dev/null 2>&1 git clone $SENTINEL_REPO $CONFIGFOLDER/sentinelLinux >/dev/null 2>&1 cd $CONFIGFOLDER/sentinelLinux export LC_ALL=C virtualenv ./venv >/dev/null 2>&1 ./venv/bin/pip install -r requirements.txt >/dev/null 2>&1 sed -i -e 's/dash_conf=\/home\/YOURUSERNAME\/\.crowdcoinbrain\/crowdcoin\.conf/dash_conf=\/root\/.crowdcoinbrain\/crowdcoin.conf/g' sentinel.conf echo "* * * * * cd $CONFIGFOLDER/sentinelLinux && ./venv/bin/python bin/sentinel.py >> $CONFIGFOLDER/sentinel.log 2>&1" > $CONFIGFOLDER/$COIN_NAME.cron crontab $CONFIGFOLDER/$COIN_NAME.cron rm $CONFIGFOLDER/$COIN_NAME.cron >/dev/null 2>&1 } function download_node() { echo -e "${GREEN}Downloading and installing $COIN_NAME daemon${NC}" cd $TMP_FOLDER >/dev/null 2>&1 wget -q $COIN_TGZ compile_error tar xvzf $COIN_ZIP >/dev/null 2>&1 cd $COIN_BINDIR chmod +x $COIN_DAEMON $COIN_CLI cp $COIN_DAEMON $COIN_CLI $COIN_PATH cd ~ >/dev/null 2>&1 rm -rf $TMP_FOLDER >/dev/null 2>&1 clear } function configure_systemd() { cat << EOF > /etc/systemd/system/$COIN_NAME.service [Unit] Description=$COIN_NAME service After=network.target [Service] User=root Group=root Type=forking #PIDFile=$CONFIGFOLDER/$COIN_NAME.pid ExecStart=$COIN_PATH$COIN_DAEMON -daemon -conf=$CONFIGFOLDER/$CONFIG_FILE -datadir=$CONFIGFOLDER ExecStop=-$COIN_PATH$COIN_CLI -conf=$CONFIGFOLDER/$CONFIG_FILE -datadir=$CONFIGFOLDER stop Restart=always PrivateTmp=true TimeoutStopSec=60s TimeoutStartSec=10s StartLimitInterval=120s StartLimitBurst=5 [Install] WantedBy=multi-user.target EOF systemctl daemon-reload sleep 3 systemctl start $COIN_NAME.service systemctl enable $COIN_NAME.service >/dev/null 2>&1 if [[ -z "$(ps axo cmd:100 | egrep $COIN_DAEMON)" ]]; then echo -e "${RED}$COIN_NAME is not running${NC}, please investigate. You should start by running the following commands as root:" echo -e "${GREEN}systemctl start $COIN_NAME.service" echo -e "systemctl status $COIN_NAME.service" echo -e "less /var/log/syslog${NC}" exit 1 fi } function create_config() { mkdir $CONFIGFOLDER >/dev/null 2>&1 RPCUSER=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w10 | head -n1) RPCPASSWORD=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w22 | head -n1) cat << EOF > $CONFIGFOLDER/$CONFIG_FILE rpcuser=$RPCUSER rpcpassword=$RPCPASSWORD rpcport=$RPC_PORT rpcthreads=8 rpcbind=127.0.0.1 rpcallowip=127.0.0.1 listen=1 server=1 daemon=1 port=$COIN_PORT staking=0 discover=1 EOF } function grab_bootstrap() { cd $CONFIGFOLDER wget -q $COIN_BOOTSTRAP } function create_key() { echo -e "${YELLOW}Enter your ${RED}$COIN_NAME masternode genkey${NC}:" read -e COINKEY if [[ -z "$COINKEY" ]]; then $COIN_PATH$COIN_DAEMON -daemon sleep 30 if [ -z "$(ps axo cmd:100 | grep $COIN_DAEMON)" ]; then echo -e "${RED}$COIN_NAME server couldn not start. Check /var/log/syslog for errors.{$NC}" exit 1 fi COINKEY=$($COIN_PATH$COIN_CLI masternode genkey) if [ "$?" -gt "0" ]; then echo -e "${RED}Wallet not fully loaded. Let us wait and try again to generate the GEN Key${NC}" sleep 30 COINKEY=$($COIN_PATH$COIN_CLI masternode genkey) fi $COIN_PATH$COIN_CLI stop fi clear } function update_config() { sed -i 's/daemon=1/daemon=0/' $CONFIGFOLDER/$CONFIG_FILE cat << EOF >> $CONFIGFOLDER/$CONFIG_FILE logintimestamps=1 maxconnections=256 masternode=1 externalip=$NODEIP:$COIN_PORT masternodeprivkey=$COINKEY #ADDNODES addnode=54.36.163.216:8585 addnode=96.126.124.245 addnode=121.200.4.203 addnode=188.165.52.69 addnode=207.148.121.239 addnode=84.17.23.43:8585 addnode=18.220.138.90:8585 addnode=86.57.164.166:8585 addnode=86.57.164.146:8585 addnode=18.217.78.145:8585 addnode=23.92.30.230:8585 addnode=35.190.182.68:8585 addnode=80.209.236.4:8585 addnode=91.201.40.89:8585 EOF } function enable_firewall() { echo -e "Installing and setting up firewall to allow port ${GREEN}$COIN_PORT${NC}" ufw allow $COIN_PORT/tcp comment "$COIN_NAME MN port" >/dev/null ufw allow ssh comment "SSH" >/dev/null 2>&1 ufw limit ssh/tcp >/dev/null 2>&1 ufw default allow outgoing >/dev/null 2>&1 echo "y" | ufw enable >/dev/null 2>&1 } function get_ip() { declare -a NODE_IPS for ips in $(netstat -i | awk '!/Kernel|Iface|lo/ {print $1," "}') do NODE_IPS+=($(curl --interface $ips --connect-timeout 2 -s4 icanhazip.com)) done if [ ${#NODE_IPS[@]} -gt 1 ] then echo -e "${GREEN}More than one IP. Please type 0 to use the first IP, 1 for the second and so on...${NC}" INDEX=0 for ip in "${NODE_IPS[@]}" do echo ${INDEX} $ip let INDEX=${INDEX}+1 done read -e choose_ip NODEIP=${NODE_IPS[$choose_ip]} else NODEIP=${NODE_IPS[0]} fi } function compile_error() { if [ "$?" -gt "0" ]; then echo -e "${RED}Failed to compile $COIN_NAME. Please investigate.${NC}" exit 1 fi } function checks() { if [[ $(lsb_release -d) != *18.04* ]]; then echo -e "${RED}You are not running Ubuntu 16.04. Installation is cancelled.${NC}" exit 1 fi if [[ $EUID -ne 0 ]]; then echo -e "${RED}$0 must be run as root.${NC}" exit 1 fi if [ -n "$(pidof $COIN_DAEMON)" ] || [ -e "$COIN_DAEMOM" ] ; then echo -e "${RED}$COIN_NAME is already installed.${NC}" exit 1 fi } function prepare_system() { echo -e "Preparing the VPS to setup: ${RED}$COIN_NAME masternode${NC}" apt-get update >/dev/null 2>&1 DEBIAN_FRONTEND=noninteractive apt-get update > /dev/null 2>&1 DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y -qq upgrade >/dev/null 2>&1 apt install -y software-properties-common >/dev/null 2>&1 echo -e "${PURPLE}Adding bitcoin PPA repository" apt-add-repository -y ppa:bitcoin/bitcoin >/dev/null 2>&1 echo -e "Installing required packages, it may take some time to finish.${NC}" apt-get update >/dev/null 2>&1 apt-get install pwgen -y >/dev/null 2>&1 apt-get install libzmq3-dev -y >/dev/null 2>&1 apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" make software-properties-common \ build-essential libtool autotools-dev autoconf libssl-dev libboost-dev libboost-chrono-dev libboost-filesystem-dev libboost-program-options-dev \ libboost-system-dev libboost-test-dev libboost-thread-dev libboost-all-dev sudo automake git wget curl libdb4.8-dev bsdmainutils libdb4.8++-dev \ libminiupnpc-dev libgmp3-dev ufw pkg-config libevent-dev libdb5.3++ unzip libzmq5 >/dev/null 2>&1 if [ "$?" -gt "0" ]; then echo -e "${RED}Not all required packages were installed properly. Try to install them manually by running the following commands:${NC}\n" echo "apt-get update" echo "apt -y install software-properties-common" echo "apt-add-repository -y ppa:bitcoin/bitcoin" echo "apt-get update" echo "apt install -y make build-essential libtool autotools-dev software-properties-common autoconf libssl-dev libboost-dev libboost-chrono-dev libboost-filesystem-dev \ libboost-program-options-dev libboost-system-dev libboost-test-dev libboost-thread-dev libboost-all-dev sudo automake git curl libdb4.8-dev \ bsdmainutils libdb4.8++-dev libminiupnpc-dev libgmp3-dev ufw pkg-config libevent-dev libdb5.3++ unzip libzmq5" exit 1 fi clear } function important_information() { clear echo echo -e "${BLUE}================================================================================================================================${NC}" echo -e "${CYAN}Guide: https://github.com/crowdcoinChain/ScriptEasyInstall/blob/master/README.md${NC}" echo -e "${BLUE}================================================================================================================================${NC}" echo -e "${RED}$COIN_NAME${NC} masternode is up and running and listening on port ${PURPLE}$COIN_PORT${NC}." echo -e "${BLUE}${NC}" echo -e "${GREEN}Service start: ${NC}${RED}systemctl start $COIN_NAME.service${NC}" echo -e "${GREEN}Service stop: ${NC}${RED}systemctl stop $COIN_NAME.service${NC}" echo -e "${GREEN}Service status: ${NC}${RED}systemctl status $COIN_NAME.service${NC}" echo -e "${GREEN}Configuration file: ${NC}${RED}$CONFIGFOLDER/$CONFIG_FILE${NC}" if [[ -n $SENTINEL_REPO ]]; then echo -e "${GREEN}Sentinel folder: ${NC}${RED}$CONFIGFOLDER/sentinelLinux${NC}" echo -e "${GREEN}Sentinel logfile: ${NC}${RED}$CONFIGFOLDER/sentinel.log${NC}" fi echo -e "${BLUE}${NC}" echo -e "${GREEN}VPS_IP:PORT ${NC}${PURPLE}$NODEIP:$COIN_PORT${NC}" echo -e "${GREEN}MASTERNODE GENKEY: ${NC}${PURPLE}$COINKEY${NC}" echo -e "${BLUE}${NC}" echo -e "${CYAN}Ensure your masternode is fully SYNCED with the BLOCKCHAIN${NC}" echo -e "https://explorer.crowdcoin.site/" echo -e "Masternode config: ${PURPLE}<ALIAS> $NODEIP:$COIN_PORT $COINKEY <TX> <ID>${NC}" echo -e "${BLUE}${NC}" echo -e "${BLUE}================================================================================================================================${NC}" echo -e "To monitor, run the following commands on your vps:" echo -e "${RED}crowdcoin-cli masternode status${NC}" echo -e "${RED}crowdcoin-cli getinfo${NC}" echo -e "${RED}crowdcoin-cli mnsync status${NC}" echo -e "${BLUE}================================================================================================================================${NC}" echo -e "${YELLOW}DONATION (CRC): CV8WdSZKp4rcTUxMLoPg8WcS1PdqEjgREV${NC}" echo -e "${YELLOW}DONATION (ETH): 0x06E4454CB946038E3252eD1d5B3fDafb85E089F5${NC}" echo -e "${BLUE}================================================================================================================================${NC}" } function setup_node() { get_ip create_config create_key update_config enable_firewall #grab_bootstrap install_sentinel important_information configure_systemd } ##### Main ##### clear #purgeOldInstallation checks prepare_system download_node setup_node
#TCP server import socket # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port server_address = ('localhost', 10000) print('starting up on {} port {}'.format(*server_address)) sock.bind(server_address) # Listen for incoming connections sock.listen(1) while True: # Wait for a connection print('waiting for a connection') connection, client_address = sock.accept() try: print('connection from', client_address) # Receive the data in small chunks and retransmit it while True: data = connection.recv(16) print('received {!r}'.format(data)) if data: print('sending data back to the client') connection.sendall(data) else: print('no data from', client_address) break finally: # Clean up the connection connection.close() #TCP client import socket # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('localhost', 10000) print('connecting to {} port {}'.format(*server_address)) sock.connect(server_address) try: # Send data message = b'this is the message. It will be repeated.' print('sending {!r}'.format(message)) sock.sendall(message) # Look for the response amount_received = 0 amount_expected = len(message) while amount_received < amount_expected: data = sock.recv(16) amount_received += len(data) print('received {!r}'.format(data)) finally: print('closing socket') sock.close()
MININIX_PKG_HOMEPAGE=https://developer.gnome.org/gdk-pixbuf/ MININIX_PKG_DESCRIPTION="Library for image loading and manipulation" MININIX_PKG_VERSION=2.36.12 MININIX_PKG_SHA256=fff85cf48223ab60e3c3c8318e2087131b590fd6f1737e42cb3759a3b427a334 MININIX_PKG_SRCURL=ftp://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/${MININIX_PKG_VERSION:0:4}/gdk-pixbuf-${MININIX_PKG_VERSION}.tar.xz MININIX_PKG_DEPENDS="glib, libpng, libtiff, libjpeg-turbo" MININIX_PKG_DEVPACKAGE_DEPENDS="libpng-dev, glib-dev" MININIX_PKG_EXTRA_CONFIGURE_ARGS=" gio_can_sniff=no --disable-glibtest "
#!/bin/sh if cmus-remote -Q | grep -q 'paused' then echo "paused"; else cmus-remote -Q | grep 'file' | awk -F/ '{print $NF}'; fi
#!/bin/bash # # bash completion file for otto (https://ottoproject.io # # To enable the completions either: # - place this file in /etc/bash_completion.d # or # - copy this file to e.g. ~/.otto-completion.sh and add the line # below to your .bashrc after bash completion features are loaded # . ~/.otto-completion.sh # _otto_compile() { COMPREPLY=( $( compgen -o default -W "${subcommands[*]}" -- "$cur" ) ) } _otto_deploy() { local subcommands=( info destroy help ) # only one subcommand for subcom in ${subcommands[*]}; do if [ "$prev" == "destroy" ]; then subcommands=("-force") elif [ "$prev" == "$subcom" ]; then return fi done COMPREPLY=( $( compgen -W "${subcommands[*]}" -- "$cur" ) ) } _otto_dev() { local subcommands=( ssh address destroy vagrant help ) # only one subcommand for subcom in ${subcommands[*]}; do if [ "$prev" == "$subcom" ]; then return fi done COMPREPLY=( $( compgen -W "${subcommands[*]}" -- "$cur" ) ) } _otto_infra() { local subcommands=( help info destroy ) # only one subcommand for subcom in ${subcommands[*]}; do if [ "$prev" == "destroy" ]; then subcommands=("-force") elif [ "$prev" == "$subcom" ]; then return fi done COMPREPLY=( $( compgen -W "${subcommands[*]}" -- "$cur" ) ) } _otto() { local commands=( build compile deploy dev infra status version ) COMPREPLY=() local cur local prev local first="${COMP_WORDS[0]}" local second="${COMP_WORDS[1]}" _get_comp_words_by_ref -n : cur prev if [ "$prev" == "$first" ]; then COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) else for option in ${commands[*]}; do if [ "$second" == "$option" ]; then declare -F _otto_$option >/dev/null || return _otto_$option fi done fi return } complete -F _otto otto
import xml.etree.ElementTree as ET def parse_xml_data(xml_data: str, code: str) -> str: root = ET.fromstring(xml_data) if code == '0': zpid = root.find('response/url/cdata').text return zpid else: msg = root.find('message/text/cdata').text return msg
<filename>instrumentation/spring/src/test/java/org/glowroot/instrumentation/spring/ControllerIT.java /* * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.glowroot.instrumentation.spring; import java.util.Iterator; import java.util.List; import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.glowroot.instrumentation.test.harness.Container; import org.glowroot.instrumentation.test.harness.Containers; import org.glowroot.instrumentation.test.harness.IncomingSpan; import org.glowroot.instrumentation.test.harness.LocalSpan; import org.glowroot.instrumentation.test.harness.Span; import static org.assertj.core.api.Assertions.assertThat; public class ControllerIT { private static Container container; @BeforeClass public static void setUp() throws Exception { container = Containers.create(); } @AfterClass public static void tearDown() throws Exception { container.close(); } @After public void afterEachTest() throws Exception { container.resetAfterEachTest(); } @Test public void shouldCaptureTransactionNameWithNormalServletMapping() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp1", "", "/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /hello/echo/*"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithContextPathAndNormalServletMapping() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp1", "/zzz", "/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /zzz/hello/echo/*"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithNormalServletMappingHittingRoot() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp1", "", "/"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /"); validateSpans(incomingSpan.childSpans(), RootController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithContextPathAndNormalServletMappingHittingRoot() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp1", "/zzz", "/"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /zzz/"); validateSpans(incomingSpan.childSpans(), RootController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithNestedServletMapping() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp2", "", "/spring/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /spring/hello/echo/*"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithContextPathAndNestedServletMapping() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp2", "/zzz", "/spring/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /zzz/spring/hello/echo/*"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithNestedServletMappingHittingRoot() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp2", "", "/spring/"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /spring/"); validateSpans(incomingSpan.childSpans(), RootController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithContextPathAndNestedServletMappingHittingRoot() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp2", "/zzz", "/spring/"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /zzz/spring/"); validateSpans(incomingSpan.childSpans(), RootController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithLessNormalServletMapping() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp3", "", "/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /hello/echo/*"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithContextPathAndLessNormalServletMapping() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp3", "/zzz", "/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /zzz/hello/echo/*"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithLessNormalServletMappingHittingRoot() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp3", "", "/"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /"); validateSpans(incomingSpan.childSpans(), RootController.class, "echo"); } @Test public void shouldCaptureTransactionNameWithContextPathAndLessNormalServletMappingHittingRoot() throws Exception { // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp3", "/zzz", "/"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET /zzz/"); validateSpans(incomingSpan.childSpans(), RootController.class, "echo"); } @Test public void shouldCaptureAltTransactionName() throws Exception { // given container.setInstrumentationProperty("spring", "useAltTransactionNaming", true); // when IncomingSpan incomingSpan = container.executeForType(InvokeSpringControllerInTomcat.class, "Web", "webapp1", "", "/hello/echo/5"); // then assertThat(incomingSpan.transactionName()).isEqualTo("GET TestController#echo"); validateSpans(incomingSpan.childSpans(), TestController.class, "echo"); } private void validateSpans(List<Span> spans, Class<?> clazz, String methodName) { Iterator<Span> i = spans.iterator(); LocalSpan localSpan = (LocalSpan) i.next(); assertThat(localSpan.message()) .isEqualTo("spring controller: " + clazz.getName() + "." + methodName + "()"); assertThat(localSpan.childSpans()).isEmpty(); assertThat(i.hasNext()).isFalse(); } @Controller @RequestMapping("hello") public static class TestController { @RequestMapping("echo/{id}") public @ResponseBody String echo() { return ""; } } @Controller public static class RootController { @RequestMapping("") public @ResponseBody String echo() { return ""; } } }
using System.Activities; public class FactorialActivity : CodeActivity { public InArgument<int> Number { get; set; } public OutArgument<int> Result { get; set; } protected override void Execute(CodeActivityContext context) { int number = Number.Get(context); int result = CalculateFactorial(number); Result.Set(context, result); } private int CalculateFactorial(int n) { if (n == 0) { return 1; } else { int factorial = 1; for (int i = 1; i <= n; i++) { factorial *= i; } return factorial; } } }
import logging class ApplicationLogger: def __init__(self): self.loggers = {} self.queue_logger = logging.getLogger('kamma.queue') def set_module_logging_level(self, module_name, logging_level): logger = logging.getLogger(f'kamma.{module_name}') logger.setLevel(logging_level) self.loggers[module_name] = logger def log_module_message(self, module_name, message, logging_level): if module_name in self.loggers: logger = self.loggers[module_name] if logging_level == 'DEBUG': logger.debug(message) elif logging_level == 'INFO': logger.info(message) elif logging_level == 'WARNING': logger.warning(message) elif logging_level == 'ERROR': logger.error(message) elif logging_level == 'CRITICAL': logger.critical(message) else: print(f"Invalid logging level: {logging_level}") else: print(f"Logger for module {module_name} not found") def log_queue_message(self, message, logging_level): if logging_level == 'DEBUG': self.queue_logger.debug(message) elif logging_level == 'INFO': self.queue_logger.info(message) elif logging_level == 'WARNING': self.queue_logger.warning(message) elif logging_level == 'ERROR': self.queue_logger.error(message) elif logging_level == 'CRITICAL': self.queue_logger.critical(message) else: print(f"Invalid logging level: {logging_level}")
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Container, Divider, Button, Icon } from 'semantic-ui-react'; import { selectYear, fetchMeetsIfNeeded, invalidateYear } from '../actions'; import Picker from '../components/Picker'; import Meets from '../components/Meets'; class TrackApp extends Component { constructor(props) { super(props); this.handleChange = this.handleChange.bind(this); this.handleRefreshClick = this.handleRefreshClick.bind(this); } componentDidMount() { const { dispatch, selectedYear } = this.props; dispatch(fetchMeetsIfNeeded(selectedYear)); } componentDidUpdate(prevProps) { if (this.props.selectedYear !== prevProps.selectedYear) { const { dispatch, selectedYear } = this.props; dispatch(fetchMeetsIfNeeded(selectedYear)); } } handleChange(nextYear) { console.log(nextYear); this.props.dispatch(selectYear(nextYear)); this.props.dispatch(selectYear(nextYear)); } handleRefreshClick(e) { e.preventDefault(); const { dispatch, selectedYear } = this.props; dispatch(invalidateYear(selectedYear)); dispatch(fetchMeetsIfNeeded(selectedYear)); } render() { const { selectedYear, meets, isFetching, lastUpdated } = this.props; return ( <Container> <Divider hidden /> <Picker value={selectedYear} onChange={this.handleChange} options={[{key: '2018', value: '2018', text: '2018'}, {key: '2017', value: '2017', text: '2017'}, {key: '2016', value: '2016', text: '2016'}]} /> <Divider hidden /> <p> {lastUpdated && ( <span> Last Updated at {new Date(lastUpdated).toLocaleTimeString()}. {' '} </span> )} </p> {!isFetching && ( <Button animated="fade" onClick={this.handleRefreshClick} fluid className="mb-30"> <Button.Content visible><Icon name="refresh" /></Button.Content> <Button.Content hidden>Refresh</Button.Content> </Button> )} <Divider hidden /> {isFetching && meets.length === 0 && <h2>Loading...</h2>} {!isFetching && meets.length === 0 && <h2>No Meets Available</h2>} {meets.length > 0 && ( <div style={{ opacity: isFetching ? 0.5 : 1 }}> <Meets meets={meets} /> </div> )} </Container> ); } } TrackApp.propTypes = { selectedYear: PropTypes.string.isRequired, meets: PropTypes.array.isRequired, isFetching: PropTypes.bool.isRequired, dispatch: PropTypes.func.isRequired, lastUpdated: PropTypes.number }; function mapStateToProps(state) { const { selectedYear, meetsByYear } = state; const { isFetching, lastUpdated, items: meets, } = meetsByYear[selectedYear] || { isFetching: true, items: [] }; return { selectedYear, meets, isFetching, lastUpdated }; } export default connect(mapStateToProps)(TrackApp);
package com.imooc.o2o.util; public class PageCalculator { public static int calculateRowIndex(int pageIndex,int pageSize){ return (pageIndex >0) ? (pageIndex -1) * pageSize :0; } }
#!/usr/bin/env bash # Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # Neither the name of ARM nor the names of its contributors may be used # to endorse or promote products derived from this software without specific # prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # This script uses the following environment variables from the variant # # VARIANT - build variant name # TOP_DIR - workspace root directory # CROSS_COMPILE - PATH to GCC including CROSS-COMPILE prefix # PARALLELISM - number of cores to build across # UEFI_BUILD_ENABLED - Flag to enable building UEFI # UEFI_PATH - sub-directory containing UEFI code # UEFI_BUILD_MODE - DEBUG or RELEASE # UEFI_TOOLCHAIN - Toolchain supported by Linaro uefi-tools: GCC49, GCC48 or GCC47 # UEFI_PLATFORMS - List of platforms to build # UEFI_PLAT_{platform name} - array of platform parameters: # - platname - the name of the platform used by the build # - makefile - the makefile to execute for this platform # - output - where to store the files in packaging phase # - defines - extra platform defines during the build # - binary - what to call the final output binary TOP_DIR=`pwd` UEFI_PATH=edk2 SCT_PATH=edk2-test UEFI_TOOLCHAIN=GCC5 UEFI_BUILD_MODE=DEBUG TARGET_ARCH=AARCH64 GCC=tools/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- CROSS_COMPILE=$TOP_DIR/$GCC BUILD_PLAT=$1 BUILD_TYPE=$2 if ! [[ $BUILD_PLAT = IR ]] && ! [[ $BUILD_PLAT = ES ]] ; then echo "Please provide a target." echo "Usage build-sct.sh <IR/ES> <BUILD_TYPE>" exit fi if ! [[ $BUILD_TYPE = S ]] && ! [[ $BUILD_TYPE = F ]] ; then echo "Please provide a Build type." echo "Usage build-sct.sh <target> <S/F>" echo "S->Standalone BBR,F->Full systemready" exit fi if [[ $BUILD_TYPE = S ]]; then BBR_DIR=$TOP_DIR/../../ else BBR_DIR=$TOP_DIR/bbr-acs fi echo "Target: $BUILD_PLAT" echo "Build type: $BUILD_TYPE" SBBR_TEST_DIR=$BBR_DIR/common/sct-tests/sbbr-tests do_build() { pushd $TOP_DIR/$SCT_PATH CROSS_COMPILE_DIR=$(dirname $CROSS_COMPILE) PATH="$PATH:$CROSS_COMPILE_DIR" export EDK2_TOOLCHAIN=$UEFI_TOOLCHAIN export ${UEFI_TOOLCHAIN}_AARCH64_PREFIX=$CROSS_COMPILE local vars= export PACKAGES_PATH=$TOP_DIR/$UEFI_PATH export PYTHON_COMMAND=/usr/bin/python3 export WORKSPACE=$TOP_DIR/$SCT_PATH/uefi-sct #export HOST_ARCH = `uname -m` #MACHINE=`uname -m` #Build base tools source $TOP_DIR/$UEFI_PATH/edksetup.sh make -C $TOP_DIR/$UEFI_PATH/BaseTools #Copy over extra files needed for SBBR tests cp -r $SBBR_TEST_DIR/SbbrBootServices uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/ cp -r $SBBR_TEST_DIR/SbbrEfiSpecVerLvl $SBBR_TEST_DIR/SbbrRequiredUefiProtocols $SBBR_TEST_DIR/SbbrSmbios $SBBR_TEST_DIR/SbbrSysEnvConfig uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/ cp -r $SBBR_TEST_DIR/SBBRRuntimeServices uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/ cp $SBBR_TEST_DIR/BBR_SCT.dsc uefi-sct/SctPkg/UEFI/ cp $SBBR_TEST_DIR/build_bbr.sh uefi-sct/SctPkg/ #Startup/runtime files. mkdir -p uefi-sct/SctPkg/BBR if [ $BUILD_PLAT = IR ]; then #EBBR cp $BBR_DIR/ebbr/config/EBBRStartup.nsh uefi-sct/SctPkg/BBR/ cp $BBR_DIR/ebbr/config/EBBR.seq uefi-sct/SctPkg/BBR/ cp $BBR_DIR/ebbr/config/EBBR_manual.seq uefi-sct/SctPkg/BBR/ cp $BBR_DIR/ebbr/config/EfiCompliant_EBBR.ini uefi-sct/SctPkg/BBR/ else #SBBR cp $BBR_DIR/sbbr/config/SBBRStartup.nsh uefi-sct/SctPkg/BBR/ cp $BBR_DIR/sbbr/config/SBBR.seq uefi-sct/SctPkg/BBR/ cp $BBR_DIR/sbbr/config/SBBR_manual.seq uefi-sct/SctPkg/BBR/ cp $BBR_DIR/sbbr/config/EfiCompliant_SBBR.ini uefi-sct/SctPkg/BBR/ fi if ! patch -R -p1 -s -f --dry-run < $BBR_DIR/common/patches/edk2-test-bbr.patch; then echo "Applying SCT patch ..." patch -p1 < $BBR_DIR/common/patches/edk2-test-bbr.patch fi pushd uefi-sct ./SctPkg/build_bbr.sh $TARGET_ARCH GCC $UEFI_BUILD_MODE popd } do_clean() { pushd $TOP_DIR/$SCT_PATH/uefi-sct CROSS_COMPILE_DIR=$(dirname $CROSS_COMPILE) PATH="$PATH:$CROSS_COMPILE_DIR" source $TOP_DIR/$UEFI_PATH/edksetup.sh make -C $TOP_DIR/$UEFI_PATH/BaseTools clean rm -rf Build/bbrSct rm -rf ${TARGET_ARCH}_SCT popd } do_package () { echo "Packaging sct... $VARIANT"; # Copy binaries to output folder pushd $TOP_DIR/$SCT_PATH/uefi-sct mkdir -p ${TARGET_ARCH}_SCT/SCT cp -r Build/bbrSct/${UEFI_BUILD_MODE}_${UEFI_TOOLCHAIN}/SctPackage${TARGET_ARCH}/${TARGET_ARCH}/* ${TARGET_ARCH}_SCT/SCT/ if [ $BUILD_PLAT = IR ]; then #EBBR cp Build/bbrSct/${UEFI_BUILD_MODE}_${UEFI_TOOLCHAIN}/SctPackage${TARGET_ARCH}/EBBRStartup.nsh ${TARGET_ARCH}_SCT/SctStartup.nsh cp SctPkg/BBR/EfiCompliant_EBBR.ini ${TARGET_ARCH}_SCT/SCT/Dependency/EfiCompliantBBTest/EfiCompliant.ini cp SctPkg/BBR/EBBR_manual.seq ${TARGET_ARCH}_SCT/SCT/Sequence/EBBR_manual.seq else #SBBR cp Build/bbrSct/${UEFI_BUILD_MODE}_${UEFI_TOOLCHAIN}/SctPackage${TARGET_ARCH}/SBBRStartup.nsh ${TARGET_ARCH}_SCT/SctStartup.nsh cp SctPkg/BBR/EfiCompliant_SBBR.ini ${TARGET_ARCH}_SCT/SCT/Dependency/EfiCompliantBBTest/EfiCompliant.ini cp SctPkg/BBR/SBBR_manual.seq ${TARGET_ARCH}_SCT/SCT/Sequence/SBBR_manual.seq fi pushd $TOP_DIR } DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) source $DIR/framework.sh $@
<reponame>dariosilva/spring-framework-5<gh_stars>0 package com.dams.services; import com.dams.domain.Recipe; import com.dams.repositories.RecipeRepository; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.HashSet; import java.util.Set; import static org.junit.Assert.*; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class RecipeServiceImplTest { RecipeServiceImpl recipeService; @Mock RecipeRepository recipeRepository; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); recipeService = new RecipeServiceImpl(recipeRepository); } @Test public void getRecipes() { Recipe recipe = new Recipe(); HashSet<Recipe> recipesData = new HashSet<>(); recipesData.add(recipe); when(recipeRepository.findAll()).thenReturn(recipesData); Set<Recipe> recipes = recipeService.getRecipes(); assertEquals(recipes.size(), 1); verify(recipeRepository, times(1)).findAll(); } }
<gh_stars>1-10 package com.webapp.model; import java.text.SimpleDateFormat; import java.util.Date; import java.util.UUID; public class Message { private String _username; private String _content; private Date _time; private UUID _uuid; private String _ago; private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private String _path; private String _uuidstr; public Message(String username, String content, Date time) { this._content = content; this._username = username; this._time = time; this._uuid = UUID.randomUUID(); this._uuidstr = this._uuid.toString(); this._ago = "Error"; this._path = null; } public Message(UUID uuid, String username, String content, Date time, String path) { this._username = username; this._content = content; this._time = time; this._uuid = uuid; this._uuidstr = uuid.toString(); this._path = path; } public Message(UUID uuid, String username, String content, Date time) { this._content = content; this._username = username; this._time = time; this._uuid = uuid; this._uuidstr = uuid.toString(); this._path = null; } public String get_username() { return _username; } public String get_content() { return _content; } public Date get_time() { return _time; } public UUID get_uuid() { return this._uuid; } public String get_path() { return this._path; } public String get_uuidstr() { return this._uuidstr; } public void set_ago(long millisec) { long duration = millisec - this._time.getTime(); duration /= 1000; if (duration < 1) { this._ago = "Just Now"; } else if (duration < 60) { this._ago = duration + " Second(s) Ago"; } else if (duration < 3600) { this._ago = duration / 60 + " Minute(s) Ago"; } else if (duration < 3600 * 24) { this._ago = duration / 3600 + " Hours(s) Ago"; } else { this._ago = format.format(this._time); } } public String get_ago() { return this._ago; } public void set_path(String _path) { this._path = _path; } @Override public String toString() { return "Message { username : " + this._username + " content : " + this._content + " date : " + this._time + " }"; } @Override public boolean equals(Object obj) { if (obj == null) return false; if (!Message.class.isAssignableFrom(obj.getClass())) return false; final Message target = (Message) obj; if (!this.get_uuid().equals(target.get_uuid())) { return false; } if (!this.get_time().toString().equals(target.get_time().toString())) { return false; } if (!this.get_username().equals(target.get_username())) { return false; } return this.get_content().equals(target.get_content()); } }
echo "soc-Epinions1.edges.random_bipartite_matching.with_header.edge" > gpuTestDump ./a.out /home/workspace/inputs/shashi/random_bipartite_matching/soc-Epinions1.edges.random_bipartite_matching.with_header.edge >> gpuTestDump echo "soc-LiveJournal1.txt.random_bipartite_matching.with_header.edge" >> gpuTestDump ./a.out /home/workspace/inputs/shashi/random_bipartite_matching/soc-LiveJournal1.txt.random_bipartite_matching.with_header.edge >> gpuTestDump echo "soc-pokec-relationships1.edges.random_bipartite_matching.with_header.edge" >> gpuTestDump ./a.out /home/workspace/inputs/shashi/random_bipartite_matching/soc-pokec-relationships1.edges.random_bipartite_matching.with_header.edge >> gpuTestDump echo "com-orkut.ungraph.txt.random_bipartite_matching.with_header.edge" >> gpuTestDump ./a.out /home/workspace/inputs/shashi/random_bipartite_matching/com-orkut.ungraph.txt.random_bipartite_matching.with_header.edge >> gpuTestDump echo "USA_ALL.txt.random_bipartite_matching.with_header.edge" >> gpuTestDump ./a.out /home/workspace/inputs/shashi/random_bipartite_matching/USA_ALL.txt.random_bipartite_matching.with_header.edge >> gpuTestDump
package com.zero.retrowrapper.emulator.registry.handlers; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import org.apache.commons.io.IOUtils; import com.zero.retrowrapper.emulator.RetroEmulator; import com.zero.retrowrapper.emulator.registry.EmulatorHandler; public final class LoadHandler extends EmulatorHandler { public LoadHandler() { super("/level/load.html?id="); } @Override public void handle(OutputStream os, String get, byte[] data) throws IOException { final String id = get.replace("/level/load.html?id=", "").split("&")[0]; try (FileInputStream fis = new FileInputStream(new File(RetroEmulator.getInstance().getMapsDirectory(), "map" + id + ".mclevel"))) { final byte[] bytes = IOUtils.toByteArray(fis); final DataOutputStream dis = new DataOutputStream(os); dis.writeUTF("ok"); dis.write(bytes); } } }
#!/bin/sh set -e set -u set -o pipefail function on_error { echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" } trap 'on_error $LINENO' ERR if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy # frameworks to, so exit 0 (signalling the script phase was successful). exit 0 fi echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" # Used as a return value for each invocation of `strip_invalid_archs` function. STRIP_BINARY_RETVAL=0 # This protects against multiple targets copying the same framework dependency at the same time. The solution # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") # Copies and strips a vendored framework install_framework() { if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then local source="${BUILT_PRODUCTS_DIR}/$1" elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" elif [ -r "$1" ]; then local source="$1" fi local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink "${source}")" fi # Use filter instead of exclude so missing patterns don't throw errors. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" local basename basename="$(basename -s .framework "$1")" binary="${destination}/${basename}.framework/${basename}" if ! [ -r "$binary" ]; then binary="${destination}/${basename}" elif [ -L "${binary}" ]; then echo "Destination binary is symlinked..." dirname="$(dirname "${binary}")" binary="${dirname}/$(readlink "${binary}")" fi # Strip invalid architectures so "fat" simulator / device frameworks work on device if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then strip_invalid_archs "$binary" fi # Resign the code if required by the build settings to avoid unstable apps code_sign_if_enabled "${destination}/$(basename "$1")" # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then local swift_runtime_libs swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) for lib in $swift_runtime_libs; do echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" code_sign_if_enabled "${destination}/${lib}" done fi } # Copies and strips a vendored dSYM install_dsym() { local source="$1" warn_missing_arch=${2:-true} if [ -r "$source" ]; then # Copy the dSYM into the targets temp dir. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" local basename basename="$(basename -s .dSYM "$source")" binary_name="$(ls "$source/Contents/Resources/DWARF")" binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" # Strip invalid architectures so "fat" simulator / device frameworks work on device if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then strip_invalid_archs "$binary" "$warn_missing_arch" fi if [[ $STRIP_BINARY_RETVAL == 1 ]]; then # Move the stripped file into its final destination. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" else # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" fi fi } # Copies the bcsymbolmap files of a vendored framework install_bcsymbolmap() { local bcsymbolmap_path="$1" local destination="${BUILT_PRODUCTS_DIR}" echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" } # Signs a framework with the provided identity code_sign_if_enabled() { if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then # Use the current code_sign_identity echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then code_sign_cmd="$code_sign_cmd &" fi echo "$code_sign_cmd" eval "$code_sign_cmd" fi } # Strip invalid architectures strip_invalid_archs() { binary="$1" warn_missing_arch=${2:-true} # Get architectures for current target binary binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" # Intersect them with the architectures we are building for intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" # If there are no archs supported by this binary then warn the user if [[ -z "$intersected_archs" ]]; then if [[ "$warn_missing_arch" == "true" ]]; then echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." fi STRIP_BINARY_RETVAL=0 return fi stripped="" for arch in $binary_archs; do if ! [[ "${ARCHS}" == *"$arch"* ]]; then # Strip non-valid architectures in-place lipo -remove "$arch" -output "$binary" "$binary" stripped="$stripped $arch" fi done if [[ "$stripped" ]]; then echo "Stripped $binary of architectures:$stripped" fi STRIP_BINARY_RETVAL=1 } install_artifact() { artifact="$1" base="$(basename "$artifact")" case $base in *.framework) install_framework "$artifact" ;; *.dSYM) # Suppress arch warnings since XCFrameworks will include many dSYM files install_dsym "$artifact" "false" ;; *.bcsymbolmap) install_bcsymbolmap "$artifact" ;; *) echo "error: Unrecognized artifact "$artifact"" ;; esac } copy_artifacts() { file_list="$1" while read artifact; do install_artifact "$artifact" done <$file_list } ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt" if [ -r "${ARTIFACT_LIST_FILE}" ]; then copy_artifacts "${ARTIFACT_LIST_FILE}" fi if [[ "$CONFIGURATION" == "Debug" ]]; then install_framework "${PODS_ROOT}/GoogleWebRTC/Frameworks/frameworks/WebRTC.framework" install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" install_framework "${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework" fi if [[ "$CONFIGURATION" == "Release" ]]; then install_framework "${PODS_ROOT}/GoogleWebRTC/Frameworks/frameworks/WebRTC.framework" install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" install_framework "${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework" fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then wait fi
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResourceInterfaceTransactionsActionEnum = void 0; /** * @export * @enum {string} */ var ResourceInterfaceTransactionsActionEnum; (function (ResourceInterfaceTransactionsActionEnum) { ResourceInterfaceTransactionsActionEnum["Checkin"] = "checkin"; ResourceInterfaceTransactionsActionEnum["Checkout"] = "checkout"; })(ResourceInterfaceTransactionsActionEnum = exports.ResourceInterfaceTransactionsActionEnum || (exports.ResourceInterfaceTransactionsActionEnum = {}));
void ApplyForce(Vector3 force) { Rigidbody rb = GetComponent<Rigidbody>(); if (rb != null) { switch (m_ForceMode) { case ForceMode.Force: rb.AddForce(force, ForceMode.Force); break; case ForceMode.Acceleration: rb.AddForce(force, ForceMode.Acceleration); break; case ForceMode.Impulse: rb.AddForce(force, ForceMode.Impulse); break; case ForceMode.VelocityChange: rb.AddForce(force, ForceMode.VelocityChange); break; default: Debug.LogError("Invalid ForceMode specified"); break; } } else { Debug.LogError("Rigidbody component not found"); } }
#!/bin/bash #$ -cwd # error = Merged with joblog #$ -o joblog.$JOB_ID #$ -j y #$ -pe shared 8 #$ -l arch=intel-E5-2670,exclusive,h_rt=24:00:00,h_data=3.5G # Email address to notify ## $ -M $USER@mal # Notify when: #$ -m bea #save job info on joblog: echo "Job $JOB_ID started on: " `hostname -s` echo "Job $JOB_ID started on: " `date ` # load the job environment: . /u/local/Modules/default/init/modules.sh module load julia/1.0.1 module li which julia # run julia code echo "julia normal_cv.jl, debias=true" pwd; julia /u/home/b/biona001/cross_validation/normal_cv.jl #echo job info on joblog: echo "Job $JOB_ID ended on: " `hostname -s` echo "Job #JOB_ID ended on: " `date ` #echo " "
#!/bin/bash cd "$(dirname "$0")" CLASSPATH=pf2_custom_rules.jar ./../pmd-bin-6.14.0/bin/run.sh pmd -no-cache -f text -d testsrc -R myrule.xml
<reponame>biotope/website /** * ## DEFINE ALL INTERFACES FOR BioModal **/ /** * Props */ interface BioModalProps { openonpageload: Boolean; } /** * State */ interface BioModalState { open: Boolean; } /** * Methods */ interface BioModalMethods { } export { BioModalProps, BioModalState, BioModalMethods }
#!/bin/bash pushd .. if [ ! -d 'classes/Ac/Controller' ]; then mkdir -p classes/Ac/Controller; fi if [ ! -d 'classes/Ac/Controller/Response' ]; then mkdir -p classes/Ac/Controller/Response; fi if [ ! -d 'classes/Ac/Controller/Context' ]; then mkdir -p classes/Ac/Controller/Context; fi if [ ! -d 'classes/Ac/Controller/Output' ]; then mkdir -p classes/Ac/Controller/Output; fi if [ ! -d 'classes/Ac' ]; then mkdir -p classes/Ac; fi if [ ! -d 'classes/Ac/Template/Helper' ]; then mkdir -p classes/Ac/Template/Helper; fi if [ ! -d 'classes/Ac/Template' ]; then mkdir -p classes/Ac/Template; fi git mv 'obsolete/Ac/Legacy/Controller/Exception.php' 'classes/Ac/Controller/Exception.php' git mv 'obsolete/Ac/Legacy/Controller/Response.php' 'classes/Ac/Controller/Response.php' git mv 'obsolete/Ac/Legacy/Controller/Response/Json.php' 'classes/Ac/Controller/Response/Json.php' git mv 'obsolete/Ac/Legacy/Controller/Response/JsonPart.php' 'classes/Ac/Controller/Response/JsonPart.php' git mv 'obsolete/Ac/Legacy/Controller/Response/Global.php' 'classes/Ac/Controller/Response/Global.php' git mv 'obsolete/Ac/Legacy/Controller/Response/Html.php' 'classes/Ac/Controller/Response/Html.php' git mv 'obsolete/Ac/Legacy/Controller/Response/Http.php' 'classes/Ac/Controller/Response/Http.php' git mv 'obsolete/Ac/Legacy/Controller/Response/Part.php' 'classes/Ac/Controller/Response/Part.php' git mv 'obsolete/Ac/Legacy/Controller/Context/Http.php' 'classes/Ac/Controller/Context/Http.php' git mv 'obsolete/Ac/Legacy/Controller/Context.php' 'classes/Ac/Controller/Context.php' git mv 'obsolete/Ac/Legacy/Output/Joomla3.php' 'classes/Ac/Controller/Output/Joomla3.php' git mv 'obsolete/Ac/Legacy/Output/Debug.php' 'classes/Ac/Controller/Output/Debug.php' git mv 'obsolete/Ac/Legacy/Output/Joomla.php' 'classes/Ac/Controller/Output/Joomla.php' git mv 'obsolete/Ac/Legacy/Output/Native.php' 'classes/Ac/Controller/Output/Native.php' git mv 'obsolete/Ac/Legacy/Output/Joomla15.php' 'classes/Ac/Controller/Output/Joomla15.php' git mv 'obsolete/Ac/Legacy/Controller.php' 'classes/Ac/Controller.php' git mv 'obsolete/Ac/Legacy/Output.php' 'classes/Ac/Output.php' git mv 'obsolete/Ac/Legacy/Template/Helper/Html.php' 'classes/Ac/Template/Helper/Html.php' git mv 'obsolete/Ac/Legacy/Template/HtmlPage.php' 'classes/Ac/Template/HtmlPage.php' git mv 'obsolete/Ac/Legacy/Template/Html.php' 'classes/Ac/Template/Html.php' git mv 'obsolete/Ac/Legacy/Template/JoomlaPage.php' 'classes/Ac/Template/JoomlaPage.php' git mv 'obsolete/Ac/Legacy/Template/Helper.php' 'classes/Ac/Template/Helper.php' git mv 'obsolete/Ac/Legacy/Template.php' 'classes/Ac/Template.php' popd find ../classes ../tests ../obsolete -type f -name '*.php' -print0 | xargs -0 sed -rf 'move-back-some-legacy-classes.sed' -i
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.fuseki.build; import static java.lang.String.format ; import static org.apache.jena.fuseki.FusekiLib.nodeLabel ; import static org.apache.jena.fuseki.FusekiLib.query ; import org.apache.jena.assembler.Assembler ; import org.apache.jena.datatypes.xsd.XSDDatatype ; import org.apache.jena.fuseki.Fuseki ; import org.apache.jena.fuseki.FusekiConfigException ; import org.apache.jena.fuseki.FusekiLib ; import org.apache.jena.fuseki.server.DataAccessPoint ; import org.apache.jena.fuseki.server.DataService ; import org.apache.jena.fuseki.server.Endpoint ; import org.apache.jena.fuseki.server.OperationName ; import org.apache.jena.query.Dataset ; import org.apache.jena.query.QuerySolution ; import org.apache.jena.query.ResultSet ; import org.apache.jena.rdf.model.Literal ; import org.apache.jena.rdf.model.RDFNode ; import org.apache.jena.rdf.model.Resource ; import org.apache.jena.sparql.core.DatasetGraph ; import org.apache.jena.sparql.util.FmtUtils ; import org.apache.jena.vocabulary.RDF ; import org.slf4j.Logger ; public class Builder { private static Logger log = Fuseki.builderLog ; /** Build a DataAccessPoint, including DataService at Resource svc */ public static DataAccessPoint buildDataAccessPoint(Resource svc) { // XXX RDFNode n = FusekiLib.getOne(svc, "fu:name") ; if ( ! n.isLiteral() ) throw new FusekiConfigException("Not a literal for access point name: "+FmtUtils.stringForRDFNode(n)); Literal object = n.asLiteral() ; if ( object.getDatatype() != null && ! object.getDatatype().equals(XSDDatatype.XSDstring) ) Fuseki.configLog.error(format("Service name '%s' is not a string", FmtUtils.stringForRDFNode(object))); String name = object.getLexicalForm() ; name = DataAccessPoint.canonical(name) ; DataService dataService = Builder.buildDataService(svc) ; DataAccessPoint dataAccess = new DataAccessPoint(name) ; dataAccess.setDataService(dataService) ; return dataAccess ; } /** Build a DatasetRef starting at Resource svc */ private static DataService buildDataService(Resource svc) { //log.debug("Service: " + nodeLabel(svc)) ; // DO REAL WORK Resource datasetDesc = ((Resource)getOne(svc, "fu:dataset")) ; // Check if it is in the model. if ( !datasetDesc.hasProperty(RDF.type) ) throw new FusekiConfigException("No rdf:type for dataset " + nodeLabel(datasetDesc)) ; Dataset ds = (Dataset)Assembler.general.open(datasetDesc) ; // In case the assembler included ja:contents DataService dataService = new DataService(ds.asDatasetGraph()) ; addServiceEP(dataService, OperationName.Query, svc, "fu:serviceQuery") ; addServiceEP(dataService, OperationName.Update, svc, "fu:serviceUpdate") ; addServiceEP(dataService, OperationName.Upload, svc, "fu:serviceUpload") ; addServiceEP(dataService, OperationName.GSP_R, svc, "fu:serviceReadGraphStore") ; addServiceEP(dataService, OperationName.GSP_RW, svc, "fu:serviceReadWriteGraphStore") ; if ( ! dataService.getOperation(OperationName.GSP_RW).isEmpty() ) dataService.addEndpoint(OperationName.Quads_RW, "") ; else if ( ! dataService.getOperation(OperationName.GSP_R).isEmpty() ) dataService.addEndpoint(OperationName.Quads_R, "") ; // XXX // // Extract timeout overriding configuration if present. // if ( svc.hasProperty(FusekiVocab.pAllowTimeoutOverride) ) { // sDesc.allowTimeoutOverride = svc.getProperty(FusekiVocab.pAllowTimeoutOverride).getObject().asLiteral().getBoolean() ; // if ( svc.hasProperty(FusekiVocab.pMaximumTimeoutOverride) ) { // sDesc.maximumTimeoutOverride = (int)(svc.getProperty(FusekiVocab.pMaximumTimeoutOverride).getObject().asLiteral().getFloat() * 1000) ; // } // } return dataService ; } /** Build a DataService starting at Resource svc */ public static DataService buildDataService(DatasetGraph dsg, boolean allowUpdate) { DataService dataService = new DataService(dsg) ; addServiceEP(dataService, OperationName.Query, "query") ; addServiceEP(dataService, OperationName.Query, "sparql") ; if ( ! allowUpdate ) { addServiceEP(dataService, OperationName.GSP_R, "data") ; addServiceEP(dataService, OperationName.Quads_R, "") ; return dataService ; } addServiceEP(dataService, OperationName.GSP_RW, "data") ; addServiceEP(dataService, OperationName.GSP_R, "get") ; addServiceEP(dataService, OperationName.Update, "update") ; addServiceEP(dataService, OperationName.Upload, "upload") ; addServiceEP(dataService, OperationName.Quads_RW, "") ; return dataService ; } private static void addServiceEP(DataService dataService, OperationName opName, String epName) { dataService.addEndpoint(opName, epName) ; } public static RDFNode getOne(Resource svc, String property) { String ln = property.substring(property.indexOf(':') + 1) ; ResultSet rs = FusekiLib.query("SELECT * { ?svc " + property + " ?x}", svc.getModel(), "svc", svc) ; if ( !rs.hasNext() ) throw new FusekiConfigException("No " + ln + " for service " + FusekiLib.nodeLabel(svc)) ; RDFNode x = rs.next().get("x") ; if ( rs.hasNext() ) throw new FusekiConfigException("Multiple " + ln + " for service " + FusekiLib.nodeLabel(svc)) ; return x ; } private static void addServiceEP(DataService dataService, OperationName opName, Resource svc, String property) { ResultSet rs = query("SELECT * { ?svc " + property + " ?ep}", svc.getModel(), "svc", svc) ; for ( ; rs.hasNext() ; ) { QuerySolution soln = rs.next() ; String epName = soln.getLiteral("ep").getLexicalForm() ; Endpoint operation = new Endpoint(opName, epName) ; addServiceEP(dataService, opName, epName); //log.info(" " + opName.name + " = " + dataAccessPoint.getName() + "/" + epName) ; } } }
import random import string def random_string(length): # get all characters chars = string.ascii_lowercase + string.ascii_uppercase + string.digits # generate string of given length str = "".join(random.choice(chars) for i in range(length)) return str # test print(random_string(7)) Output: B9xdzx1
#!/bin/sh ## renew certbot certbot renew --noninteractive --nginx --agree-tos # https://certbot.eff.org/docs/using.html#renewal ?? # certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
<filename>codeforces/0869/c.cc // https://codeforces.com/contest/869/problem/C #include <bits/stdc++.h> using namespace std; using ll = long long; const ll M = 998244353; const ll N = 5000; ll p[N+1], inv[N+1], invp[N+1]; ll binomial(ll n, ll k, ll m) { ll c = 1; while (n||k) { ll a = n%m, b = k%m; if (a<b) return 0; c = c*p[a]%m * invp[b]%m * invp[a-b]%m; n/=m, k/=m; } return c; } int main() { p[1] = inv[1] = invp[0] = 1; for (int i=2; i<=N; i++) p[i] = p[i-1]*i%M; for (int i=2; i<=N; i++) inv[i] = M-(M/i)*inv[M%i]%M; for (int i=1; i<=N; i++) invp[i] = invp[i-1] * inv[i]%M; ll a, b, c; cin >> a >> b >> c; ll ab = 0, ac = 0, bc = 0; for (int i = 1; i <= min(a, b); i++) (ab += binomial(a, i, M)*binomial(b, i, M)%M*p[i]%M) %= M; for (int i = 1; i <= min(a, c); i++) (ac += binomial(a, i, M)*binomial(c, i, M)%M*p[i]%M) %= M; for (int i = 1; i <= min(b, c); i++) (bc += binomial(b, i, M)*binomial(c, i, M)%M*p[i]%M) %= M; ll t = (1 + (ab+ac+bc)%M + ab*ac%M+ab*bc%M+ac*bc%M + ab*ac%M*bc%M)%M; cout << t << '\n'; }
<reponame>wuzzh/master_thesis_code<gh_stars>100-1000 """ Generates precision/recall curves for the given detections and ground truth BBTXT files. The script generates several files - a PDF plot, PNG plot and CSV files with the precision and recall values, which were used to generate the curves. ---------------------------------------------------------------------------------------------------- python compute_pr_curve.py path_gt gt_mapping path_detections detections_mapping path_out ---------------------------------------------------------------------------------------------------- """ __date__ = '12/02/2016' __author__ = '<NAME>' __email__ = '<EMAIL>' import argparse import os import numpy as np import matplotlib matplotlib.use('Agg') # Prevents from using X interface for plotting from matplotlib import pyplot as plt from data.shared.bbtxt import load_bbtxt from data.mappings.utils import LabelMappingManager #################################################################################################### # DEFINITIONS # #################################################################################################### # Number of steps (points) on the precision/recall curve NUM_STEPS = 20 # Categories (labels) for which we plot the PR curves CATEGORIES = [ 'car', # 'person' ] # Colors of the categories COLORS = { 'car': '#3399FF', 'person': '#FF33CC', # '#FF3300', '#40BF0D', '#FFE300', '#000000' } # Initialize the LabelMappingManager LMM = LabelMappingManager() #################################################################################################### # FUNCTIONS # #################################################################################################### def tp_fp_fn(gt, detections, min_iou, dont_care): """ Computes true positives (tp), false positives (fp) and false negatives (fn) from the given two sets of bounding boxes - ground truth and detections. Input: gt: List of BB2D ground truth bounding boxes detections: List of BB2D detections' bounding boxes min_iou: Minimum intersection over union threshold for a true positive dont_care: List of BB2D don't care regions Output: tp, fp, fn, fnr, fpd (all ints) fnr: False negatives on only required ground truth fpd: False positives only from the outside of the specified don't care regions """ # First compute a matrix of intersection over unions - we will be searching best matches in it ious = np.zeros([len(gt), len(detections)], dtype=np.float) for i in range(len(gt)): for j in range(len(detections)): ious[i,j] = gt[i].iou(detections[j]) # Indices of ground truth bbs and detections - will be used to track which ones we removed gtis = range(len(gt)) dtis = range(len(detections)) # Find maxima - best matches -> true positives tp = 0 while ious.shape[0] > 0 and ious.shape[1] > 0 and ious.max() > min_iou: i, j = np.unravel_index(ious.argmax(), ious.shape) # Remove this ground truth and detection from the matrix ious = np.delete(ious, i, axis=0) ious = np.delete(ious, j, axis=1) # Remove this ground truth and detection from index lists del gtis[i] del dtis[j] tp = tp + 1 # If we have some rows and columns left they are falses fp = ious.shape[1] # Unmatched detections fn = ious.shape[0] # Unmatched ground truth # Remove the remaining ground truth, which is not required fnr = fn for i in gtis: if not gt[i].required: fnr -= 1 # Remove the remaining detections, which lie inside of don't care regions fpd = fp for i in dtis: for d in range(len(dont_care)): # If more than 75% of the detection lies inside of a don't care region we discard it if detections[i].area() > 0 and detections[i].intersection_area(dont_care[d]) \ / detections[i].area() > 0.75: fpd -= 1; return int(tp), int(fp), int(fn), int(fnr), int(fpd) def pr_curve_points(tps, fps, fns): """ Compute points of precision/recall curve from the given error measures. Input: tps: np.array of true positives' counts (length N) fps: np.array of false positives' counts (length N) fns: np.array of false negatives' counts (length N) Output: precisions, recalls (lists of floats of length N) """ precisions = list(np.true_divide(tps, tps+fps)) recalls = list(np.true_divide(tps, tps+fns)) # Points 0,0 are obviously wrong so this will prevent them from being plotted for i in range(len(precisions)): if precisions[i] == 0 and recalls[i] == 0: precisions[i] = np.nan recalls[i] = np.nan return precisions, recalls #################################################################################################### # CLASSES # #################################################################################################### class PRPlotter(object): """ Takes care of plotting precision/recall (PR) curves for the given combination of ground truth and detection BBTXT files. """ def __init__(self, path_gt, gt_mapping, path_detections, detections_mapping, iou, title): """ Input: path_gt: Path to the BBTXT file with ground truth gt_mapping: Name of the mapping of the path_gt BBTXT file path_detections: Path to the BBTXT file with detections detections_mapping: Name of the mapping of the path_detections BBTXT file iou: Minimum instersection over union of a true positive detection title: Title of the plot """ super(PRPlotter, self).__init__() self.iou = iou self.title = title print('-- Loading ground truth: ' + path_gt) self.iml_gt = load_bbtxt(path_gt) print('-- Loading detections: ' + path_detections) self.iml_detections = load_bbtxt(path_detections) # Find min and max confidence self._min_max_confidence() # IMPORTANT! Get complete list of images! We cannot just take the ground truth files because # the BBTXT does not contain empty images, neither we can take just the detections because # that BBTXT does not contain files without detections (which could possibly contain ground # truth objects). Therefore we have to take a union of the two. The processed images, which # have no ground truth and no detections are not a problem because they do not contribute # to the statistics self.file_list = list(set(self.iml_gt.keys()).union(self.iml_detections.keys())) self._check_file_list() # Get both label mappings self.gt_mapping = LMM.get_mapping(gt_mapping) self.detections_mapping = LMM.get_mapping(detections_mapping) self._initialize_plot() self.categories = [] self.tps = [] self.fps = [] self.fns = [] self.fnsr = [] self.fpsd = [] self.precisions = [] self.recalls = [] self.precisionsr = [] self.recallsr = [] self.precisionsd = [] self.recallsd = [] self.precisionsrd = [] self.recallsrd = [] def _min_max_confidence(self): """ Determine min and max confidence for creating the linspace of steps. """ self.conf_min = 9999999 self.conf_max = -9999999 for filename in self.iml_detections: for det in self.iml_detections[filename]: if det.confidence > self.conf_max: self.conf_max = det.confidence if det.confidence < self.conf_min: self.conf_min = det.confidence def _check_file_list(self): """ Checks if the loaded ground truth and detections have some common files. """ if len(self.file_list) == len(self.iml_gt)+len(self.iml_detections): # There is no intersection of files in the data -> probably wrong ground truth print('ERROR: The detections and ground truth files do not have common paths! ' \ 'Probably a wrong ground truth file was loaded...') exit(1) def _initialize_plot(self): """ Initializes the plotting canvas for plotting the PR curves """ # Equal error rate line plt.plot((0, 1), (0, 1), c='#DDDDDD') plt.grid() plt.xlabel('precision') plt.ylabel('recall') plt.title(self.title) # plt.title(self.title + ' (iou=%.2f)'%(self.iou)) def _add_curve(self, tps, fps, fns, fnsr, fpsd, category): """ Puts a new PR curve into the plot. Input: tps: np.array of true positives' counts (length N) fps: np.array of false positives' counts (length N) fns: np.array of false negatives' counts (length N) fnsr: np.array of false negatives' counts on required gt (length N) fpsd: np.array of false negatives' counts outside of don't care regions (length N) category: Object category (label), which the curve corresponds to """ # Compute the precision and recall for the PR curve precisions, recalls = pr_curve_points(tps, fps, fns) precisionsr, recallsr = pr_curve_points(tps, fps, fnsr) precisionsd, recallsd = pr_curve_points(tps, fpsd, fns) precisionsrd, recallsrd = pr_curve_points(tps, fpsd, fnsr) plt.plot(precisions, recalls, label=category, color=COLORS[category], linewidth=2) plt.plot(precisionsd, recallsd, label=category+' - don\'t care', color=COLORS[category]) plt.plot(precisionsr, recallsr, label=category+' - required', color=COLORS[category], linestyle='--') plt.plot(precisionsrd, recallsrd, label=category+' - required, don\'t care', color=COLORS[category], linestyle=':') self.categories.append(category) self.precisions.append(precisions) self.recalls.append(recalls) self.precisionsr.append(precisionsr) self.recallsr.append(recallsr) self.precisionsd.append(precisionsd) self.recallsd.append(recallsd) self.precisionsrd.append(precisionsrd) self.recallsrd.append(recallsrd) self.tps.append(tps) self.fps.append(fps) self.fns.append(fns) self.fnsr.append(fnsr) self.fpsd.append(fpsd) def plot(self, category): """ Input: category: Object category (label), which the curve corresponds to """ print('-- Plotting category: ' + category) tps = np.zeros(NUM_STEPS, dtype=np.int) fps = np.zeros(NUM_STEPS, dtype=np.int) fns = np.zeros(NUM_STEPS, dtype=np.int) fnsr = np.zeros(NUM_STEPS, dtype=np.int) # Only required bounding boxes fpsd = np.zeros(NUM_STEPS, dtype=np.int) # False positives without those in 'dontcare' regions steps = np.linspace(self.conf_min, self.conf_max, NUM_STEPS+2) for s, conf_thr in enumerate(steps[:-2]): # Process each image from the file list for filename in self.file_list: if filename in self.iml_gt: # Filter the bounding boxes - we only want the current category gt_category = [bb for bb in self.iml_gt[filename] if self.gt_mapping[bb.label] == category] dont_care = [bb for bb in self.iml_gt[filename] if self.gt_mapping[bb.label] == 'dontcare'] else: gt_category = [] dont_care = [] if filename in self.iml_detections: # Filter the bounding boxes - we only want the current category detections_category = [bb for bb in self.iml_detections[filename] if self.detections_mapping[bb.label] == category and bb.confidence >= conf_thr] else: detections_category = [] tp, fp, fn, fnr, fpd = tp_fp_fn(gt_category, detections_category, self.iou, dont_care) tps[s] = tps[s] + tp fps[s] = fps[s] + fp fns[s] = fns[s] + fn fnsr[s] = fnsr[s] + fnr fpsd[s] = fpsd[s] + fpd # Compute precision and recall and add the curve to the plot self._add_curve(tps, fps, fns, fnsr, fpsd, category) def save_plot(self, path_out): """ Saves the current plot to PDF, PNG and CSV. Input: path_out: Path to the output file(s) (without extension) """ plt.legend(loc='lower left', prop={'size':13}) plt.savefig(path_out + '.pdf', bbox_inches='tight') plt.savefig(path_out + '.png', bbox_inches='tight') # Save each category to a different CSV file for c in range(len(self.categories)): with open(path_out + '_' + self.categories[c] + '.csv', 'w') as outfile: outfile.write('tp fp fn fnr fpd precision recall precisionr recallr precisiond ' \ 'recalld precisionrd recallrd\n') for i in range(len(self.recalls[c])): outfile.write('%d %d %d %d %d %f %f %f %f %f %f %f %f\n'%(self.tps[c][i], self.fps[c][i], self.fns[c][i], self.fnsr[c][i], self.fpsd[c][i], self.precisions[c][i], self.recalls[c][i], self.precisionsr[c][i], self.recallsr[c][i], self.precisionsd[c][i], self.recallsd[c][i], self.precisionsrd[c][i], self.recallsrd[c][i])) print('-- Plots saved to: ' + path_out) #################################################################################################### # MAIN # #################################################################################################### def check_path(path, is_folder=False): """ Checks if the given path exists. Input: path: Path to be checked is_folder: True if the checked path is a folder Returns: True if the given path exists """ if not os.path.exists(path) or (not is_folder and not os.path.isfile(path)): print('ERROR: Path "%s" does not exist!'%(path)) return False return True def parse_arguments(): """ Parse input options of the script. """ parser = argparse.ArgumentParser(description='Plot the precision/recall curve.') parser.add_argument('path_gt', metavar='path_gt', type=str, help='Path to the BBTXT ground truth file') parser.add_argument('gt_mapping', metavar='gt_mapping', type=str, help='Label mapping of the ground truth BBTXT file. One of ' \ + str(LMM.available_mappings())) parser.add_argument('path_detections', metavar='path_detections', type=str, help='Path to the BBTXT file with detections that is to be evaluated') parser.add_argument('detections_mapping', metavar='detections_mapping', type=str, help='Label mapping of the detections BBTXT file. One of ' \ + str(LMM.available_mappings())) parser.add_argument('path_out', metavar='path_out', type=str, help='Path to the output file (without extension) - extensions will be ' \ 'added automatically because more files will be generated') parser.add_argument('--iou', type=float, default=0.5, help='Minimum intersection over union (IOU) for a detection to be counted' \ ' as a true positive') parser.add_argument('--title', type=str, default='', help='Title of the plot') args = parser.parse_args() if not check_path(args.path_detections) or not check_path(args.path_gt): parser.print_help() exit(1) if args.iou <= 0.0 or args.iou > 1.0: print('ERROR: Invalid number for IOU "%f"! Must be in (0,1].'%(args.iou)) exit(1) return args def main(): args = parse_arguments() plotter = PRPlotter(args.path_gt, args.gt_mapping, args.path_detections, args.detections_mapping, args.iou, args.title) # Plot all categories for category in CATEGORIES: plotter.plot(category) plotter.save_plot(args.path_out) if __name__ == '__main__': main()
<reponame>kevinoid/openapi-transformers /** * @copyright Copyright 2019-2021 <NAME> <<EMAIL>> * @license MIT * @module "openapi-transformers/escape-enum-values.js" */ import OpenApiTransformerBase from 'openapi-transformer-base'; const escapeStringSymbol = Symbol('escapeString'); function makeEscapeString(lang) { let charToEscape = { '\0': '\\0', '\x07': '\\a', '\b': '\\b', '\t': '\\t', '\n': '\\n', '\v': '\\v', '\f': '\\f', '\r': '\\r', "'": "\\'", '"': '\\"', '\\': '\\\\', }; // Escape control characters for all languages for readability let charRange = '\0-\x1F\x7F'; let toAstralEscape, toCodeEscape; switch (lang) { case 'csharp': // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#string-literals charRange += '\n\r"\\\\\x85\u2028\u2029'; // Note: Although \x can be shorter, must be careful to provide 4 // digits when next character is hex digit. Use \u for consistency. toCodeEscape = (c) => `\\u${c.codePointAt(0).toString(16).padStart(4, '0')}`; toAstralEscape = (code) => `\\U${code.toString(16).padStart(8, '0')}`; break; case 'go': // https://golang.org/ref/spec#String_literals charRange += '\n"\\\\'; toCodeEscape = (c) => { const code = c.codePointAt(0); return code <= 0xFF ? `\\x${code.toString(16).padStart(2, '0')}` : `\\u${code.toString(16).padStart(4, '0')}`; }; toAstralEscape = (code) => `\\U${code.toString(16).padStart(8, '0')}`; break; case 'java': // https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.5 charRange += '\n"\\\\'; delete charToEscape['\0']; delete charToEscape['\x07']; delete charToEscape['\v']; toCodeEscape = (c) => `\\u${c.codePointAt(0).toString(16).padStart(4, '0')}`; break; case 'nodejs': case 'typescript': // https://www.ecma-international.org/ecma-262/6.0/#sec-literals-string-literals // Note: AutoRest currently produces single-quoted strings, but the // bloat from extra quoting is minor compared to risk. charRange += '\n"\'\\\\'; delete charToEscape['\x07']; toCodeEscape = (c) => { const code = c.codePointAt(0); return code <= 0xFF ? `\\x${code.toString(16).padStart(2, '0')}` : `\\u${code.toString(16).padStart(4, '0')}`; }; toAstralEscape = (code) => `\\u{${code.toString(16)}}`; break; case 'php': // https://www.php.net/manual/en/language.types.string.php // FIXME: Does AutoRest produce single- or double-quoted strings? // Can't test due to https://github.com/Azure/autorest/issues/3372 charRange += '\n"\\\\'; delete charToEscape['\x07']; delete charToEscape['\b']; charToEscape['\x1B'] = '\\e'; toCodeEscape = (c) => { const code = c.codePointAt(0); return code <= 0xFF ? `\\x${code.toString(16).padStart(2, '0')}` : `\\u{${code.toString(16)}}`; }; toAstralEscape = (code) => `\\u{${code.toString(16)}}`; break; case 'python': // https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals // Note: AutoRest currently produces single-quoted strings, but the // bloat from extra quoting is minor compared to risk. charRange += '\n"\'\\\\'; toCodeEscape = (c) => { const code = c.codePointAt(0); return code <= 0xFF ? `\\x${code.toString(16).padStart(2, '0')}` : `\\u${code.toString(16).padStart(4, '0')}`; }; toAstralEscape = (code) => `\\U${code.toString(16).padStart(8, '0')}`; break; case 'ruby': // Note: AutoRest currently produces single-quoted strings. // Single-quoted strings only accept \' and \\ escapes. // https://docs.ruby-lang.org/en/2.4.0/syntax/literals_rdoc.html#label-Strings charRange = "'\\\\"; charToEscape = { "'": "\\'", '\\': '\\\\', }; toCodeEscape = (c) => c; break; default: throw new RangeError(`Unrecognized language '${lang}'`); } function replaceAstral(pair) { return toAstralEscape(pair.codePointAt(0)); } function replaceChar(c) { return charToEscape[c] || toCodeEscape(c); } const charPattern = new RegExp(`[${charRange}]`, 'g'); return function escapeString(str) { if (!str || typeof str !== 'string') { return str; } const charEscaped = str.replace(charPattern, replaceChar); const astralEscaped = !toAstralEscape ? charEscaped : charEscaped.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, replaceAstral); return astralEscaped; }; } function escapeInSchema(schema, escapeString) { const xMsEnum = schema['x-ms-enum']; if (!xMsEnum || schema.type !== 'string') { // Schema won't generate a class/enum with string values return schema; } const xMsEnumValues = xMsEnum.values; if (xMsEnumValues) { // generator uses .x-ms-enum.values instead of .enum return { ...schema, 'x-ms-enum': { ...xMsEnum, values: xMsEnumValues.map((xMsEnumValue) => ({ ...xMsEnumValue, value: escapeString(xMsEnumValue.value), })), }, }; } return { ...schema, enum: schema.enum.map(escapeString), }; } /** * Transformer to escape string enum values appropriately for C# string literals * when code will be generated by Autorest, since it currently does not. * * https://github.com/Azure/autorest/issues/3371 */ export default class EscapeEnumValuesTransformer extends OpenApiTransformerBase { constructor({ language }) { super(); const typeofLanguage = typeof language; switch (typeofLanguage) { case 'string': this[escapeStringSymbol] = makeEscapeString(language); break; case 'function': this[escapeStringSymbol] = language; break; default: throw new TypeError( `options.language must be a string or function, got ${ typeofLanguage}`, ); } } transformSchema(schema) { return escapeInSchema( super.transformSchema(schema), this[escapeStringSymbol], ); } transformParameter(parameter) { return escapeInSchema( super.transformParameter(parameter), this[escapeStringSymbol], ); } }
require 'fog/core/model' module Fog module OracleCloud class Java class Instance < Fog::Model identity :service_name, :aliases=>['name', 'serviceName'] attribute :created_by attribute :auto_update attribute :cluster_name, :aliases=>'clusterName' attribute :compliance_status attribute :compliance_status_desc attribute :compute_site_name attribute :content_url attribute :creation_job_id attribute :creation_time attribute :db_associations attribute :db_info attribute :db_service_name attribute :deletion_job_id attribute :description attribute :domain_mode, :aliases=>'domainMode' attribute :edition attribute :error_status_desc attribute :fmw_control_url attribute :last_modified_time attribute :level attribute :lifecycle_control_job_id attribute :num_ip_reservations attribute :num_nodes, :aliases=>'managedServerCount' attribute :options attribute :otd_admin_url attribute :otd_provisioned attribute :otd_shape attribute :otd_strorage_size attribute :psm_plugin_version attribute :sample_app_url attribute :secure_content_url attribute :service_components attribute :service_type attribute :service_uri attribute :shape attribute :status attribute :subscription_type, :aliases=>['subscriptionType'] attribute :uri attribute :version attribute :wls_admin_url attribute :wls_deployment_channel_port attribute :wls_version, :aliases=>'wlsVersion' attribute :domain_name, :aliases=>'domainName' attribute :pdb_name, :aliases=>['pdbName', 'pdb_service_name'] # The following are only used to create an instance and are not returned in the list action attribute :cloud_storage_container, :aliases=>'cloudStorageContainer' attribute :cloud_storage_user, :aliases=>'cloudStorageUser' attribute :cloud_storage_pwd, :aliases=>'cloudStoragePassword' attribute :admin_username, :aliases=>'adminUserName' attribute :admin_password, :aliases=>'<PASSWORD>' attribute :ssh_key, :aliases=>'vmPublicKey' attribute :cloud_storage_container_if_missing, :aliases=>'cloudStorageContainerIfMissing' attribute :enable_admin_console, :aliases=>'enableAdminConsole' attribute :provision_otd, :aliases=>'provisionOTD' attribute :sample_app_deployment_requested, :aliases=>'sampleAppDeploymentRequested' attribute :admin_port, :aliases=>'adminPort' attribute :app_dbs, :aliases=>'appDBs' attribute :backup_volume_size, :aliases=>'backupVolumeSize' attribute :content_port, :aliases=>'contentPort' attribute :dba_name, :aliases=>'dbaName' attribute :dba_password, :aliases=>'dbaPassword' attribute :domain_partition_count, :aliases=>'domainPartitionCount' attribute :domain_volume_size, :aliases=>'domainVolumeSize' attribute :ip_reservations, :aliases=>'ipReservations' attribute :ms_initial_heap_mb, :aliases=>'msInitialHeapMB' attribute :ms_jvm_args, :aliases=>'msJvmArgs' attribute :ms_max_heap_mb, :aliases=>'msMaxHeapMB' attribute :ms_max_perm_mb, :aliases=>'msMaxPermMB' attribute :ms_perm_mb, :aliases=>'msPermMb' attribute :node_manager_password, :aliases=>'nodeManagerPassword' attribute :node_manager_port, :aliases=>'nodeManagerPort' attribute :node_manager_user_name, :aliases=>'nodeManagerUserName' attribute :overwrite_ms_jvm_args, :aliases=>'overwriteMsJvmArgs' attribute :secured_admin_port, :aliases=>'securedAdminPort' attribute :secured_content_port, :aliases=>'securedContentPort' # The following are used to delete an instance and are not returned in the list action attribute :force_delete def level=(value) if %w(PAAS BASIC).include? value then attributes[:level]=value else raise ArgumentError, "Invalid level. Valid values - PAAS or BASIC" end end def subscription_type=(value) if %w(HOURLY MONTHLY).include? value then attributes[:subscription_type]=value else raise ArgumentError, "Invalid subscription type. Valid values - HOURLY or MONTHLY" end end def domain_mode=(value) if value.to_s == '' then value = 'DEVELOPMENT' end if %w(DEVELOPMENT PRODUCTION).include? value then attributes[:domain_mode]=value else raise ArgumentError, "Invalid domain mode '#{value}'. Valid values - DEVELOPMENT or PRODUCTION" end end def edition=(value) if value.to_s == '' then value = 'EE' end if %w(SE EE SUITE).include? value then attributes[:edition]=value else raise ArgumentError, "Invalid edition. Valid values - SE, EE or SUITE" end end def shape=(value) if %w(oc3 oc4 oc5 oc6 oc1m oc2m oc3m oc4m).include? value then attributes[:shape]=value else raise ArgumentError, "Invalid Shape. Valid values - oc3, oc4, oc5, oc6, oc1m, oc2m, oc3m or oc4m" end end def num_nodes=(value) if value.nil? then value = 1 end if value.to_i.is_a? Integer then attributes[:num_nodes] = value.to_i else raise ArgumentError, "Invalid server count (#{value}). Valid values - 1, 2, 4 or 8" end end def initialize(attributes={}) level ||= 'PAAS' subscription_type ||= 'HOURLY' edition ||= 'EE' super end def save #identity ? update : create create end def ready? status == "Running" end def stopping? status == 'Maintenance' || status == 'Terminating' end def stopped? status == 'Stopped' end def servers service.servers.all(service_name) end def access_rules service.access_rules(:instance => self) end def destroy requires :service_name, :dba_name, :dba_password service.delete_instance(service_name, dba_name, dba_password, :force_delete => force_delete).body end def scale_out_a_cluster(cluster_name, create_cluster_if_missing) requires :service_name service.scale_out_a_cluster(service_name, cluster_name, create_cluster_if_missing).body end private def create requires :service_name, :dba_name, :dba_password, :db_service_name, :shape, :version, :ssh_key, :admin_password, :admin_username #data = service.create_instance(service_name, cloud_storage_container, cloud_storage_user, cloud_storage_password, dba_name, dba_password, db_servicename, shape, version, vm_public_key, # :level => level, # :subscriptionType => subscription_type, # :description => description) if cloud_storage_container.nil? then cloud_storage_if_missing = true stor_name = "#{service_name}_Backup" else stor_name = cloud_storage_container end stor_user = cloud_storage_user || service.username stor_pwd = <PASSWORD> || service.password params = { :serviceName => service_name, :cloudStorageContainer => stor_name, :cloudStoragePassword => <PASSWORD>, :cloudStorageUser => stor_pwd, :cloudStorageContainerIfMissing => cloud_storage_if_missing, :description => description, :enableAdminConsole => enable_admin_console.nil? ? true : enable_admin_console, :provisionOTD => provision_otd.nil? ? true : provision_otd, :sampleAppDeploymentRequested => sample_app_deployment_requested.nil? ? true : sample_app_deployment_requested, :subscriptionType => subscription_type || 'HOURLY', :level => level || 'PAAS', } options = { :adminPassword => <PASSWORD>, :adminPort => admin_port, :adminUserName => admin_username, :backupVolumeSize => backup_volume_size, :clusterName => cluster_name, :contentPort => content_port, :dbaName => dba_name, :dbaPassword => <PASSWORD>, :dbServiceName => db_service_name, :deploymentChannelPort => wls_deployment_channel_port, :domainMode => domain_mode, :domainName => domain_name, :domainPartitionCount => domain_partition_count, :domainVolumeSize => domain_volume_size, :edition => edition || 'EE', :ipReservations => ip_reservations, :managedServerCount => num_nodes || 1, :msInitialHeapMB => ms_initial_heap_mb, :msJvmArgs => ms_jvm_args, :msMaxHeapMB => ms_max_heap_mb, :msMaxPermMB => ms_max_perm_mb, :msPermMb => ms_perm_mb, :nodeManagerPassword => <PASSWORD>, :nodeManagerPort => node_manager_port, :nodeManagerUserName => node_manager_user_name, :overwriteMsJvmArgs => overwrite_ms_jvm_args, :pdbName => pdb_name, :securedAdminPort => secured_admin_port, :securedContentPort => secured_content_port, :shape => shape, :VMsPublicKey => ssh_key, :version => version } if app_dbs and app_dbs.is_a? Array and app_dbs.size >= 1 options[:appDBs] = [] app_dbs.each { |db| options[:appDBs].push({ :dbaName => db.username, :dbaPassword => <PASSWORD>, :dbServiceName => db.service_name, }) } end data = service.create_instance(params, options) end end end end end
package com.iluwatar.caching; import java.text.ParseException; import java.util.HashMap; import org.bson.Document; import com.mongodb.MongoClient; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoDatabase; import com.mongodb.client.model.UpdateOptions; /** * * <p>DBManager handles the communication with the underlying data store i.e. Database. It contains the * implemented methods for querying, inserting, and updating data. MongoDB was used as the database * for the application.</p> * * <p>Developer/Tester is able to choose whether the application should use MongoDB as its underlying * data storage (connect()) or a simple Java data structure to (temporarily) store the data/objects * during runtime (createVirtualDB()).</p> * */ public class DBManager { private static MongoClient mongoClient; private static MongoDatabase db; private static boolean useMongoDB; private static HashMap<String, UserAccount> virtualDB; public static void createVirtualDB() { useMongoDB = false; virtualDB = new HashMap<String, UserAccount>(); } public static void connect() throws ParseException { useMongoDB = true; mongoClient = new MongoClient(); db = mongoClient.getDatabase("test"); } public static UserAccount readFromDB(String userID) { if (!useMongoDB) { if (virtualDB.containsKey(userID)) return virtualDB.get(userID); return null; } if (null == db) { try { connect(); } catch (ParseException e) { e.printStackTrace(); } } FindIterable<Document> iterable = db.getCollection("user_accounts").find(new Document("userID", userID)); if (iterable == null) return null; Document doc = iterable.first(); UserAccount userAccount = new UserAccount(userID, doc.getString("userName"), doc.getString("additionalInfo")); return userAccount; } public static void writeToDB(UserAccount userAccount) { if (!useMongoDB) { virtualDB.put(userAccount.getUserID(), userAccount); return; } if (null == db) { try { connect(); } catch (ParseException e) { e.printStackTrace(); } } db.getCollection("user_accounts").insertOne( new Document("userID", userAccount.getUserID()).append("userName", userAccount.getUserName()).append("additionalInfo", userAccount.getAdditionalInfo())); } public static void updateDB(UserAccount userAccount) { if (!useMongoDB) { virtualDB.put(userAccount.getUserID(), userAccount); return; } if (null == db) { try { connect(); } catch (ParseException e) { e.printStackTrace(); } } db.getCollection("user_accounts").updateOne( new Document("userID", userAccount.getUserID()), new Document("$set", new Document("userName", userAccount.getUserName()).append( "additionalInfo", userAccount.getAdditionalInfo()))); } /** * * Insert data into DB if it does not exist. Else, update it. */ public static void upsertDB(UserAccount userAccount) { if (!useMongoDB) { virtualDB.put(userAccount.getUserID(), userAccount); return; } if (null == db) { try { connect(); } catch (ParseException e) { e.printStackTrace(); } } db.getCollection("user_accounts").updateOne( new Document("userID", userAccount.getUserID()), new Document("$set", new Document("userID", userAccount.getUserID()).append("userName", userAccount.getUserName()).append("additionalInfo", userAccount.getAdditionalInfo())), new UpdateOptions().upsert(true)); } }
<gh_stars>10-100 const vscode = require(`vscode`); module.exports = () => { const baseExtension = (vscode.extensions ? vscode.extensions.getExtension(`halcyontechltd.code-for-ibmi`) : undefined); return (baseExtension && baseExtension.isActive && baseExtension.exports ? baseExtension.exports.instance : null); }
func isValidEmail(email: String) -> Bool { let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}" let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) return emailTest.evaluate(with: email) }
<filename>src/quasar6/main/Field.java package quasar6.main; import java.util.*; /** * Utility class for the game field. * The utility class pattern is chosen over singleton * because of runtime concerns. */ public final class Field { public static final String BEGINNER = "Beginner"; public static final String INTERMEDIATE = "Intermediate"; public static final String EXPERT = "Expert"; private static int sizeX; private static int sizeY; private static Tile[][] field; private static final Random rand = new Random(); /** * Debug method for printing the current field to the console. */ @SuppressWarnings("unused") public static void printField() { System.out.println(); for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { if (field[i][j].isMine()) System.out.print("M "); else System.out.print(field[i][j].getRank() + " "); } System.out.println(); } System.out.println(); } /** * Calculates the ranks of tiles based on the rules of minesweeper. */ private static void calculateTiles() { for (int i = 0; i < sizeX; i++) for (int j = 0; j < sizeY; j++) if (field[i][j].isMine()) { var ij = new AbstractMap.SimpleImmutableEntry<>(i, j); for (int k = Math.max(0, i - 1); k < Math.min(sizeX, i + 2); k++) for (int l = Math.max(0, j - 1); l < Math.min(sizeY, j + 2); l++) { var kl = new AbstractMap.SimpleImmutableEntry<>(k, l); if (!ij.equals(kl) && !field[k][l].isMine()) field[k][l].setRank(field[k][l].getRank() + 1); } } } /** * Reveals all the tiles neighbouring the one given in the parameters * according to the rules of minesweeper. * * @param x The x coordinate of the tile * @param y The y coordinate of the tile */ public static void revealTiles(int x, int y) { if (field[x][y].getRank() > 0) field[x][y].setHidden(false); else { var xy = new AbstractMap.SimpleImmutableEntry<>(x, y); field[x][y].setHidden(false); for (int i = Math.max(0, x - 1); i < Math.min(sizeX, x + 2); i++) for (int j = Math.max(0, y - 1); j < Math.min(sizeY, y + 2); j++) { var ij = new AbstractMap.SimpleImmutableEntry<>(i, j); if (!ij.equals(xy) && field[i][j].isHidden()) { field[i][j].setHidden(false); if (field[i][j].getRank() == 0) revealTiles(i, j); } } } } /** * @return True if all the mines have been revealed. */ public static boolean isWinningState() { int allTiles = sizeX * sizeY; int mineCount; if (sizeY == 9) mineCount = 10; else if (sizeY == 16) mineCount = 40; else mineCount = 99; int revealedTiles = 0; for (int i = 0; i < sizeX; i++) for (int j = 0; j < sizeY; j++) if (!field[i][j].isHidden()) ++revealedTiles; return revealedTiles == allTiles - mineCount; } /** * Generates the mine field based on the difficulty. * This or {@link #customGenerate(int, int, int)} must be called at least once, * otherwise the game state will be illegal. * * @param difficulty The difficulty to generate. Valid values: Beginner, Intermediate, Expert * @throws IllegalArgumentException if the difficulty is not correct. */ public static void generate(String difficulty) { if (difficulty == null || !BEGINNER.equals(difficulty) && !INTERMEDIATE.equals(difficulty) && !EXPERT.equals(difficulty)) throw new IllegalArgumentException("Difficulty cannot be null and must be one of the following: Beginner, Intermediate, Expert"); if (BEGINNER.equals(difficulty)) customGenerate(9, 9, 10); else if (INTERMEDIATE.equals(difficulty)) customGenerate(16, 16, 40); else customGenerate(16, 30, 99); } /** * This method initializes the field, the sizeX and sizeY variables. * After that, it calls {@link #setMinesOnRandomPos(int)} and {@link #calculateTiles()}. * * @param rows the amount of rows to generate * @param cols the amount of columns to generate * @param mines the amount of mines to place on the field * @throws IllegalArgumentException if rows > 24 or cols > 30 or if there are more mines than Tiles */ public static void customGenerate(int rows, int cols, int mines) { if (mines > rows * cols || mines < 10) throw new IllegalArgumentException("Can't place more mines than Tiles!"); if (rows > 24 || cols > 30 || rows < 9 || cols < 9) throw new IllegalArgumentException("Provided size too big or too small!"); sizeX = rows; sizeY = cols; field = new Tile[sizeX][sizeY]; for (int i = 0; i < sizeX; i++) for (int j = 0; j < sizeY; j++) field[i][j] = new Tile(); setMinesOnRandomPos(mines); calculateTiles(); } /** * Sets N mines on the field. * * @param mines The number of mines to generate */ private static void setMinesOnRandomPos(int mines) { var cache = new ArrayList<>(); for (int i = 0; i < mines; i++) { int x = rand.nextInt(sizeX); int y = rand.nextInt(sizeY); var pos = new AbstractMap.SimpleImmutableEntry<>(x, y); if (cache.contains(pos)) ++mines; else { cache.add(pos); field[x][y].setRank(9); } } } /** * Debug method for counting the generated mines. */ @SuppressWarnings("unused") public static void countMines() { int count = 0; for (int i = 0; i < sizeX; i++) for (int j = 0; j < sizeY; j++) if (field[i][j].isMine()) ++count; System.out.println(count); } /** * @return The amount of rows */ public static int getSizeX() { return sizeX; } /** * @return The amount of columns */ public static int getSizeY() { return sizeY; } /** * @param x The x coordinate * @param y The y coordinate * @return The {@link quasar6.main.Tile Tile} object at the given coordinates */ public static Tile getTileAt(int x, int y) { return field[x][y]; } }
/******************************************************************************************************** * @file flash.h * * @brief for TLSR chips * * @author BLE Group * @date May. 12, 2018 * * @par Copyright (c) Telink Semiconductor (Shanghai) Co., Ltd. * All rights reserved. * * The information contained herein is confidential and proprietary property of Telink * Semiconductor (Shanghai) Co., Ltd. and is available under the terms * of Commercial License Agreement between Telink Semiconductor (Shanghai) * Co., Ltd. and the licensee in separate contract or the terms described here-in. * This heading MUST NOT be removed from this file. * * Licensees are granted free, non-transferable use of the information in this * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided. * *******************************************************************************************************/ #pragma once #include "../common/types.h" #include "../mcu/compiler.h" enum{ FLASH_WRITE_CMD = 0x02, FLASH_READ_CMD = 0x03, FLASH_WRITE_ENABLE_CMD = 0x06, FLASH_WRITE_DISABLE_CMD = 0x04, FLASH_READ_STATUS_CMD = 0x05, FLASH_SECT_ERASE_CMD = 0x20, FLASH_BLK_ERASE_CMD = 0xD8, FLASH_POWER_DOWN = 0xB9, FLASH_GET_JEDEC_ID = 0x9F, }; _attribute_ram_code_ void flash_erase_sector(u32 addr); _attribute_ram_code_ void flash_write_page(u32 addr, u32 len, u8 *buf); _attribute_ram_code_ void flash_read_page(u32 addr, u32 len, u8 *buf); _attribute_ram_code_ u32 flash_get_jedec_id();
function tryOr(callback, jsxExpression, defaultValue) { try { const result = callback(); return result ? jsxExpression : defaultValue; } catch (error) { return defaultValue; } } // Example usage const rule = { name: "John" }; const Hi = ({ children }) => <span>Hello, {children}!</span>; const defaultGreeting = <span>Hello, Guest!</span>; const result1 = tryOr(() => rule.name && <>: <Hi>{rule.name}</Hi></>, defaultGreeting); console.log(result1); // Output: <span>Hello, John!</span> const result2 = tryOr(() => { throw new Error("Name is not available"); }, defaultGreeting); console.log(result2); // Output: <span>Hello, Guest!</span>
import Foundation class UserManager { var users = [User]() func createUser(username: String, password: String) { if !userExists(withUsername: username) { let user = User(username: username, password: password) users.append(user) } else { print("Username already exists") } } func updatePassword(username: String, newPassword: String) { if let userIndex = users.firstIndex(where: {$0.username == username}) { let user = users[userIndex] user.password = newPassword users[userIndex] = user } else { print("Username does not exist") } } func loginUser(username: String, password: String) -> Bool { for user in users { if user.username == username && user.password == password { return true } } return false } private func userExists(withUsername username: String) -> Bool { for user in users { if user.username == username { return true } } return false } } class User { var username: String var password: String init(username: String, password: String) { self.username = username self.password = password } }
import numpy as np def distance(a, b): # This function is used to calculate the eucledian # distance between two points a and b return((np.sum((a - b)**2))**0.5) def L2norm(vec): # This function is used to calculate the L2 norm of the vector vec vec = np.array(vec) return((np.sum(vec**2))**0.5) def distance_point_to_hyperplane(pt, w, b): # This function is used to calculate the distnce of point pt # from the hyperplane which is described by w and b pt = np.array(pt) w = np.array(w) try: dist = abs(np.dot(pt, w) + b)/L2norm(w) return(dist) except: return(float("inf")) def compute_margin(data, w, b, *argv): # This function is used to calculate the margin and is used to verify # if the vectors assumed as support vectors ar actual support vectors or not min_dist = float("inf") data = np.array(data) w = np.array(w) for sample in data: pred = sample[-1]*(np.dot(sample[:-1], w) + b) # if the assumed hyperplane mis classifies even a single point then # then the assumed hyperplane doesn't maximze the margin if pred < 0: return (-float("inf")) distance = distance_point_to_hyperplane(sample[:-1], w, b) # The if condition finds the least distance between the hyperplane and the set of points if distance < min_dist: min_dist = distance for support_vector in argv: # This for loop verifies if the assumed support vector are the actual support vector # by comparing the least distance and the distance between the support vector and the hyperplane # if all the support vectors have the same minimum distance then the assumed support vectors are # the actual support vectors support_vector_distance = distance_point_to_hyperplane(support_vector, w, b) if round(support_vector_distance, 4) != round(min_dist, 4): return (-float("inf")) # if this statment is reached then it means that the assumed support vectors are the actual # support vectors return(min_dist) def svm_train_brute(training_data): training_data = np.array(training_data) # seggragting the positive and the negative sampes positive_samples = training_data[training_data[:,-1] > 0] negative_samples = training_data[training_data[:, -1] < 0] max_margin2 = -float("inf") max_margin3 = -float("inf") # iterating through each of the positive and the negative samples and computing # the hyperplane and b. for pos in positive_samples: for neg in negative_samples: pos_sample = pos[:-1] neg_sample = neg[:-1] dirW = pos_sample - neg_sample W = dirW/L2norm(dirW) possible_margin = distance(pos_sample, neg_sample)/2 # possible hyperplane with W W = W/possible_margin b = 1 - np.dot(W, pos_sample) # Computing the margin by calling the compute_margin margin = compute_margin(training_data, W, b, pos_sample, neg_sample) if (round(margin, 4) > round(max_margin2, 4)): # identifying the hyperplane which maximizes the margin max_margin2 = margin pos_support_vector = pos.copy() neg_support_vector = neg.copy() final_w2 = W.copy() final_b2 = b S2 = np.array([pos_support_vector, neg_support_vector]) # iterating through 3 samples at a time to compute the hyperplane for index1 in range(len(training_data)): for index2 in range(len(training_data)): for index3 in range(len(training_data)): if (index1 != index2 and index2 != index3 and index3 != index1): coeffs1 = np.append(training_data[index1][:-1], 1) coeffs2 = np.append(training_data[index2][:-1], 1) coeffs3 = np.append(training_data[index3][:-1], 1) sols = np.array([training_data[index1][-1], training_data[index2][-1], training_data[index3][-1]]) a = np.array([coeffs1, coeffs2, coeffs3]) try: # Solving a set of 3 equations to identify the values of w and b W = np.linalg.solve(a, sols) if np.all(W[:2] == np.array([0,0])): continue # computing the margin for a given hyperplane margin = compute_margin(training_data, W[:2], W[-1], training_data[index1][:-1], training_data[index2][:-1], training_data[index3][:-1]) except: continue # verifying if the hyperplane is having the maximum margin if (round(margin, 4) > round(max_margin3,4)): max_margin3 = margin final_w3 = W[:2] final_b3 = W[-1] S3 = np.array([training_data[index1], training_data[index2], training_data[index3]]) # Comparing the hyperplane identified by 2 points and 3 points and comparing theirs margins # returning the w, b and support vectors of the hyperplane having the largest margin if round(max_margin2, 4) > round(max_margin3, 4): return(final_w2, final_b2, S2) else: return(final_w3, final_b3, S3) def svm_test_brute(w, b, x): # using the dot product to make the predictions of the test data x w = np.array(w) x = np.array(x) pred = round(np.dot(x, w) + b, 4) if pred >= 1: return(1) elif pred <= -1: return(-1)
#!/bin/bash time valgrind --tool=cachegrind --dump-instr=yes --collect-jumps=yes $@
class ServicoNFSe: def __init__(self, nome, endpoint, envio): self.nome = nome self.endpoint = endpoint self.envio = envio class ServiceRegistry: def __init__(self): self.services = {} def register_service(self, nome, endpoint, envio): service = ServicoNFSe(nome, endpoint, envio) self.services[nome] = service def retrieve_service(self, nome): return self.services.get(nome, None) # Example usage registry = ServiceRegistry() registry.register_service('cancelar_nfse', 'http://example.com/cancel', True) registry.register_service('consulta_nfse_rps', 'http://example.com/consulta', True) service = registry.retrieve_service('cancelar_nfse') if service: print(f"Service found: {service.nome}, Endpoint: {service.endpoint}, Envio: {'XML' if service.envio else 'JSON'}") else: print("Service not found")
package com.example.jinha.wlwlab.app; public class Config { public static String SMARTHOME_IP = "192.168.1.3"; public static int SMARTHOME_PORT = 8080; public int frequency_315 = 1; public int frequency_433 = 2; public int frequency_Infrared = 3; //影院模式 public byte MoiveCenter_on[] = {0x31, 0x32}; public byte MoiveCenter_off[] = {0x31, 0x32}; //遥控器的14个按键 public byte Tv_1[] = {0x32, 0x31}; public byte Tv_2[] = {0x32, 0x32}; public byte Tv_3[] = {0x32, 0x32}; public byte Tv_4[] = {0x32, 0x32}; public byte Tv_5[] = {0x32, 0x32}; public byte Tv_6[] = {0x32, 0x32}; public byte Tv_7[] = {0x32, 0x32}; public byte Tv_8[] = {0x32, 0x32}; public byte Tv_9[] = {0x32, 0x32}; public byte Tv_10[] = {0x32, 0x32}; public byte Tv_11[] = {0x32, 0x32}; public byte Tv_12[] = {0x32, 0x32}; public byte Tv_13[] = {0x32, 0x32}; public byte Tv_14[] = {0x32, 0x32}; //灯控制 //待定 }
CREATE TABLE Employees ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), department VARCHAR(255), salary INT );
python bigmap_9.py python bigmap_10.py python bigmap_11.py python bigmap_12.py python bigmap_13.py python bigmap_14.py python bigmap_15.py python bigmap_16.py