• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/cloud/automl/v1/classification.proto
18 
19 package com.google.cloud.automl.v1;
20 
21 /**
22  *
23  *
24  * <pre>
25  * Contains annotation details specific to classification.
26  * </pre>
27  *
28  * Protobuf type {@code google.cloud.automl.v1.ClassificationAnnotation}
29  */
30 public final class ClassificationAnnotation extends com.google.protobuf.GeneratedMessageV3
31     implements
32     // @@protoc_insertion_point(message_implements:google.cloud.automl.v1.ClassificationAnnotation)
33     ClassificationAnnotationOrBuilder {
34   private static final long serialVersionUID = 0L;
35   // Use ClassificationAnnotation.newBuilder() to construct.
ClassificationAnnotation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36   private ClassificationAnnotation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
37     super(builder);
38   }
39 
ClassificationAnnotation()40   private ClassificationAnnotation() {}
41 
42   @java.lang.Override
43   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)44   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
45     return new ClassificationAnnotation();
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.automl.v1.ClassificationProto
55         .internal_static_google_cloud_automl_v1_ClassificationAnnotation_descriptor;
56   }
57 
58   @java.lang.Override
59   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()60       internalGetFieldAccessorTable() {
61     return com.google.cloud.automl.v1.ClassificationProto
62         .internal_static_google_cloud_automl_v1_ClassificationAnnotation_fieldAccessorTable
63         .ensureFieldAccessorsInitialized(
64             com.google.cloud.automl.v1.ClassificationAnnotation.class,
65             com.google.cloud.automl.v1.ClassificationAnnotation.Builder.class);
66   }
67 
68   public static final int SCORE_FIELD_NUMBER = 1;
69   private float score_ = 0F;
70   /**
71    *
72    *
73    * <pre>
74    * Output only. A confidence estimate between 0.0 and 1.0. A higher value
75    * means greater confidence that the annotation is positive. If a user
76    * approves an annotation as negative or positive, the score value remains
77    * unchanged. If a user creates an annotation, the score is 0 for negative or
78    * 1 for positive.
79    * </pre>
80    *
81    * <code>float score = 1;</code>
82    *
83    * @return The score.
84    */
85   @java.lang.Override
getScore()86   public float getScore() {
87     return score_;
88   }
89 
90   private byte memoizedIsInitialized = -1;
91 
92   @java.lang.Override
isInitialized()93   public final boolean isInitialized() {
94     byte isInitialized = memoizedIsInitialized;
95     if (isInitialized == 1) return true;
96     if (isInitialized == 0) return false;
97 
98     memoizedIsInitialized = 1;
99     return true;
100   }
101 
102   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)103   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
104     if (java.lang.Float.floatToRawIntBits(score_) != 0) {
105       output.writeFloat(1, score_);
106     }
107     getUnknownFields().writeTo(output);
108   }
109 
110   @java.lang.Override
getSerializedSize()111   public int getSerializedSize() {
112     int size = memoizedSize;
113     if (size != -1) return size;
114 
115     size = 0;
116     if (java.lang.Float.floatToRawIntBits(score_) != 0) {
117       size += com.google.protobuf.CodedOutputStream.computeFloatSize(1, score_);
118     }
119     size += getUnknownFields().getSerializedSize();
120     memoizedSize = size;
121     return size;
122   }
123 
124   @java.lang.Override
equals(final java.lang.Object obj)125   public boolean equals(final java.lang.Object obj) {
126     if (obj == this) {
127       return true;
128     }
129     if (!(obj instanceof com.google.cloud.automl.v1.ClassificationAnnotation)) {
130       return super.equals(obj);
131     }
132     com.google.cloud.automl.v1.ClassificationAnnotation other =
133         (com.google.cloud.automl.v1.ClassificationAnnotation) obj;
134 
135     if (java.lang.Float.floatToIntBits(getScore())
136         != java.lang.Float.floatToIntBits(other.getScore())) return false;
137     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
138     return true;
139   }
140 
141   @java.lang.Override
hashCode()142   public int hashCode() {
143     if (memoizedHashCode != 0) {
144       return memoizedHashCode;
145     }
146     int hash = 41;
147     hash = (19 * hash) + getDescriptor().hashCode();
148     hash = (37 * hash) + SCORE_FIELD_NUMBER;
149     hash = (53 * hash) + java.lang.Float.floatToIntBits(getScore());
150     hash = (29 * hash) + getUnknownFields().hashCode();
151     memoizedHashCode = hash;
152     return hash;
153   }
154 
parseFrom( java.nio.ByteBuffer data)155   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
156       java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
157     return PARSER.parseFrom(data);
158   }
159 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)160   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
161       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
162       throws com.google.protobuf.InvalidProtocolBufferException {
163     return PARSER.parseFrom(data, extensionRegistry);
164   }
165 
parseFrom( com.google.protobuf.ByteString data)166   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
167       com.google.protobuf.ByteString data)
168       throws com.google.protobuf.InvalidProtocolBufferException {
169     return PARSER.parseFrom(data);
170   }
171 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)172   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
173       com.google.protobuf.ByteString data,
174       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
175       throws com.google.protobuf.InvalidProtocolBufferException {
176     return PARSER.parseFrom(data, extensionRegistry);
177   }
178 
parseFrom(byte[] data)179   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(byte[] data)
180       throws com.google.protobuf.InvalidProtocolBufferException {
181     return PARSER.parseFrom(data);
182   }
183 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)184   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
185       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
186       throws com.google.protobuf.InvalidProtocolBufferException {
187     return PARSER.parseFrom(data, extensionRegistry);
188   }
189 
parseFrom( java.io.InputStream input)190   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
191       java.io.InputStream input) throws java.io.IOException {
192     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
193   }
194 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)195   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
196       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
197       throws java.io.IOException {
198     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
199         PARSER, input, extensionRegistry);
200   }
201 
parseDelimitedFrom( java.io.InputStream input)202   public static com.google.cloud.automl.v1.ClassificationAnnotation parseDelimitedFrom(
203       java.io.InputStream input) throws java.io.IOException {
204     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
205   }
206 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)207   public static com.google.cloud.automl.v1.ClassificationAnnotation parseDelimitedFrom(
208       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
209       throws java.io.IOException {
210     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
211         PARSER, input, extensionRegistry);
212   }
213 
parseFrom( com.google.protobuf.CodedInputStream input)214   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
215       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
216     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
217   }
218 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)219   public static com.google.cloud.automl.v1.ClassificationAnnotation parseFrom(
220       com.google.protobuf.CodedInputStream input,
221       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
222       throws java.io.IOException {
223     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
224         PARSER, input, extensionRegistry);
225   }
226 
227   @java.lang.Override
newBuilderForType()228   public Builder newBuilderForType() {
229     return newBuilder();
230   }
231 
newBuilder()232   public static Builder newBuilder() {
233     return DEFAULT_INSTANCE.toBuilder();
234   }
235 
newBuilder(com.google.cloud.automl.v1.ClassificationAnnotation prototype)236   public static Builder newBuilder(com.google.cloud.automl.v1.ClassificationAnnotation prototype) {
237     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
238   }
239 
240   @java.lang.Override
toBuilder()241   public Builder toBuilder() {
242     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
243   }
244 
245   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)246   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
247     Builder builder = new Builder(parent);
248     return builder;
249   }
250   /**
251    *
252    *
253    * <pre>
254    * Contains annotation details specific to classification.
255    * </pre>
256    *
257    * Protobuf type {@code google.cloud.automl.v1.ClassificationAnnotation}
258    */
259   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
260       implements
261       // @@protoc_insertion_point(builder_implements:google.cloud.automl.v1.ClassificationAnnotation)
262       com.google.cloud.automl.v1.ClassificationAnnotationOrBuilder {
getDescriptor()263     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
264       return com.google.cloud.automl.v1.ClassificationProto
265           .internal_static_google_cloud_automl_v1_ClassificationAnnotation_descriptor;
266     }
267 
268     @java.lang.Override
269     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()270         internalGetFieldAccessorTable() {
271       return com.google.cloud.automl.v1.ClassificationProto
272           .internal_static_google_cloud_automl_v1_ClassificationAnnotation_fieldAccessorTable
273           .ensureFieldAccessorsInitialized(
274               com.google.cloud.automl.v1.ClassificationAnnotation.class,
275               com.google.cloud.automl.v1.ClassificationAnnotation.Builder.class);
276     }
277 
278     // Construct using com.google.cloud.automl.v1.ClassificationAnnotation.newBuilder()
Builder()279     private Builder() {}
280 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)281     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
282       super(parent);
283     }
284 
285     @java.lang.Override
clear()286     public Builder clear() {
287       super.clear();
288       bitField0_ = 0;
289       score_ = 0F;
290       return this;
291     }
292 
293     @java.lang.Override
getDescriptorForType()294     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
295       return com.google.cloud.automl.v1.ClassificationProto
296           .internal_static_google_cloud_automl_v1_ClassificationAnnotation_descriptor;
297     }
298 
299     @java.lang.Override
getDefaultInstanceForType()300     public com.google.cloud.automl.v1.ClassificationAnnotation getDefaultInstanceForType() {
301       return com.google.cloud.automl.v1.ClassificationAnnotation.getDefaultInstance();
302     }
303 
304     @java.lang.Override
build()305     public com.google.cloud.automl.v1.ClassificationAnnotation build() {
306       com.google.cloud.automl.v1.ClassificationAnnotation result = buildPartial();
307       if (!result.isInitialized()) {
308         throw newUninitializedMessageException(result);
309       }
310       return result;
311     }
312 
313     @java.lang.Override
buildPartial()314     public com.google.cloud.automl.v1.ClassificationAnnotation buildPartial() {
315       com.google.cloud.automl.v1.ClassificationAnnotation result =
316           new com.google.cloud.automl.v1.ClassificationAnnotation(this);
317       if (bitField0_ != 0) {
318         buildPartial0(result);
319       }
320       onBuilt();
321       return result;
322     }
323 
buildPartial0(com.google.cloud.automl.v1.ClassificationAnnotation result)324     private void buildPartial0(com.google.cloud.automl.v1.ClassificationAnnotation result) {
325       int from_bitField0_ = bitField0_;
326       if (((from_bitField0_ & 0x00000001) != 0)) {
327         result.score_ = score_;
328       }
329     }
330 
331     @java.lang.Override
clone()332     public Builder clone() {
333       return super.clone();
334     }
335 
336     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)337     public Builder setField(
338         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
339       return super.setField(field, value);
340     }
341 
342     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)343     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
344       return super.clearField(field);
345     }
346 
347     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)348     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
349       return super.clearOneof(oneof);
350     }
351 
352     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)353     public Builder setRepeatedField(
354         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
355       return super.setRepeatedField(field, index, value);
356     }
357 
358     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)359     public Builder addRepeatedField(
360         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
361       return super.addRepeatedField(field, value);
362     }
363 
364     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)365     public Builder mergeFrom(com.google.protobuf.Message other) {
366       if (other instanceof com.google.cloud.automl.v1.ClassificationAnnotation) {
367         return mergeFrom((com.google.cloud.automl.v1.ClassificationAnnotation) other);
368       } else {
369         super.mergeFrom(other);
370         return this;
371       }
372     }
373 
mergeFrom(com.google.cloud.automl.v1.ClassificationAnnotation other)374     public Builder mergeFrom(com.google.cloud.automl.v1.ClassificationAnnotation other) {
375       if (other == com.google.cloud.automl.v1.ClassificationAnnotation.getDefaultInstance())
376         return this;
377       if (other.getScore() != 0F) {
378         setScore(other.getScore());
379       }
380       this.mergeUnknownFields(other.getUnknownFields());
381       onChanged();
382       return this;
383     }
384 
385     @java.lang.Override
isInitialized()386     public final boolean isInitialized() {
387       return true;
388     }
389 
390     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)391     public Builder mergeFrom(
392         com.google.protobuf.CodedInputStream input,
393         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
394         throws java.io.IOException {
395       if (extensionRegistry == null) {
396         throw new java.lang.NullPointerException();
397       }
398       try {
399         boolean done = false;
400         while (!done) {
401           int tag = input.readTag();
402           switch (tag) {
403             case 0:
404               done = true;
405               break;
406             case 13:
407               {
408                 score_ = input.readFloat();
409                 bitField0_ |= 0x00000001;
410                 break;
411               } // case 13
412             default:
413               {
414                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
415                   done = true; // was an endgroup tag
416                 }
417                 break;
418               } // default:
419           } // switch (tag)
420         } // while (!done)
421       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
422         throw e.unwrapIOException();
423       } finally {
424         onChanged();
425       } // finally
426       return this;
427     }
428 
429     private int bitField0_;
430 
431     private float score_;
432     /**
433      *
434      *
435      * <pre>
436      * Output only. A confidence estimate between 0.0 and 1.0. A higher value
437      * means greater confidence that the annotation is positive. If a user
438      * approves an annotation as negative or positive, the score value remains
439      * unchanged. If a user creates an annotation, the score is 0 for negative or
440      * 1 for positive.
441      * </pre>
442      *
443      * <code>float score = 1;</code>
444      *
445      * @return The score.
446      */
447     @java.lang.Override
getScore()448     public float getScore() {
449       return score_;
450     }
451     /**
452      *
453      *
454      * <pre>
455      * Output only. A confidence estimate between 0.0 and 1.0. A higher value
456      * means greater confidence that the annotation is positive. If a user
457      * approves an annotation as negative or positive, the score value remains
458      * unchanged. If a user creates an annotation, the score is 0 for negative or
459      * 1 for positive.
460      * </pre>
461      *
462      * <code>float score = 1;</code>
463      *
464      * @param value The score to set.
465      * @return This builder for chaining.
466      */
setScore(float value)467     public Builder setScore(float value) {
468 
469       score_ = value;
470       bitField0_ |= 0x00000001;
471       onChanged();
472       return this;
473     }
474     /**
475      *
476      *
477      * <pre>
478      * Output only. A confidence estimate between 0.0 and 1.0. A higher value
479      * means greater confidence that the annotation is positive. If a user
480      * approves an annotation as negative or positive, the score value remains
481      * unchanged. If a user creates an annotation, the score is 0 for negative or
482      * 1 for positive.
483      * </pre>
484      *
485      * <code>float score = 1;</code>
486      *
487      * @return This builder for chaining.
488      */
clearScore()489     public Builder clearScore() {
490       bitField0_ = (bitField0_ & ~0x00000001);
491       score_ = 0F;
492       onChanged();
493       return this;
494     }
495 
496     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)497     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
498       return super.setUnknownFields(unknownFields);
499     }
500 
501     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)502     public final Builder mergeUnknownFields(
503         final com.google.protobuf.UnknownFieldSet unknownFields) {
504       return super.mergeUnknownFields(unknownFields);
505     }
506 
507     // @@protoc_insertion_point(builder_scope:google.cloud.automl.v1.ClassificationAnnotation)
508   }
509 
510   // @@protoc_insertion_point(class_scope:google.cloud.automl.v1.ClassificationAnnotation)
511   private static final com.google.cloud.automl.v1.ClassificationAnnotation DEFAULT_INSTANCE;
512 
513   static {
514     DEFAULT_INSTANCE = new com.google.cloud.automl.v1.ClassificationAnnotation();
515   }
516 
getDefaultInstance()517   public static com.google.cloud.automl.v1.ClassificationAnnotation getDefaultInstance() {
518     return DEFAULT_INSTANCE;
519   }
520 
521   private static final com.google.protobuf.Parser<ClassificationAnnotation> PARSER =
522       new com.google.protobuf.AbstractParser<ClassificationAnnotation>() {
523         @java.lang.Override
524         public ClassificationAnnotation parsePartialFrom(
525             com.google.protobuf.CodedInputStream input,
526             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
527             throws com.google.protobuf.InvalidProtocolBufferException {
528           Builder builder = newBuilder();
529           try {
530             builder.mergeFrom(input, extensionRegistry);
531           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
532             throw e.setUnfinishedMessage(builder.buildPartial());
533           } catch (com.google.protobuf.UninitializedMessageException e) {
534             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
535           } catch (java.io.IOException e) {
536             throw new com.google.protobuf.InvalidProtocolBufferException(e)
537                 .setUnfinishedMessage(builder.buildPartial());
538           }
539           return builder.buildPartial();
540         }
541       };
542 
parser()543   public static com.google.protobuf.Parser<ClassificationAnnotation> parser() {
544     return PARSER;
545   }
546 
547   @java.lang.Override
getParserForType()548   public com.google.protobuf.Parser<ClassificationAnnotation> getParserForType() {
549     return PARSER;
550   }
551 
552   @java.lang.Override
getDefaultInstanceForType()553   public com.google.cloud.automl.v1.ClassificationAnnotation getDefaultInstanceForType() {
554     return DEFAULT_INSTANCE;
555   }
556 }
557