/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/contentwarehouse/v1/synonymset.proto

package com.google.cloud.contentwarehouse.v1;

/**
 *
 *
 * <pre>
 * Represents a list of synonyms for a given context.
 * For example a context "sales" could contain:
 * Synonym 1: sale, invoice, bill, order
 * Synonym 2: money, credit, finance, payment
 * Synonym 3: shipping, freight, transport
 * Each SynonymSets should be disjoint
 * </pre>
 *
 * Protobuf type {@code google.cloud.contentwarehouse.v1.SynonymSet}
 */
public final class SynonymSet extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.contentwarehouse.v1.SynonymSet)
    SynonymSetOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use SynonymSet.newBuilder() to construct.
  private SynonymSet(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private SynonymSet() {
    name_ = "";
    context_ = "";
    synonyms_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new SynonymSet();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.contentwarehouse.v1.SynonymSetProto
        .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.contentwarehouse.v1.SynonymSetProto
        .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.contentwarehouse.v1.SynonymSet.class,
            com.google.cloud.contentwarehouse.v1.SynonymSet.Builder.class);
  }

  public interface SynonymOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.contentwarehouse.v1.SynonymSet.Synonym)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @return A list containing the words.
     */
    java.util.List<java.lang.String> getWordsList();
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @return The count of words.
     */
    int getWordsCount();
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @param index The index of the element to return.
     * @return The words at the given index.
     */
    java.lang.String getWords(int index);
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the words at the given index.
     */
    com.google.protobuf.ByteString getWordsBytes(int index);
  }
  /**
   *
   *
   * <pre>
   * Represents a list of words given by the customer
   * All these words are synonyms of each other.
   * </pre>
   *
   * Protobuf type {@code google.cloud.contentwarehouse.v1.SynonymSet.Synonym}
   */
  public static final class Synonym extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.contentwarehouse.v1.SynonymSet.Synonym)
      SynonymOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use Synonym.newBuilder() to construct.
    private Synonym(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private Synonym() {
      words_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    }

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
      return new Synonym();
    }

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
      return this.unknownFields;
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.contentwarehouse.v1.SynonymSetProto
          .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_Synonym_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.contentwarehouse.v1.SynonymSetProto
          .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_Synonym_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.class,
              com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder.class);
    }

    public static final int WORDS_FIELD_NUMBER = 1;

    @SuppressWarnings("serial")
    private com.google.protobuf.LazyStringList words_;
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @return A list containing the words.
     */
    public com.google.protobuf.ProtocolStringList getWordsList() {
      return words_;
    }
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @return The count of words.
     */
    public int getWordsCount() {
      return words_.size();
    }
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @param index The index of the element to return.
     * @return The words at the given index.
     */
    public java.lang.String getWords(int index) {
      return words_.get(index);
    }
    /**
     *
     *
     * <pre>
     * For example: sale, invoice, bill, order
     * </pre>
     *
     * <code>repeated string words = 1;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the words at the given index.
     */
    public com.google.protobuf.ByteString getWordsBytes(int index) {
      return words_.getByteString(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 {
      for (int i = 0; i < words_.size(); i++) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, words_.getRaw(i));
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      {
        int dataSize = 0;
        for (int i = 0; i < words_.size(); i++) {
          dataSize += computeStringSizeNoTag(words_.getRaw(i));
        }
        size += dataSize;
        size += 1 * getWordsList().size();
      }
      size += getUnknownFields().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.contentwarehouse.v1.SynonymSet.Synonym)) {
        return super.equals(obj);
      }
      com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym other =
          (com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym) obj;

      if (!getWordsList().equals(other.getWordsList())) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      if (getWordsCount() > 0) {
        hash = (37 * hash) + WORDS_FIELD_NUMBER;
        hash = (53 * hash) + getWordsList().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym 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.contentwarehouse.v1.SynonymSet.Synonym parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym 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.contentwarehouse.v1.SynonymSet.Synonym parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym 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.contentwarehouse.v1.SynonymSet.Synonym parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym 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.contentwarehouse.v1.SynonymSet.Synonym parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym 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.contentwarehouse.v1.SynonymSet.Synonym 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>
     * Represents a list of words given by the customer
     * All these words are synonyms of each other.
     * </pre>
     *
     * Protobuf type {@code google.cloud.contentwarehouse.v1.SynonymSet.Synonym}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.contentwarehouse.v1.SynonymSet.Synonym)
        com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.contentwarehouse.v1.SynonymSetProto
            .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_Synonym_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.contentwarehouse.v1.SynonymSetProto
            .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_Synonym_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.class,
                com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder.class);
      }

      // Construct using com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        words_ = com.google.protobuf.LazyStringArrayList.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.cloud.contentwarehouse.v1.SynonymSetProto
            .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_Synonym_descriptor;
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym getDefaultInstanceForType() {
        return com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.getDefaultInstance();
      }

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

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym buildPartial() {
        com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym result =
            new com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym(this);
        buildPartialRepeatedFields(result);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartialRepeatedFields(
          com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym result) {
        if (((bitField0_ & 0x00000001) != 0)) {
          words_ = words_.getUnmodifiableView();
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.words_ = words_;
      }

      private void buildPartial0(com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym result) {
        int from_bitField0_ = bitField0_;
      }

      @java.lang.Override
      public Builder clone() {
        return super.clone();
      }

      @java.lang.Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.setField(field, value);
      }

      @java.lang.Override
      public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }

      @java.lang.Override
      public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }

      @java.lang.Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index,
          java.lang.Object value) {
        return super.setRepeatedField(field, index, value);
      }

      @java.lang.Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.addRepeatedField(field, value);
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym) {
          return mergeFrom((com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym other) {
        if (other == com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.getDefaultInstance())
          return this;
        if (!other.words_.isEmpty()) {
          if (words_.isEmpty()) {
            words_ = other.words_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureWordsIsMutable();
            words_.addAll(other.words_);
          }
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        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 {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  java.lang.String s = input.readStringRequireUtf8();
                  ensureWordsIsMutable();
                  words_.add(s);
                  break;
                } // case 10
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private com.google.protobuf.LazyStringList words_ =
          com.google.protobuf.LazyStringArrayList.EMPTY;

      private void ensureWordsIsMutable() {
        if (!((bitField0_ & 0x00000001) != 0)) {
          words_ = new com.google.protobuf.LazyStringArrayList(words_);
          bitField0_ |= 0x00000001;
        }
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @return A list containing the words.
       */
      public com.google.protobuf.ProtocolStringList getWordsList() {
        return words_.getUnmodifiableView();
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @return The count of words.
       */
      public int getWordsCount() {
        return words_.size();
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @param index The index of the element to return.
       * @return The words at the given index.
       */
      public java.lang.String getWords(int index) {
        return words_.get(index);
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @param index The index of the value to return.
       * @return The bytes of the words at the given index.
       */
      public com.google.protobuf.ByteString getWordsBytes(int index) {
        return words_.getByteString(index);
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @param index The index to set the value at.
       * @param value The words to set.
       * @return This builder for chaining.
       */
      public Builder setWords(int index, java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureWordsIsMutable();
        words_.set(index, value);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @param value The words to add.
       * @return This builder for chaining.
       */
      public Builder addWords(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureWordsIsMutable();
        words_.add(value);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @param values The words to add.
       * @return This builder for chaining.
       */
      public Builder addAllWords(java.lang.Iterable<java.lang.String> values) {
        ensureWordsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, words_);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearWords() {
        words_ = com.google.protobuf.LazyStringArrayList.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * For example: sale, invoice, bill, order
       * </pre>
       *
       * <code>repeated string words = 1;</code>
       *
       * @param value The bytes of the words to add.
       * @return This builder for chaining.
       */
      public Builder addWordsBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        ensureWordsIsMutable();
        words_.add(value);
        onChanged();
        return this;
      }

      @java.lang.Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.setUnknownFields(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.contentwarehouse.v1.SynonymSet.Synonym)
    }

    // @@protoc_insertion_point(class_scope:google.cloud.contentwarehouse.v1.SynonymSet.Synonym)
    private static final com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym();
    }

    public static com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Synonym> PARSER =
        new com.google.protobuf.AbstractParser<Synonym>() {
          @java.lang.Override
          public Synonym parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

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

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

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public static final int NAME_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object name_ = "";
  /**
   *
   *
   * <pre>
   * The resource name of the SynonymSet
   * This is mandatory for google.api.resource.
   * Format:
   * projects/{project_number}/locations/{location}/synonymSets/{context}.
   * </pre>
   *
   * <code>string name = 1;</code>
   *
   * @return The name.
   */
  @java.lang.Override
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    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();
      name_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The resource name of the SynonymSet
   * This is mandatory for google.api.resource.
   * Format:
   * projects/{project_number}/locations/{location}/synonymSets/{context}.
   * </pre>
   *
   * <code>string name = 1;</code>
   *
   * @return The bytes for name.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CONTEXT_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private volatile java.lang.Object context_ = "";
  /**
   *
   *
   * <pre>
   * This is a freeform field. Example contexts can be "sales," "engineering,"
   * "real estate," "accounting," etc.
   * The context can be supplied during search requests.
   * </pre>
   *
   * <code>string context = 2;</code>
   *
   * @return The context.
   */
  @java.lang.Override
  public java.lang.String getContext() {
    java.lang.Object ref = context_;
    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();
      context_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * This is a freeform field. Example contexts can be "sales," "engineering,"
   * "real estate," "accounting," etc.
   * The context can be supplied during search requests.
   * </pre>
   *
   * <code>string context = 2;</code>
   *
   * @return The bytes for context.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getContextBytes() {
    java.lang.Object ref = context_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      context_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SYNONYMS_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private java.util.List<com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym> synonyms_;
  /**
   *
   *
   * <pre>
   * List of Synonyms for the context.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym> getSynonymsList() {
    return synonyms_;
  }
  /**
   *
   *
   * <pre>
   * List of Synonyms for the context.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder>
      getSynonymsOrBuilderList() {
    return synonyms_;
  }
  /**
   *
   *
   * <pre>
   * List of Synonyms for the context.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
   */
  @java.lang.Override
  public int getSynonymsCount() {
    return synonyms_.size();
  }
  /**
   *
   *
   * <pre>
   * List of Synonyms for the context.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym getSynonyms(int index) {
    return synonyms_.get(index);
  }
  /**
   *
   *
   * <pre>
   * List of Synonyms for the context.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder getSynonymsOrBuilder(
      int index) {
    return synonyms_.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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(context_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, context_);
    }
    for (int i = 0; i < synonyms_.size(); i++) {
      output.writeMessage(3, synonyms_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(context_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, context_);
    }
    for (int i = 0; i < synonyms_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, synonyms_.get(i));
    }
    size += getUnknownFields().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.contentwarehouse.v1.SynonymSet)) {
      return super.equals(obj);
    }
    com.google.cloud.contentwarehouse.v1.SynonymSet other =
        (com.google.cloud.contentwarehouse.v1.SynonymSet) obj;

    if (!getName().equals(other.getName())) return false;
    if (!getContext().equals(other.getContext())) return false;
    if (!getSynonymsList().equals(other.getSynonymsList())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (37 * hash) + CONTEXT_FIELD_NUMBER;
    hash = (53 * hash) + getContext().hashCode();
    if (getSynonymsCount() > 0) {
      hash = (37 * hash) + SYNONYMS_FIELD_NUMBER;
      hash = (53 * hash) + getSynonymsList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet 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.contentwarehouse.v1.SynonymSet parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet 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.contentwarehouse.v1.SynonymSet parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet 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.contentwarehouse.v1.SynonymSet parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet 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.contentwarehouse.v1.SynonymSet parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet 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.contentwarehouse.v1.SynonymSet 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>
   * Represents a list of synonyms for a given context.
   * For example a context "sales" could contain:
   * Synonym 1: sale, invoice, bill, order
   * Synonym 2: money, credit, finance, payment
   * Synonym 3: shipping, freight, transport
   * Each SynonymSets should be disjoint
   * </pre>
   *
   * Protobuf type {@code google.cloud.contentwarehouse.v1.SynonymSet}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.contentwarehouse.v1.SynonymSet)
      com.google.cloud.contentwarehouse.v1.SynonymSetOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.contentwarehouse.v1.SynonymSetProto
          .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.contentwarehouse.v1.SynonymSetProto
          .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.contentwarehouse.v1.SynonymSet.class,
              com.google.cloud.contentwarehouse.v1.SynonymSet.Builder.class);
    }

    // Construct using com.google.cloud.contentwarehouse.v1.SynonymSet.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      name_ = "";
      context_ = "";
      if (synonymsBuilder_ == null) {
        synonyms_ = java.util.Collections.emptyList();
      } else {
        synonyms_ = null;
        synonymsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000004);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.contentwarehouse.v1.SynonymSetProto
          .internal_static_google_cloud_contentwarehouse_v1_SynonymSet_descriptor;
    }

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

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

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.SynonymSet buildPartial() {
      com.google.cloud.contentwarehouse.v1.SynonymSet result =
          new com.google.cloud.contentwarehouse.v1.SynonymSet(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(
        com.google.cloud.contentwarehouse.v1.SynonymSet result) {
      if (synonymsBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)) {
          synonyms_ = java.util.Collections.unmodifiableList(synonyms_);
          bitField0_ = (bitField0_ & ~0x00000004);
        }
        result.synonyms_ = synonyms_;
      } else {
        result.synonyms_ = synonymsBuilder_.build();
      }
    }

    private void buildPartial0(com.google.cloud.contentwarehouse.v1.SynonymSet result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.name_ = name_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.context_ = context_;
      }
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.contentwarehouse.v1.SynonymSet) {
        return mergeFrom((com.google.cloud.contentwarehouse.v1.SynonymSet) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.contentwarehouse.v1.SynonymSet other) {
      if (other == com.google.cloud.contentwarehouse.v1.SynonymSet.getDefaultInstance())
        return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (!other.getContext().isEmpty()) {
        context_ = other.context_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (synonymsBuilder_ == null) {
        if (!other.synonyms_.isEmpty()) {
          if (synonyms_.isEmpty()) {
            synonyms_ = other.synonyms_;
            bitField0_ = (bitField0_ & ~0x00000004);
          } else {
            ensureSynonymsIsMutable();
            synonyms_.addAll(other.synonyms_);
          }
          onChanged();
        }
      } else {
        if (!other.synonyms_.isEmpty()) {
          if (synonymsBuilder_.isEmpty()) {
            synonymsBuilder_.dispose();
            synonymsBuilder_ = null;
            synonyms_ = other.synonyms_;
            bitField0_ = (bitField0_ & ~0x00000004);
            synonymsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getSynonymsFieldBuilder()
                    : null;
          } else {
            synonymsBuilder_.addAllMessages(other.synonyms_);
          }
        }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      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 {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                name_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                context_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym m =
                    input.readMessage(
                        com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.parser(),
                        extensionRegistry);
                if (synonymsBuilder_ == null) {
                  ensureSynonymsIsMutable();
                  synonyms_.add(m);
                } else {
                  synonymsBuilder_.addMessage(m);
                }
                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private java.lang.Object name_ = "";
    /**
     *
     *
     * <pre>
     * The resource name of the SynonymSet
     * This is mandatory for google.api.resource.
     * Format:
     * projects/{project_number}/locations/{location}/synonymSets/{context}.
     * </pre>
     *
     * <code>string name = 1;</code>
     *
     * @return The name.
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The resource name of the SynonymSet
     * This is mandatory for google.api.resource.
     * Format:
     * projects/{project_number}/locations/{location}/synonymSets/{context}.
     * </pre>
     *
     * <code>string name = 1;</code>
     *
     * @return The bytes for name.
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The resource name of the SynonymSet
     * This is mandatory for google.api.resource.
     * Format:
     * projects/{project_number}/locations/{location}/synonymSets/{context}.
     * </pre>
     *
     * <code>string name = 1;</code>
     *
     * @param value The name to set.
     * @return This builder for chaining.
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      name_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The resource name of the SynonymSet
     * This is mandatory for google.api.resource.
     * Format:
     * projects/{project_number}/locations/{location}/synonymSets/{context}.
     * </pre>
     *
     * <code>string name = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearName() {
      name_ = getDefaultInstance().getName();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The resource name of the SynonymSet
     * This is mandatory for google.api.resource.
     * Format:
     * projects/{project_number}/locations/{location}/synonymSets/{context}.
     * </pre>
     *
     * <code>string name = 1;</code>
     *
     * @param value The bytes for name to set.
     * @return This builder for chaining.
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      name_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private java.lang.Object context_ = "";
    /**
     *
     *
     * <pre>
     * This is a freeform field. Example contexts can be "sales," "engineering,"
     * "real estate," "accounting," etc.
     * The context can be supplied during search requests.
     * </pre>
     *
     * <code>string context = 2;</code>
     *
     * @return The context.
     */
    public java.lang.String getContext() {
      java.lang.Object ref = context_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        context_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * This is a freeform field. Example contexts can be "sales," "engineering,"
     * "real estate," "accounting," etc.
     * The context can be supplied during search requests.
     * </pre>
     *
     * <code>string context = 2;</code>
     *
     * @return The bytes for context.
     */
    public com.google.protobuf.ByteString getContextBytes() {
      java.lang.Object ref = context_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        context_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * This is a freeform field. Example contexts can be "sales," "engineering,"
     * "real estate," "accounting," etc.
     * The context can be supplied during search requests.
     * </pre>
     *
     * <code>string context = 2;</code>
     *
     * @param value The context to set.
     * @return This builder for chaining.
     */
    public Builder setContext(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      context_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * This is a freeform field. Example contexts can be "sales," "engineering,"
     * "real estate," "accounting," etc.
     * The context can be supplied during search requests.
     * </pre>
     *
     * <code>string context = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearContext() {
      context_ = getDefaultInstance().getContext();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * This is a freeform field. Example contexts can be "sales," "engineering,"
     * "real estate," "accounting," etc.
     * The context can be supplied during search requests.
     * </pre>
     *
     * <code>string context = 2;</code>
     *
     * @param value The bytes for context to set.
     * @return This builder for chaining.
     */
    public Builder setContextBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      context_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private java.util.List<com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym> synonyms_ =
        java.util.Collections.emptyList();

    private void ensureSynonymsIsMutable() {
      if (!((bitField0_ & 0x00000004) != 0)) {
        synonyms_ =
            new java.util.ArrayList<com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym>(
                synonyms_);
        bitField0_ |= 0x00000004;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym,
            com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder,
            com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder>
        synonymsBuilder_;

    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public java.util.List<com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym>
        getSynonymsList() {
      if (synonymsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(synonyms_);
      } else {
        return synonymsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public int getSynonymsCount() {
      if (synonymsBuilder_ == null) {
        return synonyms_.size();
      } else {
        return synonymsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym getSynonyms(int index) {
      if (synonymsBuilder_ == null) {
        return synonyms_.get(index);
      } else {
        return synonymsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder setSynonyms(
        int index, com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym value) {
      if (synonymsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSynonymsIsMutable();
        synonyms_.set(index, value);
        onChanged();
      } else {
        synonymsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder setSynonyms(
        int index,
        com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder builderForValue) {
      if (synonymsBuilder_ == null) {
        ensureSynonymsIsMutable();
        synonyms_.set(index, builderForValue.build());
        onChanged();
      } else {
        synonymsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder addSynonyms(com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym value) {
      if (synonymsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSynonymsIsMutable();
        synonyms_.add(value);
        onChanged();
      } else {
        synonymsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder addSynonyms(
        int index, com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym value) {
      if (synonymsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureSynonymsIsMutable();
        synonyms_.add(index, value);
        onChanged();
      } else {
        synonymsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder addSynonyms(
        com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder builderForValue) {
      if (synonymsBuilder_ == null) {
        ensureSynonymsIsMutable();
        synonyms_.add(builderForValue.build());
        onChanged();
      } else {
        synonymsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder addSynonyms(
        int index,
        com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder builderForValue) {
      if (synonymsBuilder_ == null) {
        ensureSynonymsIsMutable();
        synonyms_.add(index, builderForValue.build());
        onChanged();
      } else {
        synonymsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder addAllSynonyms(
        java.lang.Iterable<? extends com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym>
            values) {
      if (synonymsBuilder_ == null) {
        ensureSynonymsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, synonyms_);
        onChanged();
      } else {
        synonymsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder clearSynonyms() {
      if (synonymsBuilder_ == null) {
        synonyms_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
      } else {
        synonymsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public Builder removeSynonyms(int index) {
      if (synonymsBuilder_ == null) {
        ensureSynonymsIsMutable();
        synonyms_.remove(index);
        onChanged();
      } else {
        synonymsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder getSynonymsBuilder(
        int index) {
      return getSynonymsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder getSynonymsOrBuilder(
        int index) {
      if (synonymsBuilder_ == null) {
        return synonyms_.get(index);
      } else {
        return synonymsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public java.util.List<
            ? extends com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder>
        getSynonymsOrBuilderList() {
      if (synonymsBuilder_ != null) {
        return synonymsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(synonyms_);
      }
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder addSynonymsBuilder() {
      return getSynonymsFieldBuilder()
          .addBuilder(com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder addSynonymsBuilder(
        int index) {
      return getSynonymsFieldBuilder()
          .addBuilder(
              index, com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * List of Synonyms for the context.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.SynonymSet.Synonym synonyms = 3;</code>
     */
    public java.util.List<com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder>
        getSynonymsBuilderList() {
      return getSynonymsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym,
            com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder,
            com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder>
        getSynonymsFieldBuilder() {
      if (synonymsBuilder_ == null) {
        synonymsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym,
                com.google.cloud.contentwarehouse.v1.SynonymSet.Synonym.Builder,
                com.google.cloud.contentwarehouse.v1.SynonymSet.SynonymOrBuilder>(
                synonyms_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean());
        synonyms_ = null;
      }
      return synonymsBuilder_;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(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.contentwarehouse.v1.SynonymSet)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.contentwarehouse.v1.SynonymSet)
  private static final com.google.cloud.contentwarehouse.v1.SynonymSet DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.contentwarehouse.v1.SynonymSet();
  }

  public static com.google.cloud.contentwarehouse.v1.SynonymSet getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<SynonymSet> PARSER =
      new com.google.protobuf.AbstractParser<SynonymSet>() {
        @java.lang.Override
        public SynonymSet parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

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

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

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