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

package com.google.cloud.gaming.v1;

/**
 *
 *
 *

 * The game server cluster connection information.
 *

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

  private GameServerClusterConnectionInfo() {
    namespace_ = "";
  }

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

  @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.gaming.v1.GameServerClusters
        .internal_static_google_cloud_gaming_v1_GameServerClusterConnectionInfo_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.gaming.v1.GameServerClusters
        .internal_static_google_cloud_gaming_v1_GameServerClusterConnectionInfo_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.gaming.v1.GameServerClusterConnectionInfo.class,
            com.google.cloud.gaming.v1.GameServerClusterConnectionInfo.Builder.class);
  }

  private int clusterReferenceCase_ = 0;
  private java.lang.Object clusterReference_;

  public enum ClusterReferenceCase
      implements
          com.google.protobuf.Internal.EnumLite,
          com.google.protobuf.AbstractMessage.InternalOneOfEnum {
    GKE_CLUSTER_REFERENCE(7),
    CLUSTERREFERENCE_NOT_SET(0);
    private final int value;

    private ClusterReferenceCase(int value) {
      this.value = value;
    }
    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ClusterReferenceCase valueOf(int value) {
      return forNumber(value);
    }

    public static ClusterReferenceCase forNumber(int value) {
      switch (value) {
        case 7:
          return GKE_CLUSTER_REFERENCE;
        case 0:
          return CLUSTERREFERENCE_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public ClusterReferenceCase getClusterReferenceCase() {
    return ClusterReferenceCase.forNumber(clusterReferenceCase_);
  }

  public static final int GKE_CLUSTER_REFERENCE_FIELD_NUMBER = 7;
  /**
   *
   *
   *

   * Reference to the GKE cluster where the game servers are installed.
   *

   *
   * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
   *
   * @return Whether the gkeClusterReference field is set.
   */
  @java.lang.Override
  public boolean hasGkeClusterReference() {
    return clusterReferenceCase_ == 7;
  }
  /**
   *
   *
   *

   * Reference to the GKE cluster where the game servers are installed.
   *

   *
   * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
   *
   * @return The gkeClusterReference.
   */
  @java.lang.Override
  public com.google.cloud.gaming.v1.GkeClusterReference getGkeClusterReference() {
    if (clusterReferenceCase_ == 7) {
      return (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_;
    }
    return com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance();
  }
  /**
   *
   *
   *

   * Reference to the GKE cluster where the game servers are installed.
   *

   *
   * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
   */
  @java.lang.Override
  public com.google.cloud.gaming.v1.GkeClusterReferenceOrBuilder getGkeClusterReferenceOrBuilder() {
    if (clusterReferenceCase_ == 7) {
      return (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_;
    }
    return com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance();
  }

  public static final int NAMESPACE_FIELD_NUMBER = 5;
  private volatile java.lang.Object namespace_;
  /**
   *
   *
   *

   * Namespace designated on the game server cluster where the Agones game
   * server instances will be created. Existence of the namespace will be
   * validated during creation.
   *

   *
   * string namespace = 5;
   *
   * @return The namespace.
   */
  @java.lang.Override
  public java.lang.String getNamespace() {
    java.lang.Object ref = namespace_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      namespace_ = s;
      return s;
    }
  }
  /**
   *
   *
   *

   * Namespace designated on the game server cluster where the Agones game
   * server instances will be created. Existence of the namespace will be
   * validated during creation.
   *

   *
   * string namespace = 5;
   *
   * @return The bytes for namespace.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNamespaceBytes() {
    java.lang.Object ref = namespace_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      namespace_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(namespace_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 5, namespace_);
    }
    if (clusterReferenceCase_ == 7) {
      output.writeMessage(7, (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(namespace_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, namespace_);
    }
    if (clusterReferenceCase_ == 7) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              7, (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_);
    }
    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.gaming.v1.GameServerClusterConnectionInfo)) {
      return super.equals(obj);
    }
    com.google.cloud.gaming.v1.GameServerClusterConnectionInfo other =
        (com.google.cloud.gaming.v1.GameServerClusterConnectionInfo) obj;

    if (!getNamespace().equals(other.getNamespace())) return false;
    if (!getClusterReferenceCase().equals(other.getClusterReferenceCase())) return false;
    switch (clusterReferenceCase_) {
      case 7:
        if (!getGkeClusterReference().equals(other.getGkeClusterReference())) return false;
        break;
      case 0:
      default:
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + NAMESPACE_FIELD_NUMBER;
    hash = (53 * hash) + getNamespace().hashCode();
    switch (clusterReferenceCase_) {
      case 7:
        hash = (37 * hash) + GKE_CLUSTER_REFERENCE_FIELD_NUMBER;
        hash = (53 * hash) + getGkeClusterReference().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

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

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

  public static com.google.cloud.gaming.v1.GameServerClusterConnectionInfo 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.gaming.v1.GameServerClusterConnectionInfo 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 game server cluster connection information.
   *

   *
   * Protobuf type {@code google.cloud.gaming.v1.GameServerClusterConnectionInfo}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.gaming.v1.GameServerClusterConnectionInfo)
      com.google.cloud.gaming.v1.GameServerClusterConnectionInfoOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.gaming.v1.GameServerClusters
          .internal_static_google_cloud_gaming_v1_GameServerClusterConnectionInfo_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.gaming.v1.GameServerClusters
          .internal_static_google_cloud_gaming_v1_GameServerClusterConnectionInfo_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.gaming.v1.GameServerClusterConnectionInfo.class,
              com.google.cloud.gaming.v1.GameServerClusterConnectionInfo.Builder.class);
    }

    // Construct using com.google.cloud.gaming.v1.GameServerClusterConnectionInfo.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      if (gkeClusterReferenceBuilder_ != null) {
        gkeClusterReferenceBuilder_.clear();
      }
      namespace_ = "";

      clusterReferenceCase_ = 0;
      clusterReference_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.gaming.v1.GameServerClusters
          .internal_static_google_cloud_gaming_v1_GameServerClusterConnectionInfo_descriptor;
    }

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

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

    @java.lang.Override
    public com.google.cloud.gaming.v1.GameServerClusterConnectionInfo buildPartial() {
      com.google.cloud.gaming.v1.GameServerClusterConnectionInfo result =
          new com.google.cloud.gaming.v1.GameServerClusterConnectionInfo(this);
      if (clusterReferenceCase_ == 7) {
        if (gkeClusterReferenceBuilder_ == null) {
          result.clusterReference_ = clusterReference_;
        } else {
          result.clusterReference_ = gkeClusterReferenceBuilder_.build();
        }
      }
      result.namespace_ = namespace_;
      result.clusterReferenceCase_ = clusterReferenceCase_;
      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.gaming.v1.GameServerClusterConnectionInfo) {
        return mergeFrom((com.google.cloud.gaming.v1.GameServerClusterConnectionInfo) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.gaming.v1.GameServerClusterConnectionInfo other) {
      if (other == com.google.cloud.gaming.v1.GameServerClusterConnectionInfo.getDefaultInstance())
        return this;
      if (!other.getNamespace().isEmpty()) {
        namespace_ = other.namespace_;
        onChanged();
      }
      switch (other.getClusterReferenceCase()) {
        case GKE_CLUSTER_REFERENCE:
          {
            mergeGkeClusterReference(other.getGkeClusterReference());
            break;
          }
        case CLUSTERREFERENCE_NOT_SET:
          {
            break;
          }
      }
      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 42:
              {
                namespace_ = input.readStringRequireUtf8();

                break;
              } // case 42
            case 58:
              {
                input.readMessage(
                    getGkeClusterReferenceFieldBuilder().getBuilder(), extensionRegistry);
                clusterReferenceCase_ = 7;
                break;
              } // case 58
            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 clusterReferenceCase_ = 0;
    private java.lang.Object clusterReference_;

    public ClusterReferenceCase getClusterReferenceCase() {
      return ClusterReferenceCase.forNumber(clusterReferenceCase_);
    }

    public Builder clearClusterReference() {
      clusterReferenceCase_ = 0;
      clusterReference_ = null;
      onChanged();
      return this;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.gaming.v1.GkeClusterReference,
            com.google.cloud.gaming.v1.GkeClusterReference.Builder,
            com.google.cloud.gaming.v1.GkeClusterReferenceOrBuilder>
        gkeClusterReferenceBuilder_;
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     *
     * @return Whether the gkeClusterReference field is set.
     */
    @java.lang.Override
    public boolean hasGkeClusterReference() {
      return clusterReferenceCase_ == 7;
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     *
     * @return The gkeClusterReference.
     */
    @java.lang.Override
    public com.google.cloud.gaming.v1.GkeClusterReference getGkeClusterReference() {
      if (gkeClusterReferenceBuilder_ == null) {
        if (clusterReferenceCase_ == 7) {
          return (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_;
        }
        return com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance();
      } else {
        if (clusterReferenceCase_ == 7) {
          return gkeClusterReferenceBuilder_.getMessage();
        }
        return com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance();
      }
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    public Builder setGkeClusterReference(com.google.cloud.gaming.v1.GkeClusterReference value) {
      if (gkeClusterReferenceBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        clusterReference_ = value;
        onChanged();
      } else {
        gkeClusterReferenceBuilder_.setMessage(value);
      }
      clusterReferenceCase_ = 7;
      return this;
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    public Builder setGkeClusterReference(
        com.google.cloud.gaming.v1.GkeClusterReference.Builder builderForValue) {
      if (gkeClusterReferenceBuilder_ == null) {
        clusterReference_ = builderForValue.build();
        onChanged();
      } else {
        gkeClusterReferenceBuilder_.setMessage(builderForValue.build());
      }
      clusterReferenceCase_ = 7;
      return this;
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    public Builder mergeGkeClusterReference(com.google.cloud.gaming.v1.GkeClusterReference value) {
      if (gkeClusterReferenceBuilder_ == null) {
        if (clusterReferenceCase_ == 7
            && clusterReference_
                != com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance()) {
          clusterReference_ =
              com.google.cloud.gaming.v1.GkeClusterReference.newBuilder(
                      (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          clusterReference_ = value;
        }
        onChanged();
      } else {
        if (clusterReferenceCase_ == 7) {
          gkeClusterReferenceBuilder_.mergeFrom(value);
        } else {
          gkeClusterReferenceBuilder_.setMessage(value);
        }
      }
      clusterReferenceCase_ = 7;
      return this;
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    public Builder clearGkeClusterReference() {
      if (gkeClusterReferenceBuilder_ == null) {
        if (clusterReferenceCase_ == 7) {
          clusterReferenceCase_ = 0;
          clusterReference_ = null;
          onChanged();
        }
      } else {
        if (clusterReferenceCase_ == 7) {
          clusterReferenceCase_ = 0;
          clusterReference_ = null;
        }
        gkeClusterReferenceBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    public com.google.cloud.gaming.v1.GkeClusterReference.Builder getGkeClusterReferenceBuilder() {
      return getGkeClusterReferenceFieldBuilder().getBuilder();
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    @java.lang.Override
    public com.google.cloud.gaming.v1.GkeClusterReferenceOrBuilder
        getGkeClusterReferenceOrBuilder() {
      if ((clusterReferenceCase_ == 7) && (gkeClusterReferenceBuilder_ != null)) {
        return gkeClusterReferenceBuilder_.getMessageOrBuilder();
      } else {
        if (clusterReferenceCase_ == 7) {
          return (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_;
        }
        return com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance();
      }
    }
    /**
     *
     *
     *

     * Reference to the GKE cluster where the game servers are installed.
     *

     *
     * .google.cloud.gaming.v1.GkeClusterReference gke_cluster_reference = 7;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.gaming.v1.GkeClusterReference,
            com.google.cloud.gaming.v1.GkeClusterReference.Builder,
            com.google.cloud.gaming.v1.GkeClusterReferenceOrBuilder>
        getGkeClusterReferenceFieldBuilder() {
      if (gkeClusterReferenceBuilder_ == null) {
        if (!(clusterReferenceCase_ == 7)) {
          clusterReference_ = com.google.cloud.gaming.v1.GkeClusterReference.getDefaultInstance();
        }
        gkeClusterReferenceBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.gaming.v1.GkeClusterReference,
                com.google.cloud.gaming.v1.GkeClusterReference.Builder,
                com.google.cloud.gaming.v1.GkeClusterReferenceOrBuilder>(
                (com.google.cloud.gaming.v1.GkeClusterReference) clusterReference_,
                getParentForChildren(),
                isClean());
        clusterReference_ = null;
      }
      clusterReferenceCase_ = 7;
      onChanged();
      ;
      return gkeClusterReferenceBuilder_;
    }

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

     * Namespace designated on the game server cluster where the Agones game
     * server instances will be created. Existence of the namespace will be
     * validated during creation.
     *

     *
     * string namespace = 5;
     *
     * @return The namespace.
     */
    public java.lang.String getNamespace() {
      java.lang.Object ref = namespace_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        namespace_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     *

     * Namespace designated on the game server cluster where the Agones game
     * server instances will be created. Existence of the namespace will be
     * validated during creation.
     *

     *
     * string namespace = 5;
     *
     * @return The bytes for namespace.
     */
    public com.google.protobuf.ByteString getNamespaceBytes() {
      java.lang.Object ref = namespace_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        namespace_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     *

     * Namespace designated on the game server cluster where the Agones game
     * server instances will be created. Existence of the namespace will be
     * validated during creation.
     *

     *
     * string namespace = 5;
     *
     * @param value The namespace to set.
     * @return This builder for chaining.
     */
    public Builder setNamespace(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

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

     * Namespace designated on the game server cluster where the Agones game
     * server instances will be created. Existence of the namespace will be
     * validated during creation.
     *

     *
     * string namespace = 5;
     *
     * @return This builder for chaining.
     */
    public Builder clearNamespace() {

      namespace_ = getDefaultInstance().getNamespace();
      onChanged();
      return this;
    }
    /**
     *
     *
     *

     * Namespace designated on the game server cluster where the Agones game
     * server instances will be created. Existence of the namespace will be
     * validated during creation.
     *

     *
     * string namespace = 5;
     *
     * @param value The bytes for namespace to set.
     * @return This builder for chaining.
     */
    public Builder setNamespaceBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

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

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

    // @@protoc_insertion_point(builder_scope:google.cloud.gaming.v1.GameServerClusterConnectionInfo)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.cloud.gaming.v1.GameServerClusterConnectionInfo();
  }

  public static com.google.cloud.gaming.v1.GameServerClusterConnectionInfo getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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


text:
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from lxml import etree
from pyquery.pyquery import PyQuery as pq
from pyquery.ajax import PyQuery as pqa
from webtest import http
from webtest.debugapp import debug_app
from .apps import application
from .apps import secure_application
from .compat import PY3k
from .compat import u
from .compat import b
from .compat import text_type
from .compat import TestCase

def not_py3k(func):
    if not PY3k:
        return func

try:
    import requests  # NOQA
    HAS_REQUEST = True
except ImportError:
    HAS_REQUEST = False

dirname = os.path.dirname(os.path.abspath(__file__))
docs = os.path.join(os.path.dirname(dirname), 'docs')
path_to_html_file = os.path.join(dirname, 'test.html')
path_to_invalid_file = os.path.join(dirname, 'invalid.xml')

class TestUnicode(TestCase):

    def test_unicode(self):
        xml = pq(u("
é
", 'utf-8'))
        self.assertEqual(type(xml.html()), text_type)
        if PY3k:
            self.assertEqual(str(xml), '
é
')
            self.assertEqual(str(xml('p:contains("é")')), '
é
')
        else:
            self.assertEqual(unicode(xml), u("
é
", 'utf-8'))
            self.assertEqual(str(xml), '
é
')
            self.assertEqual(str(xml(u('p:contains("é")', 'utf8'))),
                             '
é
')
            self.assertEqual(unicode(xml(u('p:contains("é")', 'utf8'))),
                             u('
é
', 'utf8'))

class TestAttributeCase(TestCase):

    def test_xml_upper_element_name(self):
        xml = pq('<X>foo</X>', parser='xml')
        self.assertEqual(len(xml('X')), 1)
        self.assertEqual(len(xml('x')), 0)

    def test_html_upper_element_name(self):
        xml = pq('<X>foo</X>', parser='html')
        self.assertEqual(len(xml('X')), 1)
        self.assertEqual(len(xml('x')), 1)

class TestSelector(TestCase):
    klass = pq
    html = """

node1

node2

node3

           """

    html2 = """

node1

           """

    html3 = """

node1

node2

node3

           """

    html4 = """

              <form action="/">
                <input name="enabled" type="text" value="test"/>
                <input name="disabled" type="text"
                       value="disabled" disabled="disabled"/>
                <input name="file" type="file" />
                <select name="select">
                  <option value="">Choose something</option>
                  <option value="one">One</option>
                  <option value="two" selected="selected">Two</option>
                  <option value="three">Three</option>
                </select>
                <input name="radio" type="radio" value="one"/>
                <input name="radio" type="radio"
                       value="two" checked="checked"/>
                <input name="radio" type="radio" value="three"/>
                <input name="checkbox" type="checkbox" value="a"/>
                <input name="checkbox" type="checkbox"
                       value="b" checked="checked"/>
                <input name="checkbox" type="checkbox" value="c"/>
                <input name="button" type="button" value="button" />
                <button>button</button>
              </form>

           """

    html5 = """

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5

Heading 6

           """

    def test_get_root(self):
        doc = pq(b('<?xml version="1.0" encoding="UTF-8"?><root>
</root>'))
        self.assertEqual(isinstance(doc.root, etree._ElementTree), True)
        self.assertEqual(doc.encoding, 'UTF-8')

    def test_selector_from_doc(self):
        doc = etree.fromstring(self.html)
        assert len(self.klass(doc)) == 1
        assert len(self.klass('div', doc)) == 3
        assert len(self.klass('div#node2', doc)) == 1

    def test_selector_from_html(self):
        assert len(self.klass(self.html)) == 1
        assert len(self.klass('div', self.html)) == 3
        assert len(self.klass('div#node2', self.html)) == 1

    def test_selector_from_obj(self):
        e = self.klass(self.html)
        assert len(e('div')) == 3
        assert len(e('div#node2')) == 1

    def test_selector_from_html_from_obj(self):
        e = self.klass(self.html)
        assert len(e('div', self.html2)) == 1
        assert len(e('div#node2', self.html2)) == 0

    def test_class(self):
        e = self.klass(self.html)
        assert isinstance(e, self.klass)
        n = e('div', self.html2)
        assert isinstance(n, self.klass)
        assert n._parent is e

    def test_pseudo_classes(self):
        e = self.klass(self.html)
        self.assertEqual(e('div:first').text(), 'node1')
        self.assertEqual(e('div:last').text(), 'node3')
        self.assertEqual(e('div:even').text(), 'node1 node3')
        self.assertEqual(e('div div:even').text(), '')
        self.assertEqual(e('body div:even').text(), 'node1 node3')
        self.assertEqual(e('div:gt(0)').text(), 'node2 node3')
        self.assertEqual(e('div:lt(1)').text(), 'node1')
        self.assertEqual(e('div:eq(2)').text(), 'node3')

        # test on the form
        e = self.klass(self.html4)
        assert len(e(':disabled')) == 1
        assert len(e('input:enabled')) == 9
        assert len(e(':selected')) == 1
        assert len(e(':checked')) == 2
        assert len(e(':file')) == 1
        assert len(e(':input')) == 12
        assert len(e(':button')) == 2
        assert len(e(':radio')) == 3
        assert len(e(':checkbox')) == 3

        # test on other elements
        e = self.klass(self.html5)
        assert len(e(":header")) == 6
        assert len(e(":parent")) == 2
        assert len(e(":empty")) == 1
        assert len(e(":contains('Heading')")) == 8

    def test_on_the_fly_dom_creation(self):
        e = self.klass(self.html)
        assert e('
Hello world
').text() == 'Hello world'
        assert e('').text() == ''

class TestTraversal(TestCase):
    klass = pq
    html = """

node1

                        node2 booyah

           """

    def test_filter(self):
        assert len(self.klass('div', self.html).filter('.node3')) == 1
        assert len(self.klass('div', self.html).filter('#node2')) == 1
        assert len(self.klass('div', self.html).filter(lambda i: i == 0)) == 1

        d = pq('
Hello warming world
')
        self.assertEqual(d('strong').filter(lambda el: True), [])

    def test_not(self):
        assert len(self.klass('div', self.html).not_('.node3')) == 1

    def test_is(self):
        assert self.klass('div', self.html).is_('.node3')
        assert not self.klass('div', self.html).is_('.foobazbar')

    def test_find(self):
        assert len(self.klass('#node1', self.html).find('span')) == 1
        assert len(self.klass('#node2', self.html).find('span')) == 2
        assert len(self.klass('div', self.html).find('span')) == 3

    def test_each(self):
        doc = self.klass(self.html)
        doc('span').each(lambda: doc(this).wrap(""))  # NOQA
        assert len(doc('em')) == 3

    def test_map(self):
        def ids_minus_one(i, elem):
            return int(self.klass(elem).attr('id')[-1]) - 1
        assert self.klass('div', self.html).map(ids_minus_one) == [0, 1]

        d = pq('
Hello warming world
')
        self.assertEqual(d('strong').map(lambda i, el: pq(this).text()), [])  # NOQA

    def test_end(self):
        assert len(self.klass('div', self.html).find('span').end()) == 2
        assert len(self.klass('#node2', self.html).find('span').end()) == 1

    def test_closest(self):
        assert len(self.klass('#node1 span', self.html).closest('body')) == 1
        assert self.klass('#node2',
                          self.html).closest('.node3').attr('id') == 'node2'
        assert self.klass('.node3', self.html).closest('form') == []

class TestOpener(TestCase):

    def test_open_filename(self):
        doc = pq(filename=path_to_html_file)
        self.assertEqual(len(doc('p#test').text()), 14)

    def test_invalid_filename(self):
        doc = pq(filename=path_to_invalid_file)
        self.assertEqual(len(doc('p#test').text()), 14)

    def test_custom_opener(self):
        def opener(url):
            return '

'

        doc = pq(url='http://example.com', opener=opener)
        assert len(doc('.node')) == 1, doc

class TestComment(TestCase):

    def test_comment(self):
        doc = pq('
 bar
')
        self.assertEqual(doc.text(), 'bar')

class TestCallback(TestCase):
    html = """

Coffee

Tea

Milk

    """

    def test_S_this_inside_callback(self):
        S = pq(self.html)
        self.assertEqual(S('li').map(lambda i, el: S(this).html()),  # NOQA
                                     ['Coffee', 'Tea', 'Milk'])

    def test_parameterless_callback(self):
        S = pq(self.html)
        self.assertEqual(S('li').map(lambda: S(this).html()),  # NOQA
                                     ['Coffee', 'Tea', 'Milk'])

class TestHook(TestCase):
    html = """

Coffee

Tea

Milk

    """

    def test_fn(self):
        "Example from `PyQuery.Fn` docs."
        fn = lambda: this.map(lambda i, el: pq(this).outerHtml())
        pq.fn.listOuterHtml = fn
        S = pq(self.html)
        self.assertEqual(S('li').listOuterHtml(),
                         ['
Coffee
', '
Tea
', '
Milk
'])

    def test_fn_with_kwargs(self):
        "fn() with keyword arguments."
        pq.fn.test = lambda p=1: pq(this).eq(p)
        S = pq(self.html)
        self.assertEqual(S('li').test(0).text(), 'Coffee')
        self.assertEqual(S('li').test().text(), 'Tea')
        self.assertEqual(S('li').test(p=2).text(), 'Milk')

class TestAjaxSelector(TestSelector):
    klass = pqa

    def setUp(self):
        self.s = http.StopableWSGIServer.create(application)

    @not_py3k
    def test_proxy(self):
        self.s.wait()
        application_url = self.s.application_url
        e = self.klass([])
        val = e.get(application_url)
        assert len(val('pre')) == 1, (str(val.response), val)

    def test_get(self):
        e = self.klass(app=application)
        val = e.get('/')
        assert len(val('pre')) == 1, val

    def test_secure_get(self):
        e = self.klass(app=secure_application)
        val = e.get('/', environ=dict(REMOTE_USER='gawii'))
        assert len(val('pre')) == 1, val
        val = e.get('/', REMOTE_USER='gawii')
        assert len(val('pre')) == 1, val

    def test_secure_get_not_authorized(self):
        e = self.klass(app=secure_application)
        val = e.get('/')
        assert len(val('pre')) == 0, val

    def test_post(self):
        e = self.klass(app=application)
        val = e.post('/')
        assert len(val('a')) == 1, val

    def test_subquery(self):
        e = self.klass(app=application)
        n = e('div')
        val = n.post('/')
        assert len(val('a')) == 1, val

    def tearDown(self):
        self.s.shutdown()

class TestManipulating(TestCase):
    html = '''

      TestMy link text
      My link text 2

    '''

    def test_remove(self):
        d = pq(self.html)
        d('img').remove()
        val = d('a:first').html()
        assert val == 'Test My link text', repr(val)
        val = d('a:last').html()
        assert val == ' My link text 2', repr(val)

    def test_class(self):
        d = pq('

')
        d.removeClass('xx')
        assert 'class' not in str(d), str(d)

class TestMakeLinks(TestCase):

    html = '''

    with href
    without href

    '''

    def test_make_link(self):
        d = pq(self.html, parser='xml')
        d.make_links_absolute(base_url='http://example.com')
        self.assertTrue(len(d('a[href]')), 1)
        self.assertEqual(d('a[href]').attr('href'),
                         'http://example.com/path_info')

class TestHTMLParser(TestCase):
    xml = "
I'm valid XML
"
    html = '''

      TestimageMy link text
      imageMy link text 2
      Behind you, a three-headed HTML‐Entity!

'''

    def test_parser_persistance(self):
        d = pq(self.xml, parser='xml')
        self.assertRaises(etree.XMLSyntaxError, lambda: d.after(self.html))
        d = pq(self.xml, parser='html')
        d.after(self.html)  # this should not fail

    @not_py3k
    def test_soup_parser(self):
        d = pq('<meta><title>HelloHi all
',
               parser='soup')
        self.assertEqual(str(d), (
            '<meta/><title>Hello</title>'
            'Hi all
'))

    def test_replaceWith(self):
        expected = '''

      TestimageMy link text
      imageMy link text 2
      Behind you, a three-headed HTML&dash;Entity!

'''
        d = pq(self.html)
        d('img').replace_with('image')
        val = d.__html__()
        assert val == expected, (repr(val), repr(expected))

    def test_replaceWith_with_function(self):
        expected = '''

      TestimageMy link text
      imageMy link text 2
      Behind you, a three-headed HTML&dash;Entity!

'''
        d = pq(self.html)
        d('a').replace_with(lambda i, e: pq(e).html())
        val = d.__html__()
        assert val == expected, (repr(val), repr(expected))

class TestXMLNamespace(TestCase):
    xml = '''<?xml version="1.0" encoding="UTF-8" ?>
    <foo xmlns:bar="http://example.com/bar">
    <bar:blah>What</bar:blah>
    <idiot>123</idiot>
    </foo>'''

    xhtml = '''

What

    '''

    def test_selector(self):
        expected = 'What'
        d = pq(b(self.xml), parser='xml')
        val = d('bar|blah',
                namespaces={'bar': 'http://example.com/bar'}).text()
        self.assertEqual(repr(val), repr(expected))

    def test_selector_with_xml(self):
        expected = 'What'
        d = pq('bar|blah', b(self.xml), parser='xml',
               namespaces={'bar': 'http://example.com/bar'})
        val = d.text()
        self.assertEqual(repr(val), repr(expected))

    def test_selector_html(self):
        expected = 'What'
        d = pq('blah', self.xml.split('?>', 1)[1], parser='html')
        val = d.text()
        self.assertEqual(repr(val), repr(expected))

    def test_xhtml_namespace(self):
        expected = 'What'
        d = pq(b(self.xhtml), parser='xml')
        d.xhtml_to_html()
        val = d('div').text()
        self.assertEqual(repr(val), repr(expected))

    def test_xhtml_namespace_html_parser(self):
        expected = 'What'
        d = pq(self.xhtml, parser='html')
        d.xhtml_to_html()
        val = d('div').text()
        self.assertEqual(repr(val), repr(expected))

    def test_remove_namespaces(self):
        expected = 'What'
        d = pq(b(self.xml), parser='xml').remove_namespaces()
        val = d('blah').text()
        self.assertEqual(repr(val), repr(expected))

class TestWebScrapping(TestCase):

    def setUp(self):
        self.s = http.StopableWSGIServer.create(debug_app)
        self.s.wait()
        self.application_url = self.s.application_url.rstrip('/')

    def test_get(self):
        d = pq(self.application_url, {'q': 'foo'},
               method='get')
        print(d)
        self.assertIn('REQUEST_METHOD: GET', d('p').text())
        self.assertIn('q=foo', d('p').text())

    def test_post(self):
        d = pq(self.application_url, {'q': 'foo'},
               method='post')
        self.assertIn('REQUEST_METHOD: POST', d('p').text())
        self.assertIn('q=foo', d('p').text())

    def tearDown(self):
        self.s.shutdown()

class TestWebScrappingEncoding(TestCase):

    def test_get(self):
        if not HAS_REQUEST:
            return
        d = pq(u('http://ru.wikipedia.org/wiki/Заглавная_страница', 'utf8'),
               method='get')
        print(d)
        self.assertEqual(d('#n-mainpage a').text(),
                         u('Заглавная страница', 'utf8'))

redpajama_set_name: RedPajamaGithub


text:
<?php

// Set the content type to Javascript
header("Content-type: text/javascript");

// Disallow caching
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$file = isset($_GET['file']) ? $_GET['file'] : '';

$array = array(
	"PDFJS.workerSrc" => OCP\Util::linkTo('files_pdfviewer', '3rdparty/pdfjs/pdf.worker.js'),
	"window.dir" => $dir,
	"window.file" => $file,
	);

// Echo it
foreach ($array as  $setting => $value) {
	echo($setting ."=".json_encode($value).";\n");
}


text:
var _intervals = [];
function intervalInit() {
  var els = document.getElementsByClassName("form-interval");
  for (var i=0; i<els.length; i++) {
    if (!els[i].className.match("interval-init")) {
      els[i].addClass("interval-init");
      _intervals.push(new interval(els[i]));
    }
  }
  if (typeof(MutationObserver) == "function") {
    var observer = new MutationObserver(function(mutations) {
      mutations.forEach(function(mutation) {
        intervalObserve(mutation.target);
      });
    });
    var config = { childList: true, subtree: true };
    observer.observe(document.body, config);
  }
  else {
    setInterval(function() {
      intervalObserve(document.body);
    }, 1000);
  }
}
function intervalObserve(el) {
  var els = el.getElementsByClassName("form-interval");
  for (var i=0; i<els.length; i++) {
    if (!els[i].className.match("interval-init")) {
      els[i].addClass("interval-init");
      _intervals.push(new interval(els[i]));
    }
  }
}

function interval(el) {

  this.tags = {
    wrap: el
  };

  this.init = function() {
    var self = this;
    this.tags.wrap.addClass("interval-init");
    this.tags.item = formGetItem(this.tags.wrap);
    this.suffix = this.tags.wrap.getAttribute("interval_suffix");
    this.min = this.tags.wrap.getAttribute("interval_min");
    this.max = this.tags.wrap.getAttribute("interval_max");
    this.round = this.tags.wrap.getAttribute("interval_round");
    if (this.round.match("."))
      this.round = parseFloat(this.round);
    else
      this.round = parseInt(this.round);
    this.value_follow = false;
    this.min = (this.round%1 ? parseFloat(this.min) : parseInt(this.min));
    this.max = (this.round%1 ? parseFloat(this.max) : parseInt(this.max));
    this.tags.container = this.tags.wrap.getElementsByClassName("interval-slider")[0];
    this.drag_point = null;
    this.drag_pos = 0;
    window.addEventListener("mousemove", function(e){ self.onMouseMove(e); }, false);
    window.addEventListener("mouseup", function(e){ self.onMouseUp(e); }, false);
    window.addEventListener("touchmove", function(e){ self.onMouseMove(e); }, false);
    window.addEventListener("touchend", function(e){ self.onMouseUp(e); }, false);
    this.create();
    if (this.tags.item.hasClass("interval-dropdown")) {
      this.tags.label = this.tags.item.getElementsByClassName("form-label")[0];
      this.tags.label.addEventListener("click", function(){ self.toggle(); }, false);
      window.addEventListener("click", function(e){ self.windowClick(e); }, false);
    }
  }

  this.toggle = function() {
    if (this.isOpen())
      this.close();
    else
      this.open();
  }
  this.open = function() {
    this.tags.item.addClass("active");
  }
  this.close = function() {
    this.tags.item.removeClass("active");
  }
  this.isOpen = function() {
    if (this.tags.item.hasClass("active"))
      return true;
    return false;
  }

  this.windowClick = function(e) {
    if (!this.isOpen())
      return;
    for (var i=0, el = e.target; i<10 && el != null && el != this.tags.item; i++, el = el.parentNode);
    if (!el || i == 10)
      this.close();
  }

  this.onMouseDown = function(e, point) {
    if (point != "min" && point != "max")
      return;
    e.preventDefault();
    this.drag_point = point;
    this.drag_pos = getPos(this.tags.slider.outer);
  }
  this.onMouseUp = function(e) {
    this.drag_point = null;
  }
  this.onMouseMove = function(e) {
    if (!this.drag_point)
      return;
    e.preventDefault();
    var p = this.drag_point;
    var xy = getXY(e);
    var width = this.tags.slider.outer.offsetWidth;
    var x = Math.min(Math.max(xy.x - this.drag_pos.x, 0), width)/width;
    var val = Math.round((x*(this.max-this.min)+this.min)/this.round)*this.round;

    if (val == this.tags[p].input.value)
      return;

    if (p == "min" && val >= this.getValue("max"))
      val = this.getValue("max")-this.round;
    else if (p == "max" && val <= this.getValue("min"))
      val = this.getValue("min")+this.round;

    this.setValue(p, val);

    this.lastXY = xy;
  }

  this.numberFormat = function(val) {
    if (val < 100)
      return val+this.suffix;
    var str = val.toString();
    var r = "";
    for (var i=0; i<str.length; i++) {
      if (i%3 == str.length%3 && i != 0)
        r+= " ";
      r+= str[i];
    }
    r+= this.suffix;
    return r;
  }

  this.getPoint = function(p) {
    return parseFloat(this.tags[p].point.style.left);
  }
  this.setPoint = function(p, value) {
    this.tags[p].point.style.left = value+"%";
  }

  this.getValue = function(p) {
    var val = this.tags[p].input.value;
    if (this.round%1)
      val = parseFloat(val);
    else
      val = parseInt(val);
    return val;
  }
  this.setValue = function(p, value) {
    var x = (value-this.min)/(this.max-this.min)*100;
    this.tags[p].input.value = value;
    this.tags[p].text.textContent = this.numberFormat(value);
    this.updatePosition(p);
    this.tags.wrap.trigger("change");
  }

  this.updatePositions = function() {
    this.updatePosition("min");
    this.updatePosition("max");
  }
  this.updatePosition = function(p) {
    var value = this.tags[p].input.value;
    var x = (value-this.min)/(this.max-this.min)*100;
    this.setPoint(p, x);
    if (p == "min")
      this.tags.slider.inner.style.left = x+"%";
    else if (p == "max")
      this.tags.slider.inner.style.right = (100-x)+"%";
  }

  this.create = function() {
    var self = this;
    var inp = this.tags.wrap.getElementsByTagName("input");

    this.tags.min = {
      point: document.createElement("div"),
      text: document.createElement("div"),
      input: inp[0]
    };
    this.tags.min.point.className = "slider-point slider-point-min";
    this.tags.min.text.className = "slider-text slider-text-min";
    var minp = document.createElement("div");
    minp.className = "slider-point-inner";
    this.tags.min.point.appendChild(minp);
    this.tags.min.text.textContent = this.numberFormat(this.tags.min.input.value);
    this.tags.min.point.addEventListener("mousedown", function(e) { self.onMouseDown(e, "min"); }, false);
    this.tags.min.point.addEventListener("touchstart", function(e) { self.onMouseDown(e, "min"); }, false);

    this.tags.max = {
      point: document.createElement("div"),
      text: document.createElement("div"),
      input: inp[1]
    };
    this.tags.max.point.className = "slider-point slider-point-max";
    this.tags.max.text.className = "slider-text slider-text-max";
    var maxp = document.createElement("div");
    maxp.className = "slider-point-inner";
    this.tags.max.point.appendChild(maxp);
    this.tags.max.text.textContent = this.numberFormat(this.tags.max.input.value);
    this.tags.max.point.addEventListener("mousedown", function(e) { self.onMouseDown(e, "max"); }, false);
    this.tags.max.point.addEventListener("touchstart", function(e) { self.onMouseDown(e, "max"); }, false);

    this.tags.slider = {
      outer: document.createElement("div"),
      inner: document.createElement("div")
    };
    this.tags.slider.outer.className = "slider-outer";
    this.tags.slider.inner.className = "slider-inner";

    this.updatePositions();

    this.tags.slider.outer.appendChild(this.tags.slider.inner);
    this.tags.slider.outer.appendChild(this.tags.min.point);
    this.tags.slider.outer.appendChild(this.tags.max.point);
    if (this.value_follow) {
      this.tags.min.point.appendChild(this.tags.min.text);
      this.tags.container.appendChild(this.tags.slider.outer);
      this.tags.max.point.appendChild(this.tags.max.text);
    }
    else {
      this.tags.container.appendChild(this.tags.min.text);
      this.tags.container.appendChild(this.tags.slider.outer);
      this.tags.container.appendChild(this.tags.max.text);
    }
  }

  this.init();

}

window.addEventListener("load", intervalInit, false);


text:
package org.jetbrains.plugins.scala.lang.completion3

import com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler
import com.intellij.testFramework.fixtures.CompletionAutoPopupTester
import com.intellij.testFramework.{TestModeFlags, UsefulTestCase}
import org.jetbrains.plugins.scala.base.EditorActionTestBase
import org.junit.Assert.assertNull

import scala.jdk.CollectionConverters._

class ScalaAutoPopupCompletionHandlerTest extends EditorActionTestBase {
  private[this] var myTester: CompletionAutoPopupTester = _

  override def runInDispatchThread() = false

  override def setUp(): Unit = {
    super.setUp()
    myTester = new CompletionAutoPopupTester(myFixture)
    TestModeFlags.set[java.lang.Boolean](
      CompletionAutoPopupHandler.ourTestingAutopopup, true, getTestRootDisposable
    )
  }

  private def doTest(textToType: String, expectedLookupItems: String*)(src: String): Unit = {
    myFixture.configureByText(defaultFileName, src)
    myTester.typeWithPauses(textToType)

    val actualLookupItems = myFixture.getLookupElementStrings

    UsefulTestCase.assertContainsElements[String](actualLookupItems, expectedLookupItems.asJava)
  }

  private def doTestNoAutoCompletion(textToType: String)(src: String): Unit = {
    myFixture.configureByText(defaultFileName, src)
    myTester.typeWithPauses(textToType)

    assertNull("Lookup shouldn't be shown", myTester.getLookup)
  }

  def testAutoPopupInTypeAnnotation_patternDefinition(): Unit = doTest(":", "Seq[String]") {
    s"""object O {
       |  val v$CARET = Seq.empty[String]
       |}""".stripMargin
  }

  def testAutoPopupInTypeAnnotation_variableDefinition(): Unit = doTest(":", "Seq[String]") {
    s"""object O {
       |  var v$CARET = Seq.empty[String]
       |}""".stripMargin
  }

  def testAutoPopupInTypeAnnotation_functionDefinition(): Unit = doTest(":", "Seq[String]") {
    s"""object O {
       |  def f()$CARET = Seq.empty[String]
       |}""".stripMargin
  }

  def testNoAutoPopupInTypeAnnotation_valueDeclaration(): Unit = doTestNoAutoCompletion(":") {
    s"""object O {
       |  val v$CARET
       |}""".stripMargin
  }

  def testNoAutoPopupInTypeAnnotation_variableDeclaration(): Unit = doTestNoAutoCompletion(":") {
    s"""object O {
       |  var v$CARET
       |}""".stripMargin
  }

  def testNoAutoPopupInTypeAnnotation_functionDeclaration(): Unit = doTestNoAutoCompletion(":") {
    s"""object O {
       |  def f()$CARET
       |}""".stripMargin
  }

  def testAutoPopupInTypeAnnotation_typeOnSelection(): Unit = doTest(":", "Seq[String]") {
    s"""object O {
       |  val v$START: SomeType$END$CARET = Seq.empty[String]
       |}""".stripMargin
  }

  def testNoAutoPopupInTypeAnnotation_typeOnWrongSelection(): Unit = doTestNoAutoCompletion(":") {
    s"""object O {
       |  val v$START: Some$END${CARET}Type = Seq.empty[String]
       |}""".stripMargin
  }

}


text:
namespace Avdm.NetTp.Grid.Config
{
    public interface INodeConfigPersistor
    {
        NodeConfig LoadAppConfig( string applicationName );
        void SaveAppConfig( NodeConfig config );
    }
}


text:
/*
** Insert a value into a doubly linked list.  rootp is a pointer to
** the root node, and value is the new value to be inserted.
** Returns: 0 if the value is already in the list, -1 if there was
** no memory to create a new node, 1 if the value was added
** successfully.
*/
#include <stdlib.h>
#include <stdio.h>
#include "doubly_linked_list_node.h"

int
dll_insert( register Node *rootp, int value )
{
	register Node	*this;
	register Node	*next;
	register Node	*newnode;

	/*
	** See if value is already in the list; return if it is.
	** Otherwise, allocate a new node for the value ("newnode"
	** will point to it). "this" will point to the node that the
	** new value should follow, and "next" will point to the one
	** after it.
	*/
	for( this = rootp; (next = this->fwd) != NULL; this = next ){
		if( next->value == value )
			return 0;
		if( next->value > value )
			break;
	}
	newnode = (Node *)malloc( sizeof( Node ) );
	if( newnode == NULL )
		return -1;
	newnode->value = value;

	/*
	** Add the new node to the list.
	*/
	newnode->fwd = next;
	this->fwd = newnode;

	if( this != rootp )
		newnode->bwd = this;
	else
		newnode->bwd = NULL;

	if( next != NULL )
		next->bwd = newnode;
	else
		rootp->bwd = newnode;

	return 1;
}


text:
/*
 * SubSonic - http://subsonicproject.com
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an
 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
*/

using System;
using System.Text.RegularExpressions;

namespace SubSonic.Sugar
{
    /// <summary>
    /// Summary for the Validation class
    /// </summary>
    public static class Validation
    {
        /// <summary>
        /// Determines whether the specified eval string contains only alpha characters.
        /// </summary>
        /// <param name="evalString">The eval string.</param>
        /// <returns>
        /// 	<c>true</c> if the specified eval string is alpha; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsAlpha(string evalString)
        {
            return !Regex.IsMatch(evalString, RegexPattern.ALPHA);
        }

        /// <summary>
        /// Determines whether the specified eval string contains only alphanumeric characters
        /// </summary>
        /// <param name="evalString">The eval string.</param>
        /// <returns>
        /// 	<c>true</c> if the string is alphanumeric; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsAlphaNumeric(string evalString)
        {
            return !Regex.IsMatch(evalString, RegexPattern.ALPHA_NUMERIC);
        }

        /// <summary>
        /// Determines whether the specified eval string contains only alphanumeric characters
        /// </summary>
        /// <param name="evalString">The eval string.</param>
        /// <param name="allowSpaces">if set to <c>true</c> [allow spaces].</param>
        /// <returns>
        /// 	<c>true</c> if the string is alphanumeric; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsAlphaNumeric(string evalString, bool allowSpaces)
        {
            if(allowSpaces)
                return !Regex.IsMatch(evalString, RegexPattern.ALPHA_NUMERIC_SPACE);
            return IsAlphaNumeric(evalString);
        }

        /// <summary>
        /// Determines whether the specified eval string contains only numeric characters
        /// </summary>
        /// <param name="evalString">The eval string.</param>
        /// <returns>
        /// 	<c>true</c> if the string is numeric; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsNumeric(string evalString)
        {
            return !Regex.IsMatch(evalString, RegexPattern.NUMERIC);
        }

        /// <summary>
        /// Determines whether the specified email address string is valid based on regular expression evaluation.
        /// </summary>
        /// <param name="emailAddressString">The email address string.</param>
        /// <returns>
        /// 	<c>true</c> if the specified email address is valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsEmail(string emailAddressString)
        {
            return Regex.IsMatch(emailAddressString, RegexPattern.EMAIL);
        }

        /// <summary>
        /// Determines whether the specified string is lower case.
        /// </summary>
        /// <param name="inputString">The input string.</param>
        /// <returns>
        /// 	<c>true</c> if the specified string is lower case; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsLowerCase(string inputString)
        {
            return Regex.IsMatch(inputString, RegexPattern.LOWER_CASE);
        }

        /// <summary>
        /// Determines whether the specified string is upper case.
        /// </summary>
        /// <param name="inputString">The input string.</param>
        /// <returns>
        /// 	<c>true</c> if the specified string is upper case; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsUpperCase(string inputString)
        {
            return Regex.IsMatch(inputString, RegexPattern.UPPER_CASE);
        }

        /// <summary>
        /// Determines whether the specified string is a valid GUID.
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <returns>
        /// 	<c>true</c> if the specified string is a valid GUID; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsGuid(string guid)
        {
            return Regex.IsMatch(guid, RegexPattern.GUID);
        }

        /// <summary>
        /// Determines whether the specified string is a valid US Zip Code, using either 5 or 5+4 format.
        /// </summary>
        /// <param name="zipCode">The zip code.</param>
        /// <returns>
        /// 	<c>true</c> if it is a valid zip code; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsZIPCodeAny(string zipCode)
        {
            return Regex.IsMatch(zipCode, RegexPattern.US_ZIPCODE_PLUS_FOUR_OPTIONAL);
        }

        /// <summary>
        /// Determines whether the specified string is a valid US Zip Code, using the 5 digit format.
        /// </summary>
        /// <param name="zipCode">The zip code.</param>
        /// <returns>
        /// 	<c>true</c> if it is a valid zip code; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsZIPCodeFive(string zipCode)
        {
            return Regex.IsMatch(zipCode, RegexPattern.US_ZIPCODE);
        }

        /// <summary>
        /// Determines whether the specified string is a valid US Zip Code, using the 5+4 format.
        /// </summary>
        /// <param name="zipCode">The zip code.</param>
        /// <returns>
        /// 	<c>true</c> if it is a valid zip code; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsZIPCodeFivePlusFour(string zipCode)
        {
            return Regex.IsMatch(zipCode, RegexPattern.US_ZIPCODE_PLUS_FOUR);
        }

        /// <summary>
        /// Determines whether the specified string is a valid Social Security number. Dashes are optional.
        /// </summary>
        /// <param name="socialSecurityNumber">The Social Security Number</param>
        /// <returns>
        /// 	<c>true</c> if it is a valid Social Security number; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsSocialSecurityNumber(string socialSecurityNumber)
        {
            return Regex.IsMatch(socialSecurityNumber, RegexPattern.SOCIAL_SECURITY);
        }

        /// <summary>
        /// Determines whether the specified string is a valid IP address.
        /// </summary>
        /// <param name="ipAddress">The ip address.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsIPAddress(string ipAddress)
        {
            return Regex.IsMatch(ipAddress, RegexPattern.IP_ADDRESS);
        }

        /// <summary>
        /// Determines whether the specified string is a valid US state either by full name or two letter abbreviation.
        /// </summary>
        /// <param name="stateName">The state name.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsUSState(string stateName)
        {
            stateName = stateName.ToUpper();
            if(stateName.Length > 2)
                return (!String.IsNullOrEmpty(Strings.USStateNameToAbbrev(stateName)));
            return (!String.IsNullOrEmpty(Strings.USStateAbbrevToName(stateName)));
        }

        /// <summary>
        /// Determines whether the specified string is a valid US phone number using the referenced regex string.
        /// </summary>
        /// <param name="telephoneNumber">The telephone number.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsUSTelephoneNumber(string telephoneNumber)
        {
            return Regex.IsMatch(telephoneNumber, RegexPattern.US_TELEPHONE);
        }

        /// <summary>
        /// Determines whether the specified string is a valid currency string using the referenced regex string.
        /// </summary>
        /// <param name="currency">The currency string.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsUSCurrency(string currency)
        {
            return Regex.IsMatch(currency, RegexPattern.US_CURRENCY);
        }

        /// <summary>
        /// Determines whether the specified string is a valid URL string using the referenced regex string.
        /// </summary>
        /// <param name="url">The URL string.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsURL(string url)
        {
            return Regex.IsMatch(url, RegexPattern.URL);
        }

        /// <summary>
        /// Determines whether the specified string is consider a strong password based on the supplied string.
        /// </summary>
        /// <param name="password">The password.</param>
        /// <returns>
        /// 	<c>true</c> if strong; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsStrongPassword(string password)
        {
            return Regex.IsMatch(password, RegexPattern.STRONG_PASSWORD);
        }

        #region Credit Cards

        /// <summary>
        /// Determines whether the specified string is a valid credit, based on matching any one of the eight credit card strings
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardAny(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_AMERICAN_EXPRESS) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_CARTE_BLANCHE) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_DINERS_CLUB) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_DISCOVER) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_EN_ROUTE) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_JCB) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_MASTER_CARD) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_VISA);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is an American Express, Discover, MasterCard, or Visa
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardBigFour(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_AMERICAN_EXPRESS) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_DISCOVER) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_MASTER_CARD) ||
                       Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_VISA);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is an American Express card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardAmericanExpress(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_AMERICAN_EXPRESS);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is an Carte Blanche card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardCarteBlanche(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_CARTE_BLANCHE);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is an Diner's Club card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardDinersClub(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_DINERS_CLUB);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is a Discover card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardDiscover(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_DISCOVER);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is an En Route card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardEnRoute(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_EN_ROUTE);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is an JCB card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardJCB(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_JCB);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is a Master Card credit card
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardMasterCard(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_MASTER_CARD);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified string is Visa card.
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns>
        /// 	<c>true</c> if valid; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsCreditCardVisa(string creditCard)
        {
            if(CreditPassesFormatCheck(creditCard))
            {
                creditCard = CleanCreditCardNumber(creditCard);
                return Regex.IsMatch(creditCard, RegexPattern.CREDIT_CARD_VISA);
            }
            return false;
        }

        /// <summary>
        /// Cleans the credit card number, returning just the numeric values.
        /// </summary>
        /// <param name="creditCard">The credit card.</param>
        /// <returns></returns>
        public static string CleanCreditCardNumber(string creditCard)
        {
            Regex regex = new Regex(RegexPattern.CREDIT_CARD_STRIP_NON_NUMERIC, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            return regex.Replace(creditCard, String.Empty);
        }

        /// <summary>
        /// Determines whether the credit card number, once cleaned, passes the Luhn algorith.
        /// See: http://en.wikipedia.org/wiki/Luhn_algorithm
        /// </summary>
        /// <param name="creditCardNumber">The credit card number.</param>
        /// <returns></returns>
        private static bool CreditPassesFormatCheck(string creditCardNumber)
        {
            creditCardNumber = CleanCreditCardNumber(creditCardNumber);
            if(Numbers.IsInteger(creditCardNumber))
            {
                int[] numArray = new int[creditCardNumber.Length];
                for(int i = 0; i < numArray.Length; i++)
                    numArray[i] = Convert.ToInt16(creditCardNumber[i].ToString());

                return IsValidLuhn(numArray);
            }
            return false;
        }

        /// <summary>
        /// Determines whether the specified int array passes the Luhn algorith
        /// </summary>
        /// <param name="digits">The int array to evaluate</param>
        /// <returns>
        /// 	<c>true</c> if it validates; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsValidLuhn(int[] digits)
        {
            int sum = 0;
            bool alt = false;
            for(int i = digits.Length - 1; i >= 0; i--)
            {
                if(alt)
                {
                    digits[i] *= 2;
                    if(digits[i] > 9)
                        digits[i] -= 9; // equivalent to adding the value of digits
                }
                sum += digits[i];
                alt = !alt;
            }
            return sum % 10 == 0;
        }

        #endregion
    }
}


text:
import io
import re
import sys

from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

class PyTest(TestCommand):
    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]

    def initialize_options(self):
        TestCommand.initialize_options(self)
        self.pytest_args = []

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        # import here, cause outside the eggs aren't loaded
        import pytest
        errno = pytest.main(self.pytest_args)
        sys.exit(errno)

# requirements
install_requirements = ['guessit>=0.9.1', 'babelfish>=0.5.2', 'enzyme>=0.4.1', 'beautifulsoup4>=4.2.0',
                        'requests>=2.0', 'click>=4.0', 'dogpile.cache>=0.5.4', 'stevedore>=1.0.0',
                        'chardet>=2.3.0', 'pysrt>=1.0.1', 'six>=1.9.0']

test_requirements = ['sympy', 'vcrpy>=1.6.1', 'pytest', 'pytest-pep8', 'pytest-flakes',
                     'pytest-cov']
if sys.version_info < (3, 3):
    test_requirements.append('mock')

dev_requirements = ['tox', 'sphinx', 'wheel']

# package informations
with io.open('subliminal/__init__.py', 'r') as f:
    version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]$', f.read(),
                        re.MULTILINE).group(1)

if not version:
    raise RuntimeError('Cannot find version information')

with io.open('README.rst', 'r', encoding='utf-8') as f:
    readme = f.read()

with io.open('HISTORY.rst', 'r', encoding='utf-8') as f:
    history = f.read()

setup(name='subliminal',
      version=version,
      license='MIT',
      description='Subtitles, faster than your thoughts',
      long_description=readme + '\n\n' + history,
      keywords='subtitle subtitles video movie episode tv show',
      url='https://github.com/Diaoul/subliminal',
      author='Antoine Bertin',
      author_email='diaoulael@gmail.com',
      packages=find_packages(),
      classifiers=[
          'Development Status :: 5 - Production/Stable',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: MIT License',
          'Operating System :: OS Independent',
          'Programming Language :: Python',
          'Programming Language :: Python :: 2',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: 3',
          'Programming Language :: Python :: 3.3',
          'Programming Language :: Python :: 3.4',
          'Topic :: Software Development :: Libraries :: Python Modules',
          'Topic :: Multimedia :: Video'
      ],
      entry_points={
          'subliminal.providers': [
              'addic7ed = subliminal.providers.addic7ed:Addic7edProvider',
              'opensubtitles = subliminal.providers.opensubtitles:OpenSubtitlesProvider',
              'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider',
              'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider',
              'tvsubtitles = subliminal.providers.tvsubtitles:TVsubtitlesProvider'
          ],
          'babelfish.language_converters': [
              'addic7ed = subliminal.converters.addic7ed:Addic7edConverter',
              'tvsubtitles = subliminal.converters.tvsubtitles:TVsubtitlesConverter'
          ],
          'console_scripts': [
              'subliminal = subliminal.cli:subliminal'
          ]
      },
      install_requires=install_requirements,
      tests_require=test_requirements,
      extras_require={
          'test': test_requirements,
          'dev': dev_requirements
      },
      cmdclass={'test': PyTest})


text:
class HawkesKernelPowerLawTest : public ::testing::Test {
 protected:
  double multiplier;
  double cutoff;
  double exponent;
  HawkesKernelPowerLaw hawkes_kernel_power_law;
  ArrayDouble timestamps;

  std::array<double, 6> test_times{{1., 2., 3.5, 5., 8., 100.}};

  HawkesKernelPowerLawTest() : hawkes_kernel_power_law(0, 0, 0){};

  void SetUp() override {
    multiplier = 0.1;
    cutoff = 0.01;
    exponent = 1.2;
    hawkes_kernel_power_law =
        HawkesKernelPowerLaw(multiplier, cutoff, exponent);

    timestamps = ArrayDouble{0.31, 0.93, 1.29, 2.32, 4.25};
  }
};

TEST_F(HawkesKernelPowerLawTest, is_zero) {
  EXPECT_FALSE(hawkes_kernel_power_law.is_zero());
}

TEST_F(HawkesKernelPowerLawTest, get_value) {
  EXPECT_DOUBLE_EQ(hawkes_kernel_power_law.get_value(-3), 0);

  for (double test_time : test_times) {
    EXPECT_DOUBLE_EQ(hawkes_kernel_power_law.get_value(test_time),
                     multiplier * pow(test_time + cutoff, -exponent));
  }
}

TEST_F(HawkesKernelPowerLawTest, get_norm) {
  EXPECT_DOUBLE_EQ(hawkes_kernel_power_law.get_norm(), 1.2096372793483503);
}

TEST_F(HawkesKernelPowerLawTest, invalid_constructor_parameters) {
  EXPECT_THROW(HawkesKernelPowerLaw(multiplier, cutoff, exponent, -1, -1),
               std::invalid_argument);
  EXPECT_THROW(HawkesKernelPowerLaw(multiplier, cutoff, exponent, -1, 0),
               std::invalid_argument);
  EXPECT_THROW(HawkesKernelPowerLaw(multiplier, cutoff, exponent, 0, -1),
               std::invalid_argument);
  EXPECT_THROW(HawkesKernelPowerLaw(multiplier, cutoff, exponent, 0, 0),
               std::invalid_argument);
}

#ifdef ADD_MAIN
int main(int argc, char** argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}
#endif  // ADD_MAIN


text: export const OAUTH_STORAGE_KEY = 'oauth'


text:
svn checkout http://svn.msweet.org/mxml/trunk/
cd trunk
./configure --prefix=`pwd`/../mxml-bin
make
make install


text:
package probes

import (
	"bufio"
	"bytes"
	"testing"

	. "gopkg.in/check.v1"

	"github.com/cilium/cilium/pkg/checker"
)

// Hook up gocheck into the "go test" runner.
func Test(t *testing.T) {
	TestingT(t)
}

type ProbesPrivTestSuite struct{}

var _ = Suite(&ProbesPrivTestSuite{})

func (s *ProbesPrivTestSuite) TestSystemConfigProbes(c *C) {
	pm := NewProbeManager()
	err := pm.SystemConfigProbes()
	c.Assert(err, IsNil)
}

func (s *ProbesPrivTestSuite) TestMapTypes(c *C) {
	pm := NewProbeManager()
	mapTypes := pm.GetMapTypes()
	c.Assert(mapTypes, NotNil)
}

func (s *ProbesPrivTestSuite) TestHelpers(c *C) {
	pm := NewProbeManager()
	_, ok := pm.GetHelpers("sched_act")["bpf_map_lookup_elem"]
	c.Assert(ok, Equals, true)
}

func (s *ProbesPrivTestSuite) TestWriteHeaders(c *C) {
	var buf bytes.Buffer

	expectedPatterns := []string{
		"#ifndef BPF_FEATURES_H_",
		"#define BPF_FEATURES_H_",
		"#define HAVE_BPF_SYSCALL",
		"#define HAVE.*PROG_TYPE",
		"#define HAVE.*MAP_TYPE",
		"#define HAVE_PROG_TYPE_HELPER\\(prog_type, helper\\)",
		"#define BPF__PROG_TYPE_.*__HELPER_.* [01]",
		"#endif /\\* BPF_FEATURES_H_ \\*/",
	}

	writer := bufio.NewWriter(&buf)
	pm := NewProbeManager()
	pm.writeHeaders(writer)
	content := buf.String()

	for _, pattern := range expectedPatterns {
		c.Assert(content, checker.PartialMatches, pattern)
	}
}


text:
package de.codecentric.batch.test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;

import de.codecentric.batch.TestApplication;

/**
 * This test class starts a batch job configured in XML and tests several endpoints.
 *
 * @author Tobias Flohre
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = TestApplication.class)
@WebAppConfiguration
@IntegrationTest({ "server.port=0", "batch.metrics.enabled=true", "batch.metrics.profiling.readprocesswrite.enabled=true" })
public class XmlIntegrationTest {

	RestTemplate restTemplate = new TestRestTemplate();

	@Autowired
	private JobExplorer jobExplorer;

	@Value("${local.server.port}")
	int port;

	@Test
	public void testRunJob() throws InterruptedException {
		Long executionId = restTemplate.postForObject("http://localhost:" + port + "/batch/operations/jobs/flatFile2JobXml", "", Long.class);
		while (!restTemplate.getForObject("http://localhost:" + port + "/batch/operations/jobs/executions/{executionId}", String.class, executionId)
				.equals("COMPLETED")) {
			Thread.sleep(1000);
		}
		String log = restTemplate.getForObject("http://localhost:" + port + "/batch/operations/jobs/executions/{executionId}/log", String.class,
				executionId);
		assertThat(log.length() > 20, is(true));
		JobExecution jobExecution = jobExplorer.getJobExecution(executionId);
		assertThat(jobExecution.getStatus(), is(BatchStatus.COMPLETED));
		String jobExecutionString = restTemplate.getForObject("http://localhost:" + port + "/batch/monitoring/jobs/executions/{executionId}",
				String.class, executionId);
		assertThat(jobExecutionString.contains("COMPLETED"), is(true));
	}

	@Test
	public void testGetJobNames() {
		@SuppressWarnings("unchecked")
		List<String> jobNames = restTemplate.getForObject("http://localhost:" + port + "/batch/monitoring/jobs", List.class);
		assertThat(jobNames.contains("flatFile2JobXml"), is(true));
	}

}


text:
var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var ClassC = (function (_super) {
    __extends(ClassC, _super);
    function ClassC() {
        _super.apply(this, arguments);
    }
    return ClassC;
})(test.ClassA);


text:
#pragma once
#include <aws/compute-optimizer/ComputeOptimizer_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace ComputeOptimizer
{
namespace Model
{
  enum class JobStatus
  {
    NOT_SET,
    Queued,
    InProgress,
    Complete,
    Failed
  };

namespace JobStatusMapper
{
AWS_COMPUTEOPTIMIZER_API JobStatus GetJobStatusForName(const Aws::String& name);

AWS_COMPUTEOPTIMIZER_API Aws::String GetNameForJobStatus(JobStatus value);
} // namespace JobStatusMapper
} // namespace Model
} // namespace ComputeOptimizer
} // namespace Aws


text:
<?php

namespace HRis\Api\Repositories;

class Repository implements RepositoryInterface
{
    /**
     * Eloquent model.
     *
     * @var \Illuminate\Database\Eloquent\Model
     */
    protected $model;

    /**
     * Repository constructor.
     *
     * @param \Illuminate\Database\Eloquent\Model $model
     *
     * @author Harlequin Doyon
     */
    public function __construct($model)
    {
        $this->model = $model;
    }

    /**
     * Get all records.
     *
     * @return \Illuminate\Database\Eloquent\Collection|static[]
     *
     * @author Harlequin Doyon
     */
    public function all()
    {
        return $this->model->all();
    }

    /**
     * Find a certain record.
     *
     * @param int $id
     *
     * @return \Illuminate\Database\Eloquent\Model
     *
     * @author Harlequin Doyon
     */
    public function find($id)
    {
        return $this->model->findOrFail($id);
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>
         R shiny app of my BV data

    </title>

    <meta name="robots" content="index,follow">
    <meta name="revisit-after" content="1 days">

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="cleartype" content="on">

     <link rel="stylesheet" href="http://localhost:4444/css/syntax.css" type='text/css'>
    <link rel="stylesheet" href="http://localhost:4444/css/main.css" type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
    <link rel="alternate" type="application/rss+xml" title="Bryan T. Mayer" href="http://localhost:4444/feed.xml">

Bryan T. Mayer

            Minimalistic, friendly, responsive.

            Home
            About
            Contact

            github
            twitter

R shiny app of my BV data

Last week, I took a workshop with the one and only Hadley Wickham learning about data visualization!
As part of the course we learned about shiny and so I turned one of the figures from my recent publication on
bacterial vaginosis into a
shiny app hosted on shinyapps.io.

My code is up on github: https://github.com/bryanmayer/BV_data_figure:

[top]

            Facebook

Twitter

Google+

    Copyright 2015 © Minimal-block.

        Powered by Jekyllrb.
        The minimal-block theme.


text:
import React, { PropTypes } from 'react';

import Grids from 'theme/Grid.scss';
import Styles from './Styles/main.scss';

import BreakPoints from 'helpers/breakpoints';

export default function Desktop(props) {
    const { mediaType, items } = props;

    const options = [
        ['people', 'history'],
        ['bible', 'family'],
        ['health', 'child']
    ];

    const rows = [];
    options.forEach((categoryGroup) => {
        const group = [];
        let title;
        categoryGroup.forEach((categoryItem) => {
            const category = {
                title: '',
                items: []
            };

            category.items = items.filter((item) => {
                return item.category.uid === categoryItem;
            }).map((item) => {
                title = item.category.title.ru;

                return {
                    title: item.title,
                    url: '#',
                    id: item.uid
                };
            });
            category.title = title;

            group.push(category);
        });
        rows.push(group);
    });

    const cols = rows.map((column) => {
        const arrayColumns = column.map((item) => {
            const listItems = item.items.map((el) => {
                return (

{ el.title }

                );
            });

            return (

{ item.title }

{ listItems }

            );
        });

        return arrayColumns;
    });

    const shows = (

Популярные программы

                Все программы

                { cols[0] }

                { cols[1] }

                { cols[2] }

    );

    const about = BreakPoints.tabletPortrait.name !== mediaType ? (

О телеканале

Телеканал предлагает большое разнообразие программ — для детей и молодежи, о
                семье, здоровье, творческие программы, а также программы духовной тематики — с помощью которых
                Вы сможете углубляться в познание библейских истин, быть участником интересных жизненных историй,
                отправляться с детскими героями в увлекательные путешествия, погружаться в мир музыки, узнавать о
                событиях в мире и Украине в позитивной перспективе.

            Подробнее...

        ) : null
    ;

    return (

                { shows }
                { about }

    );
}

Desktop.propTypes = {
    mediaType: PropTypes.string.isRequired,
    items: PropTypes.array
};
Desktop.defaultProps = {
    items: []
};


text:
- [Aggregations on Dataset[Double]](Aggregations%20on%20Dataset%5BDouble%5D.ipynb)
- [Median for RDDs, Datasets, and Dataframes](Median%20for%20RDDs%2C%20Datasets%2C%20and%20Dataframes.ipynb)
- [Distributed Cumulative Sum](Distributed-cumulative-sum.ipynb)
- ...


text:
<?php

namespace Cake\Network\Session;

use Cake\Cache\Cache;
use InvalidArgumentException;
use SessionHandlerInterface;

/**
 * CacheSession provides method for saving sessions into a Cache engine. Used with Session
 *
 * @see \Cake\Model\Datasource\Session for configuration information.
 */
class CacheSession implements SessionHandlerInterface
{

    /**
     * Options for this session engine
     *
     * @var array
     */
    protected $_options = [];

    /**
     * Constructor.
     *
     * @param array $config The configuration to use for this engine
     * It requires the key 'config' which is the name of the Cache config to use for
     * storing the session
     *
     * @throws \InvalidArgumentException if the 'config' key is not provided
     */
    public function __construct(array $config = [])
    {
        if (empty($config['config'])) {
            throw new InvalidArgumentException('The cache configuration name to use is required');
        }
        $this->_options = $config;
    }

    /**
     * Method called on open of a database session.
     *
     * @param string $savePath The path where to store/retrieve the session.
     * @param string $name The session name.
     * @return bool Success
     */
    public function open($savePath, $name)
    {
        return true;
    }

    /**
     * Method called on close of a database session.
     *
     * @return bool Success
     */
    public function close()
    {
        return true;
    }

    /**
     * Method used to read from a cache session.
     *
     * @param string $id The key of the value to read
     * @return string The value of the key or empty if it does not exist
     */
    public function read($id)
    {
        $value = Cache::read($id, $this->_options['config']);

        if (empty($value)) {
            return '';
        }

        return $value;
    }

    /**
     * Helper function called on write for cache sessions.
     *
     * @param int $id ID that uniquely identifies session in database
     * @param mixed $data The value of the data to be saved.
     * @return bool True for successful write, false otherwise.
     */
    public function write($id, $data)
    {
        return Cache::write($id, $data, $this->_options['config']);
    }

    /**
     * Method called on the destruction of a cache session.
     *
     * @param int $id ID that uniquely identifies session in cache
     * @return bool True for successful delete, false otherwise.
     */
    public function destroy($id)
    {
        return Cache::delete($id, $this->_options['config']);
    }

    /**
     * Helper function called on gc for cache sessions.
     *
     * @param string $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
     * @return bool True (irrespective of whether or not the garbage is being successfully collected)
     */
    public function gc($maxlifetime)
    {
        Cache::gc($this->_options['config'], time() - $maxlifetime);
        return true;
    }
}