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

package com.google.cloud.metastore.v1beta;

/**
 *
 *
 *

 * The metadata management activities of the metastore service.
 *

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

  private MetadataManagementActivity() {
    metadataExports_ = java.util.Collections.emptyList();
    restores_ = java.util.Collections.emptyList();
  }

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

  @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.metastore.v1beta.MetastoreProto
        .internal_static_google_cloud_metastore_v1beta_MetadataManagementActivity_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.metastore.v1beta.MetastoreProto
        .internal_static_google_cloud_metastore_v1beta_MetadataManagementActivity_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.metastore.v1beta.MetadataManagementActivity.class,
            com.google.cloud.metastore.v1beta.MetadataManagementActivity.Builder.class);
  }

  public static final int METADATA_EXPORTS_FIELD_NUMBER = 1;
  private java.util.List<com.google.cloud.metastore.v1beta.MetadataExport> metadataExports_;
  /**
   *
   *
   *

   * Output only. The latest metadata exports of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.metastore.v1beta.MetadataExport> getMetadataExportsList() {
    return metadataExports_;
  }
  /**
   *
   *
   *

   * Output only. The latest metadata exports of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public java.util.List<? extends com.google.cloud.metastore.v1beta.MetadataExportOrBuilder>
      getMetadataExportsOrBuilderList() {
    return metadataExports_;
  }
  /**
   *
   *
   *

   * Output only. The latest metadata exports of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public int getMetadataExportsCount() {
    return metadataExports_.size();
  }
  /**
   *
   *
   *

   * Output only. The latest metadata exports of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public com.google.cloud.metastore.v1beta.MetadataExport getMetadataExports(int index) {
    return metadataExports_.get(index);
  }
  /**
   *
   *
   *

   * Output only. The latest metadata exports of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public com.google.cloud.metastore.v1beta.MetadataExportOrBuilder getMetadataExportsOrBuilder(
      int index) {
    return metadataExports_.get(index);
  }

  public static final int RESTORES_FIELD_NUMBER = 2;
  private java.util.List<com.google.cloud.metastore.v1beta.Restore> restores_;
  /**
   *
   *
   *

   * Output only. The latest restores of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.metastore.v1beta.Restore> getRestoresList() {
    return restores_;
  }
  /**
   *
   *
   *

   * Output only. The latest restores of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public java.util.List<? extends com.google.cloud.metastore.v1beta.RestoreOrBuilder>
      getRestoresOrBuilderList() {
    return restores_;
  }
  /**
   *
   *
   *

   * Output only. The latest restores of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public int getRestoresCount() {
    return restores_.size();
  }
  /**
   *
   *
   *

   * Output only. The latest restores of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public com.google.cloud.metastore.v1beta.Restore getRestores(int index) {
    return restores_.get(index);
  }
  /**
   *
   *
   *

   * Output only. The latest restores of the metastore service.
   *

   *
   *
   * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  @java.lang.Override
  public com.google.cloud.metastore.v1beta.RestoreOrBuilder getRestoresOrBuilder(int index) {
    return restores_.get(index);
  }

  private byte memoizedIsInitialized = -1;

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    for (int i = 0; i < metadataExports_.size(); i++) {
      output.writeMessage(1, metadataExports_.get(i));
    }
    for (int i = 0; i < restores_.size(); i++) {
      output.writeMessage(2, restores_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    for (int i = 0; i < metadataExports_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, metadataExports_.get(i));
    }
    for (int i = 0; i < restores_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, restores_.get(i));
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

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

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

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (getMetadataExportsCount() > 0) {
      hash = (37 * hash) + METADATA_EXPORTS_FIELD_NUMBER;
      hash = (53 * hash) + getMetadataExportsList().hashCode();
    }
    if (getRestoresCount() > 0) {
      hash = (37 * hash) + RESTORES_FIELD_NUMBER;
      hash = (53 * hash) + getRestoresList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.metastore.v1beta.MetadataManagementActivity parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

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

  public static com.google.cloud.metastore.v1beta.MetadataManagementActivity 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.metastore.v1beta.MetadataManagementActivity 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;
  }
  /**
   *
   *
   *

   * The metadata management activities of the metastore service.
   *

   *
   * Protobuf type {@code google.cloud.metastore.v1beta.MetadataManagementActivity}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.metastore.v1beta.MetadataManagementActivity)
      com.google.cloud.metastore.v1beta.MetadataManagementActivityOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.metastore.v1beta.MetastoreProto
          .internal_static_google_cloud_metastore_v1beta_MetadataManagementActivity_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.metastore.v1beta.MetastoreProto
          .internal_static_google_cloud_metastore_v1beta_MetadataManagementActivity_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.metastore.v1beta.MetadataManagementActivity.class,
              com.google.cloud.metastore.v1beta.MetadataManagementActivity.Builder.class);
    }

    // Construct using com.google.cloud.metastore.v1beta.MetadataManagementActivity.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (metadataExportsBuilder_ == null) {
        metadataExports_ = java.util.Collections.emptyList();
      } else {
        metadataExports_ = null;
        metadataExportsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000001);
      if (restoresBuilder_ == null) {
        restores_ = java.util.Collections.emptyList();
      } else {
        restores_ = null;
        restoresBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.metastore.v1beta.MetastoreProto
          .internal_static_google_cloud_metastore_v1beta_MetadataManagementActivity_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.metastore.v1beta.MetadataManagementActivity
        getDefaultInstanceForType() {
      return com.google.cloud.metastore.v1beta.MetadataManagementActivity.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.metastore.v1beta.MetadataManagementActivity buildPartial() {
      com.google.cloud.metastore.v1beta.MetadataManagementActivity result =
          new com.google.cloud.metastore.v1beta.MetadataManagementActivity(this);
      int from_bitField0_ = bitField0_;
      if (metadataExportsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          metadataExports_ = java.util.Collections.unmodifiableList(metadataExports_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.metadataExports_ = metadataExports_;
      } else {
        result.metadataExports_ = metadataExportsBuilder_.build();
      }
      if (restoresBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          restores_ = java.util.Collections.unmodifiableList(restores_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.restores_ = restores_;
      } else {
        result.restores_ = restoresBuilder_.build();
      }
      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.metastore.v1beta.MetadataManagementActivity) {
        return mergeFrom((com.google.cloud.metastore.v1beta.MetadataManagementActivity) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.metastore.v1beta.MetadataManagementActivity other) {
      if (other
          == com.google.cloud.metastore.v1beta.MetadataManagementActivity.getDefaultInstance())
        return this;
      if (metadataExportsBuilder_ == null) {
        if (!other.metadataExports_.isEmpty()) {
          if (metadataExports_.isEmpty()) {
            metadataExports_ = other.metadataExports_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureMetadataExportsIsMutable();
            metadataExports_.addAll(other.metadataExports_);
          }
          onChanged();
        }
      } else {
        if (!other.metadataExports_.isEmpty()) {
          if (metadataExportsBuilder_.isEmpty()) {
            metadataExportsBuilder_.dispose();
            metadataExportsBuilder_ = null;
            metadataExports_ = other.metadataExports_;
            bitField0_ = (bitField0_ & ~0x00000001);
            metadataExportsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getMetadataExportsFieldBuilder()
                    : null;
          } else {
            metadataExportsBuilder_.addAllMessages(other.metadataExports_);
          }
        }
      }
      if (restoresBuilder_ == null) {
        if (!other.restores_.isEmpty()) {
          if (restores_.isEmpty()) {
            restores_ = other.restores_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureRestoresIsMutable();
            restores_.addAll(other.restores_);
          }
          onChanged();
        }
      } else {
        if (!other.restores_.isEmpty()) {
          if (restoresBuilder_.isEmpty()) {
            restoresBuilder_.dispose();
            restoresBuilder_ = null;
            restores_ = other.restores_;
            bitField0_ = (bitField0_ & ~0x00000002);
            restoresBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getRestoresFieldBuilder()
                    : null;
          } else {
            restoresBuilder_.addAllMessages(other.restores_);
          }
        }
      }
      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:
              {
                com.google.cloud.metastore.v1beta.MetadataExport m =
                    input.readMessage(
                        com.google.cloud.metastore.v1beta.MetadataExport.parser(),
                        extensionRegistry);
                if (metadataExportsBuilder_ == null) {
                  ensureMetadataExportsIsMutable();
                  metadataExports_.add(m);
                } else {
                  metadataExportsBuilder_.addMessage(m);
                }
                break;
              } // case 10
            case 18:
              {
                com.google.cloud.metastore.v1beta.Restore m =
                    input.readMessage(
                        com.google.cloud.metastore.v1beta.Restore.parser(), extensionRegistry);
                if (restoresBuilder_ == null) {
                  ensureRestoresIsMutable();
                  restores_.add(m);
                } else {
                  restoresBuilder_.addMessage(m);
                }
                break;
              } // case 18
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private java.util.List<com.google.cloud.metastore.v1beta.MetadataExport> metadataExports_ =
        java.util.Collections.emptyList();

    private void ensureMetadataExportsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        metadataExports_ =
            new java.util.ArrayList<com.google.cloud.metastore.v1beta.MetadataExport>(
                metadataExports_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.metastore.v1beta.MetadataExport,
            com.google.cloud.metastore.v1beta.MetadataExport.Builder,
            com.google.cloud.metastore.v1beta.MetadataExportOrBuilder>
        metadataExportsBuilder_;

    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public java.util.List<com.google.cloud.metastore.v1beta.MetadataExport>
        getMetadataExportsList() {
      if (metadataExportsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(metadataExports_);
      } else {
        return metadataExportsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public int getMetadataExportsCount() {
      if (metadataExportsBuilder_ == null) {
        return metadataExports_.size();
      } else {
        return metadataExportsBuilder_.getCount();
      }
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.MetadataExport getMetadataExports(int index) {
      if (metadataExportsBuilder_ == null) {
        return metadataExports_.get(index);
      } else {
        return metadataExportsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder setMetadataExports(
        int index, com.google.cloud.metastore.v1beta.MetadataExport value) {
      if (metadataExportsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMetadataExportsIsMutable();
        metadataExports_.set(index, value);
        onChanged();
      } else {
        metadataExportsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder setMetadataExports(
        int index, com.google.cloud.metastore.v1beta.MetadataExport.Builder builderForValue) {
      if (metadataExportsBuilder_ == null) {
        ensureMetadataExportsIsMutable();
        metadataExports_.set(index, builderForValue.build());
        onChanged();
      } else {
        metadataExportsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addMetadataExports(com.google.cloud.metastore.v1beta.MetadataExport value) {
      if (metadataExportsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMetadataExportsIsMutable();
        metadataExports_.add(value);
        onChanged();
      } else {
        metadataExportsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addMetadataExports(
        int index, com.google.cloud.metastore.v1beta.MetadataExport value) {
      if (metadataExportsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMetadataExportsIsMutable();
        metadataExports_.add(index, value);
        onChanged();
      } else {
        metadataExportsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addMetadataExports(
        com.google.cloud.metastore.v1beta.MetadataExport.Builder builderForValue) {
      if (metadataExportsBuilder_ == null) {
        ensureMetadataExportsIsMutable();
        metadataExports_.add(builderForValue.build());
        onChanged();
      } else {
        metadataExportsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addMetadataExports(
        int index, com.google.cloud.metastore.v1beta.MetadataExport.Builder builderForValue) {
      if (metadataExportsBuilder_ == null) {
        ensureMetadataExportsIsMutable();
        metadataExports_.add(index, builderForValue.build());
        onChanged();
      } else {
        metadataExportsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addAllMetadataExports(
        java.lang.Iterable<? extends com.google.cloud.metastore.v1beta.MetadataExport> values) {
      if (metadataExportsBuilder_ == null) {
        ensureMetadataExportsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, metadataExports_);
        onChanged();
      } else {
        metadataExportsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder clearMetadataExports() {
      if (metadataExportsBuilder_ == null) {
        metadataExports_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        metadataExportsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder removeMetadataExports(int index) {
      if (metadataExportsBuilder_ == null) {
        ensureMetadataExportsIsMutable();
        metadataExports_.remove(index);
        onChanged();
      } else {
        metadataExportsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.MetadataExport.Builder getMetadataExportsBuilder(
        int index) {
      return getMetadataExportsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.MetadataExportOrBuilder getMetadataExportsOrBuilder(
        int index) {
      if (metadataExportsBuilder_ == null) {
        return metadataExports_.get(index);
      } else {
        return metadataExportsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public java.util.List<? extends com.google.cloud.metastore.v1beta.MetadataExportOrBuilder>
        getMetadataExportsOrBuilderList() {
      if (metadataExportsBuilder_ != null) {
        return metadataExportsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(metadataExports_);
      }
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.MetadataExport.Builder addMetadataExportsBuilder() {
      return getMetadataExportsFieldBuilder()
          .addBuilder(com.google.cloud.metastore.v1beta.MetadataExport.getDefaultInstance());
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.MetadataExport.Builder addMetadataExportsBuilder(
        int index) {
      return getMetadataExportsFieldBuilder()
          .addBuilder(index, com.google.cloud.metastore.v1beta.MetadataExport.getDefaultInstance());
    }
    /**
     *
     *
     *

     * Output only. The latest metadata exports of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.MetadataExport metadata_exports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public java.util.List<com.google.cloud.metastore.v1beta.MetadataExport.Builder>
        getMetadataExportsBuilderList() {
      return getMetadataExportsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.metastore.v1beta.MetadataExport,
            com.google.cloud.metastore.v1beta.MetadataExport.Builder,
            com.google.cloud.metastore.v1beta.MetadataExportOrBuilder>
        getMetadataExportsFieldBuilder() {
      if (metadataExportsBuilder_ == null) {
        metadataExportsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.metastore.v1beta.MetadataExport,
                com.google.cloud.metastore.v1beta.MetadataExport.Builder,
                com.google.cloud.metastore.v1beta.MetadataExportOrBuilder>(
                metadataExports_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        metadataExports_ = null;
      }
      return metadataExportsBuilder_;
    }

    private java.util.List<com.google.cloud.metastore.v1beta.Restore> restores_ =
        java.util.Collections.emptyList();

    private void ensureRestoresIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        restores_ = new java.util.ArrayList<com.google.cloud.metastore.v1beta.Restore>(restores_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.metastore.v1beta.Restore,
            com.google.cloud.metastore.v1beta.Restore.Builder,
            com.google.cloud.metastore.v1beta.RestoreOrBuilder>
        restoresBuilder_;

    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public java.util.List<com.google.cloud.metastore.v1beta.Restore> getRestoresList() {
      if (restoresBuilder_ == null) {
        return java.util.Collections.unmodifiableList(restores_);
      } else {
        return restoresBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public int getRestoresCount() {
      if (restoresBuilder_ == null) {
        return restores_.size();
      } else {
        return restoresBuilder_.getCount();
      }
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.Restore getRestores(int index) {
      if (restoresBuilder_ == null) {
        return restores_.get(index);
      } else {
        return restoresBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder setRestores(int index, com.google.cloud.metastore.v1beta.Restore value) {
      if (restoresBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureRestoresIsMutable();
        restores_.set(index, value);
        onChanged();
      } else {
        restoresBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder setRestores(
        int index, com.google.cloud.metastore.v1beta.Restore.Builder builderForValue) {
      if (restoresBuilder_ == null) {
        ensureRestoresIsMutable();
        restores_.set(index, builderForValue.build());
        onChanged();
      } else {
        restoresBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addRestores(com.google.cloud.metastore.v1beta.Restore value) {
      if (restoresBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureRestoresIsMutable();
        restores_.add(value);
        onChanged();
      } else {
        restoresBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addRestores(int index, com.google.cloud.metastore.v1beta.Restore value) {
      if (restoresBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureRestoresIsMutable();
        restores_.add(index, value);
        onChanged();
      } else {
        restoresBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addRestores(com.google.cloud.metastore.v1beta.Restore.Builder builderForValue) {
      if (restoresBuilder_ == null) {
        ensureRestoresIsMutable();
        restores_.add(builderForValue.build());
        onChanged();
      } else {
        restoresBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addRestores(
        int index, com.google.cloud.metastore.v1beta.Restore.Builder builderForValue) {
      if (restoresBuilder_ == null) {
        ensureRestoresIsMutable();
        restores_.add(index, builderForValue.build());
        onChanged();
      } else {
        restoresBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder addAllRestores(
        java.lang.Iterable<? extends com.google.cloud.metastore.v1beta.Restore> values) {
      if (restoresBuilder_ == null) {
        ensureRestoresIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, restores_);
        onChanged();
      } else {
        restoresBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder clearRestores() {
      if (restoresBuilder_ == null) {
        restores_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        restoresBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public Builder removeRestores(int index) {
      if (restoresBuilder_ == null) {
        ensureRestoresIsMutable();
        restores_.remove(index);
        onChanged();
      } else {
        restoresBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.Restore.Builder getRestoresBuilder(int index) {
      return getRestoresFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.RestoreOrBuilder getRestoresOrBuilder(int index) {
      if (restoresBuilder_ == null) {
        return restores_.get(index);
      } else {
        return restoresBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public java.util.List<? extends com.google.cloud.metastore.v1beta.RestoreOrBuilder>
        getRestoresOrBuilderList() {
      if (restoresBuilder_ != null) {
        return restoresBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(restores_);
      }
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.Restore.Builder addRestoresBuilder() {
      return getRestoresFieldBuilder()
          .addBuilder(com.google.cloud.metastore.v1beta.Restore.getDefaultInstance());
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public com.google.cloud.metastore.v1beta.Restore.Builder addRestoresBuilder(int index) {
      return getRestoresFieldBuilder()
          .addBuilder(index, com.google.cloud.metastore.v1beta.Restore.getDefaultInstance());
    }
    /**
     *
     *
     *

     * Output only. The latest restores of the metastore service.
     *

     *
     *
     * repeated .google.cloud.metastore.v1beta.Restore restores = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
     *
     */
    public java.util.List<com.google.cloud.metastore.v1beta.Restore.Builder>
        getRestoresBuilderList() {
      return getRestoresFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.metastore.v1beta.Restore,
            com.google.cloud.metastore.v1beta.Restore.Builder,
            com.google.cloud.metastore.v1beta.RestoreOrBuilder>
        getRestoresFieldBuilder() {
      if (restoresBuilder_ == null) {
        restoresBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.metastore.v1beta.Restore,
                com.google.cloud.metastore.v1beta.Restore.Builder,
                com.google.cloud.metastore.v1beta.RestoreOrBuilder>(
                restores_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
        restores_ = null;
      }
      return restoresBuilder_;
    }

    @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.metastore.v1beta.MetadataManagementActivity)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.metastore.v1beta.MetadataManagementActivity)
  private static final com.google.cloud.metastore.v1beta.MetadataManagementActivity
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.metastore.v1beta.MetadataManagementActivity();
  }

  public static com.google.cloud.metastore.v1beta.MetadataManagementActivity getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<MetadataManagementActivity> PARSER =
      new com.google.protobuf.AbstractParser<MetadataManagementActivity>() {
        @java.lang.Override
        public MetadataManagementActivity 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<MetadataManagementActivity> parser() {
    return PARSER;
  }

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

  @java.lang.Override
  public com.google.cloud.metastore.v1beta.MetadataManagementActivity getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}


text:
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("tslint/lib/utils");
var metadataPropertyBase_1 = require("./metadataPropertyBase");
var utils_2 = require("./util/utils");
var METADATA_PROPERTY_NAME = 'queries';
var Rule = (function (_super) {
    __extends(Rule, _super);
    function Rule(options) {
        return _super.call(this, {
            errorMessage: Rule.FAILURE_STRING,
            propertyName: METADATA_PROPERTY_NAME
        }, options) || this;
    }
    Rule.metadata = {
        description: "Disallows usage of the `" + METADATA_PROPERTY_NAME + "` metadata property.",
        options: null,
        optionsDescription: 'Not configurable.',
        rationale: utils_1.dedent(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n      If you ever need to rename the property associated\n      with @", ",\n      @", ", @", "\n      or @", ",\n      you can modify it in a single place.\n    "], ["\n      If you ever need to rename the property associated\n      with @", ",\n      @", ", @", "\n      or @", ",\n      you can modify it in a single place.\n    "])), utils_2.AngularInnerClassDecorators.ContentChild, utils_2.AngularInnerClassDecorators.ContentChildren, utils_2.AngularInnerClassDecorators.ViewChild, utils_2.AngularInnerClassDecorators.ViewChildren),
        ruleName: 'no-queries-metadata-property',
        type: 'style',
        typescriptOnly: true
    };
    Rule.FAILURE_STRING = utils_1.dedent(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n    Use @", ",\n    @", ",\n    @", "\n    or @", "\n    rather than the `", "` metadata property\n  "], ["\n    Use @", ",\n    @", ",\n    @", "\n    or @", "\n    rather than the \\`", "\\` metadata property\n  "])), utils_2.AngularInnerClassDecorators.ContentChild, utils_2.AngularInnerClassDecorators.ContentChildren, utils_2.AngularInnerClassDecorators.ViewChild, utils_2.AngularInnerClassDecorators.ViewChildren, METADATA_PROPERTY_NAME);
    return Rule;
}(metadataPropertyBase_1.MetadataPropertyBase));
exports.Rule = Rule;
var templateObject_1, templateObject_2;

redpajama_set_name: RedPajamaGithub


text:
title: 25.9.17
layout: post
author: james.spicer
permalink: /25.9.17/
source-id: 1RLhBgVjZTbHyfAxbdhsbOMUsaUz_9H3mEUrtKnpfOTw
published: true
---

    Title:
    Excel

    Date:
    25.9.17

    Starting point:
    Excel

    Target for this lesson?
    To create a code and a way to code and decode it

    Did i reach my target?
    Yes

    Lesson review

    ***How did i learn? What strategies were effective?***

        I learned by just doing the work. Finishing off what I started last week. There actually wasn't really much. All we did was figure out how to decode it. So I did that by copy and pasting the lines of letters again but in a different order so the first would be second and the second would be first. Then just repeat the code for the first set of letters and you've got your decoding.

    ***What limited my learning?What strategies do i need to work on?***

       The thing that limited my learning this week was not really anything. I think i did a good job but i might have been talking just a little too much so next time i'll try to keep quiet.

    ***What will i change for next time?How will i improve my learning?***

      Next time i will try to talk a little less and do the same amount of work i did before because it was good.


text:
module Sidekiq
  module ActiveRecord
    VERSION = "0.0.6"
  end
end


text:
package org.openehealth.ipf.commons.flow.transfer;

import org.junit.Test;

/**
 * @author Martin Krasser
 */
public class FlowPartInfoTest {

    @Test
    public void testToString() {
        // TODO: implement
    }

}


text:
This gem provides tools for easy and painless two-sided communication between two rails applications

# Installation

Add this line to your application's Gemfile:

`gem 'communications', github: 'sck-v/communications'`

And then execute:

`$ bundle`

# Usage

The usage is simple:

## Receiver App

1. Configure receiver
  ```ruby
  Communications.configure do
    handle :channel_name, with: SomeHandler

    on_message_failure do |queue, payload, _|
      Rails.logger.info 'Message processing error'
    end
  end
  ```
2. Start the reciever

  ```ruby
  Communications::Receiver.start! rescue Bunny::TCPConnectionFailedForAllHosts
  ```
3. Implement Handler class
  ```ruby
  require 'communications/handler'

  class SomeHandler
    include Communications::Handler

    def handle(payload)
      SomeWorker.do_something_with_payload(payload)
    end
  end
  ```

## Transmitter App

1. Publish message

  ```ruby
  Communications::Publisher.publish(:channel_name, message_hash)
  ```


text:
package dataneat.base;

import java.io.Serializable;
import java.util.Properties;

import dataneat.utils.PropertiesHolder;

public abstract class BaseNeat implements Serializable {

	// defines some basic functionality to retrieve Neat parameters from a properties object

	private static final long serialVersionUID = 1L;
	private PropertiesHolder holder;

	public BaseNeat(){}

	public BaseNeat(PropertiesHolder p) {
		setHolder(p);
	}

	public Properties getParams() {
		return holder.getAppProps();
	}

	public PropertiesHolder getHolder() {
		return holder;
	}

	public void setHolder(PropertiesHolder param) {
		this.holder = param;
	}
}


text:
require 'test_helper'

class AlunosHelperTest < ActionView::TestCase
end


text:
namespace BTDB.EventStoreLayer;

public class TypeDescriptorOptions
{
    public bool SerializeNonPublicProperties { get; set; }
}


text:
import React from 'react';
import { browserHistory, Router, IndexRoute, Route } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import { Provider } from 'react-redux';
import configureStore from './store/configureStore';

import App from './app';
import NotFound from './components/errors/NotFound';
import Dashboard from './components/dashboard';
import List from './components/list';
import Edit from './components/edit';
import Filemanager from './components/filemanager';

const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store);

class Feap extends React.Component {
    render() {
        let settings = this.props;

        return (
            <Provider store={store}>
                <Router history={history}>
                    <Route path="/admin" component={App} settings={settings}>
                        <IndexRoute component={Dashboard} />
                        <Route path="/admin/media" components={Filemanager} />
                        <Route path="/admin/:object" component={List}/>
                        <Route path="/admin/:object/:id" component={Edit}/>
                        <Route path='*' component={NotFound} />
                    </Route>
                </Router>
            </Provider>
        );
    }
}

export default Feap;


text:
package shh

import (
	"crypto/tls"
	"encoding/xml"
	"fmt"
	"net"
	"net/http"
	"net/url"
	"time"

	"github.com/heroku/slog"
)

type SplunkPeers struct {
	Entries []SplunkPeerEntry `xml:"entry"`
}

type SplunkPeerEntry struct {
	Title string          `xml:"title"`
	Keys  []SplunkPeerKey `xml:"content>dict>key"`
}

type SplunkPeerKey struct {
	Name  string `xml:"name,attr"`
	Value string `xml:",chardata"`
}

type SplunkSearchPeersPoller struct {
	measurements chan<- Measurement
	url          string
	credentials  *url.Userinfo
	client       *http.Client
}

func NewSplunkSearchPeersPoller(measurements chan<- Measurement, config Config) SplunkSearchPeersPoller {
	var creds *url.Userinfo
	var url string

	// Extract the creds from the URL
	if config.SplunkPeersUrl != nil {
		creds = config.SplunkPeersUrl.User
		config.SplunkPeersUrl.User = nil
		url = config.SplunkPeersUrl.String()
	}

	client := &http.Client{
		Transport: &http.Transport{
			TLSClientConfig:       &tls.Config{InsecureSkipVerify: config.SplunkPeersSkipVerify},
			ResponseHeaderTimeout: config.NetworkTimeout,
			Dial: func(network, address string) (net.Conn, error) {
				return net.DialTimeout(network, address, config.NetworkTimeout)
			},
		},
	}

	return SplunkSearchPeersPoller{
		measurements: measurements,
		url:          url,
		credentials:  creds,
		client:       client,
	}
}

func (poller SplunkSearchPeersPoller) Poll(tick time.Time) {
	if poller.url == "" {
		return
	}

	ctx := slog.Context{"poller": poller.Name(), "fn": "Poll", "tick": tick}

	resp, err := poller.doRequest()
	if err != nil {
		LogError(ctx, err, "while performing request for this tick")
		return
	}

	defer resp.Body.Close()

	decoder := xml.NewDecoder(resp.Body)
	entries := SplunkPeers{}
	if xerr := decoder.Decode(&entries); xerr != nil {
		LogError(ctx, xerr, "while performing decode on response body")
		return
	}

	total := len(entries.Entries)
	stats := make(map[string]uint64)

	for _, entry := range entries.Entries {
		for _, key := range entry.Keys {
			if key.Name == "status" {
				k := "status:" + key.Value
				stats[k] += 1
			} else if key.Name == "replicationStatus" {
				k := "replicationStatus:" + key.Value
				stats[k] += 1
			}
		}
	}

	poller.measurements <- GaugeMeasurement{tick, poller.Name(), []string{"total"}, uint64(total), Peers}
	poller.measurements <- GaugeMeasurement{tick, poller.Name(), []string{"up"}, stats["status:Up"], Peers}
	poller.measurements <- GaugeMeasurement{tick, poller.Name(), []string{"down"}, stats["status:Down"], Peers}
	poller.measurements <- GaugeMeasurement{tick, poller.Name(), []string{"replication", "success"}, stats["replicationStatus:Successful"], Peers}
	poller.measurements <- GaugeMeasurement{tick, poller.Name(), []string{"replication", "failed"}, stats["replicationStatus:Failed"], Peers}
}

func (poller SplunkSearchPeersPoller) doRequest() (*http.Response, error) {
	req, err := http.NewRequest("GET", poller.url, nil)
	if err != nil {
		return nil, err
	}

	if poller.credentials != nil {
		password, _ := poller.credentials.Password()
		req.SetBasicAuth(poller.credentials.Username(), password)
	}

	resp, rerr := poller.client.Do(req)
	if rerr != nil {
		return nil, rerr
	} else if resp.StatusCode >= 300 {
		resp.Body.Close()
		return nil, fmt.Errorf("Response returned a %d", resp.StatusCode)
	}

	return resp, nil
}

func (poller SplunkSearchPeersPoller) Name() string {
	return "splunksearchpeers"
}

func (poller SplunkSearchPeersPoller) Exit() {}


text:
using System;
using System.Collections.Generic;
using System.Text;
using Irony.Parsing;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Irony.Tests {
  [TestClass]
  public class FreeTextLiteralTests: TerminalTestsBase  {

    //Helper method - replaces single quote with double quote and then calls TryMatch, just to make it easier to write
    // strings with quotes for tests
    private void TryMatchDoubles(string input) {
      input = input.Replace("'", "\"");
      TryMatch(input);
    }

    //The following test method and a fix are contributed by ashmind codeplex user
    [TestMethod]
    public void TestFreeTextLiteral() {
      var term = new FreeTextLiteral("FreeText", ",", ")");
      term.Escapes.Add(@"\\", @"\");
      term.Escapes.Add(@"\,", @",");
      term.Escapes.Add(@"\)", @")");

      SetTerminal(term);
      TryMatch(@"abc\\de\,\)fg,");
      Assert.IsNotNull(_token, "Failed to produce a token on valid string.");
      Assert.AreEqual(term, _token.Terminal, "Failed to scan a string - invalid Terminal in the returned token.");
      Assert.AreEqual(_token.Value.ToString(), @"abc\de,)fg", "Failed to scan a string");

      term = new FreeTextLiteral("FreeText", FreeTextOptions.AllowEof, ";");
      SetTerminal(term);
      TryMatch(@"abcdefg");
      Assert.IsNotNull(_token, "Failed to produce a token for free text ending at EOF.");
      Assert.AreEqual(term, _token.Terminal, "Failed to scan a free text ending at EOF - invalid Terminal in the returned token.");
      Assert.AreEqual(_token.Value.ToString(), @"abcdefg", "Failed to scan a free text ending at EOF");

    }

  }//class
}//namespace


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lecanactis ricasolii A. Massal.

### Remarks
null


text:
package org.sagebionetworks.web.client.widget.entity.download;

import org.sagebionetworks.repo.model.Entity;
import org.sagebionetworks.web.client.utils.CallbackP;
import org.sagebionetworks.web.client.widget.SynapseWidgetPresenter;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class UploadDialogWidget implements UploadDialogWidgetView.Presenter, SynapseWidgetPresenter {
	private UploadDialogWidgetView view;
	private Uploader uploader;

	@Inject
	public UploadDialogWidget(UploadDialogWidgetView view, Uploader uploader) {
		this.view = view;
		this.uploader = uploader;
		view.setPresenter(this);
	}

	@Override
	public Widget asWidget() {
		return view.asWidget();
	}

	public void configure(String title, Entity entity, String parentEntityId, final CallbackP<String> fileHandleIdCallback, boolean isEntity) {
		Widget body = uploader.configure(entity, parentEntityId, fileHandleIdCallback, isEntity);
		view.configureDialog(title, body);

		// add handlers for closing the window
		uploader.setSuccessHandler(() -> {
			view.hideDialog();
		});

		uploader.setCancelHandler(() -> {
			view.hideDialog();
		});
	}

	public void disableMultipleFileUploads() {
		uploader.disableMultipleFileUploads();
	}

	public void setUploaderLinkNameVisible(boolean visible) {
		uploader.setUploaderLinkNameVisible(visible);
	}

	public void show() {
		view.showDialog();
	}
}


text:
'use strict'

// initialize sample server environment for test

const http = require('http')
const RuntimeServer = require('chix-runtime')
const Transport = require('chix-transport/websocket')
const Loader = require('chix-loader/npm')
const serveMe = (req, res) => {
  res.send('Runtime')
}
const server = http.createServer(serveMe)

let rs = new RuntimeServer({
  transport: new Transport({}, server),
  loader: new Loader()
})

const fbp = `
title: Request a file
description: Simple file request
ns: test
name: graph

Request(superagent/api), End(superagent/end), Parse(json/parse), Path(json/path)

'https://serve-chix.rhcloud.com/nodes/http/request' -> url Request

Request request -> request End
# End body -> json Path
# End error -> msg Log
<- body End

# Select the description field
# '/description' -> path Path

# Log it to the console
# Path matches -> msg Log
`

rs.addGraph(fbp)

server.listen(4321, () => {
  console.log('Test Runtime Running')
})


text:
using System.Net.Http;
using System.Threading.Tasks;
using JustCli.Attributes;

namespace JustCli.TestAppAsync.Commands
{
   [Command("httpget", "Gets Url")]
   class HttpGetAsyncCommand : ICommandAsync
   {
      [CommandArgument("u", "Url", Description = "Url", DefaultValue = "http://c2.com")]
      public string Url{ get; set; }

      [CommandOutput]
      public IOutput Output { get; set; }

      public async Task<int> ExecuteAsync()
      {
         HttpClient http = new HttpClient();
         var res = await http.GetStringAsync(Url);
         Output.WriteInfo(res);
         return ReturnCode.Success;
      }
   }
}


text:
package AI::MXNet::Executor::Group;
use strict;
use warnings;
use Scalar::Util qw(blessed);
use List::Util qw(sum min);
use AI::MXNet::Base;
use AI::MXNet::Function::Parameters;

=head1 NAME

    AI::MXNet::Executor::Group - Manager for a group of executors working in different contexts.
=cut

func _split_input_slice($batch_size, $work_load_list)
{
    my $total_work_load = sum(@{ $work_load_list });
    my @batch_num_list = map { # perl does not have builtin round
        int(($_ * $batch_size / $total_work_load) + 0.5)
    } @{ $work_load_list };
    my $batch_num_sum = sum(@batch_num_list);
    my @slices;
    if($batch_num_sum < $batch_size)
    {
        $batch_num_list[-1] += $batch_size - $batch_num_sum;
    }
    my $end = 0;
    for my $batch_num (@batch_num_list)
    {
        my $begin = int(min($end, $batch_size));
        $end = int(min($begin + $batch_num, $batch_size));
        if($begin >= $end)
        {
            confess('Too many slices such that some splits are empty');
        }
        push @slices, [$begin, $end];
    }
    return \@slices;
}

# Load a array ref of arrays into a array ref of arrays specified by slices
func _load_general($data, $targets, $major_axis)
{
    zip(sub {
        my ($d_src, $d_targets, $axis) = @_;
        if(blessed($d_targets) and $d_targets->isa('AI::MXNet::NDarray'))
        {
            $d_src->copyto($d_targets);
        }
        elsif(ref $d_targets eq 'ARRAY' and blessed $d_targets->[0])
        {
            zip(sub {
                my ($src, $dst) = @_;
                $src->copyto($dst);
            }, $d_src, $d_targets);
        }
        else
        {
            for my $d (@{ $d_targets })
            {
                my ($slice_idx, $d_dst) = @{ $d };
                if($axis >= 0)
                {
                    my $shape = $d_src->shape;
                    my $do_crop = ($slice_idx->[0] != 0 or $shape->[$axis] != $slice_idx->[1]);
                    if($do_crop)
                    {
                        if($axis == 0)
                        {
                            $d_src->slice([$slice_idx->[0], $slice_idx->[1] - 1])->copyto($d_dst);
                        }
                        else
                        {
                            if($d_src->context == $d_dst->context)
                            {
                                AI::MXNet::NDArray->slice_axis(
                                    $d_src,
                                    {
                                        axis  => $axis,
                                        begin => $slice_idx->[0],
                                        end   => $slice_idx->[1],
                                        out   => $d_dst
                                    }
                                );
                            }
                            else
                            {
                                my $d_dst_copy = AI::MXNet::NDArray->slice_axis(
                                    $d_src,
                                    {
                                        axis  => $axis,
                                        begin => $slice_idx->[0],
                                        end   => $slice_idx->[1]
                                    }
                                );
                                $d_dst_copy->copyto($d_dst);
                            }
                        }
                    }
                    else
                    {
                        $d_src->copyto($d_dst);
                    }
                }
                else
                {
                    $d_src->copyto($d_dst);
                }
            }
        }
    }, $data, $targets, $major_axis);
}

# Load data into sliced arrays
func _load_data($batch, $targets, $major_axis)
{
    _load_general($batch->data, $targets, $major_axis);
}

# Load label into sliced arrays
func _load_label($batch, $targets, $major_axis)
{
    _load_general($batch->label, $targets, $major_axis);
}

# Merge outputs that live on multiple context into one, so that they look
# like living on one context.
func _merge_multi_context($outputs, $major_axis)
{
    my @rets;
    zip(sub {
        my ($tensors, $axis) = @_;
        if($axis >= 0)
        {
            if(@$tensors == 1)
            {
                push @rets, $tensors->[0];
            }
            else
            {
                my $ctx = $tensors->[0]->context;
                push @rets, AI::MXNet::NDArray->concat((map { $_->as_in_context($ctx) } @$tensors), { dim => $axis });
            }
        }
        else
        {
            # negative axis means the there is no batch_size axis, and all the
            # results should be the same on each device. We simply take the
            # first one, without checking they are actually the same
            push @rets, $tensors->[0];
        }
    }, $outputs, $major_axis);
    return \@rets;
}

## TODO
## this class is here because of https://github.com/gfx/p5-Mouse/pull/67
## once 2.4.7 version of Mouse in Ubuntu for affected Perl version
## these accessors should be merged into main class
package AI::MXNet::DataParallelExecutorGroup::_private;
use Mouse;
has [qw/output_layouts label_layouts arg_names aux_names
        batch_size slices execs data_arrays
        label_arrays param_arrays grad_arrays aux_arrays
        data_layouts shared_data_arrays input_grad_arrays
        _default_execs state_arrays/
    ] => (is => 'rw', init_arg => undef);

package AI::MXNet::DataParallelExecutorGroup;
use Mouse;
use AI::MXNet::Base;
use List::Util qw(sum);

=head1 DESCRIPTION

    DataParallelExecutorGroup is a group of executors that lives on a group of devices.
    This is a helper class used to implement data parallelization. Each mini-batch will
    be split and run on the devices.

    Parameters for constructor
    ----------
    symbol : AI::MXNet::Symbol
        The common symbolic computation graph for all executors.
    contexts : ArrayRef[AI::MXNet::Context]
        A array ref of contexts.
    workload : ArrayRef[Num]
        If not undef, could be an array ref of numbers that specify the workload to be assigned
        to different context. Larger number indicate heavier workload.
    data_shapes : ArrayRef[NameShape|AI::MXNet::DataDesc]
        Should be a array ref of [name, shape] array refs, for the shapes of data. Note the order is
        important and should be the same as the order that the `DataIter` provide the data.
    label_shapes : Maybe[ArrayRef[NameShape|AI::MXNet::DataDesc]]
        Should be a array ref of [$name, $shape] array refs, for the shapes of label. Note the order is
        important and should be the same as the order that the `DataIter` provide the label.
    param_names : ArrayRef[Str]
        A array ref of strings, indicating the names of parameters (e.g. weights, filters, etc.)
        in the computation graph.
    for_training : Bool
        Indicate whether the executors should be bind for training. When not doing training,
        the memory for gradients will not be allocated.
    inputs_need_grad : Bool
        Indicate whether the gradients for the input data should be computed. This is currently
        not used. It will be useful for implementing composition of modules.
    shared_group : AI::MXNet::DataParallelExecutorGroup
        Default is undef. This is used in bucketing. When not undef, it should be a executor
        group corresponding to a different bucket. In other words, it will correspond to a different
        symbol but with the same set of parameters (e.g. unrolled RNNs with different lengths).
        In this case, many memory will be shared.
    logger : Logger
        Default is AI::MXNet::Logging->get_logger.
    fixed_param_names: Maybe[ArrayRef[Str]]
        Indicate parameters to be fixed during training. Parameters in this array ref will not allocate
        space for gradient, nor do gradient calculation.
    grad_req : ArrayRef[GradReq]|HashRef[GradReq]|GradReq
        Requirement for gradient accumulation. Can be 'write', 'add', or 'null'
        (default to 'write').
        Can be specified globally (str) or for each argument (array ref, hash ref).
    state_names: Maybe[ArrayRef[Str]]
=cut

has 'symbol'            => (is => 'ro', isa => 'AI::MXNet::Symbol', required => 1);
has 'contexts'          => (is => 'ro', isa => 'ArrayRef[AI::MXNet::Context]', required => 1);
has 'workload'          => (is => 'ro', isa => 'ArrayRef[Num]', default => sub { [] });
has 'data_shapes'       => (is => 'rw', isa => 'ArrayRef[NameShape|AI::MXNet::DataDesc]', required => 1);
has 'label_shapes'      => (is => 'rw', isa => 'Maybe[ArrayRef[NameShape|AI::MXNet::DataDesc]]');
has 'param_names'       => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);
has 'for_training'      => (is => 'ro', isa => 'Bool', required => 1);
has 'inputs_need_grad'  => (is => 'ro', isa => 'Bool', default  => 0);
has 'shared_group'      => (is => 'ro', isa => 'Maybe[AI::MXNet::DataParallelExecutorGroup]');
has 'logger'            => (is => 'ro', default => sub { AI::MXNet::Logging->get_logger });
has 'fixed_param_names' => (is => 'rw', isa => 'Maybe[ArrayRef[Str]]');
has 'state_names'       => (is => 'rw', isa => 'Maybe[ArrayRef[Str]]');
has 'grad_req'          => (is => 'rw', isa => 'ArrayRef[GradReq]|HashRef[GradReq]|GradReq', default=>'write');
has '_p'                => (is => 'rw', init_arg => undef);
sub BUILD
{
    my $self = shift;
    my $p = AI::MXNet::DataParallelExecutorGroup::_private->new;
    $p->arg_names($self->symbol->list_arguments);
    $p->aux_names($self->symbol->list_auxiliary_states);
    $p->execs([]);
    $self->_p($p);
    $self->grad_req('null') if not $self->for_training;
    $self->fixed_param_names([]) unless defined $self->fixed_param_names;
    $self->state_names([]) unless defined $self->state_names;
    my $data_shapes = [];
    for my $d (@{ $self->data_shapes })
    {
        $d = AI::MXNet::DataDesc->new(name => $d->[0], shape => $d->[1])
            unless blessed $d;
        push @{ $data_shapes }, $d;
    }
    $self->data_shapes($data_shapes);
    if(defined $self->label_shapes)
    {
        my $label_shapes = [];
        for my $l (@{ $self->label_shapes })
        {
            $l = AI::MXNet::DataDesc->new(name => $l->[0], shape => $l->[1])
                unless blessed $l;
            push @{ $label_shapes }, $l;
        }
        $self->label_shapes($label_shapes);
    }
    my %data_names  = map { $_->name => 1 } @{ $self->data_shapes };
    my %param_names = map { $_    =>    1 } @{ $self->param_names };
    my %fixed_param_names = map { $_ => 1 } @{ $self->fixed_param_names };
    my %grad_req;
    if(not ref $self->grad_req)
    {
        for my $k (@{ $self->_p->arg_names })
        {
            if(exists $param_names{ $k })
            {
                $grad_req{$k} = exists $fixed_param_names{ $k } ? 'null' : $self->grad_req;
            }
            elsif(exists $data_names{ $k })
            {
                $grad_req{$k} = $self->inputs_need_grad ? $self->grad_req : 'null';
            }
            else
            {
                $grad_req{$k} = 'null';
            }
        }
    }
    elsif(ref $self->grad_req eq 'ARRAY')
    {
        @grad_req{ @{ $self->_p->arg_names } } = @{ $self->grad_req };
    }
    else
    {
        for my $k (@{ $self->_p->arg_names })
        {
            if(exists $param_names{ $k })
            {
                $grad_req{$k} = exists $fixed_param_names{ $k } ? 'null' : 'write';
            }
            elsif(exists $data_names{ $k })
            {
                $grad_req{$k} = $self->inputs_need_grad ? 'write' : 'null';
            }
            else
            {
                $grad_req{$k} = 'null';
            }
        }
        %grad_req = (%grad_req, %{ $self->grad_req });
    }
    $self->grad_req(\%grad_req);
    if(defined $self->shared_group)
    {
        $self->_p->shared_data_arrays($self->shared_group->_p->shared_data_arrays);
    }
    else
    {
        $self->_p->shared_data_arrays([map { +{} } 0..@{ $self->contexts }-1]);
    }
    $self->_p->output_layouts([
        map {
            AI::MXNet::DataDesc->get_batch_axis($self->symbol->slice($_)->attr('__layout__'))
        } @{ $self->symbol->list_outputs }
    ]);
    $self->bind_exec($self->data_shapes, $self->label_shapes, $self->shared_group);
}

=decide_slices

    Decide the slices for each context according to the workload.

    Parameters
    ----------
    $data_shapes : ArrayRef[AI::MXNet::DataDesc]
=cut

method decide_slices(ArrayRef[AI::MXNet::DataDesc] $data_shapes)
{
    confess("empty data_shapes array") unless @{ $data_shapes } > 0;
    my $major_axis = [map { AI::MXNet::DataDesc->get_batch_axis($_->layout) } @{ $data_shapes }];
    zip(sub {
        my ($desc, $axis) = @_;
        return if($axis == -1);
        my $batch_size = $desc->shape->[$axis];
        if(defined $self->_p->batch_size)
        {
            confess(
                "all data must have the same batch size: "
                . sprintf("batch_size = %d, but ", $self->_p->batch_size)
                . sprintf("%s has shape %s", $desc->name, '('. join(',', @{ $desc->shape }) . ')')
            ) unless $batch_size == $self->_p->batch_size;
        }
        else
        {
            $self->_p->batch_size($batch_size);
            $self->_p->slices(AI::MXNet::Executor::Group::_split_input_slice($self->_p->batch_size, $self->workload));
        }
    }, $data_shapes, $major_axis);
    return $major_axis;
}

# Collect internal arrays from executors.
method _collect_arrays()
{
    # convenient data structures
    $self->_p->data_arrays([]);
    for my $d (@{ $self->data_shapes })
    {
        my $name = $d->name;
        my @tmp;
        for my $i (0..@{ $self->_p->execs }-1)
        {
            push @tmp, [ $self->_p->slices->[$i], $self->_p->execs->[$i]->arg_dict->{$name} ];
        }
        push @{ $self->_p->data_arrays }, \@tmp;
    }
    if(defined $self->label_shapes)
    {
        $self->_p->label_arrays([]);
        for my $l (@{ $self->label_shapes })
        {
            my $name = $l->name;
            my @tmp;
            for my $i (0..@{ $self->_p->execs }-1)
            {
                push @tmp, [ $self->_p->slices->[$i], $self->_p->execs->[$i]->arg_dict->{$name} ];
            }
            push @{ $self->_p->label_arrays }, \@tmp;
        }
    }
    $self->_p->param_arrays([]);
    my %param_names = map { $_ => 1 } @{ $self->param_names };
    for my $i (0..@{ $self->_p->arg_names }-1)
    {
        my $name = $self->_p->arg_names->[$i];
        if(exists $param_names{$name})
        {
            my @tmp;
            for my $exec (@{ $self->_p->execs })
            {
                push @tmp, $exec->arg_arrays->[$i];
            }
            push @{ $self->_p->param_arrays }, \@tmp;
        }
    }
    $self->_p->state_arrays([]);
    for my $i (0..@{ $self->state_names }-1)
    {
        my $name = $self->state_names->[$i];
        my @tmp;
        for my $exec (@{ $self->_p->execs })
        {
            push @tmp, $exec->arg_dict->{$name};
        }
        push @{ $self->_p->state_arrays }, \@tmp;
    }
    if($self->for_training)
    {
        $self->_p->grad_arrays([]);
        for my $i (0..@{ $self->_p->arg_names }-1)
        {
            my $name = $self->_p->arg_names->[$i];
            if(exists $param_names{$name})
            {
                my @tmp;
                for my $exec (@{ $self->_p->execs })
                {
                    push @tmp, $exec->grad_arrays->[$i];
                }
                push @{ $self->_p->grad_arrays }, \@tmp;
            }
        }
    }
    my @data_names = map { $_->name } @{ $self->data_shapes };
    my $j = 0; my %arg_names  = map { $_ => $j++ } @{ $self->_p->arg_names };
    if($self->inputs_need_grad)
    {
        $self->_p->input_grad_arrays([]);
        for my $name (@data_names)
        {
            next unless exists $arg_names{$name};
            my @tmp;
            for my $exec (@{ $self->_p->execs })
            {
                push @tmp, $exec->grad_arrays->[$arg_names{$name}];
            }
            push @{ $self->_p->input_grad_arrays }, \@tmp;
        }
    }
    $self->_p->aux_arrays([]);
    for my $i (0..@{ $self->_p->aux_names }-1)
    {
        my @tmp;
        for my $exec (@{ $self->_p->execs })
        {
            push @tmp, $exec->aux_arrays->[$i];
        }
        push @{ $self->_p->aux_arrays }, \@tmp;
    }
}

=head2 bind_exec

    Bind executors on their respective devices.

    Parameters
    ----------
    $data_shapes  : ArrayRef[AI::MXNet::DataDesc]
    $label_shapes : Maybe[ArrayRef[AI::MXNet::DataDesc]]
    $shared_group : Maybe[AI::MXNet::DataParallelExecutorGroup]
    $reshape      : Bool
=cut

method bind_exec(
    ArrayRef[AI::MXNet::DataDesc]               $data_shapes,
    Maybe[ArrayRef[AI::MXNet::DataDesc]]        $label_shapes=,
    Maybe[AI::MXNet::DataParallelExecutorGroup] $shared_group=,
    Bool                                        $reshape=0
)
{
    assert($reshape or not @{ $self->_p->execs });
    $self->_p->batch_size(undef);

    # calculate workload and bind executors
    $self->_p->data_layouts($self->decide_slices($data_shapes));
    # call it to make sure labels has the same batch size as data
    if(defined $label_shapes)
    {
        $self->_p->label_layouts($self->decide_slices($label_shapes));
    }

    for my $i (0..@{ $self->contexts }-1)
    {
        my $data_shapes_i = $self->_sliced_shape($data_shapes, $i, $self->_p->data_layouts);
        my $label_shapes_i = [];
        if(defined $label_shapes)
        {
            $label_shapes_i = $self->_sliced_shape($label_shapes, $i, $self->_p->label_layouts);
        }
        if($reshape)
        {
            my %combined_hash = map { $_->name => $_->shape } (@{ $data_shapes_i }, @{ $label_shapes_i });
            $self->_p->execs->[$i] = $self->_p->_default_execs->[$i]->reshape(
                \%combined_hash,
                allow_up_sizing => 1,
            );
        }
        else
        {
            push @{ $self->_p->execs }, $self->_bind_ith_exec($i, $data_shapes_i, $label_shapes_i, $shared_group);
        }
    }
    $self->data_shapes($data_shapes);
    $self->label_shapes($label_shapes);
    $self->_collect_arrays;
}

=head2 reshape

    Reshape executors.

    Parameters
    ----------
    $data_shapes : ArrayRef[AI::MXNet::DataDesc]
    $label_shapes : Maybe[ArrayRef[AI::MXNet::DataDesc]]
=cut

method reshape(
    ArrayRef[AI::MXNet::DataDesc]          $data_shapes,
    Maybe[ArrayRef[AI::MXNet::DataDesc]]   $label_shapes=
)
{
    return if($data_shapes eq $self->data_shapes and $label_shapes eq $self->label_shapes);
    if (not defined $self->_p->_default_execs)
    {
        $self->_p->_default_execs([@{ $self->_p->execs }]);
    }
    $self->bind_exec($data_shapes, $label_shapes, undef, 1);
}

=head2 set_params

    Assign, i.e. copy parameters to all the executors.

    Parameters
    ----------
    $arg_params : HashRef[AI::MXNet::NDArray]
        A dictionary of name to AI::MXNet::NDArray parameter mapping.
    $aux_params : HashRef[AI::MXNet::NDArray]
        A dictionary of name to AI::MXNet::NDArray auxiliary variable mapping.
=cut

method set_params(HashRef[AI::MXNet::NDArray] $arg_params, HashRef[AI::MXNet::NDArray] $aux_params)
{
    $_->copy_params_from($arg_params, $aux_params) for @{ $self->_p->execs };
}

=head2 get_params

    Copy data from each executor to arg_params and aux_params.

    Parameters
    ----------
    $arg_params : HashRef[AI::MXNet::NDArray]
        target parameter arrays
    $aux_params : HashRef[AI::MXNet::NDArray]
        target aux arrays

    Notes
    -----
    - This function will inplace update the NDArrays in arg_params and aux_params.
=cut

method get_params(HashRef[AI::MXNet::NDArray] $arg_params, HashRef[AI::MXNet::NDArray] $aux_params)
{
    my $weight = 0;
    zip(sub {
        my ($name, $block) = @_;
            my $weight = sum(map { $_->copyto(AI::MXNet::Context->cpu) } @{ $block }) / @{ $block };
            $weight->astype($arg_params->{$name}->dtype)->copyto($arg_params->{$name});
    }, $self->param_names, $self->_p->param_arrays);
    zip(sub {
        my ($name, $block) = @_;
            my $weight = sum(map { $_->copyto(AI::MXNet::Context->cpu) } @{ $block }) / @{ $block };
            $weight->astype($aux_params->{$name}->dtype)->copyto($aux_params->{$name});
    }, $self->_p->aux_names, $self->_p->aux_arrays);
}

method get_states($merge_multi_context=1)
{
    assert((not $merge_multi_context), "merge_multi_context=True is not supported for get_states yet.");
    return $self->_p->state_arrays;
}

method set_states($states, $value)
{
    if(defined $states)
    {
        assert((not defined $value), "Only one of states & value can be specified.");
        AI::MXNet::Executor::Group::_load_general($states, $self->_p->state_arrays, [(0)x@{ $states }]);
    }
    else
    {
        assert((defined $value), "At least one of states & value must be specified.");
        assert((not defined $states), "Only one of states & value can be specified.");
        for my $d_dst (@{ $self->_p->state_arrays })
        {
            for my $dst (@{ $d_dst })
            {
                $dst .= $value;
            }
        }
    }
}

=head2 forward

    Split the data_batch according to a workload and run forward on each devices.

    Parameters
    ----------
    data_batch : AI::MXNet::DataBatch
    Or could be any object implementing similar interface.

    is_train : bool
    The hint for the backend, indicating whether we are during training phase.
    Default is undef, then the value $self->for_training will be used.
=cut

method forward(AI::MXNet::DataBatch $data_batch, Maybe[Bool] $is_train=)
{
    AI::MXNet::Executor::Group::_load_data($data_batch, $self->_p->data_arrays, $self->_p->data_layouts);
    $is_train //= $self->for_training;
    if(defined $self->_p->label_arrays)
    {
        confess("assert not is_train or data_batch.label")
            unless (not $is_train or $data_batch->label);
        if($data_batch->label)
        {
            AI::MXNet::Executor::Group::_load_label($data_batch, $self->_p->label_arrays, $self->_p->label_layouts);
        }
    }
    $_->forward($is_train) for @{ $self->_p->execs };
}

# Get the shapes of the outputs

method get_output_shapes()
{
    my @shapes = map { $_->shape } @{ $self->execs->[0]->outputs };
    my @concat_shapes;
    zip(sub {
        my ($key, $shape, $axis) = @_;
        my @the_shape = @{ $shape };
        if($axis >= 0)
        {
            $the_shape[$axis] = $self->_p->batch_size;
        }
        push @concat_shapes, AI::MXNet::DataDesc->new(name => $key, shape => \@the_shape);
    }, $self->symbol->list_outputs, \@shapes, $self->_p->output_layouts);
    return \@concat_shapes;
}

=head2 get_outputs

    Gets outputs of the previous forward computation.

    Parameters
    ----------
    merge_multi_context : bool
    Default is 1. In the case when data-parallelism is used, the outputs
    will be collected from multiple devices. A 1 value indicates that we
    should merge the collected results so that they look like from a single
    executor.

    Returns
    -------
    If merge_multi_context is 1, it is [$out1, $out2]. Otherwise, it
    is [[$out1_dev1, $out1_dev2], [$out2_dev1, $out2_dev2]]. All the output
    elements are `AI::MXNet::NDArray`.
=cut

method get_outputs(Bool $merge_multi_context=1)
{
    my $outputs;
    for my $i (0..@{ $self->_p->execs->[0]->outputs }-1)
    {
        my @tmp;
        for my $exec (@{ $self->_p->execs })
        {
            push @tmp, $exec->outputs->[$i];
        }
        push @$outputs, \@tmp;
    }
    if($merge_multi_context)
    {
        $outputs = AI::MXNet::Executor::Group::_merge_multi_context($outputs, $self->_p->output_layouts);
    }
    return $outputs;
}

=head2  get_input_grads

    Get the gradients with respect to the inputs of the module.

    Parameters
    ----------
    merge_multi_context : bool
    Default is 1. In the case when data-parallelism is used, the outputs
    will be collected from multiple devices. A 1 value indicates that we
    should merge the collected results so that they look like from a single
    executor.

    Returns
    -------
    If merge_multi_context is 1, it is [$grad1, $grad2]. Otherwise, it
    is [[$grad1_dev1, $grad1_dev2], [$grad2_dev1, $grad2_dev2]]. All the output
    elements are AI::MXNet::NDArray.
=cut

method get_input_grads(Bool $merge_multi_context=1)
{
    confess("assert \$self->inputs_need_grad") unless $self->inputs_need_grad;
    if($merge_multi_context)
    {
        return AI::MXNet::Executor::Group::_merge_multi_context($self->_p->input_grad_arrays, $self->_p->data_layouts);
    }
    return $self->_p->input_grad_arrays;
}

=head2 backward

    Run backward on all devices. A backward should be called after
    a call to the forward function. Backward cannot be called unless
    $self->for_training is 1.

    Parameters
    ----------
    out_grads : NDArray or array ref of NDArray, optional
    Gradient on the outputs to be propagated back.
    This parameter is only needed when bind is called
    on outputs that are not a loss function.
=cut

method backward(Maybe[AI::MXNet::NDArray|ArrayRef[AI::MXNet::NDArray]] $out_grads=)
{
    confess('re-bind with for_training=1 to run backward') unless $self->for_training;
    $out_grads //= [];
    zip(sub {
        my ($i, $exec, $islice) = @_;
        my @out_grads_slice;
        zip(sub{
            my ($grad, $axis) = @_;
            if($axis >= 0)
            {
                my $og_my_slice = $grad->slice_axis({
                    axis  => $axis,
                    begin => $islice->[0],
                    end   => $islice->[1]
                });
                push @out_grads_slice, $og_my_slice->as_in_context($self->contexts->[$i]);
            }
            else
            {
                push @out_grads_slice, $grad->copyto($self->contexts->[$i]);
            }
        }, $out_grads, $self->_p->output_layouts);
        $exec->backward(\@out_grads_slice);
    }, [0..@{ $self->_p->execs }-1], $self->_p->execs, $self->_p->slices);
}

=head2 update_metric

    Accumulate the performance according to eval_metric on all devices.

    Parameters
    ----------
    eval_metric : AI::MXNet::EvalMetric
        The metric used for evaluation.
    labels : array ref of NDArray
        Typically comes from label of AI::MXNet::DataBatch.
=cut

method update_metric(AI::MXNet::EvalMetric $eval_metric, ArrayRef[AI::MXNet::NDArray] $labels)
{
    zip(sub {
        my ($texec, $islice) = @_;
        my @labels_slice;
        zip(sub {
            my ($label, $axis) = @_;
            if($axis == 0)
            {
                # slicing NDArray along axis 0 can avoid copying
                push @labels_slice, $label->slice([$islice->[0], $islice->[1]-1]);
            }
            elsif($axis > 0)
            {
                my $label_my_slice = $label->slice_axis({
                    axis  => $axis,
                    begin => $islice->[0],
                    end   => $islice->[1]
                })->as_in_context($label->context);
                push @labels_slice, $label_my_slice;
            }
            else
            {
                push @labels_slice, $label;
            }
        }, $labels, $self->_p->label_layouts);
        $eval_metric->update(\@labels_slice, $texec->outputs);
    }, $self->_p->execs, $self->_p->slices);
}

method _bind_ith_exec(
    Int                                         $i,
    ArrayRef[AI::MXNet::DataDesc]               $data_shapes,
    Maybe[ArrayRef[AI::MXNet::DataDesc]]        $label_shapes,
    Maybe[AI::MXNet::DataParallelExecutorGroup] $shared_group
)
{
    my $shared_exec = $shared_group ? $shared_group->_p->execs->[$i] : undef;
    my $context = $self->contexts->[$i];
    my $shared_data_arrays = $self->_p->shared_data_arrays->[$i];
    my %input_shapes = map { $_->name => $_->shape } @{ $data_shapes };
    if(defined $label_shapes)
    {
        %input_shapes = (%input_shapes, map { $_->name => $_->shape } @{ $label_shapes });
    }
    my %input_types = map { $_->name => $_->dtype } @{ $data_shapes };
    my $executor = $self->symbol->simple_bind(
        ctx              => $context,
        grad_req         => $self->grad_req,
        type_dict        => \%input_types,
        shared_arg_names => $self->param_names,
        shared_exec      => $shared_exec,
        shared_buffer    => $shared_data_arrays,
        shapes           => \%input_shapes
    );
    return $executor;
}

=head2 _sliced_shape

    Get the sliced shapes for the i-th executor.

    Parameters
    ----------
    shapes : array ref of (str, array ref)
        The original (name, shape) pairs.
    i : int
    Which executor we are dealing with.
=cut

method _sliced_shape(ArrayRef[AI::MXNet::DataDesc] $shapes, Int $i, ArrayRef[Int] $major_axis)
{
    my @sliced_shapes;
    zip(sub {
        my ($desc, $axis) = @_;
        my @shape = @{ $desc->shape };
        if($axis >= 0)
        {
            $shape[$axis] = $self->_p->slices->[$i]->[1] - $self->_p->slices->[$i]->[0];
        }
        push @sliced_shapes, AI::MXNet::DataDesc->new(
            name    => $desc->name,
            shape   => \@shape,
            dtype   => $desc->dtype,
            layout  => $desc->layout
        );
    }, $shapes, $major_axis);
    return \@sliced_shapes;
}

=head2 install_monitor

    Install monitor on all executors

    Parameters
    ----------
    $mon : AI::MXNet::Monitor
=cut

method install_monitor(AI::MXNet::Monitor $mon)
{
    $mon->install($_) for @{ $self->_p->execs };
}

method shared_data_arrays()
{
    $self->_p->shared_data_arrays;
}

method execs()
{
    $self->_p->execs;
}

1;


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;

// [001124][emu] Luna Season ~150 Bun no 1 no Koibito~

namespace GameRes.Formats.Aos
{
    [Export(typeof(ArchiveFormat))]
    public class DatOpener : ArchiveFormat
    {
        public override string         Tag { get { return "DAT/PACK"; } }
        public override string Description { get { return "AOS engine resource archive"; } }
        public override uint     Signature { get { return 0; } }
        public override bool  IsHierarchic { get { return false; } }
        public override bool      CanWrite { get { return false; } }

        public override ArcFile TryOpen (ArcView file)
        {
            if (!file.Name.HasExtension (".dat"))
                return null;
            var idx_name = VFS.ChangeFileName (file.Name, "index.idx");
            if (!VFS.FileExists (idx_name))
                return null;
            using (var index = VFS.OpenBinaryStream (idx_name))
            {
                var dir = new List<Entry>();
                while (index.PeekByte() != -1)
                {
                    var name = index.ReadCString (0x34);
                    if (string.IsNullOrEmpty (name))
                        break;
                    var entry = Create<Entry> (name);
                    entry.Offset = index.ReadUInt32();
                    entry.Size   = index.ReadUInt32();
                    if (!entry.CheckPlacement (file.MaxOffset))
                        return null;
                    dir.Add (entry);
                }
                if (0 == dir.Count)
                    return null;
                return new ArcFile (file, this, dir);
            }
        }
    }
}


text:
int main(int, char**)
{
    static_assert((std::is_same<
        std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_copy_assignment,
        std::false_type>::value), "");

    static_assert((std::is_same<
        std::scoped_allocator_adaptor<A1<int>, A2<int>>::propagate_on_container_copy_assignment,
        std::false_type>::value), "");

    static_assert((std::is_same<
        std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_copy_assignment,
        std::true_type>::value), "");

  return 0;
}