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

package com.google.cloud.assuredworkloads.v1;

/**
 *
 *
 *

 * Request for creating a workload.
 *

 *
 * Protobuf type {@code google.cloud.assuredworkloads.v1.CreateWorkloadRequest}
 */
public final class CreateWorkloadRequest extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.assuredworkloads.v1.CreateWorkloadRequest)
    CreateWorkloadRequestOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use CreateWorkloadRequest.newBuilder() to construct.
  private CreateWorkloadRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private CreateWorkloadRequest() {
    parent_ = "";
    externalId_ = "";
  }

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

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.assuredworkloads.v1.AssuredworkloadsProto
        .internal_static_google_cloud_assuredworkloads_v1_CreateWorkloadRequest_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.assuredworkloads.v1.AssuredworkloadsProto
        .internal_static_google_cloud_assuredworkloads_v1_CreateWorkloadRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest.class,
            com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest.Builder.class);
  }

  public static final int PARENT_FIELD_NUMBER = 1;
  private volatile java.lang.Object parent_;
  /**
   *
   *
   *

   * Required. The resource name of the new Workload's parent.
   * Must be of the form `organizations/{org_id}/locations/{location_id}`.
   *

   *
   *
   * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   *
   *
   * @return The parent.
   */
  @java.lang.Override
  public java.lang.String getParent() {
    java.lang.Object ref = parent_;
    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();
      parent_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Required. The resource name of the new Workload's parent.
   * Must be of the form `organizations/{org_id}/locations/{location_id}`.
   *

   *
   *
   * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   *
   *
   * @return The bytes for parent.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getParentBytes() {
    java.lang.Object ref = parent_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      parent_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int WORKLOAD_FIELD_NUMBER = 2;
  private com.google.cloud.assuredworkloads.v1.Workload workload_;
  /**
   *
   *
   *

   * Required. Assured Workload to create
   *

   *
   *
   * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return Whether the workload field is set.
   */
  @java.lang.Override
  public boolean hasWorkload() {
    return workload_ != null;
  }
  /**
   *
   *
   *

   * Required. Assured Workload to create
   *

   *
   *
   * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return The workload.
   */
  @java.lang.Override
  public com.google.cloud.assuredworkloads.v1.Workload getWorkload() {
    return workload_ == null
        ? com.google.cloud.assuredworkloads.v1.Workload.getDefaultInstance()
        : workload_;
  }
  /**
   *
   *
   *

   * Required. Assured Workload to create
   *

   *
   *
   * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
   *
   */
  @java.lang.Override
  public com.google.cloud.assuredworkloads.v1.WorkloadOrBuilder getWorkloadOrBuilder() {
    return getWorkload();
  }

  public static final int EXTERNAL_ID_FIELD_NUMBER = 3;
  private volatile java.lang.Object externalId_;
  /**
   *
   *
   *

   * Optional. A identifier associated with the workload and underlying projects which
   * allows for the break down of billing costs for a workload. The value
   * provided for the identifier will add a label to the workload and contained
   * projects with the identifier as the value.
   *

   *
   * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The externalId.
   */
  @java.lang.Override
  public java.lang.String getExternalId() {
    java.lang.Object ref = externalId_;
    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();
      externalId_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Optional. A identifier associated with the workload and underlying projects which
   * allows for the break down of billing costs for a workload. The value
   * provided for the identifier will add a label to the workload and contained
   * projects with the identifier as the value.
   *

   *
   * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The bytes for externalId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getExternalIdBytes() {
    java.lang.Object ref = externalId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      externalId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_);
    }
    if (workload_ != null) {
      output.writeMessage(2, getWorkload());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(externalId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, externalId_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_);
    }
    if (workload_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getWorkload());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(externalId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, externalId_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

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

    if (!getParent().equals(other.getParent())) return false;
    if (hasWorkload() != other.hasWorkload()) return false;
    if (hasWorkload()) {
      if (!getWorkload().equals(other.getWorkload())) return false;
    }
    if (!getExternalId().equals(other.getExternalId())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + PARENT_FIELD_NUMBER;
    hash = (53 * hash) + getParent().hashCode();
    if (hasWorkload()) {
      hash = (37 * hash) + WORKLOAD_FIELD_NUMBER;
      hash = (53 * hash) + getWorkload().hashCode();
    }
    hash = (37 * hash) + EXTERNAL_ID_FIELD_NUMBER;
    hash = (53 * hash) + getExternalId().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

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

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(
      com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   *

   * Request for creating a workload.
   *

   *
   * Protobuf type {@code google.cloud.assuredworkloads.v1.CreateWorkloadRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.assuredworkloads.v1.CreateWorkloadRequest)
      com.google.cloud.assuredworkloads.v1.CreateWorkloadRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.assuredworkloads.v1.AssuredworkloadsProto
          .internal_static_google_cloud_assuredworkloads_v1_CreateWorkloadRequest_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.assuredworkloads.v1.AssuredworkloadsProto
          .internal_static_google_cloud_assuredworkloads_v1_CreateWorkloadRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest.class,
              com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest.Builder.class);
    }

    // Construct using com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      parent_ = "";

      if (workloadBuilder_ == null) {
        workload_ = null;
      } else {
        workload_ = null;
        workloadBuilder_ = null;
      }
      externalId_ = "";

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.assuredworkloads.v1.AssuredworkloadsProto
          .internal_static_google_cloud_assuredworkloads_v1_CreateWorkloadRequest_descriptor;
    }

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

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

    @java.lang.Override
    public com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest buildPartial() {
      com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest result =
          new com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest(this);
      result.parent_ = parent_;
      if (workloadBuilder_ == null) {
        result.workload_ = workload_;
      } else {
        result.workload_ = workloadBuilder_.build();
      }
      result.externalId_ = externalId_;
      onBuilt();
      return result;
    }

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

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

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

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

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

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

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

    public Builder mergeFrom(com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest other) {
      if (other == com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest.getDefaultInstance())
        return this;
      if (!other.getParent().isEmpty()) {
        parent_ = other.parent_;
        onChanged();
      }
      if (other.hasWorkload()) {
        mergeWorkload(other.getWorkload());
      }
      if (!other.getExternalId().isEmpty()) {
        externalId_ = other.externalId_;
        onChanged();
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                parent_ = input.readStringRequireUtf8();

                break;
              } // case 10
            case 18:
              {
                input.readMessage(getWorkloadFieldBuilder().getBuilder(), extensionRegistry);

                break;
              } // case 18
            case 26:
              {
                externalId_ = input.readStringRequireUtf8();

                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

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

     * Required. The resource name of the new Workload's parent.
     * Must be of the form `organizations/{org_id}/locations/{location_id}`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @return The parent.
     */
    public java.lang.String getParent() {
      java.lang.Object ref = parent_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        parent_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Required. The resource name of the new Workload's parent.
     * Must be of the form `organizations/{org_id}/locations/{location_id}`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @return The bytes for parent.
     */
    public com.google.protobuf.ByteString getParentBytes() {
      java.lang.Object ref = parent_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        parent_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Required. The resource name of the new Workload's parent.
     * Must be of the form `organizations/{org_id}/locations/{location_id}`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @param value The parent to set.
     * @return This builder for chaining.
     */
    public Builder setParent(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

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

     * Required. The resource name of the new Workload's parent.
     * Must be of the form `organizations/{org_id}/locations/{location_id}`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @return This builder for chaining.
     */
    public Builder clearParent() {

      parent_ = getDefaultInstance().getParent();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Required. The resource name of the new Workload's parent.
     * Must be of the form `organizations/{org_id}/locations/{location_id}`.
     *

     *
     *
     * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     *
     *
     * @param value The bytes for parent to set.
     * @return This builder for chaining.
     */
    public Builder setParentBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private com.google.cloud.assuredworkloads.v1.Workload workload_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.assuredworkloads.v1.Workload,
            com.google.cloud.assuredworkloads.v1.Workload.Builder,
            com.google.cloud.assuredworkloads.v1.WorkloadOrBuilder>
        workloadBuilder_;
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     *
     * @return Whether the workload field is set.
     */
    public boolean hasWorkload() {
      return workloadBuilder_ != null || workload_ != null;
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     *
     * @return The workload.
     */
    public com.google.cloud.assuredworkloads.v1.Workload getWorkload() {
      if (workloadBuilder_ == null) {
        return workload_ == null
            ? com.google.cloud.assuredworkloads.v1.Workload.getDefaultInstance()
            : workload_;
      } else {
        return workloadBuilder_.getMessage();
      }
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder setWorkload(com.google.cloud.assuredworkloads.v1.Workload value) {
      if (workloadBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        workload_ = value;
        onChanged();
      } else {
        workloadBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder setWorkload(
        com.google.cloud.assuredworkloads.v1.Workload.Builder builderForValue) {
      if (workloadBuilder_ == null) {
        workload_ = builderForValue.build();
        onChanged();
      } else {
        workloadBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder mergeWorkload(com.google.cloud.assuredworkloads.v1.Workload value) {
      if (workloadBuilder_ == null) {
        if (workload_ != null) {
          workload_ =
              com.google.cloud.assuredworkloads.v1.Workload.newBuilder(workload_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          workload_ = value;
        }
        onChanged();
      } else {
        workloadBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public Builder clearWorkload() {
      if (workloadBuilder_ == null) {
        workload_ = null;
        onChanged();
      } else {
        workload_ = null;
        workloadBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public com.google.cloud.assuredworkloads.v1.Workload.Builder getWorkloadBuilder() {

      onChanged();
      return getWorkloadFieldBuilder().getBuilder();
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    public com.google.cloud.assuredworkloads.v1.WorkloadOrBuilder getWorkloadOrBuilder() {
      if (workloadBuilder_ != null) {
        return workloadBuilder_.getMessageOrBuilder();
      } else {
        return workload_ == null
            ? com.google.cloud.assuredworkloads.v1.Workload.getDefaultInstance()
            : workload_;
      }
    }
    /**
     *
     *
     *

     * Required. Assured Workload to create
     *

     *
     *
     * .google.cloud.assuredworkloads.v1.Workload workload = 2 [(.google.api.field_behavior) = REQUIRED];
     *
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.assuredworkloads.v1.Workload,
            com.google.cloud.assuredworkloads.v1.Workload.Builder,
            com.google.cloud.assuredworkloads.v1.WorkloadOrBuilder>
        getWorkloadFieldBuilder() {
      if (workloadBuilder_ == null) {
        workloadBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.assuredworkloads.v1.Workload,
                com.google.cloud.assuredworkloads.v1.Workload.Builder,
                com.google.cloud.assuredworkloads.v1.WorkloadOrBuilder>(
                getWorkload(), getParentForChildren(), isClean());
        workload_ = null;
      }
      return workloadBuilder_;
    }

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

     * Optional. A identifier associated with the workload and underlying projects which
     * allows for the break down of billing costs for a workload. The value
     * provided for the identifier will add a label to the workload and contained
     * projects with the identifier as the value.
     *

     *
     * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return The externalId.
     */
    public java.lang.String getExternalId() {
      java.lang.Object ref = externalId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        externalId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Optional. A identifier associated with the workload and underlying projects which
     * allows for the break down of billing costs for a workload. The value
     * provided for the identifier will add a label to the workload and contained
     * projects with the identifier as the value.
     *

     *
     * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return The bytes for externalId.
     */
    public com.google.protobuf.ByteString getExternalIdBytes() {
      java.lang.Object ref = externalId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        externalId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Optional. A identifier associated with the workload and underlying projects which
     * allows for the break down of billing costs for a workload. The value
     * provided for the identifier will add a label to the workload and contained
     * projects with the identifier as the value.
     *

     *
     * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @param value The externalId to set.
     * @return This builder for chaining.
     */
    public Builder setExternalId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

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

     * Optional. A identifier associated with the workload and underlying projects which
     * allows for the break down of billing costs for a workload. The value
     * provided for the identifier will add a label to the workload and contained
     * projects with the identifier as the value.
     *

     *
     * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @return This builder for chaining.
     */
    public Builder clearExternalId() {

      externalId_ = getDefaultInstance().getExternalId();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Optional. A identifier associated with the workload and underlying projects which
     * allows for the break down of billing costs for a workload. The value
     * provided for the identifier will add a label to the workload and contained
     * projects with the identifier as the value.
     *

     *
     * string external_id = 3 [(.google.api.field_behavior) = OPTIONAL];
     *
     * @param value The bytes for externalId to set.
     * @return This builder for chaining.
     */
    public Builder setExternalIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

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

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

    // @@protoc_insertion_point(builder_scope:google.cloud.assuredworkloads.v1.CreateWorkloadRequest)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest();
  }

  public static com.google.cloud.assuredworkloads.v1.CreateWorkloadRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

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


text:
class AddUserIdToContacts < ActiveRecord::Migration
  def change
    add_column :contacts, :user_id, :integer
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Functional;

/**
 * Logical negation of the given $function
 *
 * @param callable $function The function to run value against
 * @return callable A negation version on the given $function
 * @no-named-arguments
 */
function not(callable $function)
{
    return function ($value) use ($function) {
        return !$function($value);
    };
}


text:
<?php

namespace DelTesting\Common\Value;

use Codeception\TestCase\Test;
use Del\Common\Value\DecimalValue;
use Del\Common\Value\IntValue;
use Del\Common\Value\StringValue;

class AlertBoxTest extends Test
{
    public function testStringValue()
    {
        $value = new StringValue('Hello');
        $this->assertTrue(is_string($value->getValue()));
        $this->assertEquals('Hello', $value->getValue());
        $value = new StringValue(12345);
        $this->assertTrue(is_string($value->getValue()));
        $this->assertEquals('12345',$value->getValue());
        $this->expectException('InvalidArgumentException');
        new StringValue(new DecimalValue(3.11));
    }

    public function testIntValue()
    {
        $value = new IntValue(123456);
        $this->assertTrue(is_int($value->getValue()));
        $this->assertEquals(123456, $value->getValue());
        $value = new IntValue('123456');
        $this->assertTrue(is_int($value->getValue()));
        $this->assertEquals(123456, $value->getValue());
        $this->expectException('InvalidArgumentException');
        new IntValue('Not numeric');
    }

    public function testDecimalValue()
    {
        $value = new DecimalValue(1234);
        $this->assertTrue(is_float($value->getValue()));
        $this->assertEquals(1234.00, $value->getValue());
        $value = new DecimalValue(1234.56389);
        $this->assertTrue(is_float($value->getValue()));
        $this->assertEquals(1234.56, $value->getValue());
        $value = new DecimalValue('1234.56');
        $this->assertTrue(is_float($value->getValue()));
        $this->assertEquals(1234.56, $value->getValue());
        $this->expectException('InvalidArgumentException');
        new DecimalValue('Not numeric');
    }
}


text:
@implementation NSURLResponse (Courier)

- (NSInteger)cou_statusCode
{
    return [(NSHTTPURLResponse *)self statusCode];
}

- (BOOL)cou_success
{
    NSInteger statusCode = [(NSHTTPURLResponse *)self statusCode];
    return (statusCode >= 200 && statusCode < 300);
}

@end


text:
require "spec_helper"

describe SpreeShopifyImporter::DataSavers::Shipments::ShipmentCreator, type: :service do
  subject { described_class.new(shopify_data_feed, parent_data_feed, spree_order) }

  before { authenticate_with_shopify }

  after { ShopifyAPI::Base.clear_session }

  describe "#create!", vcr: { cassette_name: "shopify/base_order" } do
    let(:shopify_order) { ShopifyAPI::Order.find(5_182_437_124) }
    let(:shopify_fulfillment) { shopify_order.fulfillments.first }
    let(:spree_order) { create(:order) }
    let(:parent_data_feed) do
      create(:shopify_data_feed,
             shopify_object_id: shopify_order.id,
             shopify_object_type: "ShopifyAPI::Order",
             spree_object: spree_order,
             data_feed: shopify_order.to_json)
    end
    let(:shopify_data_feed) do
      create(:shopify_data_feed,
             shopify_object_id: shopify_fulfillment.id,
             shopify_object_type: "ShopifyAPI::Fulfillment",
             data_feed: shopify_fulfillment.to_json)
    end
    let(:spree_shipment) { Spree::Shipment.last }

    it "creates spree shipment" do
      expect { subject.create! }.to change(Spree::Shipment, :count).by(1)
    end

    context "sets shipment attributes" do
      before { subject.create! }

      it "number" do
        expect(spree_shipment.number).to eq "SH#{shopify_fulfillment.id}"
      end

      it "state" do
        expect(spree_shipment.state).to eq "shipped"
      end

      it "tracking" do
        expect(spree_shipment.tracking).to eq "21123123123213"
      end
    end

    context "sets associations" do
      let(:stock_location) { Spree::StockLocation.find_by(name: I18n.t(:shopify)) }
      let(:spree_shipping_rate) { Spree::ShippingRate.last }
      let(:spree_invetory_units) { Spree::InventoryUnit.all }

      before { subject.create! }

      it "spree order" do
        expect(spree_shipment.order).to eq spree_order
      end

      it "stock location" do
        expect(spree_shipment.stock_location).to eq stock_location
      end

      it "inventory units" do
        expect(spree_shipment.inventory_units).to match_array(spree_invetory_units)
      end

      it "shipping rates" do
        expect(spree_shipment.shipping_rates).to contain_exactly(spree_shipping_rate)
      end
    end
  end
end


text:
package org.ovirt.engine.core.common.vdscommands;

import org.ovirt.engine.core.compat.Guid;

public class ChangeDiskVDSCommandParameters extends VdsAndVmIDVDSParametersBase {
    private String _diskPath;

    public ChangeDiskVDSCommandParameters(Guid vdsId, Guid vmId, String diskPath) {
        super(vdsId, vmId);
        _diskPath = diskPath;
    }

    public String getDiskPath() {
        return _diskPath;
    }

    public ChangeDiskVDSCommandParameters() {
    }

    @Override
    public String toString() {
        return String.format("%s, diskPath=%s", super.toString(), getDiskPath());
    }
}


text:
// Copyright 2015 Apcera Inc. All rights reserved.

using System;
using NATS.Client;
using System.Threading;
using System.Reflection;
using System.IO;
using System.Linq;
using Xunit;

namespace NATSUnitTests
{
    /// <summary>
    /// Run these tests with the gnatsd auth.conf configuration file.
    /// </summary>
    public class TestAuthorization
    {
        int hitDisconnect;

        UnitTestUtilities util = new UnitTestUtilities();

        private void connectAndFail(String url)
        {
            try
            {
                hitDisconnect = 0;
                Options opts = util.DefaultTestOptions;
                opts.Url = url;
                opts.DisconnectedEventHandler += handleDisconnect;
                IConnection c = new ConnectionFactory().CreateConnection(url);
                Assert.True(false, "Expected a failure; did not receive one");

                c.Close();
            }
            catch (Exception e)
            {
                Assert.True(e.Message.Contains("Authorization"));
            }
            finally
            {
                Assert.False(hitDisconnect > 0, "The disconnect event handler was incorrectly invoked.");
            }
        }

        private void handleDisconnect(object sender, ConnEventArgs e)
        {
            hitDisconnect++;
        }

        [Fact]
        public void TestAuthSuccess()
        {
            using (NATSServer s = util.CreateServerWithConfig("auth_1222.conf"))
            {
                IConnection c = new ConnectionFactory().CreateConnection("nats://username:password@localhost:1222");
                c.Close();
            }
        }

        [Fact]
        public void TestAuthFailure()
        {
            using (NATSServer s = util.CreateServerWithConfig("auth_1222.conf"))
            {
                connectAndFail("nats://username@localhost:1222");
                connectAndFail("nats://username:badpass@localhost:1222");
                connectAndFail("nats://localhost:1222");
                connectAndFail("nats://badname:password@localhost:1222");
            }
        }

        [Fact]
        public void TestAuthToken()
        {
            using (NATSServer s = util.CreateServerWithArgs("-auth S3Cr3T0k3n!"))
            {
                connectAndFail("nats://localhost:4222");
                connectAndFail("nats://invalid_token@localhost:4222");

                new ConnectionFactory().CreateConnection("nats://S3Cr3T0k3n!@localhost:4222").Close();
            }
        }

        [Fact]
        public void TestReconnectAuthTimeout()
        {
            AutoResetEvent ev  = new AutoResetEvent(false);

            using (NATSServer s1 = util.CreateServerWithConfig("auth_1222.conf"),
                              s2 = util.CreateServerWithConfig("auth_1223_timeout.conf"),
                              s3 = util.CreateServerWithConfig("auth_1224.conf"))
            {

                Options opts = util.DefaultTestOptions;

                opts.Servers = new string[]{
                    "nats://username:password@localhost:1222",
                    "nats://username:password@localhost:1223",
                    "nats://username:password@localhost:1224" };
                opts.NoRandomize = true;

                opts.ReconnectedEventHandler += (sender, args) =>
                {
                    ev.Set();
                };

                IConnection c = new ConnectionFactory().CreateConnection(opts);

                s1.Shutdown();

                // This should fail over to S2 where an authorization timeout occurs
                // then successfully reconnect to S3.

                Assert.True(ev.WaitOne(20000));
            }
        }

#if NET45
        [Fact]
        public void TestReconnectAuthTimeoutLateClose()
        {
            AutoResetEvent ev = new AutoResetEvent(false);

            using (NATSServer s1 = util.CreateServerWithConfig("auth_1222.conf"),
                              s2 = util.CreateServerWithConfig("auth_1224.conf"))
            {

                Options opts = util.DefaultTestOptions;

                opts.Servers = new string[]{
                    "nats://username:password@localhost:1222",
                    "nats://username:password@localhost:1224" };
                opts.NoRandomize = true;

                opts.ReconnectedEventHandler += (sender, args) =>
                {
                    ev.Set();
                };

                IConnection c = new ConnectionFactory().CreateConnection(opts);

                // inject an authorization timeout, as if it were processed by an incoming server message.
                // this is done at the parser level so that parsing is also tested,
                // therefore it needs reflection since Parser is an internal type.
                Type parserType = typeof(Connection).Assembly.GetType("NATS.Client.Parser");
                Assert.NotNull(parserType);

                BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance;
                object parser = Activator.CreateInstance(parserType, flags, null, new object[] { c }, null);
                Assert.NotNull(parser);

                MethodInfo parseMethod = parserType.GetMethod("parse", flags);
                Assert.NotNull(parseMethod);

                byte[] bytes = "-ERR 'Authorization Timeout'\r\n".ToCharArray().Select(ch => (byte)ch).ToArray();
                parseMethod.Invoke(parser, new object[] { bytes, bytes.Length });

                // sleep to allow the client to process the error, then shutdown the server.
                Thread.Sleep(250);
                s1.Shutdown();

                // Wait for a reconnect.
                Assert.True(ev.WaitOne(20000));
            }
        }
#endif
    }
}


text:
class SnippetsController < ApplicationController
  def index
    @snippets = Snippet.all
  end

  def show
    @snippet = Snippet.find(params[:id])
  end

  def new
    @snippet = Snippet.new
  end

  def create
    @snippet = Snippet.new(params[:snippet])
    if @snippet.save
      redirect_to @snippet, notice: "Snippet was successfully created."
    else
      render :new
    end
  end

  def edit
    @snippet = Snippet.find(params[:id])
  end

  def update
    @snippet = Snippet.find(params[:id])
    if @snippet.update_attributes(params[:snippet])
      redirect_to @snippet, notice: "Snippet was successfully updated."
    else
      render :edit
    end
  end

  def destroy
    @snippet = Snippet.find(params[:id])
    @snippet.destroy
    redirect_to snippets_url
  end
end


text:
import { TestUtils } from '../../test';
import { BwcProvider } from '../bwc/bwc';
import { CurrencyProvider } from '../currency/currency';
import { PersistenceProvider } from '../persistence/persistence';
import { FeeProvider } from './fee';

describe('Provider: Fee Provider', () => {
  let feeProvider: FeeProvider;
  let persistenceProvider: PersistenceProvider;
  let currencyProvider: CurrencyProvider;

  class BwcProviderMock {
    constructor() {}
    getClient() {
      const walletClient = {
        getFeeLevels: (coin, network, cb) => {
          let levels;
          if (coin == 'bch' && network == 'livenet') {
            levels = [{ level: 'normal', feePerKb: 1000, nbBlocks: 2 }];
          }
          if (coin == 'btc' && network == 'livenet') {
            levels = [
              { level: 'urgent', feePerKb: 272369, nbBlocks: 2 },
              { level: 'priority', feePerKb: 181579, nbBlocks: 2 },
              { level: 'normal', feePerKb: 181579, nbBlocks: 3 },
              { level: 'economy', feePerKb: 135307, nbBlocks: 6 },
              { level: 'superEconomy', feePerKb: 117048, nbBlocks: 24 }
            ];
          }
          if (network == 'testnet') {
            levels = [
              { level: 'urgent', feePerKb: 1500, nbBlocks: 2 },
              { level: 'priority', feePerKb: 1000, nbBlocks: 2 },
              { level: 'normal', feePerKb: 1000, nbBlocks: 3 },
              { level: 'economy', feePerKb: 1000, nbBlocks: 6 },
              { level: 'superEconomy', feePerKb: 1000, nbBlocks: 24 }
            ];
          }
          return cb(null, levels);
        }
      };
      return walletClient;
    }
  }

  beforeEach(() => {
    const testBed = TestUtils.configureProviderTestingModule([
      { provide: BwcProvider, useClass: BwcProviderMock }
    ]);
    feeProvider = testBed.get(FeeProvider);
    currencyProvider = testBed.get(CurrencyProvider);
    persistenceProvider = testBed.get(PersistenceProvider);
    persistenceProvider.load();
  });

  describe('getFeeOpts', () => {
    it('should get fee opts', () => {
      spyOn(currencyProvider, 'isERCToken').and.returnValue(false);
      const feeOpts = feeProvider.getFeeOpts();
      expect(feeOpts).toEqual({
        urgent: 'Urgent',
        priority: 'Priority',
        normal: 'Normal',
        economy: 'Economy',
        superEconomy: 'Super Economy',
        custom: 'Custom'
      });
    });
  });

  describe('getFeeRate', () => {
    it('should return the correct fee rate for each fee level', () => {
      // btc - livenet
      feeProvider.getFeeRate('btc', 'livenet', 'urgent').then(feeLevel => {
        expect(feeLevel).toEqual(272369);
      });

      feeProvider.getFeeRate(null, null, 'urgent').then(feeLevel => {
        expect(feeLevel).toEqual(272369);
      });
      feeProvider.getFeeRate('btc', 'livenet', 'priority').then(feeLevel => {
        expect(feeLevel).toEqual(181579);
      });
      feeProvider.getFeeRate('btc', 'livenet', 'normal').then(feeLevel => {
        expect(feeLevel).toEqual(181579);
      });
      feeProvider.getFeeRate('btc', 'livenet', 'economy').then(feeLevel => {
        expect(feeLevel).toEqual(135307);
      });
      feeProvider
        .getFeeRate('btc', 'livenet', 'superEconomy')
        .then(feeLevel => {
          expect(feeLevel).toEqual(117048);
        });
      // btc - testnet
      feeProvider.getFeeRate('btc', 'testnet', 'urgent').then(feeLevel => {
        expect(feeLevel).toEqual(1500);
      });
      feeProvider.getFeeRate('btc', 'testnet', 'priority').then(feeLevel => {
        expect(feeLevel).toEqual(1000);
      });
      feeProvider.getFeeRate('btc', 'testnet', 'normal').then(feeLevel => {
        expect(feeLevel).toEqual(1000);
      });
      feeProvider.getFeeRate('btc', 'testnet', 'economy').then(feeLevel => {
        expect(feeLevel).toEqual(1000);
      });
      feeProvider
        .getFeeRate('btc', 'testnet', 'superEconomy')
        .then(feeLevel => {
          expect(feeLevel).toEqual(1000);
        });
      // bch - livenet
      feeProvider.getFeeRate('bch', 'livenet', 'normal').then(feeLevel => {
        expect(feeLevel).toEqual(1000);
      });
    });

    it('should fail with "Could not get dynamic fee for level: FEE_LEVEL" if no response', () => {
      feeProvider.getFeeRate('bch', 'livenet', 'superEconomy').catch(err => {
        expect(err).toEqual(
          'Could not get dynamic fee for level: superEconomy'
        );
      });
    });

    it('should resolve with undefined if custom level is set', () => {
      feeProvider.getFeeRate('bch', 'livenet', 'custom').then(feeLevel => {
        expect(feeLevel).toEqual(undefined);
      });
    });
  });

  describe('getFeeLevels', () => {
    it('should return the correct fee levels from cached', () => {
      feeProvider.getFeeLevels('btc', 'livenet').then(response => {
        const btcFeeLevels = response.levels;
        expect(response.fromCache).toEqual(undefined);
        expect(btcFeeLevels).toEqual([
          { level: 'urgent', feePerKb: 272369, nbBlocks: 2 },
          { level: 'priority', feePerKb: 181579, nbBlocks: 2 },
          { level: 'normal', feePerKb: 181579, nbBlocks: 3 },
          { level: 'economy', feePerKb: 135307, nbBlocks: 6 },
          { level: 'superEconomy', feePerKb: 117048, nbBlocks: 24 }
        ]);
        feeProvider.getFeeLevels('btc', 'livenet').then(response => {
          const btcFeeLevels = response.levels;
          expect(response.fromCache).toEqual(true);
          expect(btcFeeLevels).toEqual([
            { level: 'urgent', feePerKb: 272369, nbBlocks: 2 },
            { level: 'priority', feePerKb: 181579, nbBlocks: 2 },
            { level: 'normal', feePerKb: 181579, nbBlocks: 3 },
            { level: 'economy', feePerKb: 135307, nbBlocks: 6 },
            { level: 'superEconomy', feePerKb: 117048, nbBlocks: 24 }
          ]);
        });
      });
    });

    it('should fail with "Could not get dynamic fee" if no response for livenet values from BWC', () => {
      spyOn(BwcProviderMock.prototype, 'getClient').and.returnValue({
        getFeeLevels: (_coin, _network, cb) => {
          return cb('bwc_error', null);
        }
      });

      feeProvider.getFeeLevels('btc', 'livenet').catch(err => {
        expect(err).toEqual('Could not get dynamic fee');
      });
    });

    it('should fail with "Could not get dynamic fee" if no response for testnet values from BWC', () => {
      spyOn(BwcProviderMock.prototype, 'getClient').and.returnValue({
        getFeeLevels: (_coin, network, cb) => {
          if (network == 'livenet') {
            return cb(null, {});
          }
          if (network == 'testnet') {
            return cb('bwc_error', null);
          }
        }
      });

      feeProvider.getFeeLevels('btc', 'livenet').catch(err => {
        expect(err).toEqual('Could not get dynamic fee');
      });
    });
  });
});


text:
// Copyright 2012 Google Inc. All Rights Reserved.

goog.provide('cvox.SearchLoader');
goog.require('cvox.SearchContextMenu');

/**
 * @fileoverview Inject the script into the page.
 * @author peterxiao@google.com (Peter Xiao)
 */

/**
 * @constructor
 */
cvox.SearchLoader = function() {
};

/**
 * Called when document ready state changes.
 */
cvox.SearchLoader.onReadyStateChange = function() {
  /* Make sure document is complete. Loading base.js when the document is
   * loading will destroy the DOM. */
  if (document.readyState !== 'complete') {
    return;
  }
  var GOOGLE_HOST = 'www.google.com';
  var SEARCH_PATH = '/search';

  if (window.location.host !== GOOGLE_HOST ||
      window.location.pathname !== SEARCH_PATH) {
    return;
  }

  cvox.SearchContextMenu.init();
};

/**
 * Inject Search into the page.
 */
cvox.SearchLoader.init = function() {
  if (document.readyState !== 'complete') {
    document.onreadystatechange = cvox.SearchLoader.onReadyStateChange;
  } else {
    cvox.SearchLoader.onReadyStateChange();
  }
};


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#include <sstream>
#include <limits>

#include "ifcpp/model/AttributeObject.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/model/BuildingGuid.h"
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/IFC4/include/IfcDayInMonthNumber.h"
#include "ifcpp/IFC4/include/IfcDayInWeekNumber.h"
#include "ifcpp/IFC4/include/IfcInteger.h"
#include "ifcpp/IFC4/include/IfcMonthInYearNumber.h"
#include "ifcpp/IFC4/include/IfcRecurrencePattern.h"
#include "ifcpp/IFC4/include/IfcRecurrenceTypeEnum.h"
#include "ifcpp/IFC4/include/IfcTimePeriod.h"

// ENTITY IfcRecurrencePattern
IfcRecurrencePattern::IfcRecurrencePattern( int id ) { m_entity_id = id; }
shared_ptr<BuildingObject> IfcRecurrencePattern::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcRecurrencePattern> copy_self( new IfcRecurrencePattern() );
	if( m_RecurrenceType ) { copy_self->m_RecurrenceType = dynamic_pointer_cast<IfcRecurrenceTypeEnum>( m_RecurrenceType->getDeepCopy(options) ); }
	for( size_t ii=0; ii<m_DayComponent.size(); ++ii )
	{
		auto item_ii = m_DayComponent[ii];
		if( item_ii )
		{
			copy_self->m_DayComponent.emplace_back( dynamic_pointer_cast<IfcDayInMonthNumber>(item_ii->getDeepCopy(options) ) );
		}
	}
	for( size_t ii=0; ii<m_WeekdayComponent.size(); ++ii )
	{
		auto item_ii = m_WeekdayComponent[ii];
		if( item_ii )
		{
			copy_self->m_WeekdayComponent.emplace_back( dynamic_pointer_cast<IfcDayInWeekNumber>(item_ii->getDeepCopy(options) ) );
		}
	}
	for( size_t ii=0; ii<m_MonthComponent.size(); ++ii )
	{
		auto item_ii = m_MonthComponent[ii];
		if( item_ii )
		{
			copy_self->m_MonthComponent.emplace_back( dynamic_pointer_cast<IfcMonthInYearNumber>(item_ii->getDeepCopy(options) ) );
		}
	}
	if( m_Position ) { copy_self->m_Position = dynamic_pointer_cast<IfcInteger>( m_Position->getDeepCopy(options) ); }
	if( m_Interval ) { copy_self->m_Interval = dynamic_pointer_cast<IfcInteger>( m_Interval->getDeepCopy(options) ); }
	if( m_Occurrences ) { copy_self->m_Occurrences = dynamic_pointer_cast<IfcInteger>( m_Occurrences->getDeepCopy(options) ); }
	for( size_t ii=0; ii<m_TimePeriods.size(); ++ii )
	{
		auto item_ii = m_TimePeriods[ii];
		if( item_ii )
		{
			copy_self->m_TimePeriods.emplace_back( dynamic_pointer_cast<IfcTimePeriod>(item_ii->getDeepCopy(options) ) );
		}
	}
	return copy_self;
}
void IfcRecurrencePattern::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_entity_id << "= IFCRECURRENCEPATTERN" << "(";
	if( m_RecurrenceType ) { m_RecurrenceType->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	writeTypeOfIntList( stream, m_DayComponent );
	stream << ",";
	writeTypeOfIntList( stream, m_WeekdayComponent );
	stream << ",";
	writeTypeOfIntList( stream, m_MonthComponent );
	stream << ",";
	if( m_Position ) { m_Position->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Interval ) { m_Interval->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Occurrences ) { m_Occurrences->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	writeEntityList( stream, m_TimePeriods );
	stream << ");";
}
void IfcRecurrencePattern::getStepParameter( std::stringstream& stream, bool /*is_select_type*/ ) const { stream << "#" << m_entity_id; }
const std::wstring IfcRecurrencePattern::toString() const { return L"IfcRecurrencePattern"; }
void IfcRecurrencePattern::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<BuildingEntity> >& map )
{
	const size_t num_args = args.size();
	if( num_args != 8 ){ std::stringstream err; err << "Wrong parameter count for entity IfcRecurrencePattern, expecting 8, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw BuildingException( err.str().c_str() ); }
	m_RecurrenceType = IfcRecurrenceTypeEnum::createObjectFromSTEP( args[0], map );
	readTypeOfIntegerList( args[1], m_DayComponent );
	readTypeOfIntegerList( args[2], m_WeekdayComponent );
	readTypeOfIntegerList( args[3], m_MonthComponent );
	m_Position = IfcInteger::createObjectFromSTEP( args[4], map );
	m_Interval = IfcInteger::createObjectFromSTEP( args[5], map );
	m_Occurrences = IfcInteger::createObjectFromSTEP( args[6], map );
	readEntityReferenceList( args[7], m_TimePeriods, map );
}
void IfcRecurrencePattern::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	vec_attributes.emplace_back( std::make_pair( "RecurrenceType", m_RecurrenceType ) );
	if( !m_DayComponent.empty() )
	{
		shared_ptr<AttributeObjectVector> DayComponent_vec_object( new AttributeObjectVector() );
		std::copy( m_DayComponent.begin(), m_DayComponent.end(), std::back_inserter( DayComponent_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "DayComponent", DayComponent_vec_object ) );
	}
	if( !m_WeekdayComponent.empty() )
	{
		shared_ptr<AttributeObjectVector> WeekdayComponent_vec_object( new AttributeObjectVector() );
		std::copy( m_WeekdayComponent.begin(), m_WeekdayComponent.end(), std::back_inserter( WeekdayComponent_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "WeekdayComponent", WeekdayComponent_vec_object ) );
	}
	if( !m_MonthComponent.empty() )
	{
		shared_ptr<AttributeObjectVector> MonthComponent_vec_object( new AttributeObjectVector() );
		std::copy( m_MonthComponent.begin(), m_MonthComponent.end(), std::back_inserter( MonthComponent_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "MonthComponent", MonthComponent_vec_object ) );
	}
	vec_attributes.emplace_back( std::make_pair( "Position", m_Position ) );
	vec_attributes.emplace_back( std::make_pair( "Interval", m_Interval ) );
	vec_attributes.emplace_back( std::make_pair( "Occurrences", m_Occurrences ) );
	if( !m_TimePeriods.empty() )
	{
		shared_ptr<AttributeObjectVector> TimePeriods_vec_object( new AttributeObjectVector() );
		std::copy( m_TimePeriods.begin(), m_TimePeriods.end(), std::back_inserter( TimePeriods_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "TimePeriods", TimePeriods_vec_object ) );
	}
}
void IfcRecurrencePattern::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
}
void IfcRecurrencePattern::setInverseCounterparts( shared_ptr<BuildingEntity> )
{
}
void IfcRecurrencePattern::unlinkFromInverseCounterparts()
{
}


text:
package com.athena.dolly.controller.threadpool.executor;

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 *

 * Spring에서 지원하는 TaskExecutor(ThreadPoolTaskExecutor)를 이용하여 Runnable Task를 실행시키는 실행기
 *

 * @author Sang-cheon Park
 * @version 1.0
 */
public abstract class BaseTaskExecutor {

    protected ThreadPoolTaskExecutor executor;

    /**
     * @param executor the executor to set
     */
    public void setTaskExecutor(ThreadPoolTaskExecutor executor) {
        this.executor = executor;
    }

    /**
     *

     *
     *

     * @param obj
     */
    public abstract void execute(Object... obj);
}//end of BaseTaskExecutor.java


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">BetweenJSAndJava</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>

</resources>


text:
using namespace Atomic;

namespace ToolCore
{

class NETProjectGen;

class NETProjectBase : public Object
{
    OBJECT(NETProjectBase);

public:

    NETProjectBase(Context* context, NETProjectGen* projectGen);
    virtual ~NETProjectBase();

    void ReplacePathStrings(String& path);

protected:

    SharedPtr<XMLFile> xmlFile_;
    WeakPtr<NETProjectGen> projectGen_;

};

class NETCSProject : public NETProjectBase
{
    OBJECT(NETCSProject);

public:

    NETCSProject(Context* context, NETProjectGen* projectGen);
    virtual ~NETCSProject();

    bool Load(const JSONValue& root);

    const String& GetName() { return name_; }
    const String& GetProjectGUID() { return projectGuid_; }

    bool Generate();

private:

    void CreateCompileItemGroup(XMLElement &projectRoot);
    void CreateReferencesItemGroup(XMLElement &projectRoot);
    void CreateMainPropertyGroup(XMLElement &projectRoot);
    void CreateDebugPropertyGroup(XMLElement &projectRoot);
    void CreateReleasePropertyGroup(XMLElement &projectRoot);
    void GetAssemblySearchPaths(String& paths);

    String name_;
    String projectGuid_;
    String outputType_;
    String rootNamespace_;
    String assemblyName_;
    String assemblyOutputPath_;
    String assemblySearchPaths_;

    XMLElement xmlRoot_;

    Vector<String> references_;
    Vector<String> sourceFolders_;
};

class NETSolution : public NETProjectBase
{
    OBJECT(NETSolution);

public:

    NETSolution(Context* context, NETProjectGen* projectGen);
    virtual ~NETSolution();

    bool Load(const JSONValue& root);

    bool Generate();

    const String& GetOutputPath() { return outputPath_; }

private:

    void GenerateXamarinStudio(const String& slnPath);

    String name_;
    String outputPath_;

};

class NETProjectGen : public Object
{
    OBJECT(NETProjectGen);

public:

    NETProjectGen(Context* context);
    virtual ~NETProjectGen();

    const String& GetScriptPlatform() { return scriptPlatform_; }

    NETSolution* GetSolution() { return solution_; }

    bool GetMonoBuild() { return monoBuild_; }
    bool GetGameBuild() { return gameBuild_; }

    const Vector<SharedPtr<NETCSProject>>& GetCSProjects() { return projects_; }

    void SetScriptPlatform(const String& platform) { scriptPlatform_ = platform; }

    bool Generate();

    String GenerateUUID();

    bool LoadProject(const JSONValue& root, bool gameBuild = false);
    bool LoadProject(const String& projectPath, bool gameBuild = false);

private:

    String scriptPlatform_;

    bool monoBuild_;
    bool gameBuild_;

    SharedPtr<NETSolution> solution_;
    Vector<SharedPtr<NETCSProject>> projects_;

};

}


text:
"use strict";

const selector = [
  "CallExpression",
  "[optional=false]",
  '[callee.type="MemberExpression"]',
  "[callee.computed=false]",
  "[callee.optional=false]",
  '[callee.property.type="Identifier"]',
  '[callee.property.name="call"]',
  "[arguments.length=1]",
  '[arguments.0.type!="SpreadElement"]',
].join("");

const messageId = "no-unnecessary-ast-path-call";

module.exports = {
  meta: {
    type: "suggestion",
    docs: {
      url: "https://github.com/prettier/prettier/blob/main/scripts/tools/eslint-plugin-prettier-internal-rules/no-unnecessary-ast-path-call.js",
    },
    messages: {
      [messageId]: "Do not use `AstPath.call()` with one argument.",
    },
    fixable: "code",
  },
  create(context) {
    const sourceCode = context.getSourceCode();

    return {
      [selector](node) {
        const problem = {
          node,
          messageId,
        };

        const [callback] = node.arguments;

        // Don't fix to IIFE
        if (
          callback.type !== "ArrowFunctionExpression" &&
          callback.type !== "FunctionExpression"
        ) {
          problem.fix = function (fixer) {
            const callbackText = sourceCode.getText(callback);
            const astPathText = sourceCode.getText(node.callee.object);
            return fixer.replaceText(node, `${callbackText}(${astPathText})`);
          };
        }

        context.report(problem);
      },
    };
  },
};


text:
package org.springframework.security.core.userdetails;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

import org.junit.Test;

import reactor.core.publisher.Mono;

public class MapReactiveUserDetailsServiceTests {
	private static final UserDetails USER_DETAILS = User.withUsername("user")
			.password("password")
			.roles("USER")
			.build();

	private MapReactiveUserDetailsService users = new MapReactiveUserDetailsService(Arrays.asList(USER_DETAILS));

	@Test(expected = IllegalArgumentException.class)
	public void constructorNullUsers() {
		Collection<UserDetails> users = null;
		new MapReactiveUserDetailsService(users);
	}

	@Test(expected = IllegalArgumentException.class)
	public void constructorEmptyUsers() {
		Collection<UserDetails> users = Collections.emptyList();
		new MapReactiveUserDetailsService(users);
	}

	@Test
	public void findByUsernameWhenFoundThenReturns() {
		assertThat((users.findByUsername(USER_DETAILS.getUsername()).block())).isEqualTo(USER_DETAILS);
	}

	@Test
	public void findByUsernameWhenDifferentCaseThenReturns() {
		assertThat((users.findByUsername("uSeR").block())).isEqualTo(USER_DETAILS);
	}

	@Test
	public void findByUsernameWhenClearCredentialsThenFindByUsernameStillHasCredentials() {
		User foundUser = users.findByUsername(USER_DETAILS.getUsername()).cast(User.class).block();
		assertThat(foundUser.getPassword()).isNotEmpty();
		foundUser.eraseCredentials();
		assertThat(foundUser.getPassword()).isNull();

		foundUser = users.findByUsername(USER_DETAILS.getUsername()).cast(User.class).block();
		assertThat(foundUser.getPassword()).isNotEmpty();
	}

	@Test
	public void findByUsernameWhenNotFoundThenEmpty() {
		assertThat((users.findByUsername("notfound"))).isEqualTo(Mono.empty());
	}
}


text:
package net.bither.ui.base.dialog;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TextView;

import net.bither.R;
import net.bither.bitherj.api.http.BitherUrl;
import net.bither.bitherj.core.AbstractHD;
import net.bither.bitherj.core.HDAccount;
import net.bither.bitherj.utils.Utils;
import net.bither.ui.base.DropdownMessage;
import net.bither.util.StringUtil;
import net.bither.util.UIUtil;
import net.bither.util.WalletUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;

/**
 * Created by songchenwen on 15/7/3.
 */
public class DialogHdAccountOldAddresses extends CenterDialog {
    private static final int MaxHeight = UIUtil.getScreenHeight() - UIUtil.dip2pix(200);
    private static final int ItemHeight = UIUtil.dip2pix(70);
    private static final int MAX_CACHE_SIZE = 500;

    private HDAccount hdAccount;

    private ListView lv;

    private Activity activity;

    private HashMap<Integer, String> addresses = new HashMap<Integer, String>();

    public DialogHdAccountOldAddresses(Activity context, HDAccount hdAccount) {
        super(context);
        this.hdAccount = hdAccount;
        activity = context;
        initView();
    }

    private void initView() {
        setContentView(R.layout.dialog_hd_old_addresses);
        lv = (ListView) findViewById(R.id.lv);
        lv.setAdapter(adapter);
        lv.getLayoutParams().height = caculateHeight();
    }

    private BaseAdapter adapter = new BaseAdapter() {
        @Override
        public int getCount() {
            return issuedExternalAddressCount();
        }

        @Override
        public String getItem(int position) {
            String a = addresses.get(Integer.valueOf(position));
            if (a == null) {
                a = addressForIndex(position);
                if (addresses.size() >= MAX_CACHE_SIZE) {
                    addresses.clear();
                }
                addresses.put(Integer.valueOf(position), a);
            }
            return a;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Item view;
            if (convertView == null || !(convertView instanceof Item)) {
                convertView = new Item(activity);
            }
            view = (Item) convertView;
            view.setAddress(getItem(position));
            return convertView;
        }
    };

    @Override
    public void show() {
        if (issuedExternalAddressCount() > 0) {
            super.show();
        }
    }

    private int caculateHeight() {
        int count = issuedExternalAddressCount();
        if (count <= 0) {
            return 0;
        }
        return Math.min(MaxHeight, count * ItemHeight);
    }

    private int issuedExternalAddressCount() {
            return hdAccount.issuedExternalIndex() + 1;
    }

    private String addressForIndex(int index) {
            return hdAccount.addressForPath(AbstractHD.PathType.EXTERNAL_ROOT_PATH, index)
                    .getAddress();
    }

    private void showMsg(int msg) {
        DropdownMessage.showDropdownMessage(activity, msg);
    }

    private class Item extends FrameLayout implements View.OnClickListener {
        private TextView tv;

        private String address;

        public Item(Context context) {
            super(context);
            removeAllViews();
            addView(LayoutInflater.from(context).inflate(R.layout
                    .list_item_hd_old_addresses_dialog, null), new LayoutParams(LayoutParams
                    .MATCH_PARENT, ItemHeight));
            findViewById(R.id.fl_address).setOnClickListener(this);
            tv = (TextView) findViewById(R.id.tv_subtransaction_address);
            findViewById(R.id.ibtn_view_on_net).setOnClickListener(this);
        }

        public void setAddress(String address) {
            this.address = address;
            tv.setText(WalletUtils.formatHash(address, 4, 12));
        }

        @Override
        public void onClick(View v) {
            dismiss();
            switch (v.getId()) {
                case R.id.fl_address:
                    StringUtil.copyString(address);
                    showMsg(R.string.copy_address_success);
                    break;
                case R.id.ibtn_view_on_net:
                    new DialogWithActions(activity) {
                        @Override
                        protected List<Action> getActions() {
                            ArrayList<Action> actions = new ArrayList<Action>();
                            actions.add(new Action(R.string
                                    .address_option_view_on_blockchain_info, new Runnable() {
                                @Override
                                public void run() {
                                    UIUtil.gotoBrower(activity, BitherUrl
                                            .BLOCKCHAIN_INFO_ADDRESS_URL + address);
                                }
                            }));

                            String defaultCountry = Locale.getDefault().getCountry();
                            if (Utils.compareString(defaultCountry, "CN") || Utils.compareString
                                    (defaultCountry, "cn")) {
                                actions.add(new Action(R.string.address_option_view_on_blockmeta,
                                        new Runnable() {
                                    @Override
                                    public void run() {
                                        UIUtil.gotoBrower(activity, BitherUrl
                                                .BLOCKMETA_ADDRESS_URL + address);
                                    }
                                }));
                            }
                            return actions;
                        }
                    }.show();
                    break;
            }
        }
    }
}


text:
require File.expand_path('../boot', __FILE__)

require 'rails/all'
require "attachinary/orm/active_record"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Helpy
  class Application < Rails::Application

    config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
    config.assets.paths << Rails.root.join("public",'uploads','logos')
    config.exceptions_app = self.routes

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]

    # Do not swallow errors in after_commit/after_rollback callbacks.
    config.active_record.raise_in_transactional_callbacks = true

    # We are using active_job and currently the inline backend.  You may change this if
    # you want a more robust solution. The queue is used for emails.
    config.active_job.queue_adapter = :sucker_punch

    config.to_prepare do
      Devise::Mailer.layout "mailer" # email.haml or email.erb
    end

  end
end

module Api
  class Application < Rails::Application
    config.middleware.use Rack::Cors do
      allow do
        origins "*"
        resource "*", headers: :any, methods: [:get,
            :post, :put, :delete, :options]
      end
    end
    config.active_record.raise_in_transactional_callbacks = true
  end
end


text:
text2know
=========

SMS, meet internet.

Hosted on an ec2 micro instance. See changes at http://ec2-54-187-117-53.us-west-2.compute.amazonaws.com/


text:
using Orleans.Transactions;
using Orleans.Transactions.Abstractions;

namespace Orleans.Hosting;

public static class SiloBuilderExtensions
{
    /// <summary>
    /// Configure cluster to use the distributed TM algorithm
    /// </summary>
    /// <param name="builder">Silo host builder</param>
    /// <returns>The silo builder.</returns>
    public static ISiloBuilder UseTransactions(this ISiloBuilder builder)
    {
        return builder.ConfigureServices(services => services.UseTransactionsWithSilo())
                      .AddGrainExtension<ITransactionManagerExtension, TransactionManagerExtension>()
                      .AddGrainExtension<ITransactionalResourceExtension, TransactionalResourceExtension>();
    }
}


text:
struct point
point_above(struct point point)
{
    assert(point.z > INT_MIN);
    return point_make(point.x, point.y, point.z - 1);
}

char *
point_alloc_xy(struct point point)
{
    return str_alloc_formatted("(%i, %i)", point.x, point.y);
}

struct point
point_below(struct point point)
{
    assert(point.z < INT_MAX);
    return point_make(point.x, point.y, point.z + 1);
}

int
point_compare(struct point point, struct point other)
{
    if (point.z != other.z) return point.z - other.z;
    if (point.y != other.y) return point.y - other.y;
    return point.x - other.x;
}

struct point
point_east(struct point point)
{
    assert(point.x < INT_MAX);
    return point_make(point.x + 1, point.y, point.z);
}

bool
point_equals(struct point point, struct point other)
{
    return 0 == point_compare(point, other);
}

struct point
point_make(int x, int y, int z)
{
    return (struct point){ .x=x, .y=y, .z=z };
}

struct point
point_move(struct point start, int distance, enum direction direction)
{
    assert(direction_is_valid(direction));
    switch (direction) {
        case direction_north:
            return point_make(start.x, start.y + distance, start.z);
        case direction_northeast:
            return point_make(start.x + distance, start.y + distance, start.z);
        case direction_east:
            return point_make(start.x + distance, start.y, start.z);
        case direction_southeast:
            return point_make(start.x + distance, start.y - distance, start.z);
        case direction_south:
            return point_make(start.x, start.y - distance, start.z);
        case direction_southwest:
            return point_make(start.x - distance, start.y - distance, start.z);
        case direction_west:
            return point_make(start.x - distance, start.y, start.z);
        case direction_northwest:
            return point_make(start.x - distance, start.y + distance, start.z);
    }
    return point_make(start.x, start.y + distance, start.z);
}

struct point
point_north(struct point point)
{
    assert(point.y < INT_MAX);
    return point_make(point.x, point.y + 1, point.z);
}

struct point
point_northeast(struct point point)
{
    assert(point.x < INT_MAX);
    assert(point.y < INT_MAX);
    return point_make(point.x + 1, point.y + 1, point.z);
}

struct point
point_northwest(struct point point)
{
    assert(point.x > INT_MIN);
    assert(point.y < INT_MAX);
    return point_make(point.x - 1, point.y + 1, point.z);
}

struct point
point_rotate_90_degrees_left(struct point point, enum direction direction)
{
    assert(direction_is_valid(direction));
    switch (direction) {
        case direction_north:
            assert(point.x > INT_MIN);
            assert(point.y > INT_MIN);
            return point_make(point.x - 1, point.y - 1, point.z);
        case direction_northeast:
            assert(point.x > INT_MIN + 1);
            return point_make(point.x - 2, point.y, point.z);
        case direction_east:
            assert(point.x > INT_MIN);
            assert(point.y < INT_MAX);
            return point_make(point.x - 1, point.y + 1, point.z);
        case direction_southeast:
            assert(point.y < INT_MAX - 1);
            return point_make(point.x, point.y + 2, point.z);
        case direction_south:
            assert(point.x < INT_MAX);
            assert(point.y < INT_MAX);
            return point_make(point.x + 1, point.y + 1, point.z);
        case direction_southwest:
            assert(point.x < INT_MAX - 1);
            return point_make(point.x + 2, point.y, point.z);
        case direction_west:
            assert(point.x < INT_MAX);
            assert(point.y > INT_MIN);
            return point_make(point.x + 1, point.y - 1, point.z);
        case direction_northwest:
            assert(point.y > INT_MIN + 1);
            return point_make(point.x, point.y - 2, point.z);
    }
    return point_make(point.x - 1, point.y - 1, point.z);
}

struct point
point_rotate_90_degrees_right(struct point point, enum direction direction)
{
    assert(direction_is_valid(direction));
    switch (direction) {
        case direction_north:
            assert(point.x < INT_MAX);
            assert(point.y > INT_MIN);
            return point_make(point.x + 1, point.y - 1, point.z);
        case direction_northeast:
            assert(point.y > INT_MIN + 1);
            return point_make(point.x, point.y - 2, point.z);
        case direction_east:
            assert(point.x > INT_MIN);
            assert(point.y > INT_MIN);
            return point_make(point.x - 1, point.y - 1, point.z);
        case direction_southeast:
            assert(point.x > INT_MIN + 1);
            return point_make(point.x - 2, point.y, point.z);
        case direction_south:
            assert(point.x > INT_MIN);
            assert(point.y < INT_MAX);
            return point_make(point.x - 1, point.y + 1, point.z);
        case direction_southwest:
            assert(point.y < INT_MAX - 1);
            return point_make(point.x, point.y + 2, point.z);
        case direction_west:
            assert(point.x < INT_MAX);
            assert(point.y < INT_MAX);
            return point_make(point.x + 1, point.y + 1, point.z);
        case direction_northwest:
            assert(point.x < INT_MAX - 1);
            return point_make(point.x + 2, point.y, point.z);
    }
    return point_make(point.x + 1, point.y - 1, point.z);
}

struct point
point_south(struct point point)
{
    assert(point.y > INT_MIN);
    return point_make(point.x, point.y - 1, point.z);
}

struct point
point_southeast(struct point point)
{
    assert(point.x < INT_MAX);
    assert(point.y > INT_MIN);
    return point_make(point.x + 1, point.y - 1, point.z);
}

struct point
point_southwest(struct point point)
{
    assert(point.x > INT_MIN);
    assert(point.y > INT_MIN);
    return point_make(point.x - 1, point.y - 1, point.z);
}

struct point
point_west(struct point point)
{
    assert(point.x > INT_MIN);
    return point_make(point.x - 1, point.y, point.z);
}


text:
"""Helper objects for various SOL-related commands"""

from sys import stderr, platform

if platform != 'win32':
    import pexpect
    from pexpect import TIMEOUT, EOF
from pyipmi import IpmiError

ESCAPE_SEQUENCES = {
    "IpmiTool" : {
        "terminate" : "~.",
        "list_escapes" : "~?",
        "escape_char" : "~~"
    }
}

TOOL_RESPONSES = {
    "IpmiTool" : {
        "open" : "[SOL Session operational.  Use ~? for help]",
        "close" : "[terminated ipmitool]",
        "send_error": "Error sending SOL data: FAIL",
        "bmc_closed": "SOL session closed by BMC",
        "activation_error": "Error: No response activating SOL payload",
        "session_error": "Error: Unable to establish IPMI v2 / RMCP+ session",
        "deactivation_error": "Error: No response de-activating SOL payload",
    }
}

class SOLError(IpmiError):
    """SOL error"""

class SOLConsole(object):
    """Create and control an SOL session"""

    def __init__(self, bmc, hostname, username, password):
        self.isopen = False
        self._bmc = bmc
        self._toolname = bmc.handle._tool.__class__.__name__
        self.escapes = ESCAPE_SEQUENCES[self._toolname]
        self.responses = TOOL_RESPONSES[self._toolname]

        # save authenication info
        self._auth_info = {
            'hostname' : hostname,
            'username' : username,
            'password' : password
        }

        # activate SOL session
        self._proc = self._bmc.activate_payload()
        self._proc.timeout = 5
        self.expect_exact(self.responses['open'])

        # set up log files
        self._proc.logfile_read = file('sol_read.log', 'w')
        self._proc.logfile_send = file('sol_write.log', 'w')

        try:
            self._login()
        except IpmiError:
            self.close()
            raise

        self.isopen = True

    def __del__(self):
        if self.isopen:
            self.close()
        self._bmc = None

    def close(self):
        self._logout()
        self.send(self.escapes['terminate'])
        try:
            self.expect_exact(self.responses['close'], timeout=2)
        except TIMEOUT, EOF:
            try:
                self._bmc.deactivate_payload()
            except IpmiError as e:
                assert e.message.find(self.responses['deactivation_error']) > -1
                stderr.write(e.message)

        if self._proc.isalive():
            self._proc.close()

        self.isopen = False

    def _login(self):
        hostname = self._auth_info['hostname']
        username = self._auth_info['username']
        password = self._auth_info['password']

        self.prompt = '%s@%s.*[$#] ' % (username, hostname)
        self.login_prompt = hostname + ' login: '

        # once we've activated a session, either we're logged in,
        # we need to log in, or we're not getting any data back
        login_patterns = [self.login_prompt, self.prompt, TIMEOUT, EOF]
        self.sendline()
        index = self.expect(login_patterns)

        # if we haven't found a prompt (index > 1),
        # try sending various control characters
        # control characters to send
        controls = ['\\', 'c', 'd']
        while index > 1:
            try:
                self.sendcontrol(controls.pop())
                index = self.expect(login_patterns)
            except IndexError:
                raise IpmiError('SOL session unresponsive')

        if index == 0:
            # need to log in
            try:
                self.sendline(username)
                self.expect_exact('Password: ')
                self.sendline(password)
                self.expect(self.prompt)
            except TIMEOUT:
                raise #IpmiError('%s@%s: failed login' % (username, hostname))
        elif index == 1:
            # we're already logged in
            pass

        # make the prompt more predictable
        self.sendline('export PS1="\u@\h:~\$ "')
        self.expect(self.prompt)

    def _logout(self):
        self.sendcontrol('c')
        self.sendline('logout')
        return self.expect([self.login_prompt, TIMEOUT, EOF]) == 0

    ######################################
    #                                    #
    # Wrappers for pexpect functionality #
    #                                    #
    ######################################

    def expect(self, pattern, timeout=-1, searchwindowsize=None):
        return self._proc.expect(pattern, timeout, searchwindowsize)

    def expect_exact(self, pattern, timeout=-1, searchwindowsize=None):
        return self._proc.expect_exact(pattern, timeout, searchwindowsize)

    def read(self, size=-1):
        # pexpect implements this function by expecting the delimiter
        # the default delimiter is EOF, which for our purposes, is
        # unlikely to be reached. So instead, use TIMEOUT
        # as the delimiter for now
        prev_delimiter = self._proc.delimiter
        self._proc.delimiter = TIMEOUT
        data = self._proc.read(size)
        self._proc.delimiter = prev_delimiter
        return data

    def readline(self, size=-1):
        return self._proc.readline(size)

    def send(self, s):
        return self._proc.send(s)

    def sendline(self, s=""):
        return self.send(s + "\n")

    def sendcontrol(self, char):
        return self._proc.sendcontrol(char)

    @property
    def match(self):
        return self._proc.match

# map config params to range of possible values
SOL_CONFIGURATION_PARAMETERS = {
    "set_in_progress" : ["set_in_progress", "set_complete", "commit_write"],
    "enable" : [True, False],
    "force_encryption" : [True, False],
    "force_authentication" : [True, False],
    "privilege_level" : ["USER", "OPERATOR", "ADMINISTRATOR", "OEM"],
    "character_accumulate_interval" : range(1, 256),
    "character_send_threshold" : range(256),
    "retry_count" : range(8),
    "retry_interval" : range(256),
    "volatile_bit_rate" : [9.6, 19.2, 38.4, 57.6, 115.2], #TODO: "serial"
    "non_volatile_bit_rate" : [9.6, 19.2, 38.4, 57.6, 115.2], #TODO: "serial"
    "payload_channel" : [], # implementation specific
    "payload_port_number" : [], # implementation specific
    # TODO: support OEM parameters
}

# map tools to a list of unsettable params for that tool
TOOL_RESTRICTIONS = {
    "IpmiTool": ["payload_channel", "payload_port_number"],
}


text:
//= require ./breadboard

/*global console sparks getBreadBoard $*/

(function () {
    sparks.circuitMath = function(){};

    sparks.circuitMath.prototype = {

      getResistors: function(resistorNames) {
        var resistors = [];
        var components = getBreadBoard().components;
        $.each(resistorNames, function(i, name){
          if (!!components[name]){
            resistors.push(components[name]);
          } else {
            console.log("ERROR: "+name+" cannot be found on breadboard");
          }
        });
        return resistors;
      },

      rSeries: function() {
        var resistors = this.getResistors(arguments);

        var resistance = 0;
        $.each(resistors, function(i, resistor){
          resistance += resistor.resistance;
        });
        return resistance;
      },

      rParallel: function() {
        var resistors = this.getResistors(arguments);

        var resistance = 0;
        $.each(resistors, function(i, resistor){
          resistance += (1/resistor.resistance);
        });
        return (1/resistance);
      },

      rNominalSeries: function() {
        var resistors = this.getResistors(arguments);
        var resistance = 0;
        $.each(resistors, function(i, resistor){
          resistance += resistor.nominalResistance;
        });
        return resistance;
      },

      rNominalParallel: function() {
        var resistors = this.getResistors(arguments);

        var resistance = 0;
        $.each(resistors, function(i, resistor){
          resistance += (1/resistor.nominalResistance);
        });
        return (1/resistance);
      },

      vDiv: function(){
        var resistors = this.getResistors(arguments);
        return resistors[0].resistance / (resistors[0].resistance + resistors[1].resistance);
      }
    };

    this.cMath = new sparks.circuitMath();

})();


text:
<?php defined('SYSPATH') OR die('No direct access allowed.');

class Schema extends Kohana_Schema {}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Balosar.Shared;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenIddict.Validation.AspNetCore;

namespace Balosar.Server.Controllers;

[Authorize(AuthenticationSchemes = OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme)]
[ApiController, Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
    private static readonly string[] Summaries = new[]
    {
        "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
    };

    [HttpGet]
    public IEnumerable<WeatherForecast> Get()
    {
        var random = new Random();
        return Enumerable.Range(1, 5).Select(index => new WeatherForecast
        {
            Date = DateTime.Now.AddDays(index),
            TemperatureC = random.Next(-20, 55),
            Summary = Summaries[random.Next(Summaries.Length)]
        })
        .ToArray();
    }
}


text:
package bio.terra.workspace.service.spendprofile.exceptions;

import bio.terra.common.exception.ErrorReportException;
import bio.terra.profile.client.ApiException;
import java.util.Collections;
import org.springframework.http.HttpStatus;

public class BillingProfileManagerServiceAPIException extends ErrorReportException {
  public BillingProfileManagerServiceAPIException(ApiException apiException) {
    super(
        "Error from Billing Profile Manager Service:",
        apiException,
        Collections.singletonList(apiException.getResponseBody()),
        HttpStatus.resolve(apiException.getCode()));
  }
}


text:
export SRCROOT="<%= compileDir %>" &&
mkdir -p $SRCROOT &&
cd $SRCROOT &&

### Set versions and directories
export PVERSION_LIBSSH2="<%= packageSoftwareVersion %>" &&
export PDESTDIR_OPENSSL="<%= externalDestDir_openssl %>" &&

### libssh2
# CheckURI: http://www.libssh2.org/
cd $SRCROOT && . ../build_functions.sh &&
export PNAME="libssh2" &&
export PVERSION="$PVERSION_LIBSSH2" &&
export PDIR="$PNAME-$PVERSION" &&
export PFILE="$PDIR.tar.gz" &&
export PURI="http://www.libssh2.org/download/$PFILE" &&

rm -rf $PDIR &&
GetUnpackCd &&

./configure \
  --with-openssl \
  --with-libssl-prefix=$PDESTDIR_OPENSSL &&
make -j 2 &&
make install &&
ldconfig &&

cd $SRCROOT &&
rm -rf $PDIR &&

exit 0


text:
Pure AngularJS directive which creates a dropdown button with multiple or single selections.
Doesn't require jQuery and works well with other Javascript libraries.

![Screenshot](https://raw.githubusercontent.com/isteven/angular-multi-select/master/screenshot.png)

### Demo & How To
Go to http://isteven.github.io/angular-multi-select

### Current Version
3.0.0

### Change Log
See CHANGELOG.md.
For those who's upgrading from version 2.x.x, do note that this version is not backward-compatible. Please read the manual
thoroughly and update your code accordingly.

### Bug Reporting
Please follow these steps:

1. **READ THE MANUAL AGAIN**. You might have missed something. This includes the MINIMUM ANGULARJS VERSION and the SUPPORTED BROWSERS.
2. The next step is to search in Github's issue section first. There might already be an answer for similar issue. Do check both open and closed issues.
3. If there's no previous issue found, then please create a new issue in https://github.com/isteven/angular-multi-select/issues.
4. Please **replicate the problem in JSFiddle or Plunker** (or any other online JS collaboration tool), and include the URL in the issue you are creating.
5. When you're done, please close the issue you've created.

### Licence
Released under the MIT license:

The MIT License (MIT)

Copyright (c) 2014-2015 Ignatius Steven (https://github.com/isteven)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  namespace: 'api/v1',
  //this is dependent on production/development environment
  //It is configured in config/environment.js
  host: ClientENV.hostUrl
});