// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/language/v1/language_service.proto

package com.google.cloud.language.v1;

/**
 * <pre>
 * The sentiment analysis response message.
 * </pre>
 *
 * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentResponse}
 */
public  final class AnalyzeSentimentResponse extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSentimentResponse)
    AnalyzeSentimentResponseOrBuilder {
private static final long serialVersionUID = 0L;
  // Use AnalyzeSentimentResponse.newBuilder() to construct.
  private AnalyzeSentimentResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private AnalyzeSentimentResponse() {
    language_ = "";
    sentences_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private AnalyzeSentimentResponse(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            com.google.cloud.language.v1.Sentiment.Builder subBuilder = null;
            if (documentSentiment_ != null) {
              subBuilder = documentSentiment_.toBuilder();
            }
            documentSentiment_ = input.readMessage(com.google.cloud.language.v1.Sentiment.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(documentSentiment_);
              documentSentiment_ = subBuilder.buildPartial();
            }

            break;
          }
          case 18: {
            java.lang.String s = input.readStringRequireUtf8();

            language_ = s;
            break;
          }
          case 26: {
            if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
              sentences_ = new java.util.ArrayList<com.google.cloud.language.v1.Sentence>();
              mutable_bitField0_ |= 0x00000004;
            }
            sentences_.add(
                input.readMessage(com.google.cloud.language.v1.Sentence.parser(), extensionRegistry));
            break;
          }
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
        sentences_ = java.util.Collections.unmodifiableList(sentences_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.language.v1.AnalyzeSentimentResponse.class, com.google.cloud.language.v1.AnalyzeSentimentResponse.Builder.class);
  }

  private int bitField0_;
  public static final int DOCUMENT_SENTIMENT_FIELD_NUMBER = 1;
  private com.google.cloud.language.v1.Sentiment documentSentiment_;
  /**
   * <pre>
   * The overall sentiment of the input document.
   * </pre>
   *
   * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
   */
  public boolean hasDocumentSentiment() {
    return documentSentiment_ != null;
  }
  /**
   * <pre>
   * The overall sentiment of the input document.
   * </pre>
   *
   * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
   */
  public com.google.cloud.language.v1.Sentiment getDocumentSentiment() {
    return documentSentiment_ == null ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_;
  }
  /**
   * <pre>
   * The overall sentiment of the input document.
   * </pre>
   *
   * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
   */
  public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() {
    return getDocumentSentiment();
  }

  public static final int LANGUAGE_FIELD_NUMBER = 2;
  private volatile java.lang.Object language_;
  /**
   * <pre>
   * The language of the text, which will be the same as the language specified
   * in the request or, if not specified, the automatically-detected language.
   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
   * </pre>
   *
   * <code>string language = 2;</code>
   */
  public java.lang.String getLanguage() {
    java.lang.Object ref = language_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      language_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The language of the text, which will be the same as the language specified
   * in the request or, if not specified, the automatically-detected language.
   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
   * </pre>
   *
   * <code>string language = 2;</code>
   */
  public com.google.protobuf.ByteString
      getLanguageBytes() {
    java.lang.Object ref = language_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      language_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SENTENCES_FIELD_NUMBER = 3;
  private java.util.List<com.google.cloud.language.v1.Sentence> sentences_;
  /**
   * <pre>
   * The sentiment for all the sentences in the document.
   * </pre>
   *
   * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
   */
  public java.util.List<com.google.cloud.language.v1.Sentence> getSentencesList() {
    return sentences_;
  }
  /**
   * <pre>
   * The sentiment for all the sentences in the document.
   * </pre>
   *
   * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
   */
  public java.util.List<? extends com.google.cloud.language.v1.SentenceOrBuilder> 
      getSentencesOrBuilderList() {
    return sentences_;
  }
  /**
   * <pre>
   * The sentiment for all the sentences in the document.
   * </pre>
   *
   * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
   */
  public int getSentencesCount() {
    return sentences_.size();
  }
  /**
   * <pre>
   * The sentiment for all the sentences in the document.
   * </pre>
   *
   * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
   */
  public com.google.cloud.language.v1.Sentence getSentences(int index) {
    return sentences_.get(index);
  }
  /**
   * <pre>
   * The sentiment for all the sentences in the document.
   * </pre>
   *
   * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
   */
  public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(
      int index) {
    return sentences_.get(index);
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (documentSentiment_ != null) {
      output.writeMessage(1, getDocumentSentiment());
    }
    if (!getLanguageBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_);
    }
    for (int i = 0; i < sentences_.size(); i++) {
      output.writeMessage(3, sentences_.get(i));
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (documentSentiment_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(1, getDocumentSentiment());
    }
    if (!getLanguageBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_);
    }
    for (int i = 0; i < sentences_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(3, sentences_.get(i));
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSentimentResponse)) {
      return super.equals(obj);
    }
    com.google.cloud.language.v1.AnalyzeSentimentResponse other = (com.google.cloud.language.v1.AnalyzeSentimentResponse) obj;

    boolean result = true;
    result = result && (hasDocumentSentiment() == other.hasDocumentSentiment());
    if (hasDocumentSentiment()) {
      result = result && getDocumentSentiment()
          .equals(other.getDocumentSentiment());
    }
    result = result && getLanguage()
        .equals(other.getLanguage());
    result = result && getSentencesList()
        .equals(other.getSentencesList());
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasDocumentSentiment()) {
      hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER;
      hash = (53 * hash) + getDocumentSentiment().hashCode();
    }
    hash = (37 * hash) + LANGUAGE_FIELD_NUMBER;
    hash = (53 * hash) + getLanguage().hashCode();
    if (getSentencesCount() > 0) {
      hash = (37 * hash) + SENTENCES_FIELD_NUMBER;
      hash = (53 * hash) + getSentencesList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.cloud.language.v1.AnalyzeSentimentResponse prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * <pre>
   * The sentiment analysis response message.
   * </pre>
   *
   * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentResponse}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSentimentResponse)
      com.google.cloud.language.v1.AnalyzeSentimentResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.language.v1.AnalyzeSentimentResponse.class, com.google.cloud.language.v1.AnalyzeSentimentResponse.Builder.class);
    }

    // Construct using com.google.cloud.language.v1.AnalyzeSentimentResponse.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getSentencesFieldBuilder();
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (documentSentimentBuilder_ == null) {
        documentSentiment_ = null;
      } else {
        documentSentiment_ = null;
        documentSentimentBuilder_ = null;
      }
      language_ = "";

      if (sentencesBuilder_ == null) {
        sentences_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
      } else {
        sentencesBuilder_.clear();
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstanceForType() {
      return com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.language.v1.AnalyzeSentimentResponse build() {
      com.google.cloud.language.v1.AnalyzeSentimentResponse result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.language.v1.AnalyzeSentimentResponse buildPartial() {
      com.google.cloud.language.v1.AnalyzeSentimentResponse result = new com.google.cloud.language.v1.AnalyzeSentimentResponse(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (documentSentimentBuilder_ == null) {
        result.documentSentiment_ = documentSentiment_;
      } else {
        result.documentSentiment_ = documentSentimentBuilder_.build();
      }
      result.language_ = language_;
      if (sentencesBuilder_ == null) {
        if (((bitField0_ & 0x00000004) == 0x00000004)) {
          sentences_ = java.util.Collections.unmodifiableList(sentences_);
          bitField0_ = (bitField0_ & ~0x00000004);
        }
        result.sentences_ = sentences_;
      } else {
        result.sentences_ = sentencesBuilder_.build();
      }
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return (Builder) super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.language.v1.AnalyzeSentimentResponse) {
        return mergeFrom((com.google.cloud.language.v1.AnalyzeSentimentResponse)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSentimentResponse other) {
      if (other == com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance()) return this;
      if (other.hasDocumentSentiment()) {
        mergeDocumentSentiment(other.getDocumentSentiment());
      }
      if (!other.getLanguage().isEmpty()) {
        language_ = other.language_;
        onChanged();
      }
      if (sentencesBuilder_ == null) {
        if (!other.sentences_.isEmpty()) {
          if (sentences_.isEmpty()) {
            sentences_ = other.sentences_;
            bitField0_ = (bitField0_ & ~0x00000004);
          } else {
            ensureSentencesIsMutable();
            sentences_.addAll(other.sentences_);
          }
          onChanged();
        }
      } else {
        if (!other.sentences_.isEmpty()) {
          if (sentencesBuilder_.isEmpty()) {
            sentencesBuilder_.dispose();
            sentencesBuilder_ = null;
            sentences_ = other.sentences_;
            bitField0_ = (bitField0_ & ~0x00000004);
            sentencesBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getSentencesFieldBuilder() : null;
          } else {
            sentencesBuilder_.addAllMessages(other.sentences_);
          }
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.cloud.language.v1.AnalyzeSentimentResponse parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.language.v1.AnalyzeSentimentResponse) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private com.google.cloud.language.v1.Sentiment documentSentiment_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder> documentSentimentBuilder_;
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public boolean hasDocumentSentiment() {
      return documentSentimentBuilder_ != null || documentSentiment_ != null;
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public com.google.cloud.language.v1.Sentiment getDocumentSentiment() {
      if (documentSentimentBuilder_ == null) {
        return documentSentiment_ == null ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_;
      } else {
        return documentSentimentBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public Builder setDocumentSentiment(com.google.cloud.language.v1.Sentiment value) {
      if (documentSentimentBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        documentSentiment_ = value;
        onChanged();
      } else {
        documentSentimentBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public Builder setDocumentSentiment(
        com.google.cloud.language.v1.Sentiment.Builder builderForValue) {
      if (documentSentimentBuilder_ == null) {
        documentSentiment_ = builderForValue.build();
        onChanged();
      } else {
        documentSentimentBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public Builder mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value) {
      if (documentSentimentBuilder_ == null) {
        if (documentSentiment_ != null) {
          documentSentiment_ =
            com.google.cloud.language.v1.Sentiment.newBuilder(documentSentiment_).mergeFrom(value).buildPartial();
        } else {
          documentSentiment_ = value;
        }
        onChanged();
      } else {
        documentSentimentBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public Builder clearDocumentSentiment() {
      if (documentSentimentBuilder_ == null) {
        documentSentiment_ = null;
        onChanged();
      } else {
        documentSentiment_ = null;
        documentSentimentBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public com.google.cloud.language.v1.Sentiment.Builder getDocumentSentimentBuilder() {
      
      onChanged();
      return getDocumentSentimentFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() {
      if (documentSentimentBuilder_ != null) {
        return documentSentimentBuilder_.getMessageOrBuilder();
      } else {
        return documentSentiment_ == null ?
            com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_;
      }
    }
    /**
     * <pre>
     * The overall sentiment of the input document.
     * </pre>
     *
     * <code>.google.cloud.language.v1.Sentiment document_sentiment = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder> 
        getDocumentSentimentFieldBuilder() {
      if (documentSentimentBuilder_ == null) {
        documentSentimentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder>(
                getDocumentSentiment(),
                getParentForChildren(),
                isClean());
        documentSentiment_ = null;
      }
      return documentSentimentBuilder_;
    }

    private java.lang.Object language_ = "";
    /**
     * <pre>
     * The language of the text, which will be the same as the language specified
     * in the request or, if not specified, the automatically-detected language.
     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
     * </pre>
     *
     * <code>string language = 2;</code>
     */
    public java.lang.String getLanguage() {
      java.lang.Object ref = language_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        language_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The language of the text, which will be the same as the language specified
     * in the request or, if not specified, the automatically-detected language.
     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
     * </pre>
     *
     * <code>string language = 2;</code>
     */
    public com.google.protobuf.ByteString
        getLanguageBytes() {
      java.lang.Object ref = language_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        language_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The language of the text, which will be the same as the language specified
     * in the request or, if not specified, the automatically-detected language.
     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
     * </pre>
     *
     * <code>string language = 2;</code>
     */
    public Builder setLanguage(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      language_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The language of the text, which will be the same as the language specified
     * in the request or, if not specified, the automatically-detected language.
     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
     * </pre>
     *
     * <code>string language = 2;</code>
     */
    public Builder clearLanguage() {
      
      language_ = getDefaultInstance().getLanguage();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The language of the text, which will be the same as the language specified
     * in the request or, if not specified, the automatically-detected language.
     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
     * </pre>
     *
     * <code>string language = 2;</code>
     */
    public Builder setLanguageBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      language_ = value;
      onChanged();
      return this;
    }

    private java.util.List<com.google.cloud.language.v1.Sentence> sentences_ =
      java.util.Collections.emptyList();
    private void ensureSentencesIsMutable() {
      if (!((bitField0_ & 0x00000004) == 0x00000004)) {
        sentences_ = new java.util.ArrayList<com.google.cloud.language.v1.Sentence>(sentences_);
        bitField0_ |= 0x00000004;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> sentencesBuilder_;

    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public java.util.List<com.google.cloud.language.v1.Sentence> getSentencesList() {
      if (sentencesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(sentences_);
      } else {
        return sentencesBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public int getSentencesCount() {
      if (sentencesBuilder_ == null) {
        return sentences_.size();
      } else {
        return sentencesBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public com.google.cloud.language.v1.Sentence getSentences(int index) {
      if (sentencesBuilder_ == null) {
        return sentences_.get(index);
      } else {
        return sentencesBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder setSentences(
        int index, com.google.cloud.language.v1.Sentence value) {
      if (sentencesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSentencesIsMutable();
        sentences_.set(index, value);
        onChanged();
      } else {
        sentencesBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder setSentences(
        int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) {
      if (sentencesBuilder_ == null) {
        ensureSentencesIsMutable();
        sentences_.set(index, builderForValue.build());
        onChanged();
      } else {
        sentencesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder addSentences(com.google.cloud.language.v1.Sentence value) {
      if (sentencesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSentencesIsMutable();
        sentences_.add(value);
        onChanged();
      } else {
        sentencesBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder addSentences(
        int index, com.google.cloud.language.v1.Sentence value) {
      if (sentencesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSentencesIsMutable();
        sentences_.add(index, value);
        onChanged();
      } else {
        sentencesBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder addSentences(
        com.google.cloud.language.v1.Sentence.Builder builderForValue) {
      if (sentencesBuilder_ == null) {
        ensureSentencesIsMutable();
        sentences_.add(builderForValue.build());
        onChanged();
      } else {
        sentencesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder addSentences(
        int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) {
      if (sentencesBuilder_ == null) {
        ensureSentencesIsMutable();
        sentences_.add(index, builderForValue.build());
        onChanged();
      } else {
        sentencesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder addAllSentences(
        java.lang.Iterable<? extends com.google.cloud.language.v1.Sentence> values) {
      if (sentencesBuilder_ == null) {
        ensureSentencesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, sentences_);
        onChanged();
      } else {
        sentencesBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder clearSentences() {
      if (sentencesBuilder_ == null) {
        sentences_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
      } else {
        sentencesBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public Builder removeSentences(int index) {
      if (sentencesBuilder_ == null) {
        ensureSentencesIsMutable();
        sentences_.remove(index);
        onChanged();
      } else {
        sentencesBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder(
        int index) {
      return getSentencesFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(
        int index) {
      if (sentencesBuilder_ == null) {
        return sentences_.get(index);  } else {
        return sentencesBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public java.util.List<? extends com.google.cloud.language.v1.SentenceOrBuilder> 
         getSentencesOrBuilderList() {
      if (sentencesBuilder_ != null) {
        return sentencesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(sentences_);
      }
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() {
      return getSentencesFieldBuilder().addBuilder(
          com.google.cloud.language.v1.Sentence.getDefaultInstance());
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder(
        int index) {
      return getSentencesFieldBuilder().addBuilder(
          index, com.google.cloud.language.v1.Sentence.getDefaultInstance());
    }
    /**
     * <pre>
     * The sentiment for all the sentences in the document.
     * </pre>
     *
     * <code>repeated .google.cloud.language.v1.Sentence sentences = 3;</code>
     */
    public java.util.List<com.google.cloud.language.v1.Sentence.Builder> 
         getSentencesBuilderList() {
      return getSentencesFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> 
        getSentencesFieldBuilder() {
      if (sentencesBuilder_ == null) {
        sentencesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder>(
                sentences_,
                ((bitField0_ & 0x00000004) == 0x00000004),
                getParentForChildren(),
                isClean());
        sentences_ = null;
      }
      return sentencesBuilder_;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeSentimentResponse)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSentimentResponse)
  private static final com.google.cloud.language.v1.AnalyzeSentimentResponse DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSentimentResponse();
  }

  public static com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<AnalyzeSentimentResponse>
      PARSER = new com.google.protobuf.AbstractParser<AnalyzeSentimentResponse>() {
    @java.lang.Override
    public AnalyzeSentimentResponse parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new AnalyzeSentimentResponse(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<AnalyzeSentimentResponse> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<AnalyzeSentimentResponse> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

