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/vision/v1/text_annotation.proto 18 19 package com.google.cloud.vision.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * Logical element on the page. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.vision.v1.Block} 29 */ 30 public final class Block extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.vision.v1.Block) 33 BlockOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use Block.newBuilder() to construct. Block(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private Block(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 Block()40 private Block() { 41 paragraphs_ = java.util.Collections.emptyList(); 42 blockType_ = 0; 43 } 44 45 @java.lang.Override 46 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)47 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 48 return new Block(); 49 } 50 51 @java.lang.Override getUnknownFields()52 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 53 return this.unknownFields; 54 } 55 getDescriptor()56 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 57 return com.google.cloud.vision.v1.TextAnnotationProto 58 .internal_static_google_cloud_vision_v1_Block_descriptor; 59 } 60 61 @java.lang.Override 62 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()63 internalGetFieldAccessorTable() { 64 return com.google.cloud.vision.v1.TextAnnotationProto 65 .internal_static_google_cloud_vision_v1_Block_fieldAccessorTable 66 .ensureFieldAccessorsInitialized( 67 com.google.cloud.vision.v1.Block.class, com.google.cloud.vision.v1.Block.Builder.class); 68 } 69 70 /** 71 * 72 * 73 * <pre> 74 * Type of a block (text, image etc) as identified by OCR. 75 * </pre> 76 * 77 * Protobuf enum {@code google.cloud.vision.v1.Block.BlockType} 78 */ 79 public enum BlockType implements com.google.protobuf.ProtocolMessageEnum { 80 /** 81 * 82 * 83 * <pre> 84 * Unknown block type. 85 * </pre> 86 * 87 * <code>UNKNOWN = 0;</code> 88 */ 89 UNKNOWN(0), 90 /** 91 * 92 * 93 * <pre> 94 * Regular text block. 95 * </pre> 96 * 97 * <code>TEXT = 1;</code> 98 */ 99 TEXT(1), 100 /** 101 * 102 * 103 * <pre> 104 * Table block. 105 * </pre> 106 * 107 * <code>TABLE = 2;</code> 108 */ 109 TABLE(2), 110 /** 111 * 112 * 113 * <pre> 114 * Image block. 115 * </pre> 116 * 117 * <code>PICTURE = 3;</code> 118 */ 119 PICTURE(3), 120 /** 121 * 122 * 123 * <pre> 124 * Horizontal/vertical line box. 125 * </pre> 126 * 127 * <code>RULER = 4;</code> 128 */ 129 RULER(4), 130 /** 131 * 132 * 133 * <pre> 134 * Barcode block. 135 * </pre> 136 * 137 * <code>BARCODE = 5;</code> 138 */ 139 BARCODE(5), 140 UNRECOGNIZED(-1), 141 ; 142 143 /** 144 * 145 * 146 * <pre> 147 * Unknown block type. 148 * </pre> 149 * 150 * <code>UNKNOWN = 0;</code> 151 */ 152 public static final int UNKNOWN_VALUE = 0; 153 /** 154 * 155 * 156 * <pre> 157 * Regular text block. 158 * </pre> 159 * 160 * <code>TEXT = 1;</code> 161 */ 162 public static final int TEXT_VALUE = 1; 163 /** 164 * 165 * 166 * <pre> 167 * Table block. 168 * </pre> 169 * 170 * <code>TABLE = 2;</code> 171 */ 172 public static final int TABLE_VALUE = 2; 173 /** 174 * 175 * 176 * <pre> 177 * Image block. 178 * </pre> 179 * 180 * <code>PICTURE = 3;</code> 181 */ 182 public static final int PICTURE_VALUE = 3; 183 /** 184 * 185 * 186 * <pre> 187 * Horizontal/vertical line box. 188 * </pre> 189 * 190 * <code>RULER = 4;</code> 191 */ 192 public static final int RULER_VALUE = 4; 193 /** 194 * 195 * 196 * <pre> 197 * Barcode block. 198 * </pre> 199 * 200 * <code>BARCODE = 5;</code> 201 */ 202 public static final int BARCODE_VALUE = 5; 203 getNumber()204 public final int getNumber() { 205 if (this == UNRECOGNIZED) { 206 throw new java.lang.IllegalArgumentException( 207 "Can't get the number of an unknown enum value."); 208 } 209 return value; 210 } 211 212 /** 213 * @param value The numeric wire value of the corresponding enum entry. 214 * @return The enum associated with the given numeric wire value. 215 * @deprecated Use {@link #forNumber(int)} instead. 216 */ 217 @java.lang.Deprecated valueOf(int value)218 public static BlockType valueOf(int value) { 219 return forNumber(value); 220 } 221 222 /** 223 * @param value The numeric wire value of the corresponding enum entry. 224 * @return The enum associated with the given numeric wire value. 225 */ forNumber(int value)226 public static BlockType forNumber(int value) { 227 switch (value) { 228 case 0: 229 return UNKNOWN; 230 case 1: 231 return TEXT; 232 case 2: 233 return TABLE; 234 case 3: 235 return PICTURE; 236 case 4: 237 return RULER; 238 case 5: 239 return BARCODE; 240 default: 241 return null; 242 } 243 } 244 internalGetValueMap()245 public static com.google.protobuf.Internal.EnumLiteMap<BlockType> internalGetValueMap() { 246 return internalValueMap; 247 } 248 249 private static final com.google.protobuf.Internal.EnumLiteMap<BlockType> internalValueMap = 250 new com.google.protobuf.Internal.EnumLiteMap<BlockType>() { 251 public BlockType findValueByNumber(int number) { 252 return BlockType.forNumber(number); 253 } 254 }; 255 getValueDescriptor()256 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 257 if (this == UNRECOGNIZED) { 258 throw new java.lang.IllegalStateException( 259 "Can't get the descriptor of an unrecognized enum value."); 260 } 261 return getDescriptor().getValues().get(ordinal()); 262 } 263 getDescriptorForType()264 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 265 return getDescriptor(); 266 } 267 getDescriptor()268 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 269 return com.google.cloud.vision.v1.Block.getDescriptor().getEnumTypes().get(0); 270 } 271 272 private static final BlockType[] VALUES = values(); 273 valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)274 public static BlockType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 275 if (desc.getType() != getDescriptor()) { 276 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 277 } 278 if (desc.getIndex() == -1) { 279 return UNRECOGNIZED; 280 } 281 return VALUES[desc.getIndex()]; 282 } 283 284 private final int value; 285 BlockType(int value)286 private BlockType(int value) { 287 this.value = value; 288 } 289 290 // @@protoc_insertion_point(enum_scope:google.cloud.vision.v1.Block.BlockType) 291 } 292 293 public static final int PROPERTY_FIELD_NUMBER = 1; 294 private com.google.cloud.vision.v1.TextAnnotation.TextProperty property_; 295 /** 296 * 297 * 298 * <pre> 299 * Additional information detected for the block. 300 * </pre> 301 * 302 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 303 * 304 * @return Whether the property field is set. 305 */ 306 @java.lang.Override hasProperty()307 public boolean hasProperty() { 308 return property_ != null; 309 } 310 /** 311 * 312 * 313 * <pre> 314 * Additional information detected for the block. 315 * </pre> 316 * 317 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 318 * 319 * @return The property. 320 */ 321 @java.lang.Override getProperty()322 public com.google.cloud.vision.v1.TextAnnotation.TextProperty getProperty() { 323 return property_ == null 324 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 325 : property_; 326 } 327 /** 328 * 329 * 330 * <pre> 331 * Additional information detected for the block. 332 * </pre> 333 * 334 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 335 */ 336 @java.lang.Override getPropertyOrBuilder()337 public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getPropertyOrBuilder() { 338 return property_ == null 339 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 340 : property_; 341 } 342 343 public static final int BOUNDING_BOX_FIELD_NUMBER = 2; 344 private com.google.cloud.vision.v1.BoundingPoly boundingBox_; 345 /** 346 * 347 * 348 * <pre> 349 * The bounding box for the block. 350 * The vertices are in the order of top-left, top-right, bottom-right, 351 * bottom-left. When a rotation of the bounding box is detected the rotation 352 * is represented as around the top-left corner as defined when the text is 353 * read in the 'natural' orientation. 354 * For example: 355 * * when the text is horizontal it might look like: 356 * 0----1 357 * | | 358 * 3----2 359 * * when it's rotated 180 degrees around the top-left corner it becomes: 360 * 2----3 361 * | | 362 * 1----0 363 * and the vertex order will still be (0, 1, 2, 3). 364 * </pre> 365 * 366 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 367 * 368 * @return Whether the boundingBox field is set. 369 */ 370 @java.lang.Override hasBoundingBox()371 public boolean hasBoundingBox() { 372 return boundingBox_ != null; 373 } 374 /** 375 * 376 * 377 * <pre> 378 * The bounding box for the block. 379 * The vertices are in the order of top-left, top-right, bottom-right, 380 * bottom-left. When a rotation of the bounding box is detected the rotation 381 * is represented as around the top-left corner as defined when the text is 382 * read in the 'natural' orientation. 383 * For example: 384 * * when the text is horizontal it might look like: 385 * 0----1 386 * | | 387 * 3----2 388 * * when it's rotated 180 degrees around the top-left corner it becomes: 389 * 2----3 390 * | | 391 * 1----0 392 * and the vertex order will still be (0, 1, 2, 3). 393 * </pre> 394 * 395 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 396 * 397 * @return The boundingBox. 398 */ 399 @java.lang.Override getBoundingBox()400 public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { 401 return boundingBox_ == null 402 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 403 : boundingBox_; 404 } 405 /** 406 * 407 * 408 * <pre> 409 * The bounding box for the block. 410 * The vertices are in the order of top-left, top-right, bottom-right, 411 * bottom-left. When a rotation of the bounding box is detected the rotation 412 * is represented as around the top-left corner as defined when the text is 413 * read in the 'natural' orientation. 414 * For example: 415 * * when the text is horizontal it might look like: 416 * 0----1 417 * | | 418 * 3----2 419 * * when it's rotated 180 degrees around the top-left corner it becomes: 420 * 2----3 421 * | | 422 * 1----0 423 * and the vertex order will still be (0, 1, 2, 3). 424 * </pre> 425 * 426 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 427 */ 428 @java.lang.Override getBoundingBoxOrBuilder()429 public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder() { 430 return boundingBox_ == null 431 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 432 : boundingBox_; 433 } 434 435 public static final int PARAGRAPHS_FIELD_NUMBER = 3; 436 437 @SuppressWarnings("serial") 438 private java.util.List<com.google.cloud.vision.v1.Paragraph> paragraphs_; 439 /** 440 * 441 * 442 * <pre> 443 * List of paragraphs in this block (if this blocks is of type text). 444 * </pre> 445 * 446 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 447 */ 448 @java.lang.Override getParagraphsList()449 public java.util.List<com.google.cloud.vision.v1.Paragraph> getParagraphsList() { 450 return paragraphs_; 451 } 452 /** 453 * 454 * 455 * <pre> 456 * List of paragraphs in this block (if this blocks is of type text). 457 * </pre> 458 * 459 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 460 */ 461 @java.lang.Override 462 public java.util.List<? extends com.google.cloud.vision.v1.ParagraphOrBuilder> getParagraphsOrBuilderList()463 getParagraphsOrBuilderList() { 464 return paragraphs_; 465 } 466 /** 467 * 468 * 469 * <pre> 470 * List of paragraphs in this block (if this blocks is of type text). 471 * </pre> 472 * 473 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 474 */ 475 @java.lang.Override getParagraphsCount()476 public int getParagraphsCount() { 477 return paragraphs_.size(); 478 } 479 /** 480 * 481 * 482 * <pre> 483 * List of paragraphs in this block (if this blocks is of type text). 484 * </pre> 485 * 486 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 487 */ 488 @java.lang.Override getParagraphs(int index)489 public com.google.cloud.vision.v1.Paragraph getParagraphs(int index) { 490 return paragraphs_.get(index); 491 } 492 /** 493 * 494 * 495 * <pre> 496 * List of paragraphs in this block (if this blocks is of type text). 497 * </pre> 498 * 499 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 500 */ 501 @java.lang.Override getParagraphsOrBuilder(int index)502 public com.google.cloud.vision.v1.ParagraphOrBuilder getParagraphsOrBuilder(int index) { 503 return paragraphs_.get(index); 504 } 505 506 public static final int BLOCK_TYPE_FIELD_NUMBER = 4; 507 private int blockType_ = 0; 508 /** 509 * 510 * 511 * <pre> 512 * Detected block type (text, image etc) for this block. 513 * </pre> 514 * 515 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 516 * 517 * @return The enum numeric value on the wire for blockType. 518 */ 519 @java.lang.Override getBlockTypeValue()520 public int getBlockTypeValue() { 521 return blockType_; 522 } 523 /** 524 * 525 * 526 * <pre> 527 * Detected block type (text, image etc) for this block. 528 * </pre> 529 * 530 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 531 * 532 * @return The blockType. 533 */ 534 @java.lang.Override getBlockType()535 public com.google.cloud.vision.v1.Block.BlockType getBlockType() { 536 com.google.cloud.vision.v1.Block.BlockType result = 537 com.google.cloud.vision.v1.Block.BlockType.forNumber(blockType_); 538 return result == null ? com.google.cloud.vision.v1.Block.BlockType.UNRECOGNIZED : result; 539 } 540 541 public static final int CONFIDENCE_FIELD_NUMBER = 5; 542 private float confidence_ = 0F; 543 /** 544 * 545 * 546 * <pre> 547 * Confidence of the OCR results on the block. Range [0, 1]. 548 * </pre> 549 * 550 * <code>float confidence = 5;</code> 551 * 552 * @return The confidence. 553 */ 554 @java.lang.Override getConfidence()555 public float getConfidence() { 556 return confidence_; 557 } 558 559 private byte memoizedIsInitialized = -1; 560 561 @java.lang.Override isInitialized()562 public final boolean isInitialized() { 563 byte isInitialized = memoizedIsInitialized; 564 if (isInitialized == 1) return true; 565 if (isInitialized == 0) return false; 566 567 memoizedIsInitialized = 1; 568 return true; 569 } 570 571 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)572 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 573 if (property_ != null) { 574 output.writeMessage(1, getProperty()); 575 } 576 if (boundingBox_ != null) { 577 output.writeMessage(2, getBoundingBox()); 578 } 579 for (int i = 0; i < paragraphs_.size(); i++) { 580 output.writeMessage(3, paragraphs_.get(i)); 581 } 582 if (blockType_ != com.google.cloud.vision.v1.Block.BlockType.UNKNOWN.getNumber()) { 583 output.writeEnum(4, blockType_); 584 } 585 if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { 586 output.writeFloat(5, confidence_); 587 } 588 getUnknownFields().writeTo(output); 589 } 590 591 @java.lang.Override getSerializedSize()592 public int getSerializedSize() { 593 int size = memoizedSize; 594 if (size != -1) return size; 595 596 size = 0; 597 if (property_ != null) { 598 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProperty()); 599 } 600 if (boundingBox_ != null) { 601 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getBoundingBox()); 602 } 603 for (int i = 0; i < paragraphs_.size(); i++) { 604 size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, paragraphs_.get(i)); 605 } 606 if (blockType_ != com.google.cloud.vision.v1.Block.BlockType.UNKNOWN.getNumber()) { 607 size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, blockType_); 608 } 609 if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { 610 size += com.google.protobuf.CodedOutputStream.computeFloatSize(5, confidence_); 611 } 612 size += getUnknownFields().getSerializedSize(); 613 memoizedSize = size; 614 return size; 615 } 616 617 @java.lang.Override equals(final java.lang.Object obj)618 public boolean equals(final java.lang.Object obj) { 619 if (obj == this) { 620 return true; 621 } 622 if (!(obj instanceof com.google.cloud.vision.v1.Block)) { 623 return super.equals(obj); 624 } 625 com.google.cloud.vision.v1.Block other = (com.google.cloud.vision.v1.Block) obj; 626 627 if (hasProperty() != other.hasProperty()) return false; 628 if (hasProperty()) { 629 if (!getProperty().equals(other.getProperty())) return false; 630 } 631 if (hasBoundingBox() != other.hasBoundingBox()) return false; 632 if (hasBoundingBox()) { 633 if (!getBoundingBox().equals(other.getBoundingBox())) return false; 634 } 635 if (!getParagraphsList().equals(other.getParagraphsList())) return false; 636 if (blockType_ != other.blockType_) return false; 637 if (java.lang.Float.floatToIntBits(getConfidence()) 638 != java.lang.Float.floatToIntBits(other.getConfidence())) return false; 639 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 640 return true; 641 } 642 643 @java.lang.Override hashCode()644 public int hashCode() { 645 if (memoizedHashCode != 0) { 646 return memoizedHashCode; 647 } 648 int hash = 41; 649 hash = (19 * hash) + getDescriptor().hashCode(); 650 if (hasProperty()) { 651 hash = (37 * hash) + PROPERTY_FIELD_NUMBER; 652 hash = (53 * hash) + getProperty().hashCode(); 653 } 654 if (hasBoundingBox()) { 655 hash = (37 * hash) + BOUNDING_BOX_FIELD_NUMBER; 656 hash = (53 * hash) + getBoundingBox().hashCode(); 657 } 658 if (getParagraphsCount() > 0) { 659 hash = (37 * hash) + PARAGRAPHS_FIELD_NUMBER; 660 hash = (53 * hash) + getParagraphsList().hashCode(); 661 } 662 hash = (37 * hash) + BLOCK_TYPE_FIELD_NUMBER; 663 hash = (53 * hash) + blockType_; 664 hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; 665 hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); 666 hash = (29 * hash) + getUnknownFields().hashCode(); 667 memoizedHashCode = hash; 668 return hash; 669 } 670 parseFrom(java.nio.ByteBuffer data)671 public static com.google.cloud.vision.v1.Block parseFrom(java.nio.ByteBuffer data) 672 throws com.google.protobuf.InvalidProtocolBufferException { 673 return PARSER.parseFrom(data); 674 } 675 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)676 public static com.google.cloud.vision.v1.Block parseFrom( 677 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 678 throws com.google.protobuf.InvalidProtocolBufferException { 679 return PARSER.parseFrom(data, extensionRegistry); 680 } 681 parseFrom(com.google.protobuf.ByteString data)682 public static com.google.cloud.vision.v1.Block parseFrom(com.google.protobuf.ByteString data) 683 throws com.google.protobuf.InvalidProtocolBufferException { 684 return PARSER.parseFrom(data); 685 } 686 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)687 public static com.google.cloud.vision.v1.Block parseFrom( 688 com.google.protobuf.ByteString data, 689 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 690 throws com.google.protobuf.InvalidProtocolBufferException { 691 return PARSER.parseFrom(data, extensionRegistry); 692 } 693 parseFrom(byte[] data)694 public static com.google.cloud.vision.v1.Block parseFrom(byte[] data) 695 throws com.google.protobuf.InvalidProtocolBufferException { 696 return PARSER.parseFrom(data); 697 } 698 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)699 public static com.google.cloud.vision.v1.Block parseFrom( 700 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 701 throws com.google.protobuf.InvalidProtocolBufferException { 702 return PARSER.parseFrom(data, extensionRegistry); 703 } 704 parseFrom(java.io.InputStream input)705 public static com.google.cloud.vision.v1.Block parseFrom(java.io.InputStream input) 706 throws java.io.IOException { 707 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 708 } 709 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)710 public static com.google.cloud.vision.v1.Block parseFrom( 711 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 712 throws java.io.IOException { 713 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 714 PARSER, input, extensionRegistry); 715 } 716 parseDelimitedFrom(java.io.InputStream input)717 public static com.google.cloud.vision.v1.Block parseDelimitedFrom(java.io.InputStream input) 718 throws java.io.IOException { 719 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 720 } 721 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)722 public static com.google.cloud.vision.v1.Block parseDelimitedFrom( 723 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 724 throws java.io.IOException { 725 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 726 PARSER, input, extensionRegistry); 727 } 728 parseFrom( com.google.protobuf.CodedInputStream input)729 public static com.google.cloud.vision.v1.Block parseFrom( 730 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 731 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 732 } 733 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)734 public static com.google.cloud.vision.v1.Block parseFrom( 735 com.google.protobuf.CodedInputStream input, 736 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 737 throws java.io.IOException { 738 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 739 PARSER, input, extensionRegistry); 740 } 741 742 @java.lang.Override newBuilderForType()743 public Builder newBuilderForType() { 744 return newBuilder(); 745 } 746 newBuilder()747 public static Builder newBuilder() { 748 return DEFAULT_INSTANCE.toBuilder(); 749 } 750 newBuilder(com.google.cloud.vision.v1.Block prototype)751 public static Builder newBuilder(com.google.cloud.vision.v1.Block prototype) { 752 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 753 } 754 755 @java.lang.Override toBuilder()756 public Builder toBuilder() { 757 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 758 } 759 760 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)761 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 762 Builder builder = new Builder(parent); 763 return builder; 764 } 765 /** 766 * 767 * 768 * <pre> 769 * Logical element on the page. 770 * </pre> 771 * 772 * Protobuf type {@code google.cloud.vision.v1.Block} 773 */ 774 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 775 implements 776 // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.Block) 777 com.google.cloud.vision.v1.BlockOrBuilder { getDescriptor()778 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 779 return com.google.cloud.vision.v1.TextAnnotationProto 780 .internal_static_google_cloud_vision_v1_Block_descriptor; 781 } 782 783 @java.lang.Override 784 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()785 internalGetFieldAccessorTable() { 786 return com.google.cloud.vision.v1.TextAnnotationProto 787 .internal_static_google_cloud_vision_v1_Block_fieldAccessorTable 788 .ensureFieldAccessorsInitialized( 789 com.google.cloud.vision.v1.Block.class, 790 com.google.cloud.vision.v1.Block.Builder.class); 791 } 792 793 // Construct using com.google.cloud.vision.v1.Block.newBuilder() Builder()794 private Builder() {} 795 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)796 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 797 super(parent); 798 } 799 800 @java.lang.Override clear()801 public Builder clear() { 802 super.clear(); 803 bitField0_ = 0; 804 property_ = null; 805 if (propertyBuilder_ != null) { 806 propertyBuilder_.dispose(); 807 propertyBuilder_ = null; 808 } 809 boundingBox_ = null; 810 if (boundingBoxBuilder_ != null) { 811 boundingBoxBuilder_.dispose(); 812 boundingBoxBuilder_ = null; 813 } 814 if (paragraphsBuilder_ == null) { 815 paragraphs_ = java.util.Collections.emptyList(); 816 } else { 817 paragraphs_ = null; 818 paragraphsBuilder_.clear(); 819 } 820 bitField0_ = (bitField0_ & ~0x00000004); 821 blockType_ = 0; 822 confidence_ = 0F; 823 return this; 824 } 825 826 @java.lang.Override getDescriptorForType()827 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 828 return com.google.cloud.vision.v1.TextAnnotationProto 829 .internal_static_google_cloud_vision_v1_Block_descriptor; 830 } 831 832 @java.lang.Override getDefaultInstanceForType()833 public com.google.cloud.vision.v1.Block getDefaultInstanceForType() { 834 return com.google.cloud.vision.v1.Block.getDefaultInstance(); 835 } 836 837 @java.lang.Override build()838 public com.google.cloud.vision.v1.Block build() { 839 com.google.cloud.vision.v1.Block result = buildPartial(); 840 if (!result.isInitialized()) { 841 throw newUninitializedMessageException(result); 842 } 843 return result; 844 } 845 846 @java.lang.Override buildPartial()847 public com.google.cloud.vision.v1.Block buildPartial() { 848 com.google.cloud.vision.v1.Block result = new com.google.cloud.vision.v1.Block(this); 849 buildPartialRepeatedFields(result); 850 if (bitField0_ != 0) { 851 buildPartial0(result); 852 } 853 onBuilt(); 854 return result; 855 } 856 buildPartialRepeatedFields(com.google.cloud.vision.v1.Block result)857 private void buildPartialRepeatedFields(com.google.cloud.vision.v1.Block result) { 858 if (paragraphsBuilder_ == null) { 859 if (((bitField0_ & 0x00000004) != 0)) { 860 paragraphs_ = java.util.Collections.unmodifiableList(paragraphs_); 861 bitField0_ = (bitField0_ & ~0x00000004); 862 } 863 result.paragraphs_ = paragraphs_; 864 } else { 865 result.paragraphs_ = paragraphsBuilder_.build(); 866 } 867 } 868 buildPartial0(com.google.cloud.vision.v1.Block result)869 private void buildPartial0(com.google.cloud.vision.v1.Block result) { 870 int from_bitField0_ = bitField0_; 871 if (((from_bitField0_ & 0x00000001) != 0)) { 872 result.property_ = propertyBuilder_ == null ? property_ : propertyBuilder_.build(); 873 } 874 if (((from_bitField0_ & 0x00000002) != 0)) { 875 result.boundingBox_ = 876 boundingBoxBuilder_ == null ? boundingBox_ : boundingBoxBuilder_.build(); 877 } 878 if (((from_bitField0_ & 0x00000008) != 0)) { 879 result.blockType_ = blockType_; 880 } 881 if (((from_bitField0_ & 0x00000010) != 0)) { 882 result.confidence_ = confidence_; 883 } 884 } 885 886 @java.lang.Override clone()887 public Builder clone() { 888 return super.clone(); 889 } 890 891 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)892 public Builder setField( 893 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 894 return super.setField(field, value); 895 } 896 897 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)898 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 899 return super.clearField(field); 900 } 901 902 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)903 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 904 return super.clearOneof(oneof); 905 } 906 907 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)908 public Builder setRepeatedField( 909 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 910 return super.setRepeatedField(field, index, value); 911 } 912 913 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)914 public Builder addRepeatedField( 915 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 916 return super.addRepeatedField(field, value); 917 } 918 919 @java.lang.Override mergeFrom(com.google.protobuf.Message other)920 public Builder mergeFrom(com.google.protobuf.Message other) { 921 if (other instanceof com.google.cloud.vision.v1.Block) { 922 return mergeFrom((com.google.cloud.vision.v1.Block) other); 923 } else { 924 super.mergeFrom(other); 925 return this; 926 } 927 } 928 mergeFrom(com.google.cloud.vision.v1.Block other)929 public Builder mergeFrom(com.google.cloud.vision.v1.Block other) { 930 if (other == com.google.cloud.vision.v1.Block.getDefaultInstance()) return this; 931 if (other.hasProperty()) { 932 mergeProperty(other.getProperty()); 933 } 934 if (other.hasBoundingBox()) { 935 mergeBoundingBox(other.getBoundingBox()); 936 } 937 if (paragraphsBuilder_ == null) { 938 if (!other.paragraphs_.isEmpty()) { 939 if (paragraphs_.isEmpty()) { 940 paragraphs_ = other.paragraphs_; 941 bitField0_ = (bitField0_ & ~0x00000004); 942 } else { 943 ensureParagraphsIsMutable(); 944 paragraphs_.addAll(other.paragraphs_); 945 } 946 onChanged(); 947 } 948 } else { 949 if (!other.paragraphs_.isEmpty()) { 950 if (paragraphsBuilder_.isEmpty()) { 951 paragraphsBuilder_.dispose(); 952 paragraphsBuilder_ = null; 953 paragraphs_ = other.paragraphs_; 954 bitField0_ = (bitField0_ & ~0x00000004); 955 paragraphsBuilder_ = 956 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 957 ? getParagraphsFieldBuilder() 958 : null; 959 } else { 960 paragraphsBuilder_.addAllMessages(other.paragraphs_); 961 } 962 } 963 } 964 if (other.blockType_ != 0) { 965 setBlockTypeValue(other.getBlockTypeValue()); 966 } 967 if (other.getConfidence() != 0F) { 968 setConfidence(other.getConfidence()); 969 } 970 this.mergeUnknownFields(other.getUnknownFields()); 971 onChanged(); 972 return this; 973 } 974 975 @java.lang.Override isInitialized()976 public final boolean isInitialized() { 977 return true; 978 } 979 980 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)981 public Builder mergeFrom( 982 com.google.protobuf.CodedInputStream input, 983 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 984 throws java.io.IOException { 985 if (extensionRegistry == null) { 986 throw new java.lang.NullPointerException(); 987 } 988 try { 989 boolean done = false; 990 while (!done) { 991 int tag = input.readTag(); 992 switch (tag) { 993 case 0: 994 done = true; 995 break; 996 case 10: 997 { 998 input.readMessage(getPropertyFieldBuilder().getBuilder(), extensionRegistry); 999 bitField0_ |= 0x00000001; 1000 break; 1001 } // case 10 1002 case 18: 1003 { 1004 input.readMessage(getBoundingBoxFieldBuilder().getBuilder(), extensionRegistry); 1005 bitField0_ |= 0x00000002; 1006 break; 1007 } // case 18 1008 case 26: 1009 { 1010 com.google.cloud.vision.v1.Paragraph m = 1011 input.readMessage( 1012 com.google.cloud.vision.v1.Paragraph.parser(), extensionRegistry); 1013 if (paragraphsBuilder_ == null) { 1014 ensureParagraphsIsMutable(); 1015 paragraphs_.add(m); 1016 } else { 1017 paragraphsBuilder_.addMessage(m); 1018 } 1019 break; 1020 } // case 26 1021 case 32: 1022 { 1023 blockType_ = input.readEnum(); 1024 bitField0_ |= 0x00000008; 1025 break; 1026 } // case 32 1027 case 45: 1028 { 1029 confidence_ = input.readFloat(); 1030 bitField0_ |= 0x00000010; 1031 break; 1032 } // case 45 1033 default: 1034 { 1035 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1036 done = true; // was an endgroup tag 1037 } 1038 break; 1039 } // default: 1040 } // switch (tag) 1041 } // while (!done) 1042 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1043 throw e.unwrapIOException(); 1044 } finally { 1045 onChanged(); 1046 } // finally 1047 return this; 1048 } 1049 1050 private int bitField0_; 1051 1052 private com.google.cloud.vision.v1.TextAnnotation.TextProperty property_; 1053 private com.google.protobuf.SingleFieldBuilderV3< 1054 com.google.cloud.vision.v1.TextAnnotation.TextProperty, 1055 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder, 1056 com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder> 1057 propertyBuilder_; 1058 /** 1059 * 1060 * 1061 * <pre> 1062 * Additional information detected for the block. 1063 * </pre> 1064 * 1065 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1066 * 1067 * @return Whether the property field is set. 1068 */ hasProperty()1069 public boolean hasProperty() { 1070 return ((bitField0_ & 0x00000001) != 0); 1071 } 1072 /** 1073 * 1074 * 1075 * <pre> 1076 * Additional information detected for the block. 1077 * </pre> 1078 * 1079 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1080 * 1081 * @return The property. 1082 */ getProperty()1083 public com.google.cloud.vision.v1.TextAnnotation.TextProperty getProperty() { 1084 if (propertyBuilder_ == null) { 1085 return property_ == null 1086 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 1087 : property_; 1088 } else { 1089 return propertyBuilder_.getMessage(); 1090 } 1091 } 1092 /** 1093 * 1094 * 1095 * <pre> 1096 * Additional information detected for the block. 1097 * </pre> 1098 * 1099 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1100 */ setProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value)1101 public Builder setProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value) { 1102 if (propertyBuilder_ == null) { 1103 if (value == null) { 1104 throw new NullPointerException(); 1105 } 1106 property_ = value; 1107 } else { 1108 propertyBuilder_.setMessage(value); 1109 } 1110 bitField0_ |= 0x00000001; 1111 onChanged(); 1112 return this; 1113 } 1114 /** 1115 * 1116 * 1117 * <pre> 1118 * Additional information detected for the block. 1119 * </pre> 1120 * 1121 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1122 */ setProperty( com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder builderForValue)1123 public Builder setProperty( 1124 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder builderForValue) { 1125 if (propertyBuilder_ == null) { 1126 property_ = builderForValue.build(); 1127 } else { 1128 propertyBuilder_.setMessage(builderForValue.build()); 1129 } 1130 bitField0_ |= 0x00000001; 1131 onChanged(); 1132 return this; 1133 } 1134 /** 1135 * 1136 * 1137 * <pre> 1138 * Additional information detected for the block. 1139 * </pre> 1140 * 1141 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1142 */ mergeProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value)1143 public Builder mergeProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value) { 1144 if (propertyBuilder_ == null) { 1145 if (((bitField0_ & 0x00000001) != 0) 1146 && property_ != null 1147 && property_ 1148 != com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance()) { 1149 getPropertyBuilder().mergeFrom(value); 1150 } else { 1151 property_ = value; 1152 } 1153 } else { 1154 propertyBuilder_.mergeFrom(value); 1155 } 1156 bitField0_ |= 0x00000001; 1157 onChanged(); 1158 return this; 1159 } 1160 /** 1161 * 1162 * 1163 * <pre> 1164 * Additional information detected for the block. 1165 * </pre> 1166 * 1167 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1168 */ clearProperty()1169 public Builder clearProperty() { 1170 bitField0_ = (bitField0_ & ~0x00000001); 1171 property_ = null; 1172 if (propertyBuilder_ != null) { 1173 propertyBuilder_.dispose(); 1174 propertyBuilder_ = null; 1175 } 1176 onChanged(); 1177 return this; 1178 } 1179 /** 1180 * 1181 * 1182 * <pre> 1183 * Additional information detected for the block. 1184 * </pre> 1185 * 1186 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1187 */ getPropertyBuilder()1188 public com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder getPropertyBuilder() { 1189 bitField0_ |= 0x00000001; 1190 onChanged(); 1191 return getPropertyFieldBuilder().getBuilder(); 1192 } 1193 /** 1194 * 1195 * 1196 * <pre> 1197 * Additional information detected for the block. 1198 * </pre> 1199 * 1200 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1201 */ getPropertyOrBuilder()1202 public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getPropertyOrBuilder() { 1203 if (propertyBuilder_ != null) { 1204 return propertyBuilder_.getMessageOrBuilder(); 1205 } else { 1206 return property_ == null 1207 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 1208 : property_; 1209 } 1210 } 1211 /** 1212 * 1213 * 1214 * <pre> 1215 * Additional information detected for the block. 1216 * </pre> 1217 * 1218 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 1219 */ 1220 private com.google.protobuf.SingleFieldBuilderV3< 1221 com.google.cloud.vision.v1.TextAnnotation.TextProperty, 1222 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder, 1223 com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder> getPropertyFieldBuilder()1224 getPropertyFieldBuilder() { 1225 if (propertyBuilder_ == null) { 1226 propertyBuilder_ = 1227 new com.google.protobuf.SingleFieldBuilderV3< 1228 com.google.cloud.vision.v1.TextAnnotation.TextProperty, 1229 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder, 1230 com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder>( 1231 getProperty(), getParentForChildren(), isClean()); 1232 property_ = null; 1233 } 1234 return propertyBuilder_; 1235 } 1236 1237 private com.google.cloud.vision.v1.BoundingPoly boundingBox_; 1238 private com.google.protobuf.SingleFieldBuilderV3< 1239 com.google.cloud.vision.v1.BoundingPoly, 1240 com.google.cloud.vision.v1.BoundingPoly.Builder, 1241 com.google.cloud.vision.v1.BoundingPolyOrBuilder> 1242 boundingBoxBuilder_; 1243 /** 1244 * 1245 * 1246 * <pre> 1247 * The bounding box for the block. 1248 * The vertices are in the order of top-left, top-right, bottom-right, 1249 * bottom-left. When a rotation of the bounding box is detected the rotation 1250 * is represented as around the top-left corner as defined when the text is 1251 * read in the 'natural' orientation. 1252 * For example: 1253 * * when the text is horizontal it might look like: 1254 * 0----1 1255 * | | 1256 * 3----2 1257 * * when it's rotated 180 degrees around the top-left corner it becomes: 1258 * 2----3 1259 * | | 1260 * 1----0 1261 * and the vertex order will still be (0, 1, 2, 3). 1262 * </pre> 1263 * 1264 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1265 * 1266 * @return Whether the boundingBox field is set. 1267 */ hasBoundingBox()1268 public boolean hasBoundingBox() { 1269 return ((bitField0_ & 0x00000002) != 0); 1270 } 1271 /** 1272 * 1273 * 1274 * <pre> 1275 * The bounding box for the block. 1276 * The vertices are in the order of top-left, top-right, bottom-right, 1277 * bottom-left. When a rotation of the bounding box is detected the rotation 1278 * is represented as around the top-left corner as defined when the text is 1279 * read in the 'natural' orientation. 1280 * For example: 1281 * * when the text is horizontal it might look like: 1282 * 0----1 1283 * | | 1284 * 3----2 1285 * * when it's rotated 180 degrees around the top-left corner it becomes: 1286 * 2----3 1287 * | | 1288 * 1----0 1289 * and the vertex order will still be (0, 1, 2, 3). 1290 * </pre> 1291 * 1292 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1293 * 1294 * @return The boundingBox. 1295 */ getBoundingBox()1296 public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { 1297 if (boundingBoxBuilder_ == null) { 1298 return boundingBox_ == null 1299 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 1300 : boundingBox_; 1301 } else { 1302 return boundingBoxBuilder_.getMessage(); 1303 } 1304 } 1305 /** 1306 * 1307 * 1308 * <pre> 1309 * The bounding box for the block. 1310 * The vertices are in the order of top-left, top-right, bottom-right, 1311 * bottom-left. When a rotation of the bounding box is detected the rotation 1312 * is represented as around the top-left corner as defined when the text is 1313 * read in the 'natural' orientation. 1314 * For example: 1315 * * when the text is horizontal it might look like: 1316 * 0----1 1317 * | | 1318 * 3----2 1319 * * when it's rotated 180 degrees around the top-left corner it becomes: 1320 * 2----3 1321 * | | 1322 * 1----0 1323 * and the vertex order will still be (0, 1, 2, 3). 1324 * </pre> 1325 * 1326 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1327 */ setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value)1328 public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { 1329 if (boundingBoxBuilder_ == null) { 1330 if (value == null) { 1331 throw new NullPointerException(); 1332 } 1333 boundingBox_ = value; 1334 } else { 1335 boundingBoxBuilder_.setMessage(value); 1336 } 1337 bitField0_ |= 0x00000002; 1338 onChanged(); 1339 return this; 1340 } 1341 /** 1342 * 1343 * 1344 * <pre> 1345 * The bounding box for the block. 1346 * The vertices are in the order of top-left, top-right, bottom-right, 1347 * bottom-left. When a rotation of the bounding box is detected the rotation 1348 * is represented as around the top-left corner as defined when the text is 1349 * read in the 'natural' orientation. 1350 * For example: 1351 * * when the text is horizontal it might look like: 1352 * 0----1 1353 * | | 1354 * 3----2 1355 * * when it's rotated 180 degrees around the top-left corner it becomes: 1356 * 2----3 1357 * | | 1358 * 1----0 1359 * and the vertex order will still be (0, 1, 2, 3). 1360 * </pre> 1361 * 1362 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1363 */ setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder builderForValue)1364 public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder builderForValue) { 1365 if (boundingBoxBuilder_ == null) { 1366 boundingBox_ = builderForValue.build(); 1367 } else { 1368 boundingBoxBuilder_.setMessage(builderForValue.build()); 1369 } 1370 bitField0_ |= 0x00000002; 1371 onChanged(); 1372 return this; 1373 } 1374 /** 1375 * 1376 * 1377 * <pre> 1378 * The bounding box for the block. 1379 * The vertices are in the order of top-left, top-right, bottom-right, 1380 * bottom-left. When a rotation of the bounding box is detected the rotation 1381 * is represented as around the top-left corner as defined when the text is 1382 * read in the 'natural' orientation. 1383 * For example: 1384 * * when the text is horizontal it might look like: 1385 * 0----1 1386 * | | 1387 * 3----2 1388 * * when it's rotated 180 degrees around the top-left corner it becomes: 1389 * 2----3 1390 * | | 1391 * 1----0 1392 * and the vertex order will still be (0, 1, 2, 3). 1393 * </pre> 1394 * 1395 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1396 */ mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value)1397 public Builder mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { 1398 if (boundingBoxBuilder_ == null) { 1399 if (((bitField0_ & 0x00000002) != 0) 1400 && boundingBox_ != null 1401 && boundingBox_ != com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance()) { 1402 getBoundingBoxBuilder().mergeFrom(value); 1403 } else { 1404 boundingBox_ = value; 1405 } 1406 } else { 1407 boundingBoxBuilder_.mergeFrom(value); 1408 } 1409 bitField0_ |= 0x00000002; 1410 onChanged(); 1411 return this; 1412 } 1413 /** 1414 * 1415 * 1416 * <pre> 1417 * The bounding box for the block. 1418 * The vertices are in the order of top-left, top-right, bottom-right, 1419 * bottom-left. When a rotation of the bounding box is detected the rotation 1420 * is represented as around the top-left corner as defined when the text is 1421 * read in the 'natural' orientation. 1422 * For example: 1423 * * when the text is horizontal it might look like: 1424 * 0----1 1425 * | | 1426 * 3----2 1427 * * when it's rotated 180 degrees around the top-left corner it becomes: 1428 * 2----3 1429 * | | 1430 * 1----0 1431 * and the vertex order will still be (0, 1, 2, 3). 1432 * </pre> 1433 * 1434 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1435 */ clearBoundingBox()1436 public Builder clearBoundingBox() { 1437 bitField0_ = (bitField0_ & ~0x00000002); 1438 boundingBox_ = null; 1439 if (boundingBoxBuilder_ != null) { 1440 boundingBoxBuilder_.dispose(); 1441 boundingBoxBuilder_ = null; 1442 } 1443 onChanged(); 1444 return this; 1445 } 1446 /** 1447 * 1448 * 1449 * <pre> 1450 * The bounding box for the block. 1451 * The vertices are in the order of top-left, top-right, bottom-right, 1452 * bottom-left. When a rotation of the bounding box is detected the rotation 1453 * is represented as around the top-left corner as defined when the text is 1454 * read in the 'natural' orientation. 1455 * For example: 1456 * * when the text is horizontal it might look like: 1457 * 0----1 1458 * | | 1459 * 3----2 1460 * * when it's rotated 180 degrees around the top-left corner it becomes: 1461 * 2----3 1462 * | | 1463 * 1----0 1464 * and the vertex order will still be (0, 1, 2, 3). 1465 * </pre> 1466 * 1467 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1468 */ getBoundingBoxBuilder()1469 public com.google.cloud.vision.v1.BoundingPoly.Builder getBoundingBoxBuilder() { 1470 bitField0_ |= 0x00000002; 1471 onChanged(); 1472 return getBoundingBoxFieldBuilder().getBuilder(); 1473 } 1474 /** 1475 * 1476 * 1477 * <pre> 1478 * The bounding box for the block. 1479 * The vertices are in the order of top-left, top-right, bottom-right, 1480 * bottom-left. When a rotation of the bounding box is detected the rotation 1481 * is represented as around the top-left corner as defined when the text is 1482 * read in the 'natural' orientation. 1483 * For example: 1484 * * when the text is horizontal it might look like: 1485 * 0----1 1486 * | | 1487 * 3----2 1488 * * when it's rotated 180 degrees around the top-left corner it becomes: 1489 * 2----3 1490 * | | 1491 * 1----0 1492 * and the vertex order will still be (0, 1, 2, 3). 1493 * </pre> 1494 * 1495 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1496 */ getBoundingBoxOrBuilder()1497 public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder() { 1498 if (boundingBoxBuilder_ != null) { 1499 return boundingBoxBuilder_.getMessageOrBuilder(); 1500 } else { 1501 return boundingBox_ == null 1502 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 1503 : boundingBox_; 1504 } 1505 } 1506 /** 1507 * 1508 * 1509 * <pre> 1510 * The bounding box for the block. 1511 * The vertices are in the order of top-left, top-right, bottom-right, 1512 * bottom-left. When a rotation of the bounding box is detected the rotation 1513 * is represented as around the top-left corner as defined when the text is 1514 * read in the 'natural' orientation. 1515 * For example: 1516 * * when the text is horizontal it might look like: 1517 * 0----1 1518 * | | 1519 * 3----2 1520 * * when it's rotated 180 degrees around the top-left corner it becomes: 1521 * 2----3 1522 * | | 1523 * 1----0 1524 * and the vertex order will still be (0, 1, 2, 3). 1525 * </pre> 1526 * 1527 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1528 */ 1529 private com.google.protobuf.SingleFieldBuilderV3< 1530 com.google.cloud.vision.v1.BoundingPoly, 1531 com.google.cloud.vision.v1.BoundingPoly.Builder, 1532 com.google.cloud.vision.v1.BoundingPolyOrBuilder> getBoundingBoxFieldBuilder()1533 getBoundingBoxFieldBuilder() { 1534 if (boundingBoxBuilder_ == null) { 1535 boundingBoxBuilder_ = 1536 new com.google.protobuf.SingleFieldBuilderV3< 1537 com.google.cloud.vision.v1.BoundingPoly, 1538 com.google.cloud.vision.v1.BoundingPoly.Builder, 1539 com.google.cloud.vision.v1.BoundingPolyOrBuilder>( 1540 getBoundingBox(), getParentForChildren(), isClean()); 1541 boundingBox_ = null; 1542 } 1543 return boundingBoxBuilder_; 1544 } 1545 1546 private java.util.List<com.google.cloud.vision.v1.Paragraph> paragraphs_ = 1547 java.util.Collections.emptyList(); 1548 ensureParagraphsIsMutable()1549 private void ensureParagraphsIsMutable() { 1550 if (!((bitField0_ & 0x00000004) != 0)) { 1551 paragraphs_ = new java.util.ArrayList<com.google.cloud.vision.v1.Paragraph>(paragraphs_); 1552 bitField0_ |= 0x00000004; 1553 } 1554 } 1555 1556 private com.google.protobuf.RepeatedFieldBuilderV3< 1557 com.google.cloud.vision.v1.Paragraph, 1558 com.google.cloud.vision.v1.Paragraph.Builder, 1559 com.google.cloud.vision.v1.ParagraphOrBuilder> 1560 paragraphsBuilder_; 1561 1562 /** 1563 * 1564 * 1565 * <pre> 1566 * List of paragraphs in this block (if this blocks is of type text). 1567 * </pre> 1568 * 1569 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1570 */ getParagraphsList()1571 public java.util.List<com.google.cloud.vision.v1.Paragraph> getParagraphsList() { 1572 if (paragraphsBuilder_ == null) { 1573 return java.util.Collections.unmodifiableList(paragraphs_); 1574 } else { 1575 return paragraphsBuilder_.getMessageList(); 1576 } 1577 } 1578 /** 1579 * 1580 * 1581 * <pre> 1582 * List of paragraphs in this block (if this blocks is of type text). 1583 * </pre> 1584 * 1585 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1586 */ getParagraphsCount()1587 public int getParagraphsCount() { 1588 if (paragraphsBuilder_ == null) { 1589 return paragraphs_.size(); 1590 } else { 1591 return paragraphsBuilder_.getCount(); 1592 } 1593 } 1594 /** 1595 * 1596 * 1597 * <pre> 1598 * List of paragraphs in this block (if this blocks is of type text). 1599 * </pre> 1600 * 1601 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1602 */ getParagraphs(int index)1603 public com.google.cloud.vision.v1.Paragraph getParagraphs(int index) { 1604 if (paragraphsBuilder_ == null) { 1605 return paragraphs_.get(index); 1606 } else { 1607 return paragraphsBuilder_.getMessage(index); 1608 } 1609 } 1610 /** 1611 * 1612 * 1613 * <pre> 1614 * List of paragraphs in this block (if this blocks is of type text). 1615 * </pre> 1616 * 1617 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1618 */ setParagraphs(int index, com.google.cloud.vision.v1.Paragraph value)1619 public Builder setParagraphs(int index, com.google.cloud.vision.v1.Paragraph value) { 1620 if (paragraphsBuilder_ == null) { 1621 if (value == null) { 1622 throw new NullPointerException(); 1623 } 1624 ensureParagraphsIsMutable(); 1625 paragraphs_.set(index, value); 1626 onChanged(); 1627 } else { 1628 paragraphsBuilder_.setMessage(index, value); 1629 } 1630 return this; 1631 } 1632 /** 1633 * 1634 * 1635 * <pre> 1636 * List of paragraphs in this block (if this blocks is of type text). 1637 * </pre> 1638 * 1639 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1640 */ setParagraphs( int index, com.google.cloud.vision.v1.Paragraph.Builder builderForValue)1641 public Builder setParagraphs( 1642 int index, com.google.cloud.vision.v1.Paragraph.Builder builderForValue) { 1643 if (paragraphsBuilder_ == null) { 1644 ensureParagraphsIsMutable(); 1645 paragraphs_.set(index, builderForValue.build()); 1646 onChanged(); 1647 } else { 1648 paragraphsBuilder_.setMessage(index, builderForValue.build()); 1649 } 1650 return this; 1651 } 1652 /** 1653 * 1654 * 1655 * <pre> 1656 * List of paragraphs in this block (if this blocks is of type text). 1657 * </pre> 1658 * 1659 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1660 */ addParagraphs(com.google.cloud.vision.v1.Paragraph value)1661 public Builder addParagraphs(com.google.cloud.vision.v1.Paragraph value) { 1662 if (paragraphsBuilder_ == null) { 1663 if (value == null) { 1664 throw new NullPointerException(); 1665 } 1666 ensureParagraphsIsMutable(); 1667 paragraphs_.add(value); 1668 onChanged(); 1669 } else { 1670 paragraphsBuilder_.addMessage(value); 1671 } 1672 return this; 1673 } 1674 /** 1675 * 1676 * 1677 * <pre> 1678 * List of paragraphs in this block (if this blocks is of type text). 1679 * </pre> 1680 * 1681 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1682 */ addParagraphs(int index, com.google.cloud.vision.v1.Paragraph value)1683 public Builder addParagraphs(int index, com.google.cloud.vision.v1.Paragraph value) { 1684 if (paragraphsBuilder_ == null) { 1685 if (value == null) { 1686 throw new NullPointerException(); 1687 } 1688 ensureParagraphsIsMutable(); 1689 paragraphs_.add(index, value); 1690 onChanged(); 1691 } else { 1692 paragraphsBuilder_.addMessage(index, value); 1693 } 1694 return this; 1695 } 1696 /** 1697 * 1698 * 1699 * <pre> 1700 * List of paragraphs in this block (if this blocks is of type text). 1701 * </pre> 1702 * 1703 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1704 */ addParagraphs(com.google.cloud.vision.v1.Paragraph.Builder builderForValue)1705 public Builder addParagraphs(com.google.cloud.vision.v1.Paragraph.Builder builderForValue) { 1706 if (paragraphsBuilder_ == null) { 1707 ensureParagraphsIsMutable(); 1708 paragraphs_.add(builderForValue.build()); 1709 onChanged(); 1710 } else { 1711 paragraphsBuilder_.addMessage(builderForValue.build()); 1712 } 1713 return this; 1714 } 1715 /** 1716 * 1717 * 1718 * <pre> 1719 * List of paragraphs in this block (if this blocks is of type text). 1720 * </pre> 1721 * 1722 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1723 */ addParagraphs( int index, com.google.cloud.vision.v1.Paragraph.Builder builderForValue)1724 public Builder addParagraphs( 1725 int index, com.google.cloud.vision.v1.Paragraph.Builder builderForValue) { 1726 if (paragraphsBuilder_ == null) { 1727 ensureParagraphsIsMutable(); 1728 paragraphs_.add(index, builderForValue.build()); 1729 onChanged(); 1730 } else { 1731 paragraphsBuilder_.addMessage(index, builderForValue.build()); 1732 } 1733 return this; 1734 } 1735 /** 1736 * 1737 * 1738 * <pre> 1739 * List of paragraphs in this block (if this blocks is of type text). 1740 * </pre> 1741 * 1742 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1743 */ addAllParagraphs( java.lang.Iterable<? extends com.google.cloud.vision.v1.Paragraph> values)1744 public Builder addAllParagraphs( 1745 java.lang.Iterable<? extends com.google.cloud.vision.v1.Paragraph> values) { 1746 if (paragraphsBuilder_ == null) { 1747 ensureParagraphsIsMutable(); 1748 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, paragraphs_); 1749 onChanged(); 1750 } else { 1751 paragraphsBuilder_.addAllMessages(values); 1752 } 1753 return this; 1754 } 1755 /** 1756 * 1757 * 1758 * <pre> 1759 * List of paragraphs in this block (if this blocks is of type text). 1760 * </pre> 1761 * 1762 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1763 */ clearParagraphs()1764 public Builder clearParagraphs() { 1765 if (paragraphsBuilder_ == null) { 1766 paragraphs_ = java.util.Collections.emptyList(); 1767 bitField0_ = (bitField0_ & ~0x00000004); 1768 onChanged(); 1769 } else { 1770 paragraphsBuilder_.clear(); 1771 } 1772 return this; 1773 } 1774 /** 1775 * 1776 * 1777 * <pre> 1778 * List of paragraphs in this block (if this blocks is of type text). 1779 * </pre> 1780 * 1781 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1782 */ removeParagraphs(int index)1783 public Builder removeParagraphs(int index) { 1784 if (paragraphsBuilder_ == null) { 1785 ensureParagraphsIsMutable(); 1786 paragraphs_.remove(index); 1787 onChanged(); 1788 } else { 1789 paragraphsBuilder_.remove(index); 1790 } 1791 return this; 1792 } 1793 /** 1794 * 1795 * 1796 * <pre> 1797 * List of paragraphs in this block (if this blocks is of type text). 1798 * </pre> 1799 * 1800 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1801 */ getParagraphsBuilder(int index)1802 public com.google.cloud.vision.v1.Paragraph.Builder getParagraphsBuilder(int index) { 1803 return getParagraphsFieldBuilder().getBuilder(index); 1804 } 1805 /** 1806 * 1807 * 1808 * <pre> 1809 * List of paragraphs in this block (if this blocks is of type text). 1810 * </pre> 1811 * 1812 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1813 */ getParagraphsOrBuilder(int index)1814 public com.google.cloud.vision.v1.ParagraphOrBuilder getParagraphsOrBuilder(int index) { 1815 if (paragraphsBuilder_ == null) { 1816 return paragraphs_.get(index); 1817 } else { 1818 return paragraphsBuilder_.getMessageOrBuilder(index); 1819 } 1820 } 1821 /** 1822 * 1823 * 1824 * <pre> 1825 * List of paragraphs in this block (if this blocks is of type text). 1826 * </pre> 1827 * 1828 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1829 */ 1830 public java.util.List<? extends com.google.cloud.vision.v1.ParagraphOrBuilder> getParagraphsOrBuilderList()1831 getParagraphsOrBuilderList() { 1832 if (paragraphsBuilder_ != null) { 1833 return paragraphsBuilder_.getMessageOrBuilderList(); 1834 } else { 1835 return java.util.Collections.unmodifiableList(paragraphs_); 1836 } 1837 } 1838 /** 1839 * 1840 * 1841 * <pre> 1842 * List of paragraphs in this block (if this blocks is of type text). 1843 * </pre> 1844 * 1845 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1846 */ addParagraphsBuilder()1847 public com.google.cloud.vision.v1.Paragraph.Builder addParagraphsBuilder() { 1848 return getParagraphsFieldBuilder() 1849 .addBuilder(com.google.cloud.vision.v1.Paragraph.getDefaultInstance()); 1850 } 1851 /** 1852 * 1853 * 1854 * <pre> 1855 * List of paragraphs in this block (if this blocks is of type text). 1856 * </pre> 1857 * 1858 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1859 */ addParagraphsBuilder(int index)1860 public com.google.cloud.vision.v1.Paragraph.Builder addParagraphsBuilder(int index) { 1861 return getParagraphsFieldBuilder() 1862 .addBuilder(index, com.google.cloud.vision.v1.Paragraph.getDefaultInstance()); 1863 } 1864 /** 1865 * 1866 * 1867 * <pre> 1868 * List of paragraphs in this block (if this blocks is of type text). 1869 * </pre> 1870 * 1871 * <code>repeated .google.cloud.vision.v1.Paragraph paragraphs = 3;</code> 1872 */ getParagraphsBuilderList()1873 public java.util.List<com.google.cloud.vision.v1.Paragraph.Builder> getParagraphsBuilderList() { 1874 return getParagraphsFieldBuilder().getBuilderList(); 1875 } 1876 1877 private com.google.protobuf.RepeatedFieldBuilderV3< 1878 com.google.cloud.vision.v1.Paragraph, 1879 com.google.cloud.vision.v1.Paragraph.Builder, 1880 com.google.cloud.vision.v1.ParagraphOrBuilder> getParagraphsFieldBuilder()1881 getParagraphsFieldBuilder() { 1882 if (paragraphsBuilder_ == null) { 1883 paragraphsBuilder_ = 1884 new com.google.protobuf.RepeatedFieldBuilderV3< 1885 com.google.cloud.vision.v1.Paragraph, 1886 com.google.cloud.vision.v1.Paragraph.Builder, 1887 com.google.cloud.vision.v1.ParagraphOrBuilder>( 1888 paragraphs_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); 1889 paragraphs_ = null; 1890 } 1891 return paragraphsBuilder_; 1892 } 1893 1894 private int blockType_ = 0; 1895 /** 1896 * 1897 * 1898 * <pre> 1899 * Detected block type (text, image etc) for this block. 1900 * </pre> 1901 * 1902 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 1903 * 1904 * @return The enum numeric value on the wire for blockType. 1905 */ 1906 @java.lang.Override getBlockTypeValue()1907 public int getBlockTypeValue() { 1908 return blockType_; 1909 } 1910 /** 1911 * 1912 * 1913 * <pre> 1914 * Detected block type (text, image etc) for this block. 1915 * </pre> 1916 * 1917 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 1918 * 1919 * @param value The enum numeric value on the wire for blockType to set. 1920 * @return This builder for chaining. 1921 */ setBlockTypeValue(int value)1922 public Builder setBlockTypeValue(int value) { 1923 blockType_ = value; 1924 bitField0_ |= 0x00000008; 1925 onChanged(); 1926 return this; 1927 } 1928 /** 1929 * 1930 * 1931 * <pre> 1932 * Detected block type (text, image etc) for this block. 1933 * </pre> 1934 * 1935 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 1936 * 1937 * @return The blockType. 1938 */ 1939 @java.lang.Override getBlockType()1940 public com.google.cloud.vision.v1.Block.BlockType getBlockType() { 1941 com.google.cloud.vision.v1.Block.BlockType result = 1942 com.google.cloud.vision.v1.Block.BlockType.forNumber(blockType_); 1943 return result == null ? com.google.cloud.vision.v1.Block.BlockType.UNRECOGNIZED : result; 1944 } 1945 /** 1946 * 1947 * 1948 * <pre> 1949 * Detected block type (text, image etc) for this block. 1950 * </pre> 1951 * 1952 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 1953 * 1954 * @param value The blockType to set. 1955 * @return This builder for chaining. 1956 */ setBlockType(com.google.cloud.vision.v1.Block.BlockType value)1957 public Builder setBlockType(com.google.cloud.vision.v1.Block.BlockType value) { 1958 if (value == null) { 1959 throw new NullPointerException(); 1960 } 1961 bitField0_ |= 0x00000008; 1962 blockType_ = value.getNumber(); 1963 onChanged(); 1964 return this; 1965 } 1966 /** 1967 * 1968 * 1969 * <pre> 1970 * Detected block type (text, image etc) for this block. 1971 * </pre> 1972 * 1973 * <code>.google.cloud.vision.v1.Block.BlockType block_type = 4;</code> 1974 * 1975 * @return This builder for chaining. 1976 */ clearBlockType()1977 public Builder clearBlockType() { 1978 bitField0_ = (bitField0_ & ~0x00000008); 1979 blockType_ = 0; 1980 onChanged(); 1981 return this; 1982 } 1983 1984 private float confidence_; 1985 /** 1986 * 1987 * 1988 * <pre> 1989 * Confidence of the OCR results on the block. Range [0, 1]. 1990 * </pre> 1991 * 1992 * <code>float confidence = 5;</code> 1993 * 1994 * @return The confidence. 1995 */ 1996 @java.lang.Override getConfidence()1997 public float getConfidence() { 1998 return confidence_; 1999 } 2000 /** 2001 * 2002 * 2003 * <pre> 2004 * Confidence of the OCR results on the block. Range [0, 1]. 2005 * </pre> 2006 * 2007 * <code>float confidence = 5;</code> 2008 * 2009 * @param value The confidence to set. 2010 * @return This builder for chaining. 2011 */ setConfidence(float value)2012 public Builder setConfidence(float value) { 2013 2014 confidence_ = value; 2015 bitField0_ |= 0x00000010; 2016 onChanged(); 2017 return this; 2018 } 2019 /** 2020 * 2021 * 2022 * <pre> 2023 * Confidence of the OCR results on the block. Range [0, 1]. 2024 * </pre> 2025 * 2026 * <code>float confidence = 5;</code> 2027 * 2028 * @return This builder for chaining. 2029 */ clearConfidence()2030 public Builder clearConfidence() { 2031 bitField0_ = (bitField0_ & ~0x00000010); 2032 confidence_ = 0F; 2033 onChanged(); 2034 return this; 2035 } 2036 2037 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2038 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2039 return super.setUnknownFields(unknownFields); 2040 } 2041 2042 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2043 public final Builder mergeUnknownFields( 2044 final com.google.protobuf.UnknownFieldSet unknownFields) { 2045 return super.mergeUnknownFields(unknownFields); 2046 } 2047 2048 // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1.Block) 2049 } 2050 2051 // @@protoc_insertion_point(class_scope:google.cloud.vision.v1.Block) 2052 private static final com.google.cloud.vision.v1.Block DEFAULT_INSTANCE; 2053 2054 static { 2055 DEFAULT_INSTANCE = new com.google.cloud.vision.v1.Block(); 2056 } 2057 getDefaultInstance()2058 public static com.google.cloud.vision.v1.Block getDefaultInstance() { 2059 return DEFAULT_INSTANCE; 2060 } 2061 2062 private static final com.google.protobuf.Parser<Block> PARSER = 2063 new com.google.protobuf.AbstractParser<Block>() { 2064 @java.lang.Override 2065 public Block parsePartialFrom( 2066 com.google.protobuf.CodedInputStream input, 2067 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2068 throws com.google.protobuf.InvalidProtocolBufferException { 2069 Builder builder = newBuilder(); 2070 try { 2071 builder.mergeFrom(input, extensionRegistry); 2072 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2073 throw e.setUnfinishedMessage(builder.buildPartial()); 2074 } catch (com.google.protobuf.UninitializedMessageException e) { 2075 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2076 } catch (java.io.IOException e) { 2077 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2078 .setUnfinishedMessage(builder.buildPartial()); 2079 } 2080 return builder.buildPartial(); 2081 } 2082 }; 2083 parser()2084 public static com.google.protobuf.Parser<Block> parser() { 2085 return PARSER; 2086 } 2087 2088 @java.lang.Override getParserForType()2089 public com.google.protobuf.Parser<Block> getParserForType() { 2090 return PARSER; 2091 } 2092 2093 @java.lang.Override getDefaultInstanceForType()2094 public com.google.cloud.vision.v1.Block getDefaultInstanceForType() { 2095 return DEFAULT_INSTANCE; 2096 } 2097 } 2098