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/image_annotator.proto 18 19 package com.google.cloud.vision.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * Single crop hint that is used to generate a new crop when serving an image. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.vision.v1.CropHint} 29 */ 30 public final class CropHint extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.vision.v1.CropHint) 33 CropHintOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use CropHint.newBuilder() to construct. CropHint(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private CropHint(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 CropHint()40 private CropHint() {} 41 42 @java.lang.Override 43 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)44 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 45 return new CropHint(); 46 } 47 48 @java.lang.Override getUnknownFields()49 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 50 return this.unknownFields; 51 } 52 getDescriptor()53 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 54 return com.google.cloud.vision.v1.ImageAnnotatorProto 55 .internal_static_google_cloud_vision_v1_CropHint_descriptor; 56 } 57 58 @java.lang.Override 59 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()60 internalGetFieldAccessorTable() { 61 return com.google.cloud.vision.v1.ImageAnnotatorProto 62 .internal_static_google_cloud_vision_v1_CropHint_fieldAccessorTable 63 .ensureFieldAccessorsInitialized( 64 com.google.cloud.vision.v1.CropHint.class, 65 com.google.cloud.vision.v1.CropHint.Builder.class); 66 } 67 68 public static final int BOUNDING_POLY_FIELD_NUMBER = 1; 69 private com.google.cloud.vision.v1.BoundingPoly boundingPoly_; 70 /** 71 * 72 * 73 * <pre> 74 * The bounding polygon for the crop region. The coordinates of the bounding 75 * box are in the original image's scale. 76 * </pre> 77 * 78 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 79 * 80 * @return Whether the boundingPoly field is set. 81 */ 82 @java.lang.Override hasBoundingPoly()83 public boolean hasBoundingPoly() { 84 return boundingPoly_ != null; 85 } 86 /** 87 * 88 * 89 * <pre> 90 * The bounding polygon for the crop region. The coordinates of the bounding 91 * box are in the original image's scale. 92 * </pre> 93 * 94 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 95 * 96 * @return The boundingPoly. 97 */ 98 @java.lang.Override getBoundingPoly()99 public com.google.cloud.vision.v1.BoundingPoly getBoundingPoly() { 100 return boundingPoly_ == null 101 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 102 : boundingPoly_; 103 } 104 /** 105 * 106 * 107 * <pre> 108 * The bounding polygon for the crop region. The coordinates of the bounding 109 * box are in the original image's scale. 110 * </pre> 111 * 112 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 113 */ 114 @java.lang.Override getBoundingPolyOrBuilder()115 public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() { 116 return boundingPoly_ == null 117 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 118 : boundingPoly_; 119 } 120 121 public static final int CONFIDENCE_FIELD_NUMBER = 2; 122 private float confidence_ = 0F; 123 /** 124 * 125 * 126 * <pre> 127 * Confidence of this being a salient region. Range [0, 1]. 128 * </pre> 129 * 130 * <code>float confidence = 2;</code> 131 * 132 * @return The confidence. 133 */ 134 @java.lang.Override getConfidence()135 public float getConfidence() { 136 return confidence_; 137 } 138 139 public static final int IMPORTANCE_FRACTION_FIELD_NUMBER = 3; 140 private float importanceFraction_ = 0F; 141 /** 142 * 143 * 144 * <pre> 145 * Fraction of importance of this salient region with respect to the original 146 * image. 147 * </pre> 148 * 149 * <code>float importance_fraction = 3;</code> 150 * 151 * @return The importanceFraction. 152 */ 153 @java.lang.Override getImportanceFraction()154 public float getImportanceFraction() { 155 return importanceFraction_; 156 } 157 158 private byte memoizedIsInitialized = -1; 159 160 @java.lang.Override isInitialized()161 public final boolean isInitialized() { 162 byte isInitialized = memoizedIsInitialized; 163 if (isInitialized == 1) return true; 164 if (isInitialized == 0) return false; 165 166 memoizedIsInitialized = 1; 167 return true; 168 } 169 170 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)171 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 172 if (boundingPoly_ != null) { 173 output.writeMessage(1, getBoundingPoly()); 174 } 175 if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { 176 output.writeFloat(2, confidence_); 177 } 178 if (java.lang.Float.floatToRawIntBits(importanceFraction_) != 0) { 179 output.writeFloat(3, importanceFraction_); 180 } 181 getUnknownFields().writeTo(output); 182 } 183 184 @java.lang.Override getSerializedSize()185 public int getSerializedSize() { 186 int size = memoizedSize; 187 if (size != -1) return size; 188 189 size = 0; 190 if (boundingPoly_ != null) { 191 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getBoundingPoly()); 192 } 193 if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { 194 size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidence_); 195 } 196 if (java.lang.Float.floatToRawIntBits(importanceFraction_) != 0) { 197 size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, importanceFraction_); 198 } 199 size += getUnknownFields().getSerializedSize(); 200 memoizedSize = size; 201 return size; 202 } 203 204 @java.lang.Override equals(final java.lang.Object obj)205 public boolean equals(final java.lang.Object obj) { 206 if (obj == this) { 207 return true; 208 } 209 if (!(obj instanceof com.google.cloud.vision.v1.CropHint)) { 210 return super.equals(obj); 211 } 212 com.google.cloud.vision.v1.CropHint other = (com.google.cloud.vision.v1.CropHint) obj; 213 214 if (hasBoundingPoly() != other.hasBoundingPoly()) return false; 215 if (hasBoundingPoly()) { 216 if (!getBoundingPoly().equals(other.getBoundingPoly())) return false; 217 } 218 if (java.lang.Float.floatToIntBits(getConfidence()) 219 != java.lang.Float.floatToIntBits(other.getConfidence())) return false; 220 if (java.lang.Float.floatToIntBits(getImportanceFraction()) 221 != java.lang.Float.floatToIntBits(other.getImportanceFraction())) return false; 222 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 223 return true; 224 } 225 226 @java.lang.Override hashCode()227 public int hashCode() { 228 if (memoizedHashCode != 0) { 229 return memoizedHashCode; 230 } 231 int hash = 41; 232 hash = (19 * hash) + getDescriptor().hashCode(); 233 if (hasBoundingPoly()) { 234 hash = (37 * hash) + BOUNDING_POLY_FIELD_NUMBER; 235 hash = (53 * hash) + getBoundingPoly().hashCode(); 236 } 237 hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; 238 hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); 239 hash = (37 * hash) + IMPORTANCE_FRACTION_FIELD_NUMBER; 240 hash = (53 * hash) + java.lang.Float.floatToIntBits(getImportanceFraction()); 241 hash = (29 * hash) + getUnknownFields().hashCode(); 242 memoizedHashCode = hash; 243 return hash; 244 } 245 parseFrom(java.nio.ByteBuffer data)246 public static com.google.cloud.vision.v1.CropHint parseFrom(java.nio.ByteBuffer data) 247 throws com.google.protobuf.InvalidProtocolBufferException { 248 return PARSER.parseFrom(data); 249 } 250 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)251 public static com.google.cloud.vision.v1.CropHint parseFrom( 252 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 253 throws com.google.protobuf.InvalidProtocolBufferException { 254 return PARSER.parseFrom(data, extensionRegistry); 255 } 256 parseFrom(com.google.protobuf.ByteString data)257 public static com.google.cloud.vision.v1.CropHint parseFrom(com.google.protobuf.ByteString data) 258 throws com.google.protobuf.InvalidProtocolBufferException { 259 return PARSER.parseFrom(data); 260 } 261 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)262 public static com.google.cloud.vision.v1.CropHint parseFrom( 263 com.google.protobuf.ByteString data, 264 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 265 throws com.google.protobuf.InvalidProtocolBufferException { 266 return PARSER.parseFrom(data, extensionRegistry); 267 } 268 parseFrom(byte[] data)269 public static com.google.cloud.vision.v1.CropHint parseFrom(byte[] data) 270 throws com.google.protobuf.InvalidProtocolBufferException { 271 return PARSER.parseFrom(data); 272 } 273 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)274 public static com.google.cloud.vision.v1.CropHint parseFrom( 275 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 276 throws com.google.protobuf.InvalidProtocolBufferException { 277 return PARSER.parseFrom(data, extensionRegistry); 278 } 279 parseFrom(java.io.InputStream input)280 public static com.google.cloud.vision.v1.CropHint parseFrom(java.io.InputStream input) 281 throws java.io.IOException { 282 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 283 } 284 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)285 public static com.google.cloud.vision.v1.CropHint parseFrom( 286 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 287 throws java.io.IOException { 288 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 289 PARSER, input, extensionRegistry); 290 } 291 parseDelimitedFrom(java.io.InputStream input)292 public static com.google.cloud.vision.v1.CropHint parseDelimitedFrom(java.io.InputStream input) 293 throws java.io.IOException { 294 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 295 } 296 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)297 public static com.google.cloud.vision.v1.CropHint parseDelimitedFrom( 298 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 299 throws java.io.IOException { 300 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 301 PARSER, input, extensionRegistry); 302 } 303 parseFrom( com.google.protobuf.CodedInputStream input)304 public static com.google.cloud.vision.v1.CropHint parseFrom( 305 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 306 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 307 } 308 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)309 public static com.google.cloud.vision.v1.CropHint parseFrom( 310 com.google.protobuf.CodedInputStream input, 311 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 312 throws java.io.IOException { 313 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 314 PARSER, input, extensionRegistry); 315 } 316 317 @java.lang.Override newBuilderForType()318 public Builder newBuilderForType() { 319 return newBuilder(); 320 } 321 newBuilder()322 public static Builder newBuilder() { 323 return DEFAULT_INSTANCE.toBuilder(); 324 } 325 newBuilder(com.google.cloud.vision.v1.CropHint prototype)326 public static Builder newBuilder(com.google.cloud.vision.v1.CropHint prototype) { 327 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 328 } 329 330 @java.lang.Override toBuilder()331 public Builder toBuilder() { 332 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 333 } 334 335 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)336 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 337 Builder builder = new Builder(parent); 338 return builder; 339 } 340 /** 341 * 342 * 343 * <pre> 344 * Single crop hint that is used to generate a new crop when serving an image. 345 * </pre> 346 * 347 * Protobuf type {@code google.cloud.vision.v1.CropHint} 348 */ 349 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 350 implements 351 // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.CropHint) 352 com.google.cloud.vision.v1.CropHintOrBuilder { getDescriptor()353 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 354 return com.google.cloud.vision.v1.ImageAnnotatorProto 355 .internal_static_google_cloud_vision_v1_CropHint_descriptor; 356 } 357 358 @java.lang.Override 359 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()360 internalGetFieldAccessorTable() { 361 return com.google.cloud.vision.v1.ImageAnnotatorProto 362 .internal_static_google_cloud_vision_v1_CropHint_fieldAccessorTable 363 .ensureFieldAccessorsInitialized( 364 com.google.cloud.vision.v1.CropHint.class, 365 com.google.cloud.vision.v1.CropHint.Builder.class); 366 } 367 368 // Construct using com.google.cloud.vision.v1.CropHint.newBuilder() Builder()369 private Builder() {} 370 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)371 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 372 super(parent); 373 } 374 375 @java.lang.Override clear()376 public Builder clear() { 377 super.clear(); 378 bitField0_ = 0; 379 boundingPoly_ = null; 380 if (boundingPolyBuilder_ != null) { 381 boundingPolyBuilder_.dispose(); 382 boundingPolyBuilder_ = null; 383 } 384 confidence_ = 0F; 385 importanceFraction_ = 0F; 386 return this; 387 } 388 389 @java.lang.Override getDescriptorForType()390 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 391 return com.google.cloud.vision.v1.ImageAnnotatorProto 392 .internal_static_google_cloud_vision_v1_CropHint_descriptor; 393 } 394 395 @java.lang.Override getDefaultInstanceForType()396 public com.google.cloud.vision.v1.CropHint getDefaultInstanceForType() { 397 return com.google.cloud.vision.v1.CropHint.getDefaultInstance(); 398 } 399 400 @java.lang.Override build()401 public com.google.cloud.vision.v1.CropHint build() { 402 com.google.cloud.vision.v1.CropHint result = buildPartial(); 403 if (!result.isInitialized()) { 404 throw newUninitializedMessageException(result); 405 } 406 return result; 407 } 408 409 @java.lang.Override buildPartial()410 public com.google.cloud.vision.v1.CropHint buildPartial() { 411 com.google.cloud.vision.v1.CropHint result = new com.google.cloud.vision.v1.CropHint(this); 412 if (bitField0_ != 0) { 413 buildPartial0(result); 414 } 415 onBuilt(); 416 return result; 417 } 418 buildPartial0(com.google.cloud.vision.v1.CropHint result)419 private void buildPartial0(com.google.cloud.vision.v1.CropHint result) { 420 int from_bitField0_ = bitField0_; 421 if (((from_bitField0_ & 0x00000001) != 0)) { 422 result.boundingPoly_ = 423 boundingPolyBuilder_ == null ? boundingPoly_ : boundingPolyBuilder_.build(); 424 } 425 if (((from_bitField0_ & 0x00000002) != 0)) { 426 result.confidence_ = confidence_; 427 } 428 if (((from_bitField0_ & 0x00000004) != 0)) { 429 result.importanceFraction_ = importanceFraction_; 430 } 431 } 432 433 @java.lang.Override clone()434 public Builder clone() { 435 return super.clone(); 436 } 437 438 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)439 public Builder setField( 440 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 441 return super.setField(field, value); 442 } 443 444 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)445 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 446 return super.clearField(field); 447 } 448 449 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)450 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 451 return super.clearOneof(oneof); 452 } 453 454 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)455 public Builder setRepeatedField( 456 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 457 return super.setRepeatedField(field, index, value); 458 } 459 460 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)461 public Builder addRepeatedField( 462 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 463 return super.addRepeatedField(field, value); 464 } 465 466 @java.lang.Override mergeFrom(com.google.protobuf.Message other)467 public Builder mergeFrom(com.google.protobuf.Message other) { 468 if (other instanceof com.google.cloud.vision.v1.CropHint) { 469 return mergeFrom((com.google.cloud.vision.v1.CropHint) other); 470 } else { 471 super.mergeFrom(other); 472 return this; 473 } 474 } 475 mergeFrom(com.google.cloud.vision.v1.CropHint other)476 public Builder mergeFrom(com.google.cloud.vision.v1.CropHint other) { 477 if (other == com.google.cloud.vision.v1.CropHint.getDefaultInstance()) return this; 478 if (other.hasBoundingPoly()) { 479 mergeBoundingPoly(other.getBoundingPoly()); 480 } 481 if (other.getConfidence() != 0F) { 482 setConfidence(other.getConfidence()); 483 } 484 if (other.getImportanceFraction() != 0F) { 485 setImportanceFraction(other.getImportanceFraction()); 486 } 487 this.mergeUnknownFields(other.getUnknownFields()); 488 onChanged(); 489 return this; 490 } 491 492 @java.lang.Override isInitialized()493 public final boolean isInitialized() { 494 return true; 495 } 496 497 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)498 public Builder mergeFrom( 499 com.google.protobuf.CodedInputStream input, 500 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 501 throws java.io.IOException { 502 if (extensionRegistry == null) { 503 throw new java.lang.NullPointerException(); 504 } 505 try { 506 boolean done = false; 507 while (!done) { 508 int tag = input.readTag(); 509 switch (tag) { 510 case 0: 511 done = true; 512 break; 513 case 10: 514 { 515 input.readMessage(getBoundingPolyFieldBuilder().getBuilder(), extensionRegistry); 516 bitField0_ |= 0x00000001; 517 break; 518 } // case 10 519 case 21: 520 { 521 confidence_ = input.readFloat(); 522 bitField0_ |= 0x00000002; 523 break; 524 } // case 21 525 case 29: 526 { 527 importanceFraction_ = input.readFloat(); 528 bitField0_ |= 0x00000004; 529 break; 530 } // case 29 531 default: 532 { 533 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 534 done = true; // was an endgroup tag 535 } 536 break; 537 } // default: 538 } // switch (tag) 539 } // while (!done) 540 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 541 throw e.unwrapIOException(); 542 } finally { 543 onChanged(); 544 } // finally 545 return this; 546 } 547 548 private int bitField0_; 549 550 private com.google.cloud.vision.v1.BoundingPoly boundingPoly_; 551 private com.google.protobuf.SingleFieldBuilderV3< 552 com.google.cloud.vision.v1.BoundingPoly, 553 com.google.cloud.vision.v1.BoundingPoly.Builder, 554 com.google.cloud.vision.v1.BoundingPolyOrBuilder> 555 boundingPolyBuilder_; 556 /** 557 * 558 * 559 * <pre> 560 * The bounding polygon for the crop region. The coordinates of the bounding 561 * box are in the original image's scale. 562 * </pre> 563 * 564 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 565 * 566 * @return Whether the boundingPoly field is set. 567 */ hasBoundingPoly()568 public boolean hasBoundingPoly() { 569 return ((bitField0_ & 0x00000001) != 0); 570 } 571 /** 572 * 573 * 574 * <pre> 575 * The bounding polygon for the crop region. The coordinates of the bounding 576 * box are in the original image's scale. 577 * </pre> 578 * 579 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 580 * 581 * @return The boundingPoly. 582 */ getBoundingPoly()583 public com.google.cloud.vision.v1.BoundingPoly getBoundingPoly() { 584 if (boundingPolyBuilder_ == null) { 585 return boundingPoly_ == null 586 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 587 : boundingPoly_; 588 } else { 589 return boundingPolyBuilder_.getMessage(); 590 } 591 } 592 /** 593 * 594 * 595 * <pre> 596 * The bounding polygon for the crop region. The coordinates of the bounding 597 * box are in the original image's scale. 598 * </pre> 599 * 600 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 601 */ setBoundingPoly(com.google.cloud.vision.v1.BoundingPoly value)602 public Builder setBoundingPoly(com.google.cloud.vision.v1.BoundingPoly value) { 603 if (boundingPolyBuilder_ == null) { 604 if (value == null) { 605 throw new NullPointerException(); 606 } 607 boundingPoly_ = value; 608 } else { 609 boundingPolyBuilder_.setMessage(value); 610 } 611 bitField0_ |= 0x00000001; 612 onChanged(); 613 return this; 614 } 615 /** 616 * 617 * 618 * <pre> 619 * The bounding polygon for the crop region. The coordinates of the bounding 620 * box are in the original image's scale. 621 * </pre> 622 * 623 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 624 */ setBoundingPoly( com.google.cloud.vision.v1.BoundingPoly.Builder builderForValue)625 public Builder setBoundingPoly( 626 com.google.cloud.vision.v1.BoundingPoly.Builder builderForValue) { 627 if (boundingPolyBuilder_ == null) { 628 boundingPoly_ = builderForValue.build(); 629 } else { 630 boundingPolyBuilder_.setMessage(builderForValue.build()); 631 } 632 bitField0_ |= 0x00000001; 633 onChanged(); 634 return this; 635 } 636 /** 637 * 638 * 639 * <pre> 640 * The bounding polygon for the crop region. The coordinates of the bounding 641 * box are in the original image's scale. 642 * </pre> 643 * 644 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 645 */ mergeBoundingPoly(com.google.cloud.vision.v1.BoundingPoly value)646 public Builder mergeBoundingPoly(com.google.cloud.vision.v1.BoundingPoly value) { 647 if (boundingPolyBuilder_ == null) { 648 if (((bitField0_ & 0x00000001) != 0) 649 && boundingPoly_ != null 650 && boundingPoly_ != com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance()) { 651 getBoundingPolyBuilder().mergeFrom(value); 652 } else { 653 boundingPoly_ = value; 654 } 655 } else { 656 boundingPolyBuilder_.mergeFrom(value); 657 } 658 bitField0_ |= 0x00000001; 659 onChanged(); 660 return this; 661 } 662 /** 663 * 664 * 665 * <pre> 666 * The bounding polygon for the crop region. The coordinates of the bounding 667 * box are in the original image's scale. 668 * </pre> 669 * 670 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 671 */ clearBoundingPoly()672 public Builder clearBoundingPoly() { 673 bitField0_ = (bitField0_ & ~0x00000001); 674 boundingPoly_ = null; 675 if (boundingPolyBuilder_ != null) { 676 boundingPolyBuilder_.dispose(); 677 boundingPolyBuilder_ = null; 678 } 679 onChanged(); 680 return this; 681 } 682 /** 683 * 684 * 685 * <pre> 686 * The bounding polygon for the crop region. The coordinates of the bounding 687 * box are in the original image's scale. 688 * </pre> 689 * 690 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 691 */ getBoundingPolyBuilder()692 public com.google.cloud.vision.v1.BoundingPoly.Builder getBoundingPolyBuilder() { 693 bitField0_ |= 0x00000001; 694 onChanged(); 695 return getBoundingPolyFieldBuilder().getBuilder(); 696 } 697 /** 698 * 699 * 700 * <pre> 701 * The bounding polygon for the crop region. The coordinates of the bounding 702 * box are in the original image's scale. 703 * </pre> 704 * 705 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 706 */ getBoundingPolyOrBuilder()707 public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() { 708 if (boundingPolyBuilder_ != null) { 709 return boundingPolyBuilder_.getMessageOrBuilder(); 710 } else { 711 return boundingPoly_ == null 712 ? com.google.cloud.vision.v1.BoundingPoly.getDefaultInstance() 713 : boundingPoly_; 714 } 715 } 716 /** 717 * 718 * 719 * <pre> 720 * The bounding polygon for the crop region. The coordinates of the bounding 721 * box are in the original image's scale. 722 * </pre> 723 * 724 * <code>.google.cloud.vision.v1.BoundingPoly bounding_poly = 1;</code> 725 */ 726 private com.google.protobuf.SingleFieldBuilderV3< 727 com.google.cloud.vision.v1.BoundingPoly, 728 com.google.cloud.vision.v1.BoundingPoly.Builder, 729 com.google.cloud.vision.v1.BoundingPolyOrBuilder> getBoundingPolyFieldBuilder()730 getBoundingPolyFieldBuilder() { 731 if (boundingPolyBuilder_ == null) { 732 boundingPolyBuilder_ = 733 new com.google.protobuf.SingleFieldBuilderV3< 734 com.google.cloud.vision.v1.BoundingPoly, 735 com.google.cloud.vision.v1.BoundingPoly.Builder, 736 com.google.cloud.vision.v1.BoundingPolyOrBuilder>( 737 getBoundingPoly(), getParentForChildren(), isClean()); 738 boundingPoly_ = null; 739 } 740 return boundingPolyBuilder_; 741 } 742 743 private float confidence_; 744 /** 745 * 746 * 747 * <pre> 748 * Confidence of this being a salient region. Range [0, 1]. 749 * </pre> 750 * 751 * <code>float confidence = 2;</code> 752 * 753 * @return The confidence. 754 */ 755 @java.lang.Override getConfidence()756 public float getConfidence() { 757 return confidence_; 758 } 759 /** 760 * 761 * 762 * <pre> 763 * Confidence of this being a salient region. Range [0, 1]. 764 * </pre> 765 * 766 * <code>float confidence = 2;</code> 767 * 768 * @param value The confidence to set. 769 * @return This builder for chaining. 770 */ setConfidence(float value)771 public Builder setConfidence(float value) { 772 773 confidence_ = value; 774 bitField0_ |= 0x00000002; 775 onChanged(); 776 return this; 777 } 778 /** 779 * 780 * 781 * <pre> 782 * Confidence of this being a salient region. Range [0, 1]. 783 * </pre> 784 * 785 * <code>float confidence = 2;</code> 786 * 787 * @return This builder for chaining. 788 */ clearConfidence()789 public Builder clearConfidence() { 790 bitField0_ = (bitField0_ & ~0x00000002); 791 confidence_ = 0F; 792 onChanged(); 793 return this; 794 } 795 796 private float importanceFraction_; 797 /** 798 * 799 * 800 * <pre> 801 * Fraction of importance of this salient region with respect to the original 802 * image. 803 * </pre> 804 * 805 * <code>float importance_fraction = 3;</code> 806 * 807 * @return The importanceFraction. 808 */ 809 @java.lang.Override getImportanceFraction()810 public float getImportanceFraction() { 811 return importanceFraction_; 812 } 813 /** 814 * 815 * 816 * <pre> 817 * Fraction of importance of this salient region with respect to the original 818 * image. 819 * </pre> 820 * 821 * <code>float importance_fraction = 3;</code> 822 * 823 * @param value The importanceFraction to set. 824 * @return This builder for chaining. 825 */ setImportanceFraction(float value)826 public Builder setImportanceFraction(float value) { 827 828 importanceFraction_ = value; 829 bitField0_ |= 0x00000004; 830 onChanged(); 831 return this; 832 } 833 /** 834 * 835 * 836 * <pre> 837 * Fraction of importance of this salient region with respect to the original 838 * image. 839 * </pre> 840 * 841 * <code>float importance_fraction = 3;</code> 842 * 843 * @return This builder for chaining. 844 */ clearImportanceFraction()845 public Builder clearImportanceFraction() { 846 bitField0_ = (bitField0_ & ~0x00000004); 847 importanceFraction_ = 0F; 848 onChanged(); 849 return this; 850 } 851 852 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)853 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 854 return super.setUnknownFields(unknownFields); 855 } 856 857 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)858 public final Builder mergeUnknownFields( 859 final com.google.protobuf.UnknownFieldSet unknownFields) { 860 return super.mergeUnknownFields(unknownFields); 861 } 862 863 // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1.CropHint) 864 } 865 866 // @@protoc_insertion_point(class_scope:google.cloud.vision.v1.CropHint) 867 private static final com.google.cloud.vision.v1.CropHint DEFAULT_INSTANCE; 868 869 static { 870 DEFAULT_INSTANCE = new com.google.cloud.vision.v1.CropHint(); 871 } 872 getDefaultInstance()873 public static com.google.cloud.vision.v1.CropHint getDefaultInstance() { 874 return DEFAULT_INSTANCE; 875 } 876 877 private static final com.google.protobuf.Parser<CropHint> PARSER = 878 new com.google.protobuf.AbstractParser<CropHint>() { 879 @java.lang.Override 880 public CropHint parsePartialFrom( 881 com.google.protobuf.CodedInputStream input, 882 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 883 throws com.google.protobuf.InvalidProtocolBufferException { 884 Builder builder = newBuilder(); 885 try { 886 builder.mergeFrom(input, extensionRegistry); 887 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 888 throw e.setUnfinishedMessage(builder.buildPartial()); 889 } catch (com.google.protobuf.UninitializedMessageException e) { 890 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 891 } catch (java.io.IOException e) { 892 throw new com.google.protobuf.InvalidProtocolBufferException(e) 893 .setUnfinishedMessage(builder.buildPartial()); 894 } 895 return builder.buildPartial(); 896 } 897 }; 898 parser()899 public static com.google.protobuf.Parser<CropHint> parser() { 900 return PARSER; 901 } 902 903 @java.lang.Override getParserForType()904 public com.google.protobuf.Parser<CropHint> getParserForType() { 905 return PARSER; 906 } 907 908 @java.lang.Override getDefaultInstanceForType()909 public com.google.cloud.vision.v1.CropHint getDefaultInstanceForType() { 910 return DEFAULT_INSTANCE; 911 } 912 } 913