text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/datastore/v1beta3/datastore.proto

package com.google.datastore.v1beta3;

/**
 *

 * The request for [Datastore.Commit][google.datastore.v1beta3.Datastore.Commit].
 *

 *
 * Protobuf type {@code google.datastore.v1beta3.CommitRequest}
 */
public  final class CommitRequest extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.datastore.v1beta3.CommitRequest)
    CommitRequestOrBuilder {
  // Use CommitRequest.newBuilder() to construct.
  private CommitRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private CommitRequest() {
    projectId_ = "";
    mode_ = 0;
    mutations_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
  }
  private CommitRequest(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    int mutable_bitField0_ = 0;
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!input.skipField(tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            transactionSelectorCase_ = 1;
            transactionSelector_ = input.readBytes();
            break;
          }
          case 40: {
            int rawValue = input.readEnum();

            mode_ = rawValue;
            break;
          }
          case 50: {
            if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
              mutations_ = new java.util.ArrayList<com.google.datastore.v1beta3.Mutation>();
              mutable_bitField0_ |= 0x00000008;
            }
            mutations_.add(
                input.readMessage(com.google.datastore.v1beta3.Mutation.parser(), extensionRegistry));
            break;
          }
          case 66: {
            java.lang.String s = input.readStringRequireUtf8();

            projectId_ = s;
            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_ & 0x00000008) == 0x00000008)) {
        mutations_ = java.util.Collections.unmodifiableList(mutations_);
      }
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.datastore.v1beta3.DatastoreProto.internal_static_google_datastore_v1beta3_CommitRequest_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.datastore.v1beta3.DatastoreProto.internal_static_google_datastore_v1beta3_CommitRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.datastore.v1beta3.CommitRequest.class, com.google.datastore.v1beta3.CommitRequest.Builder.class);
  }

  /**
   *

   * The modes available for commits.
   *

   *
   * Protobuf enum {@code google.datastore.v1beta3.CommitRequest.Mode}
   */
  public enum Mode
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *

     * Unspecified. This value must not be used.
     *

     *
     * MODE_UNSPECIFIED = 0;
     */
    MODE_UNSPECIFIED(0),
    /**
     *

     * Transactional: The mutations are either all applied, or none are applied.
     * Learn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions).
     *

     *
     * TRANSACTIONAL = 1;
     */
    TRANSACTIONAL(1),
    /**
     *

     * Non-transactional: The mutations may not apply as all or none.
     *

     *
     * NON_TRANSACTIONAL = 2;
     */
    NON_TRANSACTIONAL(2),
    UNRECOGNIZED(-1),
    ;

    /**
     *

     * Unspecified. This value must not be used.
     *

     *
     * MODE_UNSPECIFIED = 0;
     */
    public static final int MODE_UNSPECIFIED_VALUE = 0;
    /**
     *

     * Transactional: The mutations are either all applied, or none are applied.
     * Learn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions).
     *

     *
     * TRANSACTIONAL = 1;
     */
    public static final int TRANSACTIONAL_VALUE = 1;
    /**
     *

     * Non-transactional: The mutations may not apply as all or none.
     *

     *
     * NON_TRANSACTIONAL = 2;
     */
    public static final int NON_TRANSACTIONAL_VALUE = 2;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static Mode valueOf(int value) {
      return forNumber(value);
    }

    public static Mode forNumber(int value) {
      switch (value) {
        case 0: return MODE_UNSPECIFIED;
        case 1: return TRANSACTIONAL;
        case 2: return NON_TRANSACTIONAL;
        default: return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<Mode>
        internalGetValueMap() {
      return internalValueMap;
    }
    private static final com.google.protobuf.Internal.EnumLiteMap<
        Mode> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<Mode>() {
            public Mode findValueByNumber(int number) {
              return Mode.forNumber(number);
            }
          };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor
        getValueDescriptor() {
      return getDescriptor().getValues().get(ordinal());
    }
    public final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptorForType() {
      return getDescriptor();
    }
    public static final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptor() {
      return com.google.datastore.v1beta3.CommitRequest.getDescriptor().getEnumTypes().get(0);
    }

    private static final Mode[] VALUES = values();

    public static Mode valueOf(
        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException(
          "EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private Mode(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.datastore.v1beta3.CommitRequest.Mode)
  }

  private int bitField0_;
  private int transactionSelectorCase_ = 0;
  private java.lang.Object transactionSelector_;
  public enum TransactionSelectorCase
      implements com.google.protobuf.Internal.EnumLite {
    TRANSACTION(1),
    TRANSACTIONSELECTOR_NOT_SET(0);
    private final int value;
    private TransactionSelectorCase(int value) {
      this.value = value;
    }
    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static TransactionSelectorCase valueOf(int value) {
      return forNumber(value);
    }

    public static TransactionSelectorCase forNumber(int value) {
      switch (value) {
        case 1: return TRANSACTION;
        case 0: return TRANSACTIONSELECTOR_NOT_SET;
        default: return null;
      }
    }
    public int getNumber() {
      return this.value;
    }
  };

  public TransactionSelectorCase
  getTransactionSelectorCase() {
    return TransactionSelectorCase.forNumber(
        transactionSelectorCase_);
  }

  public static final int PROJECT_ID_FIELD_NUMBER = 8;
  private volatile java.lang.Object projectId_;
  /**
   *

   * The ID of the project against which to make the request.
   *

   *
   * optional string project_id = 8;
   */
  public java.lang.String getProjectId() {
    java.lang.Object ref = projectId_;
    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();
      projectId_ = s;
      return s;
    }
  }
  /**
   *

   * The ID of the project against which to make the request.
   *

   *
   * optional string project_id = 8;
   */
  public com.google.protobuf.ByteString
      getProjectIdBytes() {
    java.lang.Object ref = projectId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      projectId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int MODE_FIELD_NUMBER = 5;
  private int mode_;
  /**
   *

   * The type of commit to perform. Defaults to `TRANSACTIONAL`.
   *

   *
   * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
   */
  public int getModeValue() {
    return mode_;
  }
  /**
   *

   * The type of commit to perform. Defaults to `TRANSACTIONAL`.
   *

   *
   * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
   */
  public com.google.datastore.v1beta3.CommitRequest.Mode getMode() {
    com.google.datastore.v1beta3.CommitRequest.Mode result = com.google.datastore.v1beta3.CommitRequest.Mode.valueOf(mode_);
    return result == null ? com.google.datastore.v1beta3.CommitRequest.Mode.UNRECOGNIZED : result;
  }

  public static final int TRANSACTION_FIELD_NUMBER = 1;
  /**
   *

   * The identifier of the transaction associated with the commit. A
   * transaction identifier is returned by a call to
   * [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
   *

   *
   * optional bytes transaction = 1;
   */
  public com.google.protobuf.ByteString getTransaction() {
    if (transactionSelectorCase_ == 1) {
      return (com.google.protobuf.ByteString) transactionSelector_;
    }
    return com.google.protobuf.ByteString.EMPTY;
  }

  public static final int MUTATIONS_FIELD_NUMBER = 6;
  private java.util.List<com.google.datastore.v1beta3.Mutation> mutations_;
  /**
   *

   * The mutations to perform.
   * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
   * applied in order. The following sequences of mutations affecting a single
   * entity are not permitted in a single `Commit` request:
   * - `insert` followed by `insert`
   * - `update` followed by `insert`
   * - `upsert` followed by `insert`
   * - `delete` followed by `update`
   * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
   * entity.
   *

   *
   * repeated .google.datastore.v1beta3.Mutation mutations = 6;
   */
  public java.util.List<com.google.datastore.v1beta3.Mutation> getMutationsList() {
    return mutations_;
  }
  /**
   *

   * The mutations to perform.
   * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
   * applied in order. The following sequences of mutations affecting a single
   * entity are not permitted in a single `Commit` request:
   * - `insert` followed by `insert`
   * - `update` followed by `insert`
   * - `upsert` followed by `insert`
   * - `delete` followed by `update`
   * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
   * entity.
   *

   *
   * repeated .google.datastore.v1beta3.Mutation mutations = 6;
   */
  public java.util.List<? extends com.google.datastore.v1beta3.MutationOrBuilder>
      getMutationsOrBuilderList() {
    return mutations_;
  }
  /**
   *

   * The mutations to perform.
   * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
   * applied in order. The following sequences of mutations affecting a single
   * entity are not permitted in a single `Commit` request:
   * - `insert` followed by `insert`
   * - `update` followed by `insert`
   * - `upsert` followed by `insert`
   * - `delete` followed by `update`
   * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
   * entity.
   *

   *
   * repeated .google.datastore.v1beta3.Mutation mutations = 6;
   */
  public int getMutationsCount() {
    return mutations_.size();
  }
  /**
   *

   * The mutations to perform.
   * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
   * applied in order. The following sequences of mutations affecting a single
   * entity are not permitted in a single `Commit` request:
   * - `insert` followed by `insert`
   * - `update` followed by `insert`
   * - `upsert` followed by `insert`
   * - `delete` followed by `update`
   * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
   * entity.
   *

   *
   * repeated .google.datastore.v1beta3.Mutation mutations = 6;
   */
  public com.google.datastore.v1beta3.Mutation getMutations(int index) {
    return mutations_.get(index);
  }
  /**
   *

   * The mutations to perform.
   * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
   * applied in order. The following sequences of mutations affecting a single
   * entity are not permitted in a single `Commit` request:
   * - `insert` followed by `insert`
   * - `update` followed by `insert`
   * - `upsert` followed by `insert`
   * - `delete` followed by `update`
   * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
   * entity.
   *

   *
   * repeated .google.datastore.v1beta3.Mutation mutations = 6;
   */
  public com.google.datastore.v1beta3.MutationOrBuilder getMutationsOrBuilder(
      int index) {
    return mutations_.get(index);
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (transactionSelectorCase_ == 1) {
      output.writeBytes(
          1, (com.google.protobuf.ByteString)((com.google.protobuf.ByteString) transactionSelector_));
    }
    if (mode_ != com.google.datastore.v1beta3.CommitRequest.Mode.MODE_UNSPECIFIED.getNumber()) {
      output.writeEnum(5, mode_);
    }
    for (int i = 0; i < mutations_.size(); i++) {
      output.writeMessage(6, mutations_.get(i));
    }
    if (!getProjectIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 8, projectId_);
    }
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (transactionSelectorCase_ == 1) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(
            1, (com.google.protobuf.ByteString)((com.google.protobuf.ByteString) transactionSelector_));
    }
    if (mode_ != com.google.datastore.v1beta3.CommitRequest.Mode.MODE_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(5, mode_);
    }
    for (int i = 0; i < mutations_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(6, mutations_.get(i));
    }
    if (!getProjectIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, projectId_);
    }
    memoizedSize = size;
    return size;
  }

  private static final long serialVersionUID = 0L;
  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.google.datastore.v1beta3.CommitRequest)) {
      return super.equals(obj);
    }
    com.google.datastore.v1beta3.CommitRequest other = (com.google.datastore.v1beta3.CommitRequest) obj;

    boolean result = true;
    result = result && getProjectId()
        .equals(other.getProjectId());
    result = result && mode_ == other.mode_;
    result = result && getMutationsList()
        .equals(other.getMutationsList());
    result = result && getTransactionSelectorCase().equals(
        other.getTransactionSelectorCase());
    if (!result) return false;
    switch (transactionSelectorCase_) {
      case 1:
        result = result && getTransaction()
            .equals(other.getTransaction());
        break;
      case 0:
      default:
    }
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptorForType().hashCode();
    hash = (37 * hash) + PROJECT_ID_FIELD_NUMBER;
    hash = (53 * hash) + getProjectId().hashCode();
    hash = (37 * hash) + MODE_FIELD_NUMBER;
    hash = (53 * hash) + mode_;
    if (getMutationsCount() > 0) {
      hash = (37 * hash) + MUTATIONS_FIELD_NUMBER;
      hash = (53 * hash) + getMutationsList().hashCode();
    }
    switch (transactionSelectorCase_) {
      case 1:
        hash = (37 * hash) + TRANSACTION_FIELD_NUMBER;
        hash = (53 * hash) + getTransaction().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.datastore.v1beta3.CommitRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.datastore.v1beta3.CommitRequest 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.datastore.v1beta3.CommitRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.datastore.v1beta3.CommitRequest parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.datastore.v1beta3.CommitRequest parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.datastore.v1beta3.CommitRequest 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.datastore.v1beta3.CommitRequest parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.datastore.v1beta3.CommitRequest 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.datastore.v1beta3.CommitRequest parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.datastore.v1beta3.CommitRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.datastore.v1beta3.CommitRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  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;
  }
  /**
   *

   * The request for [Datastore.Commit][google.datastore.v1beta3.Datastore.Commit].
   *

   *
   * Protobuf type {@code google.datastore.v1beta3.CommitRequest}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.datastore.v1beta3.CommitRequest)
      com.google.datastore.v1beta3.CommitRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.datastore.v1beta3.DatastoreProto.internal_static_google_datastore_v1beta3_CommitRequest_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.datastore.v1beta3.DatastoreProto.internal_static_google_datastore_v1beta3_CommitRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.datastore.v1beta3.CommitRequest.class, com.google.datastore.v1beta3.CommitRequest.Builder.class);
    }

    // Construct using com.google.datastore.v1beta3.CommitRequest.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getMutationsFieldBuilder();
      }
    }
    public Builder clear() {
      super.clear();
      projectId_ = "";

      mode_ = 0;

      if (mutationsBuilder_ == null) {
        mutations_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000008);
      } else {
        mutationsBuilder_.clear();
      }
      transactionSelectorCase_ = 0;
      transactionSelector_ = null;
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.datastore.v1beta3.DatastoreProto.internal_static_google_datastore_v1beta3_CommitRequest_descriptor;
    }

    public com.google.datastore.v1beta3.CommitRequest getDefaultInstanceForType() {
      return com.google.datastore.v1beta3.CommitRequest.getDefaultInstance();
    }

    public com.google.datastore.v1beta3.CommitRequest build() {
      com.google.datastore.v1beta3.CommitRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.datastore.v1beta3.CommitRequest buildPartial() {
      com.google.datastore.v1beta3.CommitRequest result = new com.google.datastore.v1beta3.CommitRequest(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.projectId_ = projectId_;
      result.mode_ = mode_;
      if (transactionSelectorCase_ == 1) {
        result.transactionSelector_ = transactionSelector_;
      }
      if (mutationsBuilder_ == null) {
        if (((bitField0_ & 0x00000008) == 0x00000008)) {
          mutations_ = java.util.Collections.unmodifiableList(mutations_);
          bitField0_ = (bitField0_ & ~0x00000008);
        }
        result.mutations_ = mutations_;
      } else {
        result.mutations_ = mutationsBuilder_.build();
      }
      result.bitField0_ = to_bitField0_;
      result.transactionSelectorCase_ = transactionSelectorCase_;
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.datastore.v1beta3.CommitRequest) {
        return mergeFrom((com.google.datastore.v1beta3.CommitRequest)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.datastore.v1beta3.CommitRequest other) {
      if (other == com.google.datastore.v1beta3.CommitRequest.getDefaultInstance()) return this;
      if (!other.getProjectId().isEmpty()) {
        projectId_ = other.projectId_;
        onChanged();
      }
      if (other.mode_ != 0) {
        setModeValue(other.getModeValue());
      }
      if (mutationsBuilder_ == null) {
        if (!other.mutations_.isEmpty()) {
          if (mutations_.isEmpty()) {
            mutations_ = other.mutations_;
            bitField0_ = (bitField0_ & ~0x00000008);
          } else {
            ensureMutationsIsMutable();
            mutations_.addAll(other.mutations_);
          }
          onChanged();
        }
      } else {
        if (!other.mutations_.isEmpty()) {
          if (mutationsBuilder_.isEmpty()) {
            mutationsBuilder_.dispose();
            mutationsBuilder_ = null;
            mutations_ = other.mutations_;
            bitField0_ = (bitField0_ & ~0x00000008);
            mutationsBuilder_ =
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getMutationsFieldBuilder() : null;
          } else {
            mutationsBuilder_.addAllMessages(other.mutations_);
          }
        }
      }
      switch (other.getTransactionSelectorCase()) {
        case TRANSACTION: {
          setTransaction(other.getTransaction());
          break;
        }
        case TRANSACTIONSELECTOR_NOT_SET: {
          break;
        }
      }
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.datastore.v1beta3.CommitRequest parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.datastore.v1beta3.CommitRequest) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int transactionSelectorCase_ = 0;
    private java.lang.Object transactionSelector_;
    public TransactionSelectorCase
        getTransactionSelectorCase() {
      return TransactionSelectorCase.forNumber(
          transactionSelectorCase_);
    }

    public Builder clearTransactionSelector() {
      transactionSelectorCase_ = 0;
      transactionSelector_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private java.lang.Object projectId_ = "";
    /**
     *

     * The ID of the project against which to make the request.
     *

     *
     * optional string project_id = 8;
     */
    public java.lang.String getProjectId() {
      java.lang.Object ref = projectId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        projectId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *

     * The ID of the project against which to make the request.
     *

     *
     * optional string project_id = 8;
     */
    public com.google.protobuf.ByteString
        getProjectIdBytes() {
      java.lang.Object ref = projectId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        projectId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *

     * The ID of the project against which to make the request.
     *

     *
     * optional string project_id = 8;
     */
    public Builder setProjectId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }

      projectId_ = value;
      onChanged();
      return this;
    }
    /**
     *

     * The ID of the project against which to make the request.
     *

     *
     * optional string project_id = 8;
     */
    public Builder clearProjectId() {

      projectId_ = getDefaultInstance().getProjectId();
      onChanged();
      return this;
    }
    /**
     *

     * The ID of the project against which to make the request.
     *

     *
     * optional string project_id = 8;
     */
    public Builder setProjectIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);

      projectId_ = value;
      onChanged();
      return this;
    }

    private int mode_ = 0;
    /**
     *

     * The type of commit to perform. Defaults to `TRANSACTIONAL`.
     *

     *
     * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
     */
    public int getModeValue() {
      return mode_;
    }
    /**
     *

     * The type of commit to perform. Defaults to `TRANSACTIONAL`.
     *

     *
     * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
     */
    public Builder setModeValue(int value) {
      mode_ = value;
      onChanged();
      return this;
    }
    /**
     *

     * The type of commit to perform. Defaults to `TRANSACTIONAL`.
     *

     *
     * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
     */
    public com.google.datastore.v1beta3.CommitRequest.Mode getMode() {
      com.google.datastore.v1beta3.CommitRequest.Mode result = com.google.datastore.v1beta3.CommitRequest.Mode.valueOf(mode_);
      return result == null ? com.google.datastore.v1beta3.CommitRequest.Mode.UNRECOGNIZED : result;
    }
    /**
     *

     * The type of commit to perform. Defaults to `TRANSACTIONAL`.
     *

     *
     * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
     */
    public Builder setMode(com.google.datastore.v1beta3.CommitRequest.Mode value) {
      if (value == null) {
        throw new NullPointerException();
      }

      mode_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *

     * The type of commit to perform. Defaults to `TRANSACTIONAL`.
     *

     *
     * optional .google.datastore.v1beta3.CommitRequest.Mode mode = 5;
     */
    public Builder clearMode() {

      mode_ = 0;
      onChanged();
      return this;
    }

    /**
     *

     * The identifier of the transaction associated with the commit. A
     * transaction identifier is returned by a call to
     * [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
     *

     *
     * optional bytes transaction = 1;
     */
    public com.google.protobuf.ByteString getTransaction() {
      if (transactionSelectorCase_ == 1) {
        return (com.google.protobuf.ByteString) transactionSelector_;
      }
      return com.google.protobuf.ByteString.EMPTY;
    }
    /**
     *

     * The identifier of the transaction associated with the commit. A
     * transaction identifier is returned by a call to
     * [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
     *

     *
     * optional bytes transaction = 1;
     */
    public Builder setTransaction(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  transactionSelectorCase_ = 1;
      transactionSelector_ = value;
      onChanged();
      return this;
    }
    /**
     *

     * The identifier of the transaction associated with the commit. A
     * transaction identifier is returned by a call to
     * [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
     *

     *
     * optional bytes transaction = 1;
     */
    public Builder clearTransaction() {
      if (transactionSelectorCase_ == 1) {
        transactionSelectorCase_ = 0;
        transactionSelector_ = null;
        onChanged();
      }
      return this;
    }

    private java.util.List<com.google.datastore.v1beta3.Mutation> mutations_ =
      java.util.Collections.emptyList();
    private void ensureMutationsIsMutable() {
      if (!((bitField0_ & 0x00000008) == 0x00000008)) {
        mutations_ = new java.util.ArrayList<com.google.datastore.v1beta3.Mutation>(mutations_);
        bitField0_ |= 0x00000008;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.datastore.v1beta3.Mutation, com.google.datastore.v1beta3.Mutation.Builder, com.google.datastore.v1beta3.MutationOrBuilder> mutationsBuilder_;

    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public java.util.List<com.google.datastore.v1beta3.Mutation> getMutationsList() {
      if (mutationsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(mutations_);
      } else {
        return mutationsBuilder_.getMessageList();
      }
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public int getMutationsCount() {
      if (mutationsBuilder_ == null) {
        return mutations_.size();
      } else {
        return mutationsBuilder_.getCount();
      }
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public com.google.datastore.v1beta3.Mutation getMutations(int index) {
      if (mutationsBuilder_ == null) {
        return mutations_.get(index);
      } else {
        return mutationsBuilder_.getMessage(index);
      }
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder setMutations(
        int index, com.google.datastore.v1beta3.Mutation value) {
      if (mutationsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMutationsIsMutable();
        mutations_.set(index, value);
        onChanged();
      } else {
        mutationsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder setMutations(
        int index, com.google.datastore.v1beta3.Mutation.Builder builderForValue) {
      if (mutationsBuilder_ == null) {
        ensureMutationsIsMutable();
        mutations_.set(index, builderForValue.build());
        onChanged();
      } else {
        mutationsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder addMutations(com.google.datastore.v1beta3.Mutation value) {
      if (mutationsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMutationsIsMutable();
        mutations_.add(value);
        onChanged();
      } else {
        mutationsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder addMutations(
        int index, com.google.datastore.v1beta3.Mutation value) {
      if (mutationsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMutationsIsMutable();
        mutations_.add(index, value);
        onChanged();
      } else {
        mutationsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder addMutations(
        com.google.datastore.v1beta3.Mutation.Builder builderForValue) {
      if (mutationsBuilder_ == null) {
        ensureMutationsIsMutable();
        mutations_.add(builderForValue.build());
        onChanged();
      } else {
        mutationsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder addMutations(
        int index, com.google.datastore.v1beta3.Mutation.Builder builderForValue) {
      if (mutationsBuilder_ == null) {
        ensureMutationsIsMutable();
        mutations_.add(index, builderForValue.build());
        onChanged();
      } else {
        mutationsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder addAllMutations(
        java.lang.Iterable<? extends com.google.datastore.v1beta3.Mutation> values) {
      if (mutationsBuilder_ == null) {
        ensureMutationsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, mutations_);
        onChanged();
      } else {
        mutationsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder clearMutations() {
      if (mutationsBuilder_ == null) {
        mutations_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000008);
        onChanged();
      } else {
        mutationsBuilder_.clear();
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public Builder removeMutations(int index) {
      if (mutationsBuilder_ == null) {
        ensureMutationsIsMutable();
        mutations_.remove(index);
        onChanged();
      } else {
        mutationsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public com.google.datastore.v1beta3.Mutation.Builder getMutationsBuilder(
        int index) {
      return getMutationsFieldBuilder().getBuilder(index);
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public com.google.datastore.v1beta3.MutationOrBuilder getMutationsOrBuilder(
        int index) {
      if (mutationsBuilder_ == null) {
        return mutations_.get(index);  } else {
        return mutationsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public java.util.List<? extends com.google.datastore.v1beta3.MutationOrBuilder>
         getMutationsOrBuilderList() {
      if (mutationsBuilder_ != null) {
        return mutationsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(mutations_);
      }
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public com.google.datastore.v1beta3.Mutation.Builder addMutationsBuilder() {
      return getMutationsFieldBuilder().addBuilder(
          com.google.datastore.v1beta3.Mutation.getDefaultInstance());
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public com.google.datastore.v1beta3.Mutation.Builder addMutationsBuilder(
        int index) {
      return getMutationsFieldBuilder().addBuilder(
          index, com.google.datastore.v1beta3.Mutation.getDefaultInstance());
    }
    /**
     *

     * The mutations to perform.
     * When mode is `TRANSACTIONAL`, mutations affecting a single entity are
     * applied in order. The following sequences of mutations affecting a single
     * entity are not permitted in a single `Commit` request:
     * - `insert` followed by `insert`
     * - `update` followed by `insert`
     * - `upsert` followed by `insert`
     * - `delete` followed by `update`
     * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
     * entity.
     *

     *
     * repeated .google.datastore.v1beta3.Mutation mutations = 6;
     */
    public java.util.List<com.google.datastore.v1beta3.Mutation.Builder>
         getMutationsBuilderList() {
      return getMutationsFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.datastore.v1beta3.Mutation, com.google.datastore.v1beta3.Mutation.Builder, com.google.datastore.v1beta3.MutationOrBuilder>
        getMutationsFieldBuilder() {
      if (mutationsBuilder_ == null) {
        mutationsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.datastore.v1beta3.Mutation, com.google.datastore.v1beta3.Mutation.Builder, com.google.datastore.v1beta3.MutationOrBuilder>(
                mutations_,
                ((bitField0_ & 0x00000008) == 0x00000008),
                getParentForChildren(),
                isClean());
        mutations_ = null;
      }
      return mutationsBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

    // @@protoc_insertion_point(builder_scope:google.datastore.v1beta3.CommitRequest)
  }

  // @@protoc_insertion_point(class_scope:google.datastore.v1beta3.CommitRequest)
  private static final com.google.datastore.v1beta3.CommitRequest DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.datastore.v1beta3.CommitRequest();
  }

  public static com.google.datastore.v1beta3.CommitRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  public com.google.datastore.v1beta3.CommitRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}


text:
@implementation SKProduct (LocalizedPrice)

- (NSString *)localizedPrice
{
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
    [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
    [numberFormatter setLocale:self.priceLocale];
    NSString *formattedString = [numberFormatter stringFromNumber:self.price];
    numberFormatter = nil;
    return formattedString;
}

@end

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.rds.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * This data type is used as a response element in the DescribeDBClusterBacktracks action.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BacktrackDBClusterResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB cluster.
     *

     */
    private String dBClusterIdentifier;
    /**
     *

     * Contains the backtrack identifier.
     *

     */
    private String backtrackIdentifier;
    /**
     *

     * The timestamp of the time to which the DB cluster was backtracked.
     *

     */
    private java.util.Date backtrackTo;
    /**
     *

     * The timestamp of the time from which the DB cluster was backtracked.
     *

     */
    private java.util.Date backtrackedFrom;
    /**
     *

     * The timestamp of the time at which the backtrack was requested.
     *

     */
    private java.util.Date backtrackRequestCreationTime;
    /**
     *

     * The status of the backtrack. This property returns one of the following values:
     *

     *

     *

     *

     * applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * completed - The backtrack has successfully been applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * failed - An error occurred while the backtrack was applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     *

     */
    private String status;

    /**
     *

     * Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB cluster.
     *

     *
     * @param dBClusterIdentifier
     *        Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB
     *        cluster.
     */

    public void setDBClusterIdentifier(String dBClusterIdentifier) {
        this.dBClusterIdentifier = dBClusterIdentifier;
    }

    /**
     *

     * Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB cluster.
     *

     *
     * @return Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB
     *         cluster.
     */

    public String getDBClusterIdentifier() {
        return this.dBClusterIdentifier;
    }

    /**
     *

     * Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB cluster.
     *

     *
     * @param dBClusterIdentifier
     *        Contains a user-supplied DB cluster identifier. This identifier is the unique key that identifies a DB
     *        cluster.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BacktrackDBClusterResult withDBClusterIdentifier(String dBClusterIdentifier) {
        setDBClusterIdentifier(dBClusterIdentifier);
        return this;
    }

    /**
     *

     * Contains the backtrack identifier.
     *

     *
     * @param backtrackIdentifier
     *        Contains the backtrack identifier.
     */

    public void setBacktrackIdentifier(String backtrackIdentifier) {
        this.backtrackIdentifier = backtrackIdentifier;
    }

    /**
     *

     * Contains the backtrack identifier.
     *

     *
     * @return Contains the backtrack identifier.
     */

    public String getBacktrackIdentifier() {
        return this.backtrackIdentifier;
    }

    /**
     *

     * Contains the backtrack identifier.
     *

     *
     * @param backtrackIdentifier
     *        Contains the backtrack identifier.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BacktrackDBClusterResult withBacktrackIdentifier(String backtrackIdentifier) {
        setBacktrackIdentifier(backtrackIdentifier);
        return this;
    }

    /**
     *

     * The timestamp of the time to which the DB cluster was backtracked.
     *

     *
     * @param backtrackTo
     *        The timestamp of the time to which the DB cluster was backtracked.
     */

    public void setBacktrackTo(java.util.Date backtrackTo) {
        this.backtrackTo = backtrackTo;
    }

    /**
     *

     * The timestamp of the time to which the DB cluster was backtracked.
     *

     *
     * @return The timestamp of the time to which the DB cluster was backtracked.
     */

    public java.util.Date getBacktrackTo() {
        return this.backtrackTo;
    }

    /**
     *

     * The timestamp of the time to which the DB cluster was backtracked.
     *

     *
     * @param backtrackTo
     *        The timestamp of the time to which the DB cluster was backtracked.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BacktrackDBClusterResult withBacktrackTo(java.util.Date backtrackTo) {
        setBacktrackTo(backtrackTo);
        return this;
    }

    /**
     *

     * The timestamp of the time from which the DB cluster was backtracked.
     *

     *
     * @param backtrackedFrom
     *        The timestamp of the time from which the DB cluster was backtracked.
     */

    public void setBacktrackedFrom(java.util.Date backtrackedFrom) {
        this.backtrackedFrom = backtrackedFrom;
    }

    /**
     *

     * The timestamp of the time from which the DB cluster was backtracked.
     *

     *
     * @return The timestamp of the time from which the DB cluster was backtracked.
     */

    public java.util.Date getBacktrackedFrom() {
        return this.backtrackedFrom;
    }

    /**
     *

     * The timestamp of the time from which the DB cluster was backtracked.
     *

     *
     * @param backtrackedFrom
     *        The timestamp of the time from which the DB cluster was backtracked.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BacktrackDBClusterResult withBacktrackedFrom(java.util.Date backtrackedFrom) {
        setBacktrackedFrom(backtrackedFrom);
        return this;
    }

    /**
     *

     * The timestamp of the time at which the backtrack was requested.
     *

     *
     * @param backtrackRequestCreationTime
     *        The timestamp of the time at which the backtrack was requested.
     */

    public void setBacktrackRequestCreationTime(java.util.Date backtrackRequestCreationTime) {
        this.backtrackRequestCreationTime = backtrackRequestCreationTime;
    }

    /**
     *

     * The timestamp of the time at which the backtrack was requested.
     *

     *
     * @return The timestamp of the time at which the backtrack was requested.
     */

    public java.util.Date getBacktrackRequestCreationTime() {
        return this.backtrackRequestCreationTime;
    }

    /**
     *

     * The timestamp of the time at which the backtrack was requested.
     *

     *
     * @param backtrackRequestCreationTime
     *        The timestamp of the time at which the backtrack was requested.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BacktrackDBClusterResult withBacktrackRequestCreationTime(java.util.Date backtrackRequestCreationTime) {
        setBacktrackRequestCreationTime(backtrackRequestCreationTime);
        return this;
    }

    /**
     *

     * The status of the backtrack. This property returns one of the following values:
     *

     *

     *

     *

     * applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * completed - The backtrack has successfully been applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * failed - An error occurred while the backtrack was applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     *

     *
     * @param status
     *        The status of the backtrack. This property returns one of the following values:

     *

     *

     *

     *        applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     *        completed - The backtrack has successfully been applied to or rolled back from the DB
     *        cluster.
     *

     *

     *

     *

     *        failed - An error occurred while the backtrack was applied to or rolled back from the DB
     *        cluster.
     *

     *

     *

     *

     *        pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     */

    public void setStatus(String status) {
        this.status = status;
    }

    /**
     *

     * The status of the backtrack. This property returns one of the following values:
     *

     *

     *

     *

     * applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * completed - The backtrack has successfully been applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * failed - An error occurred while the backtrack was applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     *

     *
     * @return The status of the backtrack. This property returns one of the following values:

     *

     *

     *

     *         applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     *         completed - The backtrack has successfully been applied to or rolled back from the DB
     *         cluster.
     *

     *

     *

     *

     *         failed - An error occurred while the backtrack was applied to or rolled back from the DB
     *         cluster.
     *

     *

     *

     *

     *         pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     */

    public String getStatus() {
        return this.status;
    }

    /**
     *

     * The status of the backtrack. This property returns one of the following values:
     *

     *

     *

     *

     * applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * completed - The backtrack has successfully been applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * failed - An error occurred while the backtrack was applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     * pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     *

     *
     * @param status
     *        The status of the backtrack. This property returns one of the following values:

     *

     *

     *

     *        applying - The backtrack is currently being applied to or rolled back from the DB cluster.
     *

     *

     *

     *

     *        completed - The backtrack has successfully been applied to or rolled back from the DB
     *        cluster.
     *

     *

     *

     *

     *        failed - An error occurred while the backtrack was applied to or rolled back from the DB
     *        cluster.
     *

     *

     *

     *

     *        pending - The backtrack is currently pending application to or rollback from the DB cluster.
     *

     *

     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BacktrackDBClusterResult withStatus(String status) {
        setStatus(status);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getDBClusterIdentifier() != null)
            sb.append("DBClusterIdentifier: ").append(getDBClusterIdentifier()).append(",");
        if (getBacktrackIdentifier() != null)
            sb.append("BacktrackIdentifier: ").append(getBacktrackIdentifier()).append(",");
        if (getBacktrackTo() != null)
            sb.append("BacktrackTo: ").append(getBacktrackTo()).append(",");
        if (getBacktrackedFrom() != null)
            sb.append("BacktrackedFrom: ").append(getBacktrackedFrom()).append(",");
        if (getBacktrackRequestCreationTime() != null)
            sb.append("BacktrackRequestCreationTime: ").append(getBacktrackRequestCreationTime()).append(",");
        if (getStatus() != null)
            sb.append("Status: ").append(getStatus());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof BacktrackDBClusterResult == false)
            return false;
        BacktrackDBClusterResult other = (BacktrackDBClusterResult) obj;
        if (other.getDBClusterIdentifier() == null ^ this.getDBClusterIdentifier() == null)
            return false;
        if (other.getDBClusterIdentifier() != null && other.getDBClusterIdentifier().equals(this.getDBClusterIdentifier()) == false)
            return false;
        if (other.getBacktrackIdentifier() == null ^ this.getBacktrackIdentifier() == null)
            return false;
        if (other.getBacktrackIdentifier() != null && other.getBacktrackIdentifier().equals(this.getBacktrackIdentifier()) == false)
            return false;
        if (other.getBacktrackTo() == null ^ this.getBacktrackTo() == null)
            return false;
        if (other.getBacktrackTo() != null && other.getBacktrackTo().equals(this.getBacktrackTo()) == false)
            return false;
        if (other.getBacktrackedFrom() == null ^ this.getBacktrackedFrom() == null)
            return false;
        if (other.getBacktrackedFrom() != null && other.getBacktrackedFrom().equals(this.getBacktrackedFrom()) == false)
            return false;
        if (other.getBacktrackRequestCreationTime() == null ^ this.getBacktrackRequestCreationTime() == null)
            return false;
        if (other.getBacktrackRequestCreationTime() != null && other.getBacktrackRequestCreationTime().equals(this.getBacktrackRequestCreationTime()) == false)
            return false;
        if (other.getStatus() == null ^ this.getStatus() == null)
            return false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getDBClusterIdentifier() == null) ? 0 : getDBClusterIdentifier().hashCode());
        hashCode = prime * hashCode + ((getBacktrackIdentifier() == null) ? 0 : getBacktrackIdentifier().hashCode());
        hashCode = prime * hashCode + ((getBacktrackTo() == null) ? 0 : getBacktrackTo().hashCode());
        hashCode = prime * hashCode + ((getBacktrackedFrom() == null) ? 0 : getBacktrackedFrom().hashCode());
        hashCode = prime * hashCode + ((getBacktrackRequestCreationTime() == null) ? 0 : getBacktrackRequestCreationTime().hashCode());
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return hashCode;
    }

    @Override
    public BacktrackDBClusterResult clone() {
        try {
            return (BacktrackDBClusterResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
// Copyright 2007, 2009, 2011 The Apache Software Foundation
//
// 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
//
//     http://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.

package org.apache.tapestry5.annotations;

import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.*;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.UseWith;

/**
 * Used in conjunction with the {@link Inject} annotation to identify a service by name and not by type. This
 * is most useful when there are multiple services with the same service interface and a particular one needs to be
 * selected.
 */
@Target(
        { FIELD, PARAMETER })
@Documented
@Retention(RUNTIME)
@UseWith({COMPONENT,MIXIN,PAGE,SERVICE})
public @interface Service
{
    /**
     * The name of the service. Symbols will be expanded and case is not relevant.
     */
    String value();
}


text:
package org.drools.chance.rule.constraint.core.connectives.impl.lukas;

import org.drools.chance.rule.constraint.core.connectives.impl.AbstractConnective;
import org.drools.chance.rule.constraint.core.connectives.impl.LogicConnectives;
import org.drools.chance.degree.Degree;
import org.drools.chance.evaluation.Evaluation;

public class Xor extends AbstractConnective {

    public Xor() { }

    private static Xor instance = new Xor();

    public static Xor getInstance() {
        return instance;
    }

    public LogicConnectives getType() {
        return LogicConnectives.XOR;
    }

    public Degree eval(Degree deg) {
        throw new UnsupportedOperationException("Logic X-Or operator is not unary");
    }

    public Degree eval(Degree left, Degree right) {
        return (left.sub(right)).sum(right.sub(left));
    }

    public Degree eval(Degree... degs) {
        Degree deg = degs[0];
        for (int j = 1; j < degs.length; j++) {
            deg = this.eval(deg,degs[j]);
        }
        return deg;
    }

    public Degree eval(Evaluation... degs) {
        Degree deg = degs[0].getDegree();
        for (int j = 1; j < degs.length; j++) {
            deg = this.eval( deg, degs[j].getDegree() );
        }
        return deg;
    }

    public boolean isUnary() {
        return false;
    }

    public boolean isBinary() {
        return true;
    }

    public boolean isNary() {
        return false;
    }
}


text:
module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'eslint:recommended', // enforce syntax & detect problems
    'plugin:react/recommended', // add react rules
    'plugin:prettier/recommended', // check code style
    'plugin:import/errors',
    'plugin:import/warnings',
    'plugin:react/recommended',
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  overrides: [
    {
      files: '*.js',
      excludedFiles: ['src/**', 'gatsby-browser.js'],
      env: {
        node: true,
        browser: false,
      },
      parserOptions: {
        sourceType: 'script',
      },
    },
  ],
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  rules: {
    // Don't require escaped apostrophes and quotes
    'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }],
    // Types are for chumps
    'react/prop-types': 'off',
  },
  settings: {
    react: {
      version: 'detect',
    },
    'import/resolver': {
      node: {
        extensions: ['.js', '.jsx'],
      },
    },
  },
};


text:
<?php
class ControllerModuleHTML extends Controller {
	public function index($setting) {
		$data['heading_title'] = html_entity_decode($setting['heading'][$this->config->get('config_language_id')], ENT_QUOTES, 'UTF-8');
		$data['html'] = html_entity_decode($setting['description'][$this->config->get('config_language_id')], ENT_QUOTES, 'UTF-8');

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/html.tpl')) {
			return $this->load->view($this->config->get('config_template') . '/template/module/html.tpl', $data);
		} else {
			return $this->load->view('default/template/module/html.tpl', $data);
		}
	}
}


text:
module ControllerHelpers
  def log_in_as_admin(admin)
    @request.env['devise.mapping'] = Devise.mappings[:admin]
    sign_in FactoryGirl.create(admin)
  end
end


text:
package test.integration;

import com.github.sormuras.beethoven.Annotation;
import com.github.sormuras.beethoven.type.Type;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;

public class Counter extends AbstractProcessor {

  public @interface Mark {}

  public final List<Element> marked = new ArrayList<>();
  public final Map<String, Type> types = new HashMap<>();
  public final List<Annotation> annotations = new ArrayList<>();
  public Elements elementUtils;
  public Types typeUtils;
  public boolean createAbc = true;

  @Override
  public SourceVersion getSupportedSourceVersion() {
    return SourceVersion.latest();
  }

  @Override
  public Set<String> getSupportedAnnotationTypes() {
    Set<String> set = new HashSet<>();
    set.add(Mark.class.getCanonicalName());
    return set;
  }

  @Override
  public synchronized void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    this.elementUtils = processingEnv.getElementUtils();
    this.typeUtils = processingEnv.getTypeUtils();
  }

  @Override
  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    // System.out.println("\n" +roundEnv);
    if (roundEnv.processingOver()) {
      return true;
    }

    for (Element root : roundEnv.getRootElements()) {
      this.annotations.addAll(
          root.getAnnotationMirrors().stream()
              .map(Type.Mirrors::annotation)
              .collect(Collectors.toList()));
    }
    marked.addAll(roundEnv.getElementsAnnotatedWith(Mark.class));
    for (Element element : marked) {
      TypeMirror mirror = element.asType();
      if (element instanceof ExecutableElement) {
        mirror = ((ExecutableElement) element).getReturnType();
      }
      String name = element.getSimpleName().toString();
      Type type = Type.type(mirror);
      types.put(name, type);
    }

    if (createAbc) {
      createAbc = false;
      try {
        JavaFileObject src = processingEnv.getFiler().createSourceFile("test.Abc");
        PrintWriter writer = new PrintWriter(src.openWriter());
        writer.println("package test; class Abc {}");
        writer.close();
      } catch (Exception e) {
        processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "" + e);
      }
    }

    return true;
  }
}


text:
package org.apache.http.HC4.nio.pool;

import org.apache.http.HC4.annotation.Immutable;
import org.apache.http.HC4.concurrent.BasicFuture;
import org.apache.http.HC4.pool.PoolEntry;

import java.util.concurrent.atomic.AtomicBoolean;

@Immutable
class LeaseRequest<T, C, E extends PoolEntry<T, C>> {

    private final T route;
    private final Object state;
    private final long connectTimeout;
    private final long deadline;
    private final BasicFuture<E> future;
    private final AtomicBoolean completed;
    private volatile E result;
    private volatile Exception ex;

    /**
     * Contructor
     * @param route route
     * @param state state
     * @param connectTimeout http connection timeout
     * @param leaseTimeout timeout to wait in a request queue until kicked off
     * @param future future callback
     */
    public LeaseRequest(
            final T route,
            final Object state,
            final long connectTimeout,
            final long leaseTimeout,
            final BasicFuture<E> future) {
        super();
        this.route = route;
        this.state = state;
        this.connectTimeout = connectTimeout;
        this.deadline = leaseTimeout > 0 ? System.currentTimeMillis() + leaseTimeout :
                Long.MAX_VALUE;
        this.future = future;
        this.completed = new AtomicBoolean(false);
    }

    public T getRoute() {
        return this.route;
    }

    public Object getState() {
        return this.state;
    }

    public long getConnectTimeout() {
        return this.connectTimeout;
    }

    public long getDeadline() {
        return this.deadline;
    }

    public boolean isDone() {
        return this.completed.get();
    }

    public void failed(final Exception ex) {
        if (this.completed.compareAndSet(false, true)) {
            this.ex = ex;
        }
    }

    public void completed(final E result) {
        if (this.completed.compareAndSet(false, true)) {
            this.result = result;
        }
    }

    public BasicFuture<E> getFuture() {
        return this.future;
    }

    public E getResult() {
        return this.result;
    }

    public Exception getException() {
        return this.ex;
    }

    @Override
    public String toString() {
        final StringBuilder buffer = new StringBuilder();
        buffer.append("[");
        buffer.append(this.route);
        buffer.append("][");
        buffer.append(this.state);
        buffer.append("]");
        return buffer.toString();
    }

}


text:
This project is a client implementation for the [Seafile](https://www.seafile.com) Web API  for .Net as portable class library (PCL).
It can be used in desktop apps, Windows Universal Platform Projects (UWP), Windows Store applications as well as in apps for Windows Phone 7.5+, 8.x and on Windows 10 Mobile.

The aim is to create a library to easily access a Seafile server and the files stored there through a .Net application in a strong-typed fashion (no custom JSON parsing and with meaningful error messages, etc.) The library uses async/await methods for requests to the Seafile server.

The current stable release of the SeafClient library is available on NuGet [here](https://www.nuget.org/packages/SeafClient/).

This repository is automatically built and tested with AppVeyor:

![build status](https://ci.appveyor.com/api/projects/status/github/renber/seafclient?svg=true)

![test status](http://teststatusbadge.azurewebsites.net/api/status/renber/seafclient)

## Usage example (C#)

```C#
using SeafClient;

async Task Demo()
{
    Uri serverUri= new Uri("https://seacloud.cc", UriKind.Absolute);
    string username = "testuser@internet.com";
    char[] password = new char[] { 't', 'e', 's', 't' };

    try {
        // authenticate with the Seafile server and retrieve a Session
        SeafSession session = await SeafSession.Establish(serverUri, username, password);

        // connection was successful
        // btw: the password array is now empty (all elements are now char 0)
        // now retrieve some information about the account
        var accountInfo = await session.CheckAccountInfo();
        Debug.WriteLine(String.Format("Nickname: {0}\nUsed Storage: {1:d} Bytes\nQuota: {2}",
            accountInfo.Nickname, accountInfo.Usage, accountInfo.Usage, accountInfo.HasUnlimitedSpace ? "unlimited" :
            (accountInfo.Quota.ToString() + "Bytes")));
        // get the url of the user avatar
        var userAvatar = await session.GetUserAvatar(128);
        Debug.WriteLine("Url to user's avatar: " + userAvatar.Url);

        // get the libraries
        var libraries = await session.ListLibraries();
        foreach (var lib in libraries)
            Debug.WriteLine(lib.Name + " " + lib.Timestamp.ToString());

        // list root contents of the first library
        var firstLib = libraries.FirstOrDefault();
        if (firstLib != null)
        {
            var content = await session.ListDirectory(firstLib, "/");
            foreach (var dirEntry in content)
                if (dirEntry.Type == SeafClient.Types.DirEntryType.File)
                    Debug.WriteLine(dirEntry.Name + " - " + dirEntry.Size.ToString() + " Bytes");
                else
                    Debug.WriteLine(dirEntry.Name);
        }

    } catch (SeafException e)
    {
                Debug.WriteLine(String.Format("An error occured: {0} (ErrorCode: {1} ({2}))", e.Message,
                e.SeafError.SeafErrorCode, e.SeafError.HttpStatusCode));
    }
}
```

## Currently implemented requests
See the [official Seafile Web API documentation](http://manual.seafile.com/develop/web_api.html) for a list of all available requests. The following requests are currently implemented:

* Authentication
* Ping (with and without authentication)
* Get Server Info
* Check Account Info
* Get User Avatar
* List Libraries / List Shared Libraries
* List Directory Entries
* Create Directory
* Delete Directory / File
* Rename Directory / File
* Copy / Move File
* Get Thumbnail Image
* Get Download Link
* Get Upload Link / Upload file
* Starred files (list / star / unstar)
* Decrypt an encrypted library (allowing to download files from the encrypted library)


text:
import {handleActions} from 'redux-actions'
import {Map} from 'immutable'

const defaultState = Map({
  networkUrl: null,
  styleUrl: null
})

export default handleActions({
  SET_NETWORK_SOURCE: (state, action) => (
    state.set('networkUrl', action.payload)
  ),
  SET_STYLE_SOURCE: (state, action) => (
    state.set('styleUrl', action.payload)
  )
}, defaultState)


text:
"""Tests for gfsa.datasets.google.random_python.python_numbers_control_flow."""

from absl.testing import absltest
from absl.testing import parameterized
import gast
import numpy as np
from gfsa.datasets.random_python import python_numbers_control_flow
from gfsa.datasets.random_python import top_down_refinement

class PythonNumbersControlFlowTest(parameterized.TestCase):

  # pylint: disable=g-complex-comprehension
  @parameterized.named_parameters([{
      "testcase_name": type(wt.template).__name__,
      "template": wt.template
  } for wt in python_numbers_control_flow.CFG_DISTRIBUTION.weighted_templates])
  # pylint: enable=g-complex-comprehension
  def test_buildable(self, template):
    """Test that each template can be built when given acceptable arguments."""
    rng = np.random.RandomState(1234)

    # Construct a hole that this template can always fill.
    hole = top_down_refinement.Hole(
        template.fills_type,
        python_numbers_control_flow.ASTHoleMetadata(
            names_in_scope=("a",),
            inside_function=True,
            inside_loop=True,
            op_depth=0))
    self.assertTrue(template.can_fill(hole))

    # Make sure we can build this object with no errors.
    filler = template.fill(hole, rng)
    dummy_values = {
        python_numbers_control_flow.ASTHoleType.NUMBER:
            (lambda: gast.Constant(value=1, kind=None)),
        python_numbers_control_flow.ASTHoleType.BOOL:
            (lambda: gast.Constant(value=True, kind=None)),
        python_numbers_control_flow.ASTHoleType.STMT: gast.Pass,
        python_numbers_control_flow.ASTHoleType.STMTS: (lambda: []),
        python_numbers_control_flow.ASTHoleType.STMTS_NONEMPTY:
            (lambda: [gast.Pass()]),
        python_numbers_control_flow.ASTHoleType.BLOCK: (lambda: [gast.Pass()]),
    }
    hole_values = [dummy_values[h.hole_type]() for h in filler.holes]
    value = filler.build(*hole_values)

    # Check the type of the value that was built.
    if template.fills_type in (
        python_numbers_control_flow.ASTHoleType.STMTS_NONEMPTY,
        python_numbers_control_flow.ASTHoleType.BLOCK):
      self.assertTrue(value)
      for item in value:
        self.assertIsInstance(item, gast.stmt)
    elif template.fills_type == python_numbers_control_flow.ASTHoleType.STMTS:
      for item in value:
        self.assertIsInstance(item, gast.stmt)
    elif template.fills_type == python_numbers_control_flow.ASTHoleType.STMT:
      self.assertIsInstance(value, gast.stmt)
    elif template.fills_type in (python_numbers_control_flow.ASTHoleType.NUMBER,
                                 python_numbers_control_flow.ASTHoleType.BOOL):
      self.assertIsInstance(value, gast.expr)
    else:
      raise NotImplementedError(f"Unexpected fill type {template.fills_type}; "
                                "please update this test.")

    # Check that cost reflects number of AST nodes.
    total_cost = 0
    if isinstance(value, gast.AST):
      for _ in gast.walk(value):
        total_cost += 1
    else:
      for item in value:
        for _ in gast.walk(item):
          total_cost += 1

    self.assertEqual(template.required_cost, total_cost)

    cost_without_holes = total_cost - sum(
        python_numbers_control_flow.ALL_COSTS[h.hole_type]
        for h in filler.holes)

    self.assertEqual(filler.cost, cost_without_holes)

    # Check determinism
    for _ in range(20):
      rng = np.random.RandomState(1234)
      redo_value = template.fill(hole, rng).build(*hole_values)
      if isinstance(value, list):
        self.assertEqual([gast.dump(v) for v in value],
                         [gast.dump(v) for v in redo_value])
      else:
        self.assertEqual(gast.dump(value), gast.dump(redo_value))

if __name__ == "__main__":
  absltest.main()


text:
- [How do I use pseudo-selectors like `:checked` or `:last`?](#how-do-i-use-pseudo-selectors-like-checked-or-last)
- [How can I use `ReactCSSTransitionGroup` without any classes?](#how-can-i-use-reactcsstransitiongroup-without-any-classes)
- [How can I use Radium with jsbin?](#how-can-i-use-radium-with-jsbin)
- [Can I use my favourite CSS/LESS/SASS syntax?](#can-i-use-my-favourite-csslesssass-syntax)
- [Can I use Radium with Bootstrap?](#can-i-use-radium-with-bootstrap)
- [Why doesn't Radium work on SomeComponent?](#why-doesnt-radium-work-on-somecomponent)

## How do I use pseudo-selectors like `:checked`, `:last`, `:before`, or `:after`?

Radium only provides the interactivity pseudo-selectors `:hover`, `:active`, and `:focus`. You need to use JavaScript logic to implement the others. To implement `:checked` for example:

```as
class CheckForBold extends React.Component {
  constructor() {
    super();
    this.state = {isChecked: false};
  }

  _onChange = () => {
    this.setState({isChecked: !this.state.isChecked});
  };

  render() {
    return (
      <label style={{fontWeight: this.state.isChecked ? 'bold' : 'normal'}}>
        <input
          checked={this.state.isChecked}
          onChange={this._onChange}
          type="checkbox"
        />
      {' '}Check for bold
      </label>
    );
  }
}
```

Instead of `:first` and `:last`, change behavior during array iteration. Note that the border property is broken down into parts to avoid complications as in issue #95.

```as
var droids = [
  'R2-D2',
  'C-3PO',
  'Huyang',
  'Droideka',
  'Probe Droid'
];

@Radium
class DroidList extends React.Component {
  render() {
    return (
      <ul style={{padding: 0}}>
        {droids.map((droid, index, arr) =>
          <li key={index} style={{
            borderColor: 'black',
            borderRadius: index === 0 ? '12px 12px 0 0' :
              index === (arr.length - 1) ? '0 0 12px 12px' : '',
            borderStyle: 'solid',
            borderWidth: index === (arr.length - 1) ? '1px' : '1px 1px 0 1px',
            cursor: 'pointer',
            listStyle: 'none',
            padding: 12,
            ':hover': {
              background: '#eee'
            }
          }}>
           {droid}
          </li>
        )}
      </ul>
    );
  }
}
```

Instead of `:before` and `:after`, add extra elements when rendering your HTML.

## How can I use `ReactCSSTransitionGroup` without any classes?

Try out the experimental [`ReactStyleTransitionGroup`](https://github.com/adambbecker/react-style-transition-group) instead.

## How can I use Radium with jsbin?

To get the latest version, drop this into the HTML:

```html
<script src="https://rawgit.com/FormidableLabs/radium/master/dist/radium.js"></script>
```

We also recommend changing the JavaScript language to ES6/Babel.

## Can I use my favourite CSS/LESS/SASS syntax?

Yes, with the help of the [react-styling](https://github.com/halt-hammerzeit/react-styling) module, which requires [template strings](https://babeljs.io/docs/learn-es2015/#template-strings). Using react-styling you can write your styles in any syntax you like (curly braces or tabs, CSS, LESS/SASS, anything will do).

The example from the main Readme (using regular CSS syntax)

```as
<Button kind="primary">Radium Button</Button>
```

```as
import styler from 'react-styling/flat'

@Radium
class Button extends React.Component {
  static propTypes = {
    kind: React.PropTypes.oneOf(['primary', 'warning']).isRequired
  }

  render() {
    return (
      <button style={style[`button_${this.props.kind}`]}>
        {this.props.children}
      </button>
    )
  }
}

const style = styler`
  .button {
    color: #fff;

    :hover {
      background: ${color('#0074d9').lighten(0.2).hexString()};
    }

    &.primary {
      background: #0074D9;
    }

    &.warning {
      background: #FF4136;
    }
  }
`
```

You can find a more advanced example in the [react-styling readme](https://github.com/halt-hammerzeit/react-styling#radium).

## Can I use Radium with Bootstrap?

See https://github.com/FormidableLabs/radium/issues/323 for discussion.

## Why doesn't Radium work on SomeComponent?

Radium doesn't mess with the `style` prop of non-DOM elements. This includes thin wrappers like `react-router`'s `Link` component. We can't assume that a custom component will use `style` the same way DOM elements do. For instance, it could be a string enum to select a specific style. In order for resolving `style` on a custom element to work, that element needs to actually pass that `style` prop to the DOM element underneath, in addition to passing down all the event handlers (`onMouseEnter`, etc). Since Radium has no control over the implementation of other components, resolving styles on them is not safe.

A workaround is to wrap your custom component in Radium, even if you do not have the source, like this:
```as
var Link = require('react-router').Link;
Link = Radium(Link);
```
Huge thanks to @mairh for coming up with this idea in https://github.com/FormidableLabs/radium/issues/324.

We are also exploring adding a mechanism to bypass Radium's check, see https://github.com/FormidableLabs/radium/issues/258.


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;

namespace EESLP.Services.Logging.API
{
    public class Program
    {
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .ConfigureLogging((hostingContext, builder) => {
                    Log.Logger = new LoggerConfiguration()
                        .Enrich.FromLogContext()
                        .Enrich.WithMachineName()
                        .Enrich.WithProperty("EESLPApiName","EESLP.Logging.Api")
                        .WriteTo.Elasticsearch(new Serilog.Sinks.Elasticsearch.ElasticsearchSinkOptions(new Uri(hostingContext.Configuration["Services:elasticsearch"]))
                        {
                            IndexFormat = "apilogs",
                            TypeName = "apilogevent"
                        })
                        .CreateLogger();

                    builder.AddSerilog();
                })
                .UseStartup<Startup>()
                .Build();
    }
}


text:
module Dune
  module Dashboard
    class Engine < ::Rails::Engine
      isolate_namespace Dune::Dashboard

      initializer 'dune.dashboard.assets.precompile' do |app|
        app.config.assets.paths << Dune::Dashboard::Engine.root.join('vendor', 'assets', 'components')
        app.config.assets.precompile += %w(dune-dashboard-application.css dune-dashboard-libs.js dune-dashboard-application.js dune-dashboard-templates.js)
      end
    end
  end
end


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Bull. Soc. mycol. Fr. 16: 144 (1900)

#### Original name
Lilliputia Boud. & Pat.

### Remarks
null


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE377_Insecure_Temporary_File__char_tempnam_17.c
Label Definition File: CWE377_Insecure_Temporary_File.label.xml
Template File: point-flaw-17.tmpl.c
*/
/*
 * @description
 * CWE: 377 Insecure Temporary File
 * Sinks: tempnam
 *    GoodSink: Create and open a temporary file more securely, with mkstemp()
 *    BadSink : Create and open a temporary file, created with tempnam(), insecurely
 * Flow Variant: 17 Control flow: for loops
 *
 * */

#include "std_testcase.h"

#include <wchar.h>
#ifndef _WIN32
#include <unistd.h>
#endif

#ifdef _WIN32
#define OPEN _open
#define CLOSE _close
#define TEMPNAM tempnam
// to run on Windows, supply a replacement for Unix mkstemp()
#define MKSTEMP _mkstemp
static int _mkstemp(const char * t){
  size_t l = strlen(t) + 1;
  char s[50];
  strncpy(s, t, l);
  return _mktemp_s(s, l) ? -1 : _open(s, _O_CREAT|_O_EXCL);
}

#define O_RDWR _O_RDWR
#define O_CREAT _O_CREAT
#define O_EXCL _O_EXCL
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#else
#define OPEN open
#define CLOSE close
#define TEMPNAM tempnam
#define MKSTEMP mkstemp
#endif

#ifndef OMITBAD

void CWE377_Insecure_Temporary_File__char_tempnam_17_bad()
{
    int j;
    for(j = 0; j < 1; j++)
    {
        {
            char * filename;
            int fileDesc;
            filename = TEMPNAM(NULL, NULL);
            if (filename == NULL)
            {
                exit(1);
            }
            printLine(filename);
            /* FLAW: Open a temporary file using open() and flags that do not prevent a race condition */
            fileDesc = OPEN(filename, O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
            if (fileDesc != -1)
            {
                printLine("Temporary file was opened...now closing file");
                CLOSE(fileDesc);
            }
            free(filename);
        }
    }
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* good1() uses the GoodSinkBody in the for statements */
static void good1()
{
    int k;
    for(k = 0; k < 1; k++)
    {
        {
            char filename[] = "/tmp/fileXXXXXX"; // mutable store for filename
            // FIX: Use mkstemp(). This is not a perfect solution, since file
            // names are too predictable, but it is a vast improvement.
            int fileDesc = MKSTEMP(filename);
            printLine(filename);
            if (fileDesc != -1)
            {
                printLine("Temporary file was opened...now closing file");
                CLOSE(fileDesc);
            }
        }
    }
}

void CWE377_Insecure_Temporary_File__char_tempnam_17_good()
{
    good1();
}

#endif /* OMITGOOD */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    CWE377_Insecure_Temporary_File__char_tempnam_17_good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    CWE377_Insecure_Temporary_File__char_tempnam_17_bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif