1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/automl/v1/data_items.proto 18 19 package com.google.cloud.automl.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * Message that describes dimension of a document. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.automl.v1.DocumentDimensions} 29 */ 30 public final class DocumentDimensions extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.automl.v1.DocumentDimensions) 33 DocumentDimensionsOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use DocumentDimensions.newBuilder() to construct. DocumentDimensions(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private DocumentDimensions(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 DocumentDimensions()40 private DocumentDimensions() { 41 unit_ = 0; 42 } 43 44 @java.lang.Override 45 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)46 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 47 return new DocumentDimensions(); 48 } 49 50 @java.lang.Override getUnknownFields()51 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 52 return this.unknownFields; 53 } 54 getDescriptor()55 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 56 return com.google.cloud.automl.v1.DataItems 57 .internal_static_google_cloud_automl_v1_DocumentDimensions_descriptor; 58 } 59 60 @java.lang.Override 61 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()62 internalGetFieldAccessorTable() { 63 return com.google.cloud.automl.v1.DataItems 64 .internal_static_google_cloud_automl_v1_DocumentDimensions_fieldAccessorTable 65 .ensureFieldAccessorsInitialized( 66 com.google.cloud.automl.v1.DocumentDimensions.class, 67 com.google.cloud.automl.v1.DocumentDimensions.Builder.class); 68 } 69 70 /** 71 * 72 * 73 * <pre> 74 * Unit of the document dimension. 75 * </pre> 76 * 77 * Protobuf enum {@code google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit} 78 */ 79 public enum DocumentDimensionUnit implements com.google.protobuf.ProtocolMessageEnum { 80 /** 81 * 82 * 83 * <pre> 84 * Should not be used. 85 * </pre> 86 * 87 * <code>DOCUMENT_DIMENSION_UNIT_UNSPECIFIED = 0;</code> 88 */ 89 DOCUMENT_DIMENSION_UNIT_UNSPECIFIED(0), 90 /** 91 * 92 * 93 * <pre> 94 * Document dimension is measured in inches. 95 * </pre> 96 * 97 * <code>INCH = 1;</code> 98 */ 99 INCH(1), 100 /** 101 * 102 * 103 * <pre> 104 * Document dimension is measured in centimeters. 105 * </pre> 106 * 107 * <code>CENTIMETER = 2;</code> 108 */ 109 CENTIMETER(2), 110 /** 111 * 112 * 113 * <pre> 114 * Document dimension is measured in points. 72 points = 1 inch. 115 * </pre> 116 * 117 * <code>POINT = 3;</code> 118 */ 119 POINT(3), 120 UNRECOGNIZED(-1), 121 ; 122 123 /** 124 * 125 * 126 * <pre> 127 * Should not be used. 128 * </pre> 129 * 130 * <code>DOCUMENT_DIMENSION_UNIT_UNSPECIFIED = 0;</code> 131 */ 132 public static final int DOCUMENT_DIMENSION_UNIT_UNSPECIFIED_VALUE = 0; 133 /** 134 * 135 * 136 * <pre> 137 * Document dimension is measured in inches. 138 * </pre> 139 * 140 * <code>INCH = 1;</code> 141 */ 142 public static final int INCH_VALUE = 1; 143 /** 144 * 145 * 146 * <pre> 147 * Document dimension is measured in centimeters. 148 * </pre> 149 * 150 * <code>CENTIMETER = 2;</code> 151 */ 152 public static final int CENTIMETER_VALUE = 2; 153 /** 154 * 155 * 156 * <pre> 157 * Document dimension is measured in points. 72 points = 1 inch. 158 * </pre> 159 * 160 * <code>POINT = 3;</code> 161 */ 162 public static final int POINT_VALUE = 3; 163 getNumber()164 public final int getNumber() { 165 if (this == UNRECOGNIZED) { 166 throw new java.lang.IllegalArgumentException( 167 "Can't get the number of an unknown enum value."); 168 } 169 return value; 170 } 171 172 /** 173 * @param value The numeric wire value of the corresponding enum entry. 174 * @return The enum associated with the given numeric wire value. 175 * @deprecated Use {@link #forNumber(int)} instead. 176 */ 177 @java.lang.Deprecated valueOf(int value)178 public static DocumentDimensionUnit valueOf(int value) { 179 return forNumber(value); 180 } 181 182 /** 183 * @param value The numeric wire value of the corresponding enum entry. 184 * @return The enum associated with the given numeric wire value. 185 */ forNumber(int value)186 public static DocumentDimensionUnit forNumber(int value) { 187 switch (value) { 188 case 0: 189 return DOCUMENT_DIMENSION_UNIT_UNSPECIFIED; 190 case 1: 191 return INCH; 192 case 2: 193 return CENTIMETER; 194 case 3: 195 return POINT; 196 default: 197 return null; 198 } 199 } 200 201 public static com.google.protobuf.Internal.EnumLiteMap<DocumentDimensionUnit> internalGetValueMap()202 internalGetValueMap() { 203 return internalValueMap; 204 } 205 206 private static final com.google.protobuf.Internal.EnumLiteMap<DocumentDimensionUnit> 207 internalValueMap = 208 new com.google.protobuf.Internal.EnumLiteMap<DocumentDimensionUnit>() { 209 public DocumentDimensionUnit findValueByNumber(int number) { 210 return DocumentDimensionUnit.forNumber(number); 211 } 212 }; 213 getValueDescriptor()214 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 215 if (this == UNRECOGNIZED) { 216 throw new java.lang.IllegalStateException( 217 "Can't get the descriptor of an unrecognized enum value."); 218 } 219 return getDescriptor().getValues().get(ordinal()); 220 } 221 getDescriptorForType()222 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 223 return getDescriptor(); 224 } 225 getDescriptor()226 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 227 return com.google.cloud.automl.v1.DocumentDimensions.getDescriptor().getEnumTypes().get(0); 228 } 229 230 private static final DocumentDimensionUnit[] VALUES = values(); 231 valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc)232 public static DocumentDimensionUnit valueOf( 233 com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 234 if (desc.getType() != getDescriptor()) { 235 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 236 } 237 if (desc.getIndex() == -1) { 238 return UNRECOGNIZED; 239 } 240 return VALUES[desc.getIndex()]; 241 } 242 243 private final int value; 244 DocumentDimensionUnit(int value)245 private DocumentDimensionUnit(int value) { 246 this.value = value; 247 } 248 249 // @@protoc_insertion_point(enum_scope:google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit) 250 } 251 252 public static final int UNIT_FIELD_NUMBER = 1; 253 private int unit_ = 0; 254 /** 255 * 256 * 257 * <pre> 258 * Unit of the dimension. 259 * </pre> 260 * 261 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 262 * 263 * @return The enum numeric value on the wire for unit. 264 */ 265 @java.lang.Override getUnitValue()266 public int getUnitValue() { 267 return unit_; 268 } 269 /** 270 * 271 * 272 * <pre> 273 * Unit of the dimension. 274 * </pre> 275 * 276 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 277 * 278 * @return The unit. 279 */ 280 @java.lang.Override getUnit()281 public com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit getUnit() { 282 com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit result = 283 com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit.forNumber(unit_); 284 return result == null 285 ? com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit.UNRECOGNIZED 286 : result; 287 } 288 289 public static final int WIDTH_FIELD_NUMBER = 2; 290 private float width_ = 0F; 291 /** 292 * 293 * 294 * <pre> 295 * Width value of the document, works together with the unit. 296 * </pre> 297 * 298 * <code>float width = 2;</code> 299 * 300 * @return The width. 301 */ 302 @java.lang.Override getWidth()303 public float getWidth() { 304 return width_; 305 } 306 307 public static final int HEIGHT_FIELD_NUMBER = 3; 308 private float height_ = 0F; 309 /** 310 * 311 * 312 * <pre> 313 * Height value of the document, works together with the unit. 314 * </pre> 315 * 316 * <code>float height = 3;</code> 317 * 318 * @return The height. 319 */ 320 @java.lang.Override getHeight()321 public float getHeight() { 322 return height_; 323 } 324 325 private byte memoizedIsInitialized = -1; 326 327 @java.lang.Override isInitialized()328 public final boolean isInitialized() { 329 byte isInitialized = memoizedIsInitialized; 330 if (isInitialized == 1) return true; 331 if (isInitialized == 0) return false; 332 333 memoizedIsInitialized = 1; 334 return true; 335 } 336 337 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)338 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 339 if (unit_ 340 != com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit 341 .DOCUMENT_DIMENSION_UNIT_UNSPECIFIED 342 .getNumber()) { 343 output.writeEnum(1, unit_); 344 } 345 if (java.lang.Float.floatToRawIntBits(width_) != 0) { 346 output.writeFloat(2, width_); 347 } 348 if (java.lang.Float.floatToRawIntBits(height_) != 0) { 349 output.writeFloat(3, height_); 350 } 351 getUnknownFields().writeTo(output); 352 } 353 354 @java.lang.Override getSerializedSize()355 public int getSerializedSize() { 356 int size = memoizedSize; 357 if (size != -1) return size; 358 359 size = 0; 360 if (unit_ 361 != com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit 362 .DOCUMENT_DIMENSION_UNIT_UNSPECIFIED 363 .getNumber()) { 364 size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, unit_); 365 } 366 if (java.lang.Float.floatToRawIntBits(width_) != 0) { 367 size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, width_); 368 } 369 if (java.lang.Float.floatToRawIntBits(height_) != 0) { 370 size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, height_); 371 } 372 size += getUnknownFields().getSerializedSize(); 373 memoizedSize = size; 374 return size; 375 } 376 377 @java.lang.Override equals(final java.lang.Object obj)378 public boolean equals(final java.lang.Object obj) { 379 if (obj == this) { 380 return true; 381 } 382 if (!(obj instanceof com.google.cloud.automl.v1.DocumentDimensions)) { 383 return super.equals(obj); 384 } 385 com.google.cloud.automl.v1.DocumentDimensions other = 386 (com.google.cloud.automl.v1.DocumentDimensions) obj; 387 388 if (unit_ != other.unit_) return false; 389 if (java.lang.Float.floatToIntBits(getWidth()) 390 != java.lang.Float.floatToIntBits(other.getWidth())) return false; 391 if (java.lang.Float.floatToIntBits(getHeight()) 392 != java.lang.Float.floatToIntBits(other.getHeight())) return false; 393 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 394 return true; 395 } 396 397 @java.lang.Override hashCode()398 public int hashCode() { 399 if (memoizedHashCode != 0) { 400 return memoizedHashCode; 401 } 402 int hash = 41; 403 hash = (19 * hash) + getDescriptor().hashCode(); 404 hash = (37 * hash) + UNIT_FIELD_NUMBER; 405 hash = (53 * hash) + unit_; 406 hash = (37 * hash) + WIDTH_FIELD_NUMBER; 407 hash = (53 * hash) + java.lang.Float.floatToIntBits(getWidth()); 408 hash = (37 * hash) + HEIGHT_FIELD_NUMBER; 409 hash = (53 * hash) + java.lang.Float.floatToIntBits(getHeight()); 410 hash = (29 * hash) + getUnknownFields().hashCode(); 411 memoizedHashCode = hash; 412 return hash; 413 } 414 parseFrom(java.nio.ByteBuffer data)415 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom(java.nio.ByteBuffer data) 416 throws com.google.protobuf.InvalidProtocolBufferException { 417 return PARSER.parseFrom(data); 418 } 419 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)420 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 421 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 422 throws com.google.protobuf.InvalidProtocolBufferException { 423 return PARSER.parseFrom(data, extensionRegistry); 424 } 425 parseFrom( com.google.protobuf.ByteString data)426 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 427 com.google.protobuf.ByteString data) 428 throws com.google.protobuf.InvalidProtocolBufferException { 429 return PARSER.parseFrom(data); 430 } 431 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)432 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 433 com.google.protobuf.ByteString data, 434 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 435 throws com.google.protobuf.InvalidProtocolBufferException { 436 return PARSER.parseFrom(data, extensionRegistry); 437 } 438 parseFrom(byte[] data)439 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom(byte[] data) 440 throws com.google.protobuf.InvalidProtocolBufferException { 441 return PARSER.parseFrom(data); 442 } 443 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)444 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 445 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 446 throws com.google.protobuf.InvalidProtocolBufferException { 447 return PARSER.parseFrom(data, extensionRegistry); 448 } 449 parseFrom(java.io.InputStream input)450 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom(java.io.InputStream input) 451 throws java.io.IOException { 452 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 453 } 454 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)455 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 456 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 457 throws java.io.IOException { 458 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 459 PARSER, input, extensionRegistry); 460 } 461 parseDelimitedFrom( java.io.InputStream input)462 public static com.google.cloud.automl.v1.DocumentDimensions parseDelimitedFrom( 463 java.io.InputStream input) throws java.io.IOException { 464 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 465 } 466 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)467 public static com.google.cloud.automl.v1.DocumentDimensions parseDelimitedFrom( 468 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 469 throws java.io.IOException { 470 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 471 PARSER, input, extensionRegistry); 472 } 473 parseFrom( com.google.protobuf.CodedInputStream input)474 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 475 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 476 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 477 } 478 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)479 public static com.google.cloud.automl.v1.DocumentDimensions parseFrom( 480 com.google.protobuf.CodedInputStream input, 481 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 482 throws java.io.IOException { 483 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 484 PARSER, input, extensionRegistry); 485 } 486 487 @java.lang.Override newBuilderForType()488 public Builder newBuilderForType() { 489 return newBuilder(); 490 } 491 newBuilder()492 public static Builder newBuilder() { 493 return DEFAULT_INSTANCE.toBuilder(); 494 } 495 newBuilder(com.google.cloud.automl.v1.DocumentDimensions prototype)496 public static Builder newBuilder(com.google.cloud.automl.v1.DocumentDimensions prototype) { 497 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 498 } 499 500 @java.lang.Override toBuilder()501 public Builder toBuilder() { 502 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 503 } 504 505 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)506 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 507 Builder builder = new Builder(parent); 508 return builder; 509 } 510 /** 511 * 512 * 513 * <pre> 514 * Message that describes dimension of a document. 515 * </pre> 516 * 517 * Protobuf type {@code google.cloud.automl.v1.DocumentDimensions} 518 */ 519 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 520 implements 521 // @@protoc_insertion_point(builder_implements:google.cloud.automl.v1.DocumentDimensions) 522 com.google.cloud.automl.v1.DocumentDimensionsOrBuilder { getDescriptor()523 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 524 return com.google.cloud.automl.v1.DataItems 525 .internal_static_google_cloud_automl_v1_DocumentDimensions_descriptor; 526 } 527 528 @java.lang.Override 529 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()530 internalGetFieldAccessorTable() { 531 return com.google.cloud.automl.v1.DataItems 532 .internal_static_google_cloud_automl_v1_DocumentDimensions_fieldAccessorTable 533 .ensureFieldAccessorsInitialized( 534 com.google.cloud.automl.v1.DocumentDimensions.class, 535 com.google.cloud.automl.v1.DocumentDimensions.Builder.class); 536 } 537 538 // Construct using com.google.cloud.automl.v1.DocumentDimensions.newBuilder() Builder()539 private Builder() {} 540 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)541 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 542 super(parent); 543 } 544 545 @java.lang.Override clear()546 public Builder clear() { 547 super.clear(); 548 bitField0_ = 0; 549 unit_ = 0; 550 width_ = 0F; 551 height_ = 0F; 552 return this; 553 } 554 555 @java.lang.Override getDescriptorForType()556 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 557 return com.google.cloud.automl.v1.DataItems 558 .internal_static_google_cloud_automl_v1_DocumentDimensions_descriptor; 559 } 560 561 @java.lang.Override getDefaultInstanceForType()562 public com.google.cloud.automl.v1.DocumentDimensions getDefaultInstanceForType() { 563 return com.google.cloud.automl.v1.DocumentDimensions.getDefaultInstance(); 564 } 565 566 @java.lang.Override build()567 public com.google.cloud.automl.v1.DocumentDimensions build() { 568 com.google.cloud.automl.v1.DocumentDimensions result = buildPartial(); 569 if (!result.isInitialized()) { 570 throw newUninitializedMessageException(result); 571 } 572 return result; 573 } 574 575 @java.lang.Override buildPartial()576 public com.google.cloud.automl.v1.DocumentDimensions buildPartial() { 577 com.google.cloud.automl.v1.DocumentDimensions result = 578 new com.google.cloud.automl.v1.DocumentDimensions(this); 579 if (bitField0_ != 0) { 580 buildPartial0(result); 581 } 582 onBuilt(); 583 return result; 584 } 585 buildPartial0(com.google.cloud.automl.v1.DocumentDimensions result)586 private void buildPartial0(com.google.cloud.automl.v1.DocumentDimensions result) { 587 int from_bitField0_ = bitField0_; 588 if (((from_bitField0_ & 0x00000001) != 0)) { 589 result.unit_ = unit_; 590 } 591 if (((from_bitField0_ & 0x00000002) != 0)) { 592 result.width_ = width_; 593 } 594 if (((from_bitField0_ & 0x00000004) != 0)) { 595 result.height_ = height_; 596 } 597 } 598 599 @java.lang.Override clone()600 public Builder clone() { 601 return super.clone(); 602 } 603 604 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)605 public Builder setField( 606 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 607 return super.setField(field, value); 608 } 609 610 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)611 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 612 return super.clearField(field); 613 } 614 615 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)616 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 617 return super.clearOneof(oneof); 618 } 619 620 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)621 public Builder setRepeatedField( 622 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 623 return super.setRepeatedField(field, index, value); 624 } 625 626 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)627 public Builder addRepeatedField( 628 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 629 return super.addRepeatedField(field, value); 630 } 631 632 @java.lang.Override mergeFrom(com.google.protobuf.Message other)633 public Builder mergeFrom(com.google.protobuf.Message other) { 634 if (other instanceof com.google.cloud.automl.v1.DocumentDimensions) { 635 return mergeFrom((com.google.cloud.automl.v1.DocumentDimensions) other); 636 } else { 637 super.mergeFrom(other); 638 return this; 639 } 640 } 641 mergeFrom(com.google.cloud.automl.v1.DocumentDimensions other)642 public Builder mergeFrom(com.google.cloud.automl.v1.DocumentDimensions other) { 643 if (other == com.google.cloud.automl.v1.DocumentDimensions.getDefaultInstance()) return this; 644 if (other.unit_ != 0) { 645 setUnitValue(other.getUnitValue()); 646 } 647 if (other.getWidth() != 0F) { 648 setWidth(other.getWidth()); 649 } 650 if (other.getHeight() != 0F) { 651 setHeight(other.getHeight()); 652 } 653 this.mergeUnknownFields(other.getUnknownFields()); 654 onChanged(); 655 return this; 656 } 657 658 @java.lang.Override isInitialized()659 public final boolean isInitialized() { 660 return true; 661 } 662 663 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)664 public Builder mergeFrom( 665 com.google.protobuf.CodedInputStream input, 666 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 667 throws java.io.IOException { 668 if (extensionRegistry == null) { 669 throw new java.lang.NullPointerException(); 670 } 671 try { 672 boolean done = false; 673 while (!done) { 674 int tag = input.readTag(); 675 switch (tag) { 676 case 0: 677 done = true; 678 break; 679 case 8: 680 { 681 unit_ = input.readEnum(); 682 bitField0_ |= 0x00000001; 683 break; 684 } // case 8 685 case 21: 686 { 687 width_ = input.readFloat(); 688 bitField0_ |= 0x00000002; 689 break; 690 } // case 21 691 case 29: 692 { 693 height_ = input.readFloat(); 694 bitField0_ |= 0x00000004; 695 break; 696 } // case 29 697 default: 698 { 699 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 700 done = true; // was an endgroup tag 701 } 702 break; 703 } // default: 704 } // switch (tag) 705 } // while (!done) 706 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 707 throw e.unwrapIOException(); 708 } finally { 709 onChanged(); 710 } // finally 711 return this; 712 } 713 714 private int bitField0_; 715 716 private int unit_ = 0; 717 /** 718 * 719 * 720 * <pre> 721 * Unit of the dimension. 722 * </pre> 723 * 724 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 725 * 726 * @return The enum numeric value on the wire for unit. 727 */ 728 @java.lang.Override getUnitValue()729 public int getUnitValue() { 730 return unit_; 731 } 732 /** 733 * 734 * 735 * <pre> 736 * Unit of the dimension. 737 * </pre> 738 * 739 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 740 * 741 * @param value The enum numeric value on the wire for unit to set. 742 * @return This builder for chaining. 743 */ setUnitValue(int value)744 public Builder setUnitValue(int value) { 745 unit_ = value; 746 bitField0_ |= 0x00000001; 747 onChanged(); 748 return this; 749 } 750 /** 751 * 752 * 753 * <pre> 754 * Unit of the dimension. 755 * </pre> 756 * 757 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 758 * 759 * @return The unit. 760 */ 761 @java.lang.Override getUnit()762 public com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit getUnit() { 763 com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit result = 764 com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit.forNumber(unit_); 765 return result == null 766 ? com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit.UNRECOGNIZED 767 : result; 768 } 769 /** 770 * 771 * 772 * <pre> 773 * Unit of the dimension. 774 * </pre> 775 * 776 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 777 * 778 * @param value The unit to set. 779 * @return This builder for chaining. 780 */ setUnit( com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit value)781 public Builder setUnit( 782 com.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit value) { 783 if (value == null) { 784 throw new NullPointerException(); 785 } 786 bitField0_ |= 0x00000001; 787 unit_ = value.getNumber(); 788 onChanged(); 789 return this; 790 } 791 /** 792 * 793 * 794 * <pre> 795 * Unit of the dimension. 796 * </pre> 797 * 798 * <code>.google.cloud.automl.v1.DocumentDimensions.DocumentDimensionUnit unit = 1;</code> 799 * 800 * @return This builder for chaining. 801 */ clearUnit()802 public Builder clearUnit() { 803 bitField0_ = (bitField0_ & ~0x00000001); 804 unit_ = 0; 805 onChanged(); 806 return this; 807 } 808 809 private float width_; 810 /** 811 * 812 * 813 * <pre> 814 * Width value of the document, works together with the unit. 815 * </pre> 816 * 817 * <code>float width = 2;</code> 818 * 819 * @return The width. 820 */ 821 @java.lang.Override getWidth()822 public float getWidth() { 823 return width_; 824 } 825 /** 826 * 827 * 828 * <pre> 829 * Width value of the document, works together with the unit. 830 * </pre> 831 * 832 * <code>float width = 2;</code> 833 * 834 * @param value The width to set. 835 * @return This builder for chaining. 836 */ setWidth(float value)837 public Builder setWidth(float value) { 838 839 width_ = value; 840 bitField0_ |= 0x00000002; 841 onChanged(); 842 return this; 843 } 844 /** 845 * 846 * 847 * <pre> 848 * Width value of the document, works together with the unit. 849 * </pre> 850 * 851 * <code>float width = 2;</code> 852 * 853 * @return This builder for chaining. 854 */ clearWidth()855 public Builder clearWidth() { 856 bitField0_ = (bitField0_ & ~0x00000002); 857 width_ = 0F; 858 onChanged(); 859 return this; 860 } 861 862 private float height_; 863 /** 864 * 865 * 866 * <pre> 867 * Height value of the document, works together with the unit. 868 * </pre> 869 * 870 * <code>float height = 3;</code> 871 * 872 * @return The height. 873 */ 874 @java.lang.Override getHeight()875 public float getHeight() { 876 return height_; 877 } 878 /** 879 * 880 * 881 * <pre> 882 * Height value of the document, works together with the unit. 883 * </pre> 884 * 885 * <code>float height = 3;</code> 886 * 887 * @param value The height to set. 888 * @return This builder for chaining. 889 */ setHeight(float value)890 public Builder setHeight(float value) { 891 892 height_ = value; 893 bitField0_ |= 0x00000004; 894 onChanged(); 895 return this; 896 } 897 /** 898 * 899 * 900 * <pre> 901 * Height value of the document, works together with the unit. 902 * </pre> 903 * 904 * <code>float height = 3;</code> 905 * 906 * @return This builder for chaining. 907 */ clearHeight()908 public Builder clearHeight() { 909 bitField0_ = (bitField0_ & ~0x00000004); 910 height_ = 0F; 911 onChanged(); 912 return this; 913 } 914 915 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)916 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 917 return super.setUnknownFields(unknownFields); 918 } 919 920 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)921 public final Builder mergeUnknownFields( 922 final com.google.protobuf.UnknownFieldSet unknownFields) { 923 return super.mergeUnknownFields(unknownFields); 924 } 925 926 // @@protoc_insertion_point(builder_scope:google.cloud.automl.v1.DocumentDimensions) 927 } 928 929 // @@protoc_insertion_point(class_scope:google.cloud.automl.v1.DocumentDimensions) 930 private static final com.google.cloud.automl.v1.DocumentDimensions DEFAULT_INSTANCE; 931 932 static { 933 DEFAULT_INSTANCE = new com.google.cloud.automl.v1.DocumentDimensions(); 934 } 935 getDefaultInstance()936 public static com.google.cloud.automl.v1.DocumentDimensions getDefaultInstance() { 937 return DEFAULT_INSTANCE; 938 } 939 940 private static final com.google.protobuf.Parser<DocumentDimensions> PARSER = 941 new com.google.protobuf.AbstractParser<DocumentDimensions>() { 942 @java.lang.Override 943 public DocumentDimensions parsePartialFrom( 944 com.google.protobuf.CodedInputStream input, 945 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 946 throws com.google.protobuf.InvalidProtocolBufferException { 947 Builder builder = newBuilder(); 948 try { 949 builder.mergeFrom(input, extensionRegistry); 950 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 951 throw e.setUnfinishedMessage(builder.buildPartial()); 952 } catch (com.google.protobuf.UninitializedMessageException e) { 953 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 954 } catch (java.io.IOException e) { 955 throw new com.google.protobuf.InvalidProtocolBufferException(e) 956 .setUnfinishedMessage(builder.buildPartial()); 957 } 958 return builder.buildPartial(); 959 } 960 }; 961 parser()962 public static com.google.protobuf.Parser<DocumentDimensions> parser() { 963 return PARSER; 964 } 965 966 @java.lang.Override getParserForType()967 public com.google.protobuf.Parser<DocumentDimensions> getParserForType() { 968 return PARSER; 969 } 970 971 @java.lang.Override getDefaultInstanceForType()972 public com.google.cloud.automl.v1.DocumentDimensions getDefaultInstanceForType() { 973 return DEFAULT_INSTANCE; 974 } 975 } 976