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 * Structural unit of text representing a number of words in certain order. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.vision.v1.Paragraph} 29 */ 30 public final class Paragraph extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.vision.v1.Paragraph) 33 ParagraphOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use Paragraph.newBuilder() to construct. Paragraph(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private Paragraph(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 Paragraph()40 private Paragraph() { 41 words_ = java.util.Collections.emptyList(); 42 } 43 44 @java.lang.Override 45 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)46 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 47 return new Paragraph(); 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.vision.v1.TextAnnotationProto 57 .internal_static_google_cloud_vision_v1_Paragraph_descriptor; 58 } 59 60 @java.lang.Override 61 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()62 internalGetFieldAccessorTable() { 63 return com.google.cloud.vision.v1.TextAnnotationProto 64 .internal_static_google_cloud_vision_v1_Paragraph_fieldAccessorTable 65 .ensureFieldAccessorsInitialized( 66 com.google.cloud.vision.v1.Paragraph.class, 67 com.google.cloud.vision.v1.Paragraph.Builder.class); 68 } 69 70 public static final int PROPERTY_FIELD_NUMBER = 1; 71 private com.google.cloud.vision.v1.TextAnnotation.TextProperty property_; 72 /** 73 * 74 * 75 * <pre> 76 * Additional information detected for the paragraph. 77 * </pre> 78 * 79 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 80 * 81 * @return Whether the property field is set. 82 */ 83 @java.lang.Override hasProperty()84 public boolean hasProperty() { 85 return property_ != null; 86 } 87 /** 88 * 89 * 90 * <pre> 91 * Additional information detected for the paragraph. 92 * </pre> 93 * 94 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 95 * 96 * @return The property. 97 */ 98 @java.lang.Override getProperty()99 public com.google.cloud.vision.v1.TextAnnotation.TextProperty getProperty() { 100 return property_ == null 101 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 102 : property_; 103 } 104 /** 105 * 106 * 107 * <pre> 108 * Additional information detected for the paragraph. 109 * </pre> 110 * 111 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 112 */ 113 @java.lang.Override getPropertyOrBuilder()114 public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getPropertyOrBuilder() { 115 return property_ == null 116 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 117 : property_; 118 } 119 120 public static final int BOUNDING_BOX_FIELD_NUMBER = 2; 121 private com.google.cloud.vision.v1.BoundingPoly boundingBox_; 122 /** 123 * 124 * 125 * <pre> 126 * The bounding box for the paragraph. 127 * The vertices are in the order of top-left, top-right, bottom-right, 128 * bottom-left. When a rotation of the bounding box is detected the rotation 129 * is represented as around the top-left corner as defined when the text is 130 * read in the 'natural' orientation. 131 * For example: 132 * * when the text is horizontal it might look like: 133 * 0----1 134 * | | 135 * 3----2 136 * * when it's rotated 180 degrees around the top-left corner it becomes: 137 * 2----3 138 * | | 139 * 1----0 140 * and the vertex order will still be (0, 1, 2, 3). 141 * </pre> 142 * 143 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 144 * 145 * @return Whether the boundingBox field is set. 146 */ 147 @java.lang.Override hasBoundingBox()148 public boolean hasBoundingBox() { 149 return boundingBox_ != null; 150 } 151 /** 152 * 153 * 154 * <pre> 155 * The bounding box for the paragraph. 156 * The vertices are in the order of top-left, top-right, bottom-right, 157 * bottom-left. When a rotation of the bounding box is detected the rotation 158 * is represented as around the top-left corner as defined when the text is 159 * read in the 'natural' orientation. 160 * For example: 161 * * when the text is horizontal it might look like: 162 * 0----1 163 * | | 164 * 3----2 165 * * when it's rotated 180 degrees around the top-left corner it becomes: 166 * 2----3 167 * | | 168 * 1----0 169 * and the vertex order will still be (0, 1, 2, 3). 170 * </pre> 171 * 172 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 173 * 174 * @return The boundingBox. 175 */ 176 @java.lang.Override getBoundingBox()177 public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { 178 return boundingBox_ == null 179 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 180 : boundingBox_; 181 } 182 /** 183 * 184 * 185 * <pre> 186 * The bounding box for the paragraph. 187 * The vertices are in the order of top-left, top-right, bottom-right, 188 * bottom-left. When a rotation of the bounding box is detected the rotation 189 * is represented as around the top-left corner as defined when the text is 190 * read in the 'natural' orientation. 191 * For example: 192 * * when the text is horizontal it might look like: 193 * 0----1 194 * | | 195 * 3----2 196 * * when it's rotated 180 degrees around the top-left corner it becomes: 197 * 2----3 198 * | | 199 * 1----0 200 * and the vertex order will still be (0, 1, 2, 3). 201 * </pre> 202 * 203 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 204 */ 205 @java.lang.Override getBoundingBoxOrBuilder()206 public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder() { 207 return boundingBox_ == null 208 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 209 : boundingBox_; 210 } 211 212 public static final int WORDS_FIELD_NUMBER = 3; 213 214 @SuppressWarnings("serial") 215 private java.util.List<com.google.cloud.vision.v1.Word> words_; 216 /** 217 * 218 * 219 * <pre> 220 * List of all words in this paragraph. 221 * </pre> 222 * 223 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 224 */ 225 @java.lang.Override getWordsList()226 public java.util.List<com.google.cloud.vision.v1.Word> getWordsList() { 227 return words_; 228 } 229 /** 230 * 231 * 232 * <pre> 233 * List of all words in this paragraph. 234 * </pre> 235 * 236 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 237 */ 238 @java.lang.Override 239 public java.util.List<? extends com.google.cloud.vision.v1.WordOrBuilder> getWordsOrBuilderList()240 getWordsOrBuilderList() { 241 return words_; 242 } 243 /** 244 * 245 * 246 * <pre> 247 * List of all words in this paragraph. 248 * </pre> 249 * 250 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 251 */ 252 @java.lang.Override getWordsCount()253 public int getWordsCount() { 254 return words_.size(); 255 } 256 /** 257 * 258 * 259 * <pre> 260 * List of all words in this paragraph. 261 * </pre> 262 * 263 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 264 */ 265 @java.lang.Override getWords(int index)266 public com.google.cloud.vision.v1.Word getWords(int index) { 267 return words_.get(index); 268 } 269 /** 270 * 271 * 272 * <pre> 273 * List of all words in this paragraph. 274 * </pre> 275 * 276 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 277 */ 278 @java.lang.Override getWordsOrBuilder(int index)279 public com.google.cloud.vision.v1.WordOrBuilder getWordsOrBuilder(int index) { 280 return words_.get(index); 281 } 282 283 public static final int CONFIDENCE_FIELD_NUMBER = 4; 284 private float confidence_ = 0F; 285 /** 286 * 287 * 288 * <pre> 289 * Confidence of the OCR results for the paragraph. Range [0, 1]. 290 * </pre> 291 * 292 * <code>float confidence = 4;</code> 293 * 294 * @return The confidence. 295 */ 296 @java.lang.Override getConfidence()297 public float getConfidence() { 298 return confidence_; 299 } 300 301 private byte memoizedIsInitialized = -1; 302 303 @java.lang.Override isInitialized()304 public final boolean isInitialized() { 305 byte isInitialized = memoizedIsInitialized; 306 if (isInitialized == 1) return true; 307 if (isInitialized == 0) return false; 308 309 memoizedIsInitialized = 1; 310 return true; 311 } 312 313 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)314 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 315 if (property_ != null) { 316 output.writeMessage(1, getProperty()); 317 } 318 if (boundingBox_ != null) { 319 output.writeMessage(2, getBoundingBox()); 320 } 321 for (int i = 0; i < words_.size(); i++) { 322 output.writeMessage(3, words_.get(i)); 323 } 324 if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { 325 output.writeFloat(4, confidence_); 326 } 327 getUnknownFields().writeTo(output); 328 } 329 330 @java.lang.Override getSerializedSize()331 public int getSerializedSize() { 332 int size = memoizedSize; 333 if (size != -1) return size; 334 335 size = 0; 336 if (property_ != null) { 337 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getProperty()); 338 } 339 if (boundingBox_ != null) { 340 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getBoundingBox()); 341 } 342 for (int i = 0; i < words_.size(); i++) { 343 size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, words_.get(i)); 344 } 345 if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { 346 size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, confidence_); 347 } 348 size += getUnknownFields().getSerializedSize(); 349 memoizedSize = size; 350 return size; 351 } 352 353 @java.lang.Override equals(final java.lang.Object obj)354 public boolean equals(final java.lang.Object obj) { 355 if (obj == this) { 356 return true; 357 } 358 if (!(obj instanceof com.google.cloud.vision.v1.Paragraph)) { 359 return super.equals(obj); 360 } 361 com.google.cloud.vision.v1.Paragraph other = (com.google.cloud.vision.v1.Paragraph) obj; 362 363 if (hasProperty() != other.hasProperty()) return false; 364 if (hasProperty()) { 365 if (!getProperty().equals(other.getProperty())) return false; 366 } 367 if (hasBoundingBox() != other.hasBoundingBox()) return false; 368 if (hasBoundingBox()) { 369 if (!getBoundingBox().equals(other.getBoundingBox())) return false; 370 } 371 if (!getWordsList().equals(other.getWordsList())) return false; 372 if (java.lang.Float.floatToIntBits(getConfidence()) 373 != java.lang.Float.floatToIntBits(other.getConfidence())) return false; 374 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 375 return true; 376 } 377 378 @java.lang.Override hashCode()379 public int hashCode() { 380 if (memoizedHashCode != 0) { 381 return memoizedHashCode; 382 } 383 int hash = 41; 384 hash = (19 * hash) + getDescriptor().hashCode(); 385 if (hasProperty()) { 386 hash = (37 * hash) + PROPERTY_FIELD_NUMBER; 387 hash = (53 * hash) + getProperty().hashCode(); 388 } 389 if (hasBoundingBox()) { 390 hash = (37 * hash) + BOUNDING_BOX_FIELD_NUMBER; 391 hash = (53 * hash) + getBoundingBox().hashCode(); 392 } 393 if (getWordsCount() > 0) { 394 hash = (37 * hash) + WORDS_FIELD_NUMBER; 395 hash = (53 * hash) + getWordsList().hashCode(); 396 } 397 hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; 398 hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); 399 hash = (29 * hash) + getUnknownFields().hashCode(); 400 memoizedHashCode = hash; 401 return hash; 402 } 403 parseFrom(java.nio.ByteBuffer data)404 public static com.google.cloud.vision.v1.Paragraph parseFrom(java.nio.ByteBuffer data) 405 throws com.google.protobuf.InvalidProtocolBufferException { 406 return PARSER.parseFrom(data); 407 } 408 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)409 public static com.google.cloud.vision.v1.Paragraph parseFrom( 410 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 411 throws com.google.protobuf.InvalidProtocolBufferException { 412 return PARSER.parseFrom(data, extensionRegistry); 413 } 414 parseFrom(com.google.protobuf.ByteString data)415 public static com.google.cloud.vision.v1.Paragraph parseFrom(com.google.protobuf.ByteString data) 416 throws com.google.protobuf.InvalidProtocolBufferException { 417 return PARSER.parseFrom(data); 418 } 419 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)420 public static com.google.cloud.vision.v1.Paragraph parseFrom( 421 com.google.protobuf.ByteString data, 422 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 423 throws com.google.protobuf.InvalidProtocolBufferException { 424 return PARSER.parseFrom(data, extensionRegistry); 425 } 426 parseFrom(byte[] data)427 public static com.google.cloud.vision.v1.Paragraph parseFrom(byte[] data) 428 throws com.google.protobuf.InvalidProtocolBufferException { 429 return PARSER.parseFrom(data); 430 } 431 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)432 public static com.google.cloud.vision.v1.Paragraph parseFrom( 433 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 434 throws com.google.protobuf.InvalidProtocolBufferException { 435 return PARSER.parseFrom(data, extensionRegistry); 436 } 437 parseFrom(java.io.InputStream input)438 public static com.google.cloud.vision.v1.Paragraph parseFrom(java.io.InputStream input) 439 throws java.io.IOException { 440 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 441 } 442 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)443 public static com.google.cloud.vision.v1.Paragraph parseFrom( 444 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 445 throws java.io.IOException { 446 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 447 PARSER, input, extensionRegistry); 448 } 449 parseDelimitedFrom(java.io.InputStream input)450 public static com.google.cloud.vision.v1.Paragraph parseDelimitedFrom(java.io.InputStream input) 451 throws java.io.IOException { 452 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 453 } 454 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)455 public static com.google.cloud.vision.v1.Paragraph parseDelimitedFrom( 456 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 457 throws java.io.IOException { 458 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 459 PARSER, input, extensionRegistry); 460 } 461 parseFrom( com.google.protobuf.CodedInputStream input)462 public static com.google.cloud.vision.v1.Paragraph parseFrom( 463 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 464 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 465 } 466 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)467 public static com.google.cloud.vision.v1.Paragraph parseFrom( 468 com.google.protobuf.CodedInputStream input, 469 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 470 throws java.io.IOException { 471 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 472 PARSER, input, extensionRegistry); 473 } 474 475 @java.lang.Override newBuilderForType()476 public Builder newBuilderForType() { 477 return newBuilder(); 478 } 479 newBuilder()480 public static Builder newBuilder() { 481 return DEFAULT_INSTANCE.toBuilder(); 482 } 483 newBuilder(com.google.cloud.vision.v1.Paragraph prototype)484 public static Builder newBuilder(com.google.cloud.vision.v1.Paragraph prototype) { 485 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 486 } 487 488 @java.lang.Override toBuilder()489 public Builder toBuilder() { 490 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 491 } 492 493 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)494 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 495 Builder builder = new Builder(parent); 496 return builder; 497 } 498 /** 499 * 500 * 501 * <pre> 502 * Structural unit of text representing a number of words in certain order. 503 * </pre> 504 * 505 * Protobuf type {@code google.cloud.vision.v1.Paragraph} 506 */ 507 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 508 implements 509 // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.Paragraph) 510 com.google.cloud.vision.v1.ParagraphOrBuilder { getDescriptor()511 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 512 return com.google.cloud.vision.v1.TextAnnotationProto 513 .internal_static_google_cloud_vision_v1_Paragraph_descriptor; 514 } 515 516 @java.lang.Override 517 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()518 internalGetFieldAccessorTable() { 519 return com.google.cloud.vision.v1.TextAnnotationProto 520 .internal_static_google_cloud_vision_v1_Paragraph_fieldAccessorTable 521 .ensureFieldAccessorsInitialized( 522 com.google.cloud.vision.v1.Paragraph.class, 523 com.google.cloud.vision.v1.Paragraph.Builder.class); 524 } 525 526 // Construct using com.google.cloud.vision.v1.Paragraph.newBuilder() Builder()527 private Builder() {} 528 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)529 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 530 super(parent); 531 } 532 533 @java.lang.Override clear()534 public Builder clear() { 535 super.clear(); 536 bitField0_ = 0; 537 property_ = null; 538 if (propertyBuilder_ != null) { 539 propertyBuilder_.dispose(); 540 propertyBuilder_ = null; 541 } 542 boundingBox_ = null; 543 if (boundingBoxBuilder_ != null) { 544 boundingBoxBuilder_.dispose(); 545 boundingBoxBuilder_ = null; 546 } 547 if (wordsBuilder_ == null) { 548 words_ = java.util.Collections.emptyList(); 549 } else { 550 words_ = null; 551 wordsBuilder_.clear(); 552 } 553 bitField0_ = (bitField0_ & ~0x00000004); 554 confidence_ = 0F; 555 return this; 556 } 557 558 @java.lang.Override getDescriptorForType()559 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 560 return com.google.cloud.vision.v1.TextAnnotationProto 561 .internal_static_google_cloud_vision_v1_Paragraph_descriptor; 562 } 563 564 @java.lang.Override getDefaultInstanceForType()565 public com.google.cloud.vision.v1.Paragraph getDefaultInstanceForType() { 566 return com.google.cloud.vision.v1.Paragraph.getDefaultInstance(); 567 } 568 569 @java.lang.Override build()570 public com.google.cloud.vision.v1.Paragraph build() { 571 com.google.cloud.vision.v1.Paragraph result = buildPartial(); 572 if (!result.isInitialized()) { 573 throw newUninitializedMessageException(result); 574 } 575 return result; 576 } 577 578 @java.lang.Override buildPartial()579 public com.google.cloud.vision.v1.Paragraph buildPartial() { 580 com.google.cloud.vision.v1.Paragraph result = new com.google.cloud.vision.v1.Paragraph(this); 581 buildPartialRepeatedFields(result); 582 if (bitField0_ != 0) { 583 buildPartial0(result); 584 } 585 onBuilt(); 586 return result; 587 } 588 buildPartialRepeatedFields(com.google.cloud.vision.v1.Paragraph result)589 private void buildPartialRepeatedFields(com.google.cloud.vision.v1.Paragraph result) { 590 if (wordsBuilder_ == null) { 591 if (((bitField0_ & 0x00000004) != 0)) { 592 words_ = java.util.Collections.unmodifiableList(words_); 593 bitField0_ = (bitField0_ & ~0x00000004); 594 } 595 result.words_ = words_; 596 } else { 597 result.words_ = wordsBuilder_.build(); 598 } 599 } 600 buildPartial0(com.google.cloud.vision.v1.Paragraph result)601 private void buildPartial0(com.google.cloud.vision.v1.Paragraph result) { 602 int from_bitField0_ = bitField0_; 603 if (((from_bitField0_ & 0x00000001) != 0)) { 604 result.property_ = propertyBuilder_ == null ? property_ : propertyBuilder_.build(); 605 } 606 if (((from_bitField0_ & 0x00000002) != 0)) { 607 result.boundingBox_ = 608 boundingBoxBuilder_ == null ? boundingBox_ : boundingBoxBuilder_.build(); 609 } 610 if (((from_bitField0_ & 0x00000008) != 0)) { 611 result.confidence_ = confidence_; 612 } 613 } 614 615 @java.lang.Override clone()616 public Builder clone() { 617 return super.clone(); 618 } 619 620 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)621 public Builder setField( 622 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 623 return super.setField(field, value); 624 } 625 626 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)627 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 628 return super.clearField(field); 629 } 630 631 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)632 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 633 return super.clearOneof(oneof); 634 } 635 636 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)637 public Builder setRepeatedField( 638 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 639 return super.setRepeatedField(field, index, value); 640 } 641 642 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)643 public Builder addRepeatedField( 644 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 645 return super.addRepeatedField(field, value); 646 } 647 648 @java.lang.Override mergeFrom(com.google.protobuf.Message other)649 public Builder mergeFrom(com.google.protobuf.Message other) { 650 if (other instanceof com.google.cloud.vision.v1.Paragraph) { 651 return mergeFrom((com.google.cloud.vision.v1.Paragraph) other); 652 } else { 653 super.mergeFrom(other); 654 return this; 655 } 656 } 657 mergeFrom(com.google.cloud.vision.v1.Paragraph other)658 public Builder mergeFrom(com.google.cloud.vision.v1.Paragraph other) { 659 if (other == com.google.cloud.vision.v1.Paragraph.getDefaultInstance()) return this; 660 if (other.hasProperty()) { 661 mergeProperty(other.getProperty()); 662 } 663 if (other.hasBoundingBox()) { 664 mergeBoundingBox(other.getBoundingBox()); 665 } 666 if (wordsBuilder_ == null) { 667 if (!other.words_.isEmpty()) { 668 if (words_.isEmpty()) { 669 words_ = other.words_; 670 bitField0_ = (bitField0_ & ~0x00000004); 671 } else { 672 ensureWordsIsMutable(); 673 words_.addAll(other.words_); 674 } 675 onChanged(); 676 } 677 } else { 678 if (!other.words_.isEmpty()) { 679 if (wordsBuilder_.isEmpty()) { 680 wordsBuilder_.dispose(); 681 wordsBuilder_ = null; 682 words_ = other.words_; 683 bitField0_ = (bitField0_ & ~0x00000004); 684 wordsBuilder_ = 685 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 686 ? getWordsFieldBuilder() 687 : null; 688 } else { 689 wordsBuilder_.addAllMessages(other.words_); 690 } 691 } 692 } 693 if (other.getConfidence() != 0F) { 694 setConfidence(other.getConfidence()); 695 } 696 this.mergeUnknownFields(other.getUnknownFields()); 697 onChanged(); 698 return this; 699 } 700 701 @java.lang.Override isInitialized()702 public final boolean isInitialized() { 703 return true; 704 } 705 706 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)707 public Builder mergeFrom( 708 com.google.protobuf.CodedInputStream input, 709 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 710 throws java.io.IOException { 711 if (extensionRegistry == null) { 712 throw new java.lang.NullPointerException(); 713 } 714 try { 715 boolean done = false; 716 while (!done) { 717 int tag = input.readTag(); 718 switch (tag) { 719 case 0: 720 done = true; 721 break; 722 case 10: 723 { 724 input.readMessage(getPropertyFieldBuilder().getBuilder(), extensionRegistry); 725 bitField0_ |= 0x00000001; 726 break; 727 } // case 10 728 case 18: 729 { 730 input.readMessage(getBoundingBoxFieldBuilder().getBuilder(), extensionRegistry); 731 bitField0_ |= 0x00000002; 732 break; 733 } // case 18 734 case 26: 735 { 736 com.google.cloud.vision.v1.Word m = 737 input.readMessage(com.google.cloud.vision.v1.Word.parser(), extensionRegistry); 738 if (wordsBuilder_ == null) { 739 ensureWordsIsMutable(); 740 words_.add(m); 741 } else { 742 wordsBuilder_.addMessage(m); 743 } 744 break; 745 } // case 26 746 case 37: 747 { 748 confidence_ = input.readFloat(); 749 bitField0_ |= 0x00000008; 750 break; 751 } // case 37 752 default: 753 { 754 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 755 done = true; // was an endgroup tag 756 } 757 break; 758 } // default: 759 } // switch (tag) 760 } // while (!done) 761 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 762 throw e.unwrapIOException(); 763 } finally { 764 onChanged(); 765 } // finally 766 return this; 767 } 768 769 private int bitField0_; 770 771 private com.google.cloud.vision.v1.TextAnnotation.TextProperty property_; 772 private com.google.protobuf.SingleFieldBuilderV3< 773 com.google.cloud.vision.v1.TextAnnotation.TextProperty, 774 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder, 775 com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder> 776 propertyBuilder_; 777 /** 778 * 779 * 780 * <pre> 781 * Additional information detected for the paragraph. 782 * </pre> 783 * 784 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 785 * 786 * @return Whether the property field is set. 787 */ hasProperty()788 public boolean hasProperty() { 789 return ((bitField0_ & 0x00000001) != 0); 790 } 791 /** 792 * 793 * 794 * <pre> 795 * Additional information detected for the paragraph. 796 * </pre> 797 * 798 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 799 * 800 * @return The property. 801 */ getProperty()802 public com.google.cloud.vision.v1.TextAnnotation.TextProperty getProperty() { 803 if (propertyBuilder_ == null) { 804 return property_ == null 805 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 806 : property_; 807 } else { 808 return propertyBuilder_.getMessage(); 809 } 810 } 811 /** 812 * 813 * 814 * <pre> 815 * Additional information detected for the paragraph. 816 * </pre> 817 * 818 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 819 */ setProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value)820 public Builder setProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value) { 821 if (propertyBuilder_ == null) { 822 if (value == null) { 823 throw new NullPointerException(); 824 } 825 property_ = value; 826 } else { 827 propertyBuilder_.setMessage(value); 828 } 829 bitField0_ |= 0x00000001; 830 onChanged(); 831 return this; 832 } 833 /** 834 * 835 * 836 * <pre> 837 * Additional information detected for the paragraph. 838 * </pre> 839 * 840 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 841 */ setProperty( com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder builderForValue)842 public Builder setProperty( 843 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder builderForValue) { 844 if (propertyBuilder_ == null) { 845 property_ = builderForValue.build(); 846 } else { 847 propertyBuilder_.setMessage(builderForValue.build()); 848 } 849 bitField0_ |= 0x00000001; 850 onChanged(); 851 return this; 852 } 853 /** 854 * 855 * 856 * <pre> 857 * Additional information detected for the paragraph. 858 * </pre> 859 * 860 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 861 */ mergeProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value)862 public Builder mergeProperty(com.google.cloud.vision.v1.TextAnnotation.TextProperty value) { 863 if (propertyBuilder_ == null) { 864 if (((bitField0_ & 0x00000001) != 0) 865 && property_ != null 866 && property_ 867 != com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance()) { 868 getPropertyBuilder().mergeFrom(value); 869 } else { 870 property_ = value; 871 } 872 } else { 873 propertyBuilder_.mergeFrom(value); 874 } 875 bitField0_ |= 0x00000001; 876 onChanged(); 877 return this; 878 } 879 /** 880 * 881 * 882 * <pre> 883 * Additional information detected for the paragraph. 884 * </pre> 885 * 886 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 887 */ clearProperty()888 public Builder clearProperty() { 889 bitField0_ = (bitField0_ & ~0x00000001); 890 property_ = null; 891 if (propertyBuilder_ != null) { 892 propertyBuilder_.dispose(); 893 propertyBuilder_ = null; 894 } 895 onChanged(); 896 return this; 897 } 898 /** 899 * 900 * 901 * <pre> 902 * Additional information detected for the paragraph. 903 * </pre> 904 * 905 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 906 */ getPropertyBuilder()907 public com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder getPropertyBuilder() { 908 bitField0_ |= 0x00000001; 909 onChanged(); 910 return getPropertyFieldBuilder().getBuilder(); 911 } 912 /** 913 * 914 * 915 * <pre> 916 * Additional information detected for the paragraph. 917 * </pre> 918 * 919 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 920 */ getPropertyOrBuilder()921 public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getPropertyOrBuilder() { 922 if (propertyBuilder_ != null) { 923 return propertyBuilder_.getMessageOrBuilder(); 924 } else { 925 return property_ == null 926 ? com.google.cloud.vision.v1.TextAnnotation.TextProperty.getDefaultInstance() 927 : property_; 928 } 929 } 930 /** 931 * 932 * 933 * <pre> 934 * Additional information detected for the paragraph. 935 * </pre> 936 * 937 * <code>.google.cloud.vision.v1.TextAnnotation.TextProperty property = 1;</code> 938 */ 939 private com.google.protobuf.SingleFieldBuilderV3< 940 com.google.cloud.vision.v1.TextAnnotation.TextProperty, 941 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder, 942 com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder> getPropertyFieldBuilder()943 getPropertyFieldBuilder() { 944 if (propertyBuilder_ == null) { 945 propertyBuilder_ = 946 new com.google.protobuf.SingleFieldBuilderV3< 947 com.google.cloud.vision.v1.TextAnnotation.TextProperty, 948 com.google.cloud.vision.v1.TextAnnotation.TextProperty.Builder, 949 com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder>( 950 getProperty(), getParentForChildren(), isClean()); 951 property_ = null; 952 } 953 return propertyBuilder_; 954 } 955 956 private com.google.cloud.vision.v1.BoundingPoly boundingBox_; 957 private com.google.protobuf.SingleFieldBuilderV3< 958 com.google.cloud.vision.v1.BoundingPoly, 959 com.google.cloud.vision.v1.BoundingPoly.Builder, 960 com.google.cloud.vision.v1.BoundingPolyOrBuilder> 961 boundingBoxBuilder_; 962 /** 963 * 964 * 965 * <pre> 966 * The bounding box for the paragraph. 967 * The vertices are in the order of top-left, top-right, bottom-right, 968 * bottom-left. When a rotation of the bounding box is detected the rotation 969 * is represented as around the top-left corner as defined when the text is 970 * read in the 'natural' orientation. 971 * For example: 972 * * when the text is horizontal it might look like: 973 * 0----1 974 * | | 975 * 3----2 976 * * when it's rotated 180 degrees around the top-left corner it becomes: 977 * 2----3 978 * | | 979 * 1----0 980 * and the vertex order will still be (0, 1, 2, 3). 981 * </pre> 982 * 983 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 984 * 985 * @return Whether the boundingBox field is set. 986 */ hasBoundingBox()987 public boolean hasBoundingBox() { 988 return ((bitField0_ & 0x00000002) != 0); 989 } 990 /** 991 * 992 * 993 * <pre> 994 * The bounding box for the paragraph. 995 * The vertices are in the order of top-left, top-right, bottom-right, 996 * bottom-left. When a rotation of the bounding box is detected the rotation 997 * is represented as around the top-left corner as defined when the text is 998 * read in the 'natural' orientation. 999 * For example: 1000 * * when the text is horizontal it might look like: 1001 * 0----1 1002 * | | 1003 * 3----2 1004 * * when it's rotated 180 degrees around the top-left corner it becomes: 1005 * 2----3 1006 * | | 1007 * 1----0 1008 * and the vertex order will still be (0, 1, 2, 3). 1009 * </pre> 1010 * 1011 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1012 * 1013 * @return The boundingBox. 1014 */ getBoundingBox()1015 public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { 1016 if (boundingBoxBuilder_ == null) { 1017 return boundingBox_ == null 1018 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 1019 : boundingBox_; 1020 } else { 1021 return boundingBoxBuilder_.getMessage(); 1022 } 1023 } 1024 /** 1025 * 1026 * 1027 * <pre> 1028 * The bounding box for the paragraph. 1029 * The vertices are in the order of top-left, top-right, bottom-right, 1030 * bottom-left. When a rotation of the bounding box is detected the rotation 1031 * is represented as around the top-left corner as defined when the text is 1032 * read in the 'natural' orientation. 1033 * For example: 1034 * * when the text is horizontal it might look like: 1035 * 0----1 1036 * | | 1037 * 3----2 1038 * * when it's rotated 180 degrees around the top-left corner it becomes: 1039 * 2----3 1040 * | | 1041 * 1----0 1042 * and the vertex order will still be (0, 1, 2, 3). 1043 * </pre> 1044 * 1045 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1046 */ setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value)1047 public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { 1048 if (boundingBoxBuilder_ == null) { 1049 if (value == null) { 1050 throw new NullPointerException(); 1051 } 1052 boundingBox_ = value; 1053 } else { 1054 boundingBoxBuilder_.setMessage(value); 1055 } 1056 bitField0_ |= 0x00000002; 1057 onChanged(); 1058 return this; 1059 } 1060 /** 1061 * 1062 * 1063 * <pre> 1064 * The bounding box for the paragraph. 1065 * The vertices are in the order of top-left, top-right, bottom-right, 1066 * bottom-left. When a rotation of the bounding box is detected the rotation 1067 * is represented as around the top-left corner as defined when the text is 1068 * read in the 'natural' orientation. 1069 * For example: 1070 * * when the text is horizontal it might look like: 1071 * 0----1 1072 * | | 1073 * 3----2 1074 * * when it's rotated 180 degrees around the top-left corner it becomes: 1075 * 2----3 1076 * | | 1077 * 1----0 1078 * and the vertex order will still be (0, 1, 2, 3). 1079 * </pre> 1080 * 1081 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1082 */ setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder builderForValue)1083 public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder builderForValue) { 1084 if (boundingBoxBuilder_ == null) { 1085 boundingBox_ = builderForValue.build(); 1086 } else { 1087 boundingBoxBuilder_.setMessage(builderForValue.build()); 1088 } 1089 bitField0_ |= 0x00000002; 1090 onChanged(); 1091 return this; 1092 } 1093 /** 1094 * 1095 * 1096 * <pre> 1097 * The bounding box for the paragraph. 1098 * The vertices are in the order of top-left, top-right, bottom-right, 1099 * bottom-left. When a rotation of the bounding box is detected the rotation 1100 * is represented as around the top-left corner as defined when the text is 1101 * read in the 'natural' orientation. 1102 * For example: 1103 * * when the text is horizontal it might look like: 1104 * 0----1 1105 * | | 1106 * 3----2 1107 * * when it's rotated 180 degrees around the top-left corner it becomes: 1108 * 2----3 1109 * | | 1110 * 1----0 1111 * and the vertex order will still be (0, 1, 2, 3). 1112 * </pre> 1113 * 1114 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1115 */ mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value)1116 public Builder mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { 1117 if (boundingBoxBuilder_ == null) { 1118 if (((bitField0_ & 0x00000002) != 0) 1119 && boundingBox_ != null 1120 && boundingBox_ != com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance()) { 1121 getBoundingBoxBuilder().mergeFrom(value); 1122 } else { 1123 boundingBox_ = value; 1124 } 1125 } else { 1126 boundingBoxBuilder_.mergeFrom(value); 1127 } 1128 bitField0_ |= 0x00000002; 1129 onChanged(); 1130 return this; 1131 } 1132 /** 1133 * 1134 * 1135 * <pre> 1136 * The bounding box for the paragraph. 1137 * The vertices are in the order of top-left, top-right, bottom-right, 1138 * bottom-left. When a rotation of the bounding box is detected the rotation 1139 * is represented as around the top-left corner as defined when the text is 1140 * read in the 'natural' orientation. 1141 * For example: 1142 * * when the text is horizontal it might look like: 1143 * 0----1 1144 * | | 1145 * 3----2 1146 * * when it's rotated 180 degrees around the top-left corner it becomes: 1147 * 2----3 1148 * | | 1149 * 1----0 1150 * and the vertex order will still be (0, 1, 2, 3). 1151 * </pre> 1152 * 1153 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1154 */ clearBoundingBox()1155 public Builder clearBoundingBox() { 1156 bitField0_ = (bitField0_ & ~0x00000002); 1157 boundingBox_ = null; 1158 if (boundingBoxBuilder_ != null) { 1159 boundingBoxBuilder_.dispose(); 1160 boundingBoxBuilder_ = null; 1161 } 1162 onChanged(); 1163 return this; 1164 } 1165 /** 1166 * 1167 * 1168 * <pre> 1169 * The bounding box for the paragraph. 1170 * The vertices are in the order of top-left, top-right, bottom-right, 1171 * bottom-left. When a rotation of the bounding box is detected the rotation 1172 * is represented as around the top-left corner as defined when the text is 1173 * read in the 'natural' orientation. 1174 * For example: 1175 * * when the text is horizontal it might look like: 1176 * 0----1 1177 * | | 1178 * 3----2 1179 * * when it's rotated 180 degrees around the top-left corner it becomes: 1180 * 2----3 1181 * | | 1182 * 1----0 1183 * and the vertex order will still be (0, 1, 2, 3). 1184 * </pre> 1185 * 1186 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1187 */ getBoundingBoxBuilder()1188 public com.google.cloud.vision.v1.BoundingPoly.Builder getBoundingBoxBuilder() { 1189 bitField0_ |= 0x00000002; 1190 onChanged(); 1191 return getBoundingBoxFieldBuilder().getBuilder(); 1192 } 1193 /** 1194 * 1195 * 1196 * <pre> 1197 * The bounding box for the paragraph. 1198 * The vertices are in the order of top-left, top-right, bottom-right, 1199 * bottom-left. When a rotation of the bounding box is detected the rotation 1200 * is represented as around the top-left corner as defined when the text is 1201 * read in the 'natural' orientation. 1202 * For example: 1203 * * when the text is horizontal it might look like: 1204 * 0----1 1205 * | | 1206 * 3----2 1207 * * when it's rotated 180 degrees around the top-left corner it becomes: 1208 * 2----3 1209 * | | 1210 * 1----0 1211 * and the vertex order will still be (0, 1, 2, 3). 1212 * </pre> 1213 * 1214 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1215 */ getBoundingBoxOrBuilder()1216 public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder() { 1217 if (boundingBoxBuilder_ != null) { 1218 return boundingBoxBuilder_.getMessageOrBuilder(); 1219 } else { 1220 return boundingBox_ == null 1221 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 1222 : boundingBox_; 1223 } 1224 } 1225 /** 1226 * 1227 * 1228 * <pre> 1229 * The bounding box for the paragraph. 1230 * The vertices are in the order of top-left, top-right, bottom-right, 1231 * bottom-left. When a rotation of the bounding box is detected the rotation 1232 * is represented as around the top-left corner as defined when the text is 1233 * read in the 'natural' orientation. 1234 * For example: 1235 * * when the text is horizontal it might look like: 1236 * 0----1 1237 * | | 1238 * 3----2 1239 * * when it's rotated 180 degrees around the top-left corner it becomes: 1240 * 2----3 1241 * | | 1242 * 1----0 1243 * and the vertex order will still be (0, 1, 2, 3). 1244 * </pre> 1245 * 1246 * <code>.google.cloud.vision.v1.BoundingPoly bounding_box = 2;</code> 1247 */ 1248 private com.google.protobuf.SingleFieldBuilderV3< 1249 com.google.cloud.vision.v1.BoundingPoly, 1250 com.google.cloud.vision.v1.BoundingPoly.Builder, 1251 com.google.cloud.vision.v1.BoundingPolyOrBuilder> getBoundingBoxFieldBuilder()1252 getBoundingBoxFieldBuilder() { 1253 if (boundingBoxBuilder_ == null) { 1254 boundingBoxBuilder_ = 1255 new com.google.protobuf.SingleFieldBuilderV3< 1256 com.google.cloud.vision.v1.BoundingPoly, 1257 com.google.cloud.vision.v1.BoundingPoly.Builder, 1258 com.google.cloud.vision.v1.BoundingPolyOrBuilder>( 1259 getBoundingBox(), getParentForChildren(), isClean()); 1260 boundingBox_ = null; 1261 } 1262 return boundingBoxBuilder_; 1263 } 1264 1265 private java.util.List<com.google.cloud.vision.v1.Word> words_ = 1266 java.util.Collections.emptyList(); 1267 ensureWordsIsMutable()1268 private void ensureWordsIsMutable() { 1269 if (!((bitField0_ & 0x00000004) != 0)) { 1270 words_ = new java.util.ArrayList<com.google.cloud.vision.v1.Word>(words_); 1271 bitField0_ |= 0x00000004; 1272 } 1273 } 1274 1275 private com.google.protobuf.RepeatedFieldBuilderV3< 1276 com.google.cloud.vision.v1.Word, 1277 com.google.cloud.vision.v1.Word.Builder, 1278 com.google.cloud.vision.v1.WordOrBuilder> 1279 wordsBuilder_; 1280 1281 /** 1282 * 1283 * 1284 * <pre> 1285 * List of all words in this paragraph. 1286 * </pre> 1287 * 1288 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1289 */ getWordsList()1290 public java.util.List<com.google.cloud.vision.v1.Word> getWordsList() { 1291 if (wordsBuilder_ == null) { 1292 return java.util.Collections.unmodifiableList(words_); 1293 } else { 1294 return wordsBuilder_.getMessageList(); 1295 } 1296 } 1297 /** 1298 * 1299 * 1300 * <pre> 1301 * List of all words in this paragraph. 1302 * </pre> 1303 * 1304 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1305 */ getWordsCount()1306 public int getWordsCount() { 1307 if (wordsBuilder_ == null) { 1308 return words_.size(); 1309 } else { 1310 return wordsBuilder_.getCount(); 1311 } 1312 } 1313 /** 1314 * 1315 * 1316 * <pre> 1317 * List of all words in this paragraph. 1318 * </pre> 1319 * 1320 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1321 */ getWords(int index)1322 public com.google.cloud.vision.v1.Word getWords(int index) { 1323 if (wordsBuilder_ == null) { 1324 return words_.get(index); 1325 } else { 1326 return wordsBuilder_.getMessage(index); 1327 } 1328 } 1329 /** 1330 * 1331 * 1332 * <pre> 1333 * List of all words in this paragraph. 1334 * </pre> 1335 * 1336 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1337 */ setWords(int index, com.google.cloud.vision.v1.Word value)1338 public Builder setWords(int index, com.google.cloud.vision.v1.Word value) { 1339 if (wordsBuilder_ == null) { 1340 if (value == null) { 1341 throw new NullPointerException(); 1342 } 1343 ensureWordsIsMutable(); 1344 words_.set(index, value); 1345 onChanged(); 1346 } else { 1347 wordsBuilder_.setMessage(index, value); 1348 } 1349 return this; 1350 } 1351 /** 1352 * 1353 * 1354 * <pre> 1355 * List of all words in this paragraph. 1356 * </pre> 1357 * 1358 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1359 */ setWords(int index, com.google.cloud.vision.v1.Word.Builder builderForValue)1360 public Builder setWords(int index, com.google.cloud.vision.v1.Word.Builder builderForValue) { 1361 if (wordsBuilder_ == null) { 1362 ensureWordsIsMutable(); 1363 words_.set(index, builderForValue.build()); 1364 onChanged(); 1365 } else { 1366 wordsBuilder_.setMessage(index, builderForValue.build()); 1367 } 1368 return this; 1369 } 1370 /** 1371 * 1372 * 1373 * <pre> 1374 * List of all words in this paragraph. 1375 * </pre> 1376 * 1377 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1378 */ addWords(com.google.cloud.vision.v1.Word value)1379 public Builder addWords(com.google.cloud.vision.v1.Word value) { 1380 if (wordsBuilder_ == null) { 1381 if (value == null) { 1382 throw new NullPointerException(); 1383 } 1384 ensureWordsIsMutable(); 1385 words_.add(value); 1386 onChanged(); 1387 } else { 1388 wordsBuilder_.addMessage(value); 1389 } 1390 return this; 1391 } 1392 /** 1393 * 1394 * 1395 * <pre> 1396 * List of all words in this paragraph. 1397 * </pre> 1398 * 1399 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1400 */ addWords(int index, com.google.cloud.vision.v1.Word value)1401 public Builder addWords(int index, com.google.cloud.vision.v1.Word value) { 1402 if (wordsBuilder_ == null) { 1403 if (value == null) { 1404 throw new NullPointerException(); 1405 } 1406 ensureWordsIsMutable(); 1407 words_.add(index, value); 1408 onChanged(); 1409 } else { 1410 wordsBuilder_.addMessage(index, value); 1411 } 1412 return this; 1413 } 1414 /** 1415 * 1416 * 1417 * <pre> 1418 * List of all words in this paragraph. 1419 * </pre> 1420 * 1421 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1422 */ addWords(com.google.cloud.vision.v1.Word.Builder builderForValue)1423 public Builder addWords(com.google.cloud.vision.v1.Word.Builder builderForValue) { 1424 if (wordsBuilder_ == null) { 1425 ensureWordsIsMutable(); 1426 words_.add(builderForValue.build()); 1427 onChanged(); 1428 } else { 1429 wordsBuilder_.addMessage(builderForValue.build()); 1430 } 1431 return this; 1432 } 1433 /** 1434 * 1435 * 1436 * <pre> 1437 * List of all words in this paragraph. 1438 * </pre> 1439 * 1440 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1441 */ addWords(int index, com.google.cloud.vision.v1.Word.Builder builderForValue)1442 public Builder addWords(int index, com.google.cloud.vision.v1.Word.Builder builderForValue) { 1443 if (wordsBuilder_ == null) { 1444 ensureWordsIsMutable(); 1445 words_.add(index, builderForValue.build()); 1446 onChanged(); 1447 } else { 1448 wordsBuilder_.addMessage(index, builderForValue.build()); 1449 } 1450 return this; 1451 } 1452 /** 1453 * 1454 * 1455 * <pre> 1456 * List of all words in this paragraph. 1457 * </pre> 1458 * 1459 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1460 */ addAllWords( java.lang.Iterable<? extends com.google.cloud.vision.v1.Word> values)1461 public Builder addAllWords( 1462 java.lang.Iterable<? extends com.google.cloud.vision.v1.Word> values) { 1463 if (wordsBuilder_ == null) { 1464 ensureWordsIsMutable(); 1465 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, words_); 1466 onChanged(); 1467 } else { 1468 wordsBuilder_.addAllMessages(values); 1469 } 1470 return this; 1471 } 1472 /** 1473 * 1474 * 1475 * <pre> 1476 * List of all words in this paragraph. 1477 * </pre> 1478 * 1479 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1480 */ clearWords()1481 public Builder clearWords() { 1482 if (wordsBuilder_ == null) { 1483 words_ = java.util.Collections.emptyList(); 1484 bitField0_ = (bitField0_ & ~0x00000004); 1485 onChanged(); 1486 } else { 1487 wordsBuilder_.clear(); 1488 } 1489 return this; 1490 } 1491 /** 1492 * 1493 * 1494 * <pre> 1495 * List of all words in this paragraph. 1496 * </pre> 1497 * 1498 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1499 */ removeWords(int index)1500 public Builder removeWords(int index) { 1501 if (wordsBuilder_ == null) { 1502 ensureWordsIsMutable(); 1503 words_.remove(index); 1504 onChanged(); 1505 } else { 1506 wordsBuilder_.remove(index); 1507 } 1508 return this; 1509 } 1510 /** 1511 * 1512 * 1513 * <pre> 1514 * List of all words in this paragraph. 1515 * </pre> 1516 * 1517 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1518 */ getWordsBuilder(int index)1519 public com.google.cloud.vision.v1.Word.Builder getWordsBuilder(int index) { 1520 return getWordsFieldBuilder().getBuilder(index); 1521 } 1522 /** 1523 * 1524 * 1525 * <pre> 1526 * List of all words in this paragraph. 1527 * </pre> 1528 * 1529 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1530 */ getWordsOrBuilder(int index)1531 public com.google.cloud.vision.v1.WordOrBuilder getWordsOrBuilder(int index) { 1532 if (wordsBuilder_ == null) { 1533 return words_.get(index); 1534 } else { 1535 return wordsBuilder_.getMessageOrBuilder(index); 1536 } 1537 } 1538 /** 1539 * 1540 * 1541 * <pre> 1542 * List of all words in this paragraph. 1543 * </pre> 1544 * 1545 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1546 */ 1547 public java.util.List<? extends com.google.cloud.vision.v1.WordOrBuilder> getWordsOrBuilderList()1548 getWordsOrBuilderList() { 1549 if (wordsBuilder_ != null) { 1550 return wordsBuilder_.getMessageOrBuilderList(); 1551 } else { 1552 return java.util.Collections.unmodifiableList(words_); 1553 } 1554 } 1555 /** 1556 * 1557 * 1558 * <pre> 1559 * List of all words in this paragraph. 1560 * </pre> 1561 * 1562 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1563 */ addWordsBuilder()1564 public com.google.cloud.vision.v1.Word.Builder addWordsBuilder() { 1565 return getWordsFieldBuilder() 1566 .addBuilder(com.google.cloud.vision.v1.Word.getDefaultInstance()); 1567 } 1568 /** 1569 * 1570 * 1571 * <pre> 1572 * List of all words in this paragraph. 1573 * </pre> 1574 * 1575 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1576 */ addWordsBuilder(int index)1577 public com.google.cloud.vision.v1.Word.Builder addWordsBuilder(int index) { 1578 return getWordsFieldBuilder() 1579 .addBuilder(index, com.google.cloud.vision.v1.Word.getDefaultInstance()); 1580 } 1581 /** 1582 * 1583 * 1584 * <pre> 1585 * List of all words in this paragraph. 1586 * </pre> 1587 * 1588 * <code>repeated .google.cloud.vision.v1.Word words = 3;</code> 1589 */ getWordsBuilderList()1590 public java.util.List<com.google.cloud.vision.v1.Word.Builder> getWordsBuilderList() { 1591 return getWordsFieldBuilder().getBuilderList(); 1592 } 1593 1594 private com.google.protobuf.RepeatedFieldBuilderV3< 1595 com.google.cloud.vision.v1.Word, 1596 com.google.cloud.vision.v1.Word.Builder, 1597 com.google.cloud.vision.v1.WordOrBuilder> getWordsFieldBuilder()1598 getWordsFieldBuilder() { 1599 if (wordsBuilder_ == null) { 1600 wordsBuilder_ = 1601 new com.google.protobuf.RepeatedFieldBuilderV3< 1602 com.google.cloud.vision.v1.Word, 1603 com.google.cloud.vision.v1.Word.Builder, 1604 com.google.cloud.vision.v1.WordOrBuilder>( 1605 words_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); 1606 words_ = null; 1607 } 1608 return wordsBuilder_; 1609 } 1610 1611 private float confidence_; 1612 /** 1613 * 1614 * 1615 * <pre> 1616 * Confidence of the OCR results for the paragraph. Range [0, 1]. 1617 * </pre> 1618 * 1619 * <code>float confidence = 4;</code> 1620 * 1621 * @return The confidence. 1622 */ 1623 @java.lang.Override getConfidence()1624 public float getConfidence() { 1625 return confidence_; 1626 } 1627 /** 1628 * 1629 * 1630 * <pre> 1631 * Confidence of the OCR results for the paragraph. Range [0, 1]. 1632 * </pre> 1633 * 1634 * <code>float confidence = 4;</code> 1635 * 1636 * @param value The confidence to set. 1637 * @return This builder for chaining. 1638 */ setConfidence(float value)1639 public Builder setConfidence(float value) { 1640 1641 confidence_ = value; 1642 bitField0_ |= 0x00000008; 1643 onChanged(); 1644 return this; 1645 } 1646 /** 1647 * 1648 * 1649 * <pre> 1650 * Confidence of the OCR results for the paragraph. Range [0, 1]. 1651 * </pre> 1652 * 1653 * <code>float confidence = 4;</code> 1654 * 1655 * @return This builder for chaining. 1656 */ clearConfidence()1657 public Builder clearConfidence() { 1658 bitField0_ = (bitField0_ & ~0x00000008); 1659 confidence_ = 0F; 1660 onChanged(); 1661 return this; 1662 } 1663 1664 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1665 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1666 return super.setUnknownFields(unknownFields); 1667 } 1668 1669 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1670 public final Builder mergeUnknownFields( 1671 final com.google.protobuf.UnknownFieldSet unknownFields) { 1672 return super.mergeUnknownFields(unknownFields); 1673 } 1674 1675 // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1.Paragraph) 1676 } 1677 1678 // @@protoc_insertion_point(class_scope:google.cloud.vision.v1.Paragraph) 1679 private static final com.google.cloud.vision.v1.Paragraph DEFAULT_INSTANCE; 1680 1681 static { 1682 DEFAULT_INSTANCE = new com.google.cloud.vision.v1.Paragraph(); 1683 } 1684 getDefaultInstance()1685 public static com.google.cloud.vision.v1.Paragraph getDefaultInstance() { 1686 return DEFAULT_INSTANCE; 1687 } 1688 1689 private static final com.google.protobuf.Parser<Paragraph> PARSER = 1690 new com.google.protobuf.AbstractParser<Paragraph>() { 1691 @java.lang.Override 1692 public Paragraph parsePartialFrom( 1693 com.google.protobuf.CodedInputStream input, 1694 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1695 throws com.google.protobuf.InvalidProtocolBufferException { 1696 Builder builder = newBuilder(); 1697 try { 1698 builder.mergeFrom(input, extensionRegistry); 1699 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1700 throw e.setUnfinishedMessage(builder.buildPartial()); 1701 } catch (com.google.protobuf.UninitializedMessageException e) { 1702 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1703 } catch (java.io.IOException e) { 1704 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1705 .setUnfinishedMessage(builder.buildPartial()); 1706 } 1707 return builder.buildPartial(); 1708 } 1709 }; 1710 parser()1711 public static com.google.protobuf.Parser<Paragraph> parser() { 1712 return PARSER; 1713 } 1714 1715 @java.lang.Override getParserForType()1716 public com.google.protobuf.Parser<Paragraph> getParserForType() { 1717 return PARSER; 1718 } 1719 1720 @java.lang.Override getDefaultInstanceForType()1721 public com.google.cloud.vision.v1.Paragraph getDefaultInstanceForType() { 1722 return DEFAULT_INSTANCE; 1723 } 1724 } 1725