text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/ml/v1beta1/model_service.proto

package com.google.cloud.ml.api.v1beta1;

/**
 *

 * Represents a machine learning solution.
 * A model can have multiple versions, each of which is a deployed, trained
 * model ready to receive prediction requests. The model itself is just a
 * container.
 *

 *
 * Protobuf type {@code google.cloud.ml.v1beta1.Model}
 */
public  final class Model extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.cloud.ml.v1beta1.Model)
    ModelOrBuilder {
  // Use Model.newBuilder() to construct.
  private Model(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private Model() {
    name_ = "";
    description_ = "";
  }

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

            name_ = s;
            break;
          }
          case 18: {
            java.lang.String s = input.readStringRequireUtf8();

            description_ = s;
            break;
          }
          case 26: {
            com.google.cloud.ml.api.v1beta1.Version.Builder subBuilder = null;
            if (defaultVersion_ != null) {
              subBuilder = defaultVersion_.toBuilder();
            }
            defaultVersion_ = input.readMessage(com.google.cloud.ml.api.v1beta1.Version.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(defaultVersion_);
              defaultVersion_ = subBuilder.buildPartial();
            }

            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.cloud.ml.api.v1beta1.ModelServiceProto.internal_static_google_cloud_ml_v1beta1_Model_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.ml.api.v1beta1.ModelServiceProto.internal_static_google_cloud_ml_v1beta1_Model_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.ml.api.v1beta1.Model.class, com.google.cloud.ml.api.v1beta1.Model.Builder.class);
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   *

   * Required. The name specified for the model when it was created.
   * The model name must be unique within the project it is created in.
   *

   *
   * optional string name = 1;
   */
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs =
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      name_ = s;
      return s;
    }
  }
  /**
   *

   * Required. The name specified for the model when it was created.
   * The model name must be unique within the project it is created in.
   *

   *
   * optional string name = 1;
   */
  public com.google.protobuf.ByteString
      getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DESCRIPTION_FIELD_NUMBER = 2;
  private volatile java.lang.Object description_;
  /**
   *

   * Optional. The description specified for the model when it was created.
   *

   *
   * optional string description = 2;
   */
  public java.lang.String getDescription() {
    java.lang.Object ref = description_;
    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();
      description_ = s;
      return s;
    }
  }
  /**
   *

   * Optional. The description specified for the model when it was created.
   *

   *
   * optional string description = 2;
   */
  public com.google.protobuf.ByteString
      getDescriptionBytes() {
    java.lang.Object ref = description_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      description_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DEFAULT_VERSION_FIELD_NUMBER = 3;
  private com.google.cloud.ml.api.v1beta1.Version defaultVersion_;
  /**
   *

   * Output only. The default version of the model. This version will be used to
   * handle prediction requests that do not specify a version.
   * You can change the default version by calling
   * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
   *

   *
   * optional .google.cloud.ml.v1beta1.Version default_version = 3;
   */
  public boolean hasDefaultVersion() {
    return defaultVersion_ != null;
  }
  /**
   *

   * Output only. The default version of the model. This version will be used to
   * handle prediction requests that do not specify a version.
   * You can change the default version by calling
   * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
   *

   *
   * optional .google.cloud.ml.v1beta1.Version default_version = 3;
   */
  public com.google.cloud.ml.api.v1beta1.Version getDefaultVersion() {
    return defaultVersion_ == null ? com.google.cloud.ml.api.v1beta1.Version.getDefaultInstance() : defaultVersion_;
  }
  /**
   *

   * Output only. The default version of the model. This version will be used to
   * handle prediction requests that do not specify a version.
   * You can change the default version by calling
   * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
   *

   *
   * optional .google.cloud.ml.v1beta1.Version default_version = 3;
   */
  public com.google.cloud.ml.api.v1beta1.VersionOrBuilder getDefaultVersionOrBuilder() {
    return getDefaultVersion();
  }

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

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (!getDescriptionBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, description_);
    }
    if (defaultVersion_ != null) {
      output.writeMessage(3, getDefaultVersion());
    }
  }

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

    size = 0;
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (!getDescriptionBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, description_);
    }
    if (defaultVersion_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(3, getDefaultVersion());
    }
    memoizedSize = size;
    return size;
  }

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

    boolean result = true;
    result = result && getName()
        .equals(other.getName());
    result = result && getDescription()
        .equals(other.getDescription());
    result = result && (hasDefaultVersion() == other.hasDefaultVersion());
    if (hasDefaultVersion()) {
      result = result && getDefaultVersion()
          .equals(other.getDefaultVersion());
    }
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptorForType().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER;
    hash = (53 * hash) + getDescription().hashCode();
    if (hasDefaultVersion()) {
      hash = (37 * hash) + DEFAULT_VERSION_FIELD_NUMBER;
      hash = (53 * hash) + getDefaultVersion().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.cloud.ml.api.v1beta1.Model prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

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

   * Represents a machine learning solution.
   * A model can have multiple versions, each of which is a deployed, trained
   * model ready to receive prediction requests. The model itself is just a
   * container.
   *

   *
   * Protobuf type {@code google.cloud.ml.v1beta1.Model}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.cloud.ml.v1beta1.Model)
      com.google.cloud.ml.api.v1beta1.ModelOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.cloud.ml.api.v1beta1.ModelServiceProto.internal_static_google_cloud_ml_v1beta1_Model_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.ml.api.v1beta1.ModelServiceProto.internal_static_google_cloud_ml_v1beta1_Model_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.ml.api.v1beta1.Model.class, com.google.cloud.ml.api.v1beta1.Model.Builder.class);
    }

    // Construct using com.google.cloud.ml.api.v1beta1.Model.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

      description_ = "";

      if (defaultVersionBuilder_ == null) {
        defaultVersion_ = null;
      } else {
        defaultVersion_ = null;
        defaultVersionBuilder_ = null;
      }
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.cloud.ml.api.v1beta1.ModelServiceProto.internal_static_google_cloud_ml_v1beta1_Model_descriptor;
    }

    public com.google.cloud.ml.api.v1beta1.Model getDefaultInstanceForType() {
      return com.google.cloud.ml.api.v1beta1.Model.getDefaultInstance();
    }

    public com.google.cloud.ml.api.v1beta1.Model build() {
      com.google.cloud.ml.api.v1beta1.Model result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.cloud.ml.api.v1beta1.Model buildPartial() {
      com.google.cloud.ml.api.v1beta1.Model result = new com.google.cloud.ml.api.v1beta1.Model(this);
      result.name_ = name_;
      result.description_ = description_;
      if (defaultVersionBuilder_ == null) {
        result.defaultVersion_ = defaultVersion_;
      } else {
        result.defaultVersion_ = defaultVersionBuilder_.build();
      }
      onBuilt();
      return result;
    }

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

    public Builder mergeFrom(com.google.cloud.ml.api.v1beta1.Model other) {
      if (other == com.google.cloud.ml.api.v1beta1.Model.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getDescription().isEmpty()) {
        description_ = other.description_;
        onChanged();
      }
      if (other.hasDefaultVersion()) {
        mergeDefaultVersion(other.getDefaultVersion());
      }
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.cloud.ml.api.v1beta1.Model parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.ml.api.v1beta1.Model) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

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

     * Required. The name specified for the model when it was created.
     * The model name must be unique within the project it is created in.
     *

     *
     * optional string name = 1;
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *

     * Required. The name specified for the model when it was created.
     * The model name must be unique within the project it is created in.
     *

     *
     * optional string name = 1;
     */
    public com.google.protobuf.ByteString
        getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *

     * Required. The name specified for the model when it was created.
     * The model name must be unique within the project it is created in.
     *

     *
     * optional string name = 1;
     */
    public Builder setName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }

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

     * Required. The name specified for the model when it was created.
     * The model name must be unique within the project it is created in.
     *

     *
     * optional string name = 1;
     */
    public Builder clearName() {

      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     *

     * Required. The name specified for the model when it was created.
     * The model name must be unique within the project it is created in.
     *

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

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

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

     * Optional. The description specified for the model when it was created.
     *

     *
     * optional string description = 2;
     */
    public java.lang.String getDescription() {
      java.lang.Object ref = description_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        description_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *

     * Optional. The description specified for the model when it was created.
     *

     *
     * optional string description = 2;
     */
    public com.google.protobuf.ByteString
        getDescriptionBytes() {
      java.lang.Object ref = description_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        description_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *

     * Optional. The description specified for the model when it was created.
     *

     *
     * optional string description = 2;
     */
    public Builder setDescription(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }

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

     * Optional. The description specified for the model when it was created.
     *

     *
     * optional string description = 2;
     */
    public Builder clearDescription() {

      description_ = getDefaultInstance().getDescription();
      onChanged();
      return this;
    }
    /**
     *

     * Optional. The description specified for the model when it was created.
     *

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

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

    private com.google.cloud.ml.api.v1beta1.Version defaultVersion_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.ml.api.v1beta1.Version, com.google.cloud.ml.api.v1beta1.Version.Builder, com.google.cloud.ml.api.v1beta1.VersionOrBuilder> defaultVersionBuilder_;
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public boolean hasDefaultVersion() {
      return defaultVersionBuilder_ != null || defaultVersion_ != null;
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public com.google.cloud.ml.api.v1beta1.Version getDefaultVersion() {
      if (defaultVersionBuilder_ == null) {
        return defaultVersion_ == null ? com.google.cloud.ml.api.v1beta1.Version.getDefaultInstance() : defaultVersion_;
      } else {
        return defaultVersionBuilder_.getMessage();
      }
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public Builder setDefaultVersion(com.google.cloud.ml.api.v1beta1.Version value) {
      if (defaultVersionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        defaultVersion_ = value;
        onChanged();
      } else {
        defaultVersionBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public Builder setDefaultVersion(
        com.google.cloud.ml.api.v1beta1.Version.Builder builderForValue) {
      if (defaultVersionBuilder_ == null) {
        defaultVersion_ = builderForValue.build();
        onChanged();
      } else {
        defaultVersionBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public Builder mergeDefaultVersion(com.google.cloud.ml.api.v1beta1.Version value) {
      if (defaultVersionBuilder_ == null) {
        if (defaultVersion_ != null) {
          defaultVersion_ =
            com.google.cloud.ml.api.v1beta1.Version.newBuilder(defaultVersion_).mergeFrom(value).buildPartial();
        } else {
          defaultVersion_ = value;
        }
        onChanged();
      } else {
        defaultVersionBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public Builder clearDefaultVersion() {
      if (defaultVersionBuilder_ == null) {
        defaultVersion_ = null;
        onChanged();
      } else {
        defaultVersion_ = null;
        defaultVersionBuilder_ = null;
      }

      return this;
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public com.google.cloud.ml.api.v1beta1.Version.Builder getDefaultVersionBuilder() {

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

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    public com.google.cloud.ml.api.v1beta1.VersionOrBuilder getDefaultVersionOrBuilder() {
      if (defaultVersionBuilder_ != null) {
        return defaultVersionBuilder_.getMessageOrBuilder();
      } else {
        return defaultVersion_ == null ?
            com.google.cloud.ml.api.v1beta1.Version.getDefaultInstance() : defaultVersion_;
      }
    }
    /**
     *

     * Output only. The default version of the model. This version will be used to
     * handle prediction requests that do not specify a version.
     * You can change the default version by calling
     * [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault).
     *

     *
     * optional .google.cloud.ml.v1beta1.Version default_version = 3;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.ml.api.v1beta1.Version, com.google.cloud.ml.api.v1beta1.Version.Builder, com.google.cloud.ml.api.v1beta1.VersionOrBuilder>
        getDefaultVersionFieldBuilder() {
      if (defaultVersionBuilder_ == null) {
        defaultVersionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.ml.api.v1beta1.Version, com.google.cloud.ml.api.v1beta1.Version.Builder, com.google.cloud.ml.api.v1beta1.VersionOrBuilder>(
                getDefaultVersion(),
                getParentForChildren(),
                isClean());
        defaultVersion_ = null;
      }
      return defaultVersionBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return this;
    }

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

    // @@protoc_insertion_point(builder_scope:google.cloud.ml.v1beta1.Model)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.ml.v1beta1.Model)
  private static final com.google.cloud.ml.api.v1beta1.Model DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.cloud.ml.api.v1beta1.Model();
  }

  public static com.google.cloud.ml.api.v1beta1.Model getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  public com.google.cloud.ml.api.v1beta1.Model getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}


text:
using Scientia.HtmlRenderer.Adapters;
using Scientia.HtmlRenderer.Adapters.Entities;
using Scientia.HtmlRenderer.Core.Handlers;

namespace Scientia.HtmlRenderer.Core.Dom
{
    /// <summary>
    /// Represents a word inside an inline box
    /// </summary>
    /// <remarks>
    /// Because of performance, words of text are the most atomic
    /// element in the project. It should be characters, but come on,
    /// imagine the performance when drawing char by char on the device.<br/>
    /// It may change for future versions of the library.
    /// </remarks>
    internal abstract class CssRect
    {
        #region Fields and Consts

        /// <summary>
        /// the CSS box owner of the word
        /// </summary>
        private readonly CssBox _OwnerBox;

        /// <summary>
        /// Rectangle
        /// </summary>
        private RRect Rect;

        /// <summary>
        /// If the word is selected this points to the selection handler for more data
        /// </summary>
        private SelectionHandler _Selection;

        #endregion

        /// <summary>
        /// Init.
        /// </summary>
        /// <param name="owner">the CSS box owner of the word</param>
        protected CssRect(CssBox owner)
        {
            this._OwnerBox = owner;
        }

        /// <summary>
        /// Gets the Box where this word belongs.
        /// </summary>
        public CssBox OwnerBox
        {
            get { return this._OwnerBox; }
        }

        /// <summary>
        /// Gets or sets the bounds of the rectangle
        /// </summary>
        public RRect Rectangle
        {
            get { return this.Rect; }
            set { this.Rect = value; }
        }

        /// <summary>
        /// Left of the rectangle
        /// </summary>
        public double Left
        {
            get { return this.Rect.X; }
            set { this.Rect.X = value; }
        }

        /// <summary>
        /// Top of the rectangle
        /// </summary>
        public double Top
        {
            get { return this.Rect.Y; }
            set { this.Rect.Y = value; }
        }

        /// <summary>
        /// Width of the rectangle
        /// </summary>
        public double Width
        {
            get { return this.Rect.Width; }
            set { this.Rect.Width = value; }
        }

        /// <summary>
        /// Get the full width of the word including the spacing.
        /// </summary>
        public double FullWidth
        {
            get { return this.Rect.Width + this.ActualWordSpacing; }
        }

        /// <summary>
        /// Gets the actual width of whitespace between words.
        /// </summary>
        public double ActualWordSpacing
        {
            get { return this.OwnerBox != null ? (this.HasSpaceAfter ? this.OwnerBox.ActualWordSpacing : 0) + (this.IsImage ? this.OwnerBox.ActualWordSpacing : 0) : 0; }
        }

        /// <summary>
        /// Height of the rectangle
        /// </summary>
        public double Height
        {
            get { return this.Rect.Height; }
            set { this.Rect.Height = value; }
        }

        /// <summary>
        /// Gets or sets the right of the rectangle. When setting, it only affects the Width of the rectangle.
        /// </summary>
        public double Right
        {
            get { return this.Rectangle.Right; }
            set { this.Width = value - this.Left; }
        }

        /// <summary>
        /// Gets or sets the bottom of the rectangle. When setting, it only affects the Height of the rectangle.
        /// </summary>
        public double Bottom
        {
            get { return this.Rectangle.Bottom; }
            set { this.Height = value - this.Top; }
        }

        /// <summary>
        /// If the word is selected this points to the selection handler for more data
        /// </summary>
        public SelectionHandler Selection
        {
            get { return this._Selection; }
            set { this._Selection = value; }
        }

        /// <summary>
        /// was there a whitespace before the word chars (before trim)
        /// </summary>
        public virtual bool HasSpaceBefore
        {
            get { return false; }
        }

        /// <summary>
        /// was there a whitespace after the word chars (before trim)
        /// </summary>
        public virtual bool HasSpaceAfter
        {
            get { return false; }
        }

        /// <summary>
        /// Gets the image this words represents (if one exists)
        /// </summary>
        public virtual RImage Image
        {
            get { return null; }

            // ReSharper disable ValueParameterNotUsed
            set { }

            // ReSharper restore ValueParameterNotUsed
        }

        /// <summary>
        /// Gets if the word represents an image.
        /// </summary>
        public virtual bool IsImage
        {
            get { return false; }
        }

        /// <summary>
        /// Gets a bool indicating if this word is composed only by spaces.
        /// Spaces include tabs and line breaks
        /// </summary>
        public virtual bool IsSpaces
        {
            get { return true; }
        }

        /// <summary>
        /// Gets if the word is composed by only a line break
        /// </summary>
        public virtual bool IsLineBreak
        {
            get { return false; }
        }

        /// <summary>
        /// Gets the text of the word
        /// </summary>
        public virtual string Text
        {
            get { return null; }
        }

        /// <summary>
        /// is the word is currently selected
        /// </summary>
        public bool Selected
        {
            get { return this._Selection != null; }
        }

        /// <summary>
        /// the selection start index if the word is partially selected (-1 if not selected or fully selected)
        /// </summary>
        public int SelectedStartIndex
        {
            get { return this._Selection != null ? this._Selection.GetSelectingStartIndex(this) : -1; }
        }

        /// <summary>
        /// the selection end index if the word is partially selected (-1 if not selected or fully selected)
        /// </summary>
        public int SelectedEndIndexOffset
        {
            get { return this._Selection != null ? this._Selection.GetSelectedEndIndexOffset(this) : -1; }
        }

        /// <summary>
        /// the selection start offset if the word is partially selected (-1 if not selected or fully selected)
        /// </summary>
        public double SelectedStartOffset
        {
            get { return this._Selection != null ? this._Selection.GetSelectedStartOffset(this) : -1; }
        }

        /// <summary>
        /// the selection end offset if the word is partially selected (-1 if not selected or fully selected)
        /// </summary>
        public double SelectedEndOffset
        {
            get { return this._Selection != null ? this._Selection.GetSelectedEndOffset(this) : -1; }
        }

        /// <summary>
        /// Gets or sets an offset to be considered in measurements
        /// </summary>
        internal double LeftGlyphPadding
        {
            get { return this.OwnerBox != null ? this.OwnerBox.ActualFont.LeftPadding : 0; }
        }

        /// <summary>
        /// Represents this word for debugging purposes
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format("{0} ({1} char{2})", this.Text.Replace(' ', '-').Replace("\n", "\\n"), this.Text.Length, this.Text.Length != 1 ? "s" : string.Empty);
        }

        public bool BreakPage()
        {
            var container = this.OwnerBox.HtmlContainer;

            if (this.Height >= container.PageSize.Height)
                return false;

            var remTop = (this.Top - container.MarginTop) % container.PageSize.Height;
            var remBottom = (this.Bottom - container.MarginTop) % container.PageSize.Height;

            if (remTop > remBottom)
            {
                this.Top += container.PageSize.Height - remTop + 1;
                return true;
            }

            return false;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/***************************************************************************/
/*                                                                         */
/* matrix.h - Matrix class for mruby                                       */
/* Copyright (C) 2015 Paolo Bosetti                                        */
/* paolo[dot]bosetti[at]unitn.it                                           */
/* Department of Industrial Engineering, University of Trento              */
/*                                                                         */
/* This library is free software.  You can redistribute it and/or          */
/* modify it under the terms of the GNU GENERAL PUBLIC LICENSE 2.0.        */
/*                                                                         */
/* This library is distributed in the hope that it will be useful,         */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of          */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           */
/* Artistic License 2.0 for more details.                                  */
/*                                                                         */
/* See the file LICENSE                                                    */
/*                                                                         */
/***************************************************************************/

#ifndef MATRIX_H
#define MATRIX_H

#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <time.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>

#include "mruby.h"
#include "mruby/variable.h"
#include "mruby/string.h"
#include "mruby/data.h"
#include "mruby/class.h"
#include "mruby/value.h"
#include "mruby/array.h"
#include "mruby/numeric.h"
#include "mruby/compile.h"

#define E_MATRIX_ERROR (mrb_class_get(mrb, "MatrixError"))

/***********************************************\
 MATRICES
\***********************************************/

// Garbage collector handler, for play_data struct
// if play_data contains other dynamic data, free it too!
// Check it with GC.start
void matrix_destructor(mrb_state *mrb, void *p_);

// Utility function for getting the struct out of the wrapping IV @data
void mrb_matrix_get_data(mrb_state *mrb, mrb_value self, gsl_matrix **data);

void mrb_gsl_matrix_init(mrb_state *mrb);

#endif // MATRIX_H


text: create a Email Scene Judge branch from private svn repo


text:
![2.8 stars](../../images/ic_star_black_18dp_1x.png)![2.8 stars](../../images/ic_star_black_18dp_1x.png)![2.8 stars](../../images/ic_star_half_black_18dp_1x.png)![2.8 stars](../../images/ic_star_border_black_18dp_1x.png)![2.8 stars](../../images/ic_star_border_black_18dp_1x.png) 18

With the Honeywell skill and Alexa, you can now interact with your Honeywell Lyric thermostat(s) with your voice.
This skill is compatible with Lyric Round™ Wi-Fi, Lyric T5, and Lyric T6 Pro Thermostats.

To get started, select the 'Enable Skill' button in the Alexa App to link your Honeywell Lyric account and discover your thermostat(s). Find more information about connecting Smart Home devices at http://amzn.to/291lR7u

When using the skill, you need to specify by name which thermostat/sensor to use. There are two ways to define this/these names:
- Use the name(s) you set up already – these are shown and can be changed in the Lyric app, or
- Create an Alexa group, like Bedroom or Downstairs, and add the thermostat and/or one or more sensors to the group. More information at http://amzn.to/2965dCE

Once you know the name or group of your thermostat, you can say the following: "Alexa, lower Bedroom by 3 degrees", or "Alexa, set Downstairs temperature to 72".
The full list of commands includes:
- "Alexa, set [group or thermostat name] to X degrees"
- "Alexa, raise [group or thermostat name] by X degrees"
- "Alexa, lower [group or thermostat name] by X degrees"

***

### Skill Details

* **Invocation Name:** null
* **Category:** null
* **ID:** amzn1.ask.skill.c4c85c7d-f4f9-480b-b66c-03f7f8c1960e
* **ASIN:** B01JP8EOCW
* **Author:** Honeywell
* **Release Date:** August 8, 2016 @ 12:07:10
* **Privacy Policy:** http://yourhome.honeywell.com/privacy-statement
* **Terms of Use:** http://yourhome.honeywell.com/terms-and-conditions
* **In-App Purchasing:** No


text:
namespace device {
namespace {
constexpr double kMaxDurationMillis = 5000.0;  // 5 seconds

bool IsValidEffectType(mojom::GamepadHapticEffectType type) {
  return type == mojom::GamepadHapticEffectType::
                     GamepadHapticEffectTypeDualRumble ||
         type == mojom::GamepadHapticEffectType::
                     GamepadHapticEffectTypeTriggerRumble;
}

}  // namespace

AbstractHapticGamepad::AbstractHapticGamepad() = default;

AbstractHapticGamepad::~AbstractHapticGamepad() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  // Shutdown() must be called to allow the device a chance to stop vibration
  // and release held resources.
  DCHECK(is_shut_down_);
}

void AbstractHapticGamepad::Shutdown() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  DCHECK(!is_shutting_down_);
  is_shutting_down_ = true;

  // If an effect is still playing, try to stop vibration. This may fail if the
  // gamepad is already disconnected.
  if (playing_effect_callback_) {
    sequence_id_++;
    SetZeroVibration();
    GamepadDataFetcher::RunVibrationCallback(
        std::move(playing_effect_callback_), std::move(callback_runner_),
        mojom::GamepadHapticsResult::GamepadHapticsResultPreempted);
  }
  DoShutdown();

  // No vibration effects may be played once shutdown is complete.
  is_shut_down_ = true;
}

void AbstractHapticGamepad::SetZeroVibration() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  SetVibration(mojom::GamepadEffectParameters::New());
}

double AbstractHapticGamepad::GetMaxEffectDurationMillis() {
  return kMaxDurationMillis;
}

void AbstractHapticGamepad::PlayEffect(
    mojom::GamepadHapticEffectType type,
    mojom::GamepadEffectParametersPtr params,
    mojom::GamepadHapticsManager::PlayVibrationEffectOnceCallback callback,
    scoped_refptr<base::SequencedTaskRunner> callback_runner) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  DCHECK(!is_shut_down_);
  if (!IsValidEffectType(type)) {
    // Only dual-rumble and trigger-rumble effects are supported.
    GamepadDataFetcher::RunVibrationCallback(
        std::move(callback), std::move(callback_runner),
        mojom::GamepadHapticsResult::GamepadHapticsResultNotSupported);
    return;
  }

  int sequence_id = ++sequence_id_;

  if (playing_effect_callback_) {
    // An effect is already playing on this device and will be preempted in
    // order to start the new effect. Finish the playing effect by calling its
    // callback with a "preempted" result code. Use the |callback_runner_| that
    // was provided with the playing effect as it may post tasks to a different
    // sequence than the |callback_runner| for the current effect.
    GamepadDataFetcher::RunVibrationCallback(
        std::move(playing_effect_callback_), std::move(callback_runner_),
        mojom::GamepadHapticsResult::GamepadHapticsResultPreempted);
  }
  if (params->start_delay > 0.0)
    SetZeroVibration();

  playing_effect_callback_ = std::move(callback);
  callback_runner_ = std::move(callback_runner);

  PlayVibrationEffect(sequence_id, std::move(params));
}

void AbstractHapticGamepad::ResetVibration(
    mojom::GamepadHapticsManager::ResetVibrationActuatorCallback callback,
    scoped_refptr<base::SequencedTaskRunner> callback_runner) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  DCHECK(!is_shut_down_);
  sequence_id_++;

  SetZeroVibration();
  if (playing_effect_callback_) {
    // An effect is already playing on this device and will be preempted in
    // order to reset vibration. Finish the playing effect by calling its
    // callback with a "preempted" result code. Use the |callback_runner_| that
    // was provided with the playing effect as it may post tasks to a different
    // sequence than the |callback_runner| for the reset.
    GamepadDataFetcher::RunVibrationCallback(
        std::move(playing_effect_callback_), std::move(callback_runner_),
        mojom::GamepadHapticsResult::GamepadHapticsResultPreempted);
  }

  GamepadDataFetcher::RunVibrationCallback(
      std::move(callback), std::move(callback_runner),
      mojom::GamepadHapticsResult::GamepadHapticsResultComplete);
}

void AbstractHapticGamepad::PlayVibrationEffect(
    int sequence_id,
    mojom::GamepadEffectParametersPtr params) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  double duration = params->duration;
  double start_delay = params->start_delay;
  base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
      FROM_HERE,
      base::BindOnce(&AbstractHapticGamepad::StartVibration, GetWeakPtr(),
                     sequence_id, duration, std::move(params)),
      base::Milliseconds(start_delay));
}

void AbstractHapticGamepad::StartVibration(
    int sequence_id,
    double duration,
    mojom::GamepadEffectParametersPtr params) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  if (is_shut_down_ || sequence_id != sequence_id_)
    return;
  SetVibration(params.Clone());

  const double max_duration = GetMaxEffectDurationMillis();
  if (duration > max_duration) {
    // The device does not support effects this long. Issue periodic vibration
    // commands until the effect is complete.
    double remaining_duration = duration - max_duration;
    base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
        FROM_HERE,
        base::BindOnce(&AbstractHapticGamepad::StartVibration, GetWeakPtr(),
                       sequence_id, remaining_duration, params.Clone()),
        base::Milliseconds(max_duration));
  } else {
    base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
        FROM_HERE,
        base::BindOnce(&AbstractHapticGamepad::FinishEffect, GetWeakPtr(),
                       sequence_id),
        base::Milliseconds(duration));
  }
}

void AbstractHapticGamepad::FinishEffect(int sequence_id) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  if (is_shut_down_ || sequence_id != sequence_id_)
    return;

  GamepadDataFetcher::RunVibrationCallback(
      std::move(playing_effect_callback_), std::move(callback_runner_),
      mojom::GamepadHapticsResult::GamepadHapticsResultComplete);
}

}  // namespace device


text:
<!doctype html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>jQuery Mobile Support Test Suite</title>

	<link rel="stylesheet"  href="../../../css/themes/default/jquery.mobile.css"/>
	<link rel="stylesheet" href="../../../external/qunit/qunit.css"/>


text:
"""
The `cretonne.entities` module predefines all the Cretonne entity reference
operand types. There are corresponding definitions in the `cretonne.entities`
Rust module.
"""
from __future__ import absolute_import
from cdsl.operands import EntityRefKind

#: A reference to an extended basic block in the same function.
#: This is primarliy used in control flow instructions.
ebb = EntityRefKind(
        'ebb', 'An extended basic block in the same function.',
        default_member='destination')

#: A reference to a stack slot declared in the function preamble.
stack_slot = EntityRefKind('stack_slot', 'A stack slot.')

#: A reference to a global variable.
global_var = EntityRefKind('global_var', 'A global variable.')

#: A reference to a function sugnature declared in the function preamble.
#: Tbis is used to provide the call signature in an indirect call instruction.
sig_ref = EntityRefKind('sig_ref', 'A function signature.')

#: A reference to an external function declared in the function preamble.
#: This is used to provide the callee and signature in a call instruction.
func_ref = EntityRefKind('func_ref', 'An external function.')

#: A reference to a jump table declared in the function preamble.
jump_table = EntityRefKind(
        'jump_table', 'A jump table.', default_member='table')

#: A reference to a heap declared in the function preamble.
heap = EntityRefKind('heap', 'A heap.')


text:
package dockerfile // import "github.com/docker/docker/builder/dockerfile"

import (
	"bytes"
	"context"
	"fmt"
	"io"
	"sort"
	"strings"

	"github.com/containerd/containerd/platforms"
	"github.com/docker/docker/api/types"
	"github.com/docker/docker/api/types/backend"
	"github.com/docker/docker/api/types/container"
	"github.com/docker/docker/builder"
	"github.com/docker/docker/builder/remotecontext"
	"github.com/docker/docker/errdefs"
	"github.com/docker/docker/pkg/idtools"
	"github.com/docker/docker/pkg/streamformatter"
	"github.com/docker/docker/pkg/stringid"
	"github.com/moby/buildkit/frontend/dockerfile/instructions"
	"github.com/moby/buildkit/frontend/dockerfile/parser"
	"github.com/moby/buildkit/frontend/dockerfile/shell"
	specs "github.com/opencontainers/image-spec/specs-go/v1"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
	"golang.org/x/sync/syncmap"
)

var validCommitCommands = map[string]bool{
	"cmd":         true,
	"entrypoint":  true,
	"healthcheck": true,
	"env":         true,
	"expose":      true,
	"label":       true,
	"onbuild":     true,
	"stopsignal":  true,
	"user":        true,
	"volume":      true,
	"workdir":     true,
}

const (
	stepFormat = "Step %d/%d : %v"
)

// BuildManager is shared across all Builder objects
type BuildManager struct {
	idMapping idtools.IdentityMapping
	backend   builder.Backend
	pathCache pathCache // TODO: make this persistent
}

// NewBuildManager creates a BuildManager
func NewBuildManager(b builder.Backend, identityMapping idtools.IdentityMapping) (*BuildManager, error) {
	bm := &BuildManager{
		backend:   b,
		pathCache: &syncmap.Map{},
		idMapping: identityMapping,
	}
	return bm, nil
}

// Build starts a new build from a BuildConfig
func (bm *BuildManager) Build(ctx context.Context, config backend.BuildConfig) (*builder.Result, error) {
	buildsTriggered.Inc()
	if config.Options.Dockerfile == "" {
		config.Options.Dockerfile = builder.DefaultDockerfileName
	}

	source, dockerfile, err := remotecontext.Detect(config)
	if err != nil {
		return nil, err
	}
	defer func() {
		if source != nil {
			if err := source.Close(); err != nil {
				logrus.Debugf("[BUILDER] failed to remove temporary context: %v", err)
			}
		}
	}()

	ctx, cancel := context.WithCancel(ctx)
	defer cancel()

	builderOptions := builderOptions{
		Options:        config.Options,
		ProgressWriter: config.ProgressWriter,
		Backend:        bm.backend,
		PathCache:      bm.pathCache,
		IDMapping:      bm.idMapping,
	}
	b, err := newBuilder(ctx, builderOptions)
	if err != nil {
		return nil, err
	}
	return b.build(source, dockerfile)
}

// builderOptions are the dependencies required by the builder
type builderOptions struct {
	Options        *types.ImageBuildOptions
	Backend        builder.Backend
	ProgressWriter backend.ProgressWriter
	PathCache      pathCache
	IDMapping      idtools.IdentityMapping
}

// Builder is a Dockerfile builder
// It implements the builder.Backend interface.
type Builder struct {
	options *types.ImageBuildOptions

	Stdout io.Writer
	Stderr io.Writer
	Aux    *streamformatter.AuxFormatter
	Output io.Writer

	docker    builder.Backend
	clientCtx context.Context

	idMapping        idtools.IdentityMapping
	disableCommit    bool
	imageSources     *imageSources
	pathCache        pathCache
	containerManager *containerManager
	imageProber      ImageProber
	platform         *specs.Platform
}

// newBuilder creates a new Dockerfile builder from an optional dockerfile and a Options.
func newBuilder(clientCtx context.Context, options builderOptions) (*Builder, error) {
	config := options.Options
	if config == nil {
		config = new(types.ImageBuildOptions)
	}

	b := &Builder{
		clientCtx:        clientCtx,
		options:          config,
		Stdout:           options.ProgressWriter.StdoutFormatter,
		Stderr:           options.ProgressWriter.StderrFormatter,
		Aux:              options.ProgressWriter.AuxFormatter,
		Output:           options.ProgressWriter.Output,
		docker:           options.Backend,
		idMapping:        options.IDMapping,
		imageSources:     newImageSources(clientCtx, options),
		pathCache:        options.PathCache,
		imageProber:      newImageProber(options.Backend, config.CacheFrom, config.NoCache),
		containerManager: newContainerManager(options.Backend),
	}

	// same as in Builder.Build in builder/builder-next/builder.go
	// TODO: remove once config.Platform is of type specs.Platform
	if config.Platform != "" {
		sp, err := platforms.Parse(config.Platform)
		if err != nil {
			return nil, err
		}
		b.platform = &sp
	}

	return b, nil
}

// Build 'LABEL' command(s) from '--label' options and add to the last stage
func buildLabelOptions(labels map[string]string, stages []instructions.Stage) {
	keys := []string{}
	for key := range labels {
		keys = append(keys, key)
	}

	// Sort the label to have a repeatable order
	sort.Strings(keys)
	for _, key := range keys {
		value := labels[key]
		stages[len(stages)-1].AddCommand(instructions.NewLabelCommand(key, value, true))
	}
}

// Build runs the Dockerfile builder by parsing the Dockerfile and executing
// the instructions from the file.
func (b *Builder) build(source builder.Source, dockerfile *parser.Result) (*builder.Result, error) {
	defer b.imageSources.Unmount()

	stages, metaArgs, err := instructions.Parse(dockerfile.AST)
	if err != nil {
		var uiErr *instructions.UnknownInstructionError
		if errors.As(err, &uiErr) {
			buildsFailed.WithValues(metricsUnknownInstructionError).Inc()
		}
		return nil, errdefs.InvalidParameter(err)
	}
	if b.options.Target != "" {
		targetIx, found := instructions.HasStage(stages, b.options.Target)
		if !found {
			buildsFailed.WithValues(metricsBuildTargetNotReachableError).Inc()
			return nil, errdefs.InvalidParameter(errors.Errorf("failed to reach build target %s in Dockerfile", b.options.Target))
		}
		stages = stages[:targetIx+1]
	}

	// Add 'LABEL' command specified by '--label' option to the last stage
	buildLabelOptions(b.options.Labels, stages)

	dockerfile.PrintWarnings(b.Stderr)
	dispatchState, err := b.dispatchDockerfileWithCancellation(stages, metaArgs, dockerfile.EscapeToken, source)
	if err != nil {
		return nil, err
	}
	if dispatchState.imageID == "" {
		buildsFailed.WithValues(metricsDockerfileEmptyError).Inc()
		return nil, errors.New("No image was generated. Is your Dockerfile empty?")
	}
	return &builder.Result{ImageID: dispatchState.imageID, FromImage: dispatchState.baseImage}, nil
}

func emitImageID(aux *streamformatter.AuxFormatter, state *dispatchState) error {
	if aux == nil || state.imageID == "" {
		return nil
	}
	return aux.Emit("", types.BuildResult{ID: state.imageID})
}

func processMetaArg(meta instructions.ArgCommand, shlex *shell.Lex, args *BuildArgs) error {
	// shell.Lex currently only support the concatenated string format
	envs := convertMapToEnvList(args.GetAllAllowed())
	if err := meta.Expand(func(word string) (string, error) {
		return shlex.ProcessWord(word, envs)
	}); err != nil {
		return err
	}
	for _, arg := range meta.Args {
		args.AddArg(arg.Key, arg.Value)
		args.AddMetaArg(arg.Key, arg.Value)
	}
	return nil
}

func printCommand(out io.Writer, currentCommandIndex int, totalCommands int, cmd interface{}) int {
	fmt.Fprintf(out, stepFormat, currentCommandIndex, totalCommands, cmd)
	fmt.Fprintln(out)
	return currentCommandIndex + 1
}

func (b *Builder) dispatchDockerfileWithCancellation(parseResult []instructions.Stage, metaArgs []instructions.ArgCommand, escapeToken rune, source builder.Source) (*dispatchState, error) {
	dispatchRequest := dispatchRequest{}
	buildArgs := NewBuildArgs(b.options.BuildArgs)
	totalCommands := len(metaArgs) + len(parseResult)
	currentCommandIndex := 1
	for _, stage := range parseResult {
		totalCommands += len(stage.Commands)
	}
	shlex := shell.NewLex(escapeToken)
	for i := range metaArgs {
		currentCommandIndex = printCommand(b.Stdout, currentCommandIndex, totalCommands, &metaArgs[i])

		err := processMetaArg(metaArgs[i], shlex, buildArgs)
		if err != nil {
			return nil, err
		}
	}

	stagesResults := newStagesBuildResults()

	for _, s := range parseResult {
		stage := s
		if err := stagesResults.checkStageNameAvailable(stage.Name); err != nil {
			return nil, err
		}
		dispatchRequest = newDispatchRequest(b, escapeToken, source, buildArgs, stagesResults)

		currentCommandIndex = printCommand(b.Stdout, currentCommandIndex, totalCommands, stage.SourceCode)
		if err := initializeStage(dispatchRequest, &stage); err != nil {
			return nil, err
		}
		dispatchRequest.state.updateRunConfig()
		fmt.Fprintf(b.Stdout, " ---> %s\n", stringid.TruncateID(dispatchRequest.state.imageID))
		for _, cmd := range stage.Commands {
			select {
			case <-b.clientCtx.Done():
				logrus.Debug("Builder: build cancelled!")
				fmt.Fprint(b.Stdout, "Build cancelled\n")
				buildsFailed.WithValues(metricsBuildCanceled).Inc()
				return nil, errors.New("Build cancelled")
			default:
				// Not cancelled yet, keep going...
			}

			currentCommandIndex = printCommand(b.Stdout, currentCommandIndex, totalCommands, cmd)

			if err := dispatch(dispatchRequest, cmd); err != nil {
				return nil, err
			}
			dispatchRequest.state.updateRunConfig()
			fmt.Fprintf(b.Stdout, " ---> %s\n", stringid.TruncateID(dispatchRequest.state.imageID))
		}
		if err := emitImageID(b.Aux, dispatchRequest.state); err != nil {
			return nil, err
		}
		buildArgs.MergeReferencedArgs(dispatchRequest.state.buildArgs)
		if err := commitStage(dispatchRequest.state, stagesResults); err != nil {
			return nil, err
		}
	}
	buildArgs.WarnOnUnusedBuildArgs(b.Stdout)
	return dispatchRequest.state, nil
}

// BuildFromConfig builds directly from `changes`, treating it as if it were the contents of a Dockerfile
// It will:
// - Call parse.Parse() to get an AST root for the concatenated Dockerfile entries.
// - Do build by calling builder.dispatch() to call all entries' handling routines
//
// BuildFromConfig is used by the /commit endpoint, with the changes
// coming from the query parameter of the same name.
//
// TODO: Remove?
func BuildFromConfig(config *container.Config, changes []string, os string) (*container.Config, error) {
	if len(changes) == 0 {
		return config, nil
	}

	dockerfile, err := parser.Parse(bytes.NewBufferString(strings.Join(changes, "\n")))
	if err != nil {
		return nil, errdefs.InvalidParameter(err)
	}

	b, err := newBuilder(context.Background(), builderOptions{
		Options: &types.ImageBuildOptions{NoCache: true},
	})
	if err != nil {
		return nil, err
	}

	// ensure that the commands are valid
	for _, n := range dockerfile.AST.Children {
		if !validCommitCommands[strings.ToLower(n.Value)] {
			return nil, errdefs.InvalidParameter(errors.Errorf("%s is not a valid change command", n.Value))
		}
	}

	b.Stdout = io.Discard
	b.Stderr = io.Discard
	b.disableCommit = true

	var commands []instructions.Command
	for _, n := range dockerfile.AST.Children {
		cmd, err := instructions.ParseCommand(n)
		if err != nil {
			return nil, errdefs.InvalidParameter(err)
		}
		commands = append(commands, cmd)
	}

	dispatchRequest := newDispatchRequest(b, dockerfile.EscapeToken, nil, NewBuildArgs(b.options.BuildArgs), newStagesBuildResults())
	// We make mutations to the configuration, ensure we have a copy
	dispatchRequest.state.runConfig = copyRunConfig(config)
	dispatchRequest.state.imageID = config.Image
	dispatchRequest.state.operatingSystem = os
	for _, cmd := range commands {
		err := dispatch(dispatchRequest, cmd)
		if err != nil {
			return nil, errdefs.InvalidParameter(err)
		}
		dispatchRequest.state.updateRunConfig()
	}

	return dispatchRequest.state.runConfig, nil
}

func convertMapToEnvList(m map[string]string) []string {
	result := []string{}
	for k, v := range m {
		result = append(result, k+"="+v)
	}
	return result
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Ionic makes it incredibly easy to build beautiful and interactive mobile apps using HTML5 and AngularJS.">
<meta name="keywords" content="html5,javascript,mobile,drifty,ionic,hybrid,phonegap,cordova,native,ios,android,angularjs">
<meta name="author" content="Drifty">
<meta property="og:image" content="http://ionicframework.com/img/ionic-logo-blog.png"/>

<link href="/css/v2.css?1" rel="stylesheet">

<link rel="stylesheet" href="/css/ionic-hljs.css">

    <title>Ionic 2 Guide | Adding Pages - Ionic 2 Developer Preview -  Ionic Framework</title>

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        Toggle navigation

      </button>

      <form class="navbar-form navbar-left" role="search">

          <input type="text" class="form-control" placeholder="Search">

      </form>

Getting Started

Docs

Blog

Forum

            More

              Ionic Platform

              Showcase

              Job Board

              Market

              Ionic Worldwide

              Playground

              Creator

Shop

        <form class="form-group search" role="search">
          <input type="text" class="form-control" placeholder="Search">
        </form>

    Getting Started

        Welcome

        Installation

        Tutorial

        Migration

    Components

Overview

Action Sheets

Buttons

Cards

Checkbox

Icons

Inputs

Lists

Menus

Modals

Navigation

Popups

Radio

Range

Select

Slides

Switch

Tabs

    Platform

App Links

Barcode

Battery

Camera

Contacts

Device

Device Motion

Device Orientation

Dialogs

Geolocation

Keyboard

Status Bar

Storage

Vibration

    Theming

        Intro

        Theming your App

        Sass Variables

          Platform Styles

          Overriding Ionic Variables

    FAQ

    API

    Resources

        Resources Intro

        Developer Tips

        Glossary

        Ionicons

        Editors and IDEs

Adding Pages

  Improve this doc

Now that we have a basic understanding of the layout of an Ionic 2 app, let's walk through the process of

creating and navigating to pages in our app.

Taking a look at app/app.html, we see this line near the bottom:

<ion-nav #content [root]="rootPage"></ion-nav>

Pay attention to the [root] property binding. This sets what is essentially the

first, or "root" page for the ion-nav controller. When the navigation controller loads, the component referenced by rootPage will be the root page.

In app/app.js, the MyApp root component specifies this in its constructor:

import {App, IonicApp, IonicPlatform} from 'ionic/ionic';
import {HelloIonicPage} from './hello-ionic/hello-ionic';
import {ListPage} from './list/list';

class MyApp {

  constructor(app: IonicApp, platform: IonicPlatform) {

    // set up our app
    this.app = app;
    this.platform = platform;
    this.initializeApp();

    // set our app's pages
    this.pages = [
      { title: 'Hello Ionic', component: HelloIonicPage },
      { title: 'My First List', component: ListPage }
    ];

    // make HelloIonicPage the root (or first) page
    this.rootPage = HelloIonicPage;
  }

  ...
}

We see that this.rootPage is set to HelloIonicPage, so HelloIonicPage will be the first page loaded in the nav controller. Let's take a look at it.

Creating a Page

Next, let's check out the HelloIonicPage that we are importing. Inside the app/hello-ionic/ folder, let's open up hello-ionic.js.

<button type="button" class="btn btn-primary btn-sm" data-toggle="collapse" data-target="#naming-conventions">
  Naming conventions
</button>

You may have noticed that each page has its own folder that is named after the page. Inside each folder, we also see a .html and a .scss file with the same name. For example, inside of hello-ionic/ we will find hello-ionic.js, hello-ionic.html, and hello-ionic.scss. Although using this pattern is not required, it can be helpful to keep things organized.

Below, you will see the HelloIonicPage class which has a Page decorator. This creates a Page - an Angular component and an Angular view configured with all the necessary directives already that is meant to be loaded dynamically, so it does not use a tag selector:

import {Page, NavController} from 'ionic/ionic';

@Page({
  templateUrl: 'app/hello-ionic/hello-ionic.html'
})
export class HelloIonicPage {
  constructor(nav: NavController) {
    this.nav = nav;
  }

}

Note that we pass in the nav object, and set it as a property in the constructor.

All pages have both a class, and an associated template. Let's checkout app/hello-ionic/hello-ionic.html - the template file for this page:

<ion-navbar *navbar>
  <a menu-toggle>
    <icon menu></icon>
  </a>
  <ion-title>Hello Ionic</ion-title>
</ion-navbar>

<ion-content padding class="getting-started">

  <h3>Welcome to your first Ionic app!</h3>

  <p>
    This starter project is our way of helping you get a functional app running in record time.
    ...
  </p>
</ion-content>

The <ion-navbar *navbar> component functions as configuration

data for the navigation bar. As we navigate to the page, the nav bar will be updated with the

various ion-nav-items for buttons in the bar, and <ion-title> for the title of the bar.

The rest of the template is standard Ionic code that sets up our content area, and then

renders our welcome message.

Creating Additional Pages

To create an additional page, we don't need to do much beyond making sure we correctly configure the title and anything else we want the navigation bar to display.

Let's check out the contents of app/list/list.js. Inside, you will see a new page is being defined:

import {IonicApp, Page, NavController, NavParams} from 'ionic/ionic';

@Page({
  templateUrl: 'app/list/list.html'
})
export class ListPage {
  constructor(app: IonicApp, nav: NavController, navParams: NavParams) {
    this.nav = nav;
    ...
   }
   ...
   itemTapped(event, item) {
     console.log('You selected', item.title);
   }
}

This page will create a basic list page containing a number of items. Notice that we are also defining an itemTapped function that logs the title of an item to the console. Let's go check out how this function gets called. Open up app/list/list.html:

<ion-item *ng-for="#item of items" (click)="itemTapped($event, item)">

This will add each item to the list, and register a click handler on each of those items. When the item is tapped or clicked, it will call our itemTapped function that logs the title of the item to the console. Also note that we pass this function the click event, as well as the item that was tapped.

Overall, this page is very similar to the HelloIonicPage we saw earlier. Currently, when you tap an item, our app will log a message to the console. In the next section, we will learn about how we can improve this by navigating to a new page!

Navigating


text:
package lingua.ui.gtk.main_window.actions;

import lingua.resources.StringResources;
import lingua.ui.gtk.main_window.MainWindow;
import org.freedesktop.icons.ActionIcon;
import org.gnome.gdk.Keyval;
import org.gnome.gdk.ModifierType;
import org.gnome.gtk.Action;

/**
 *
 * @author Georgios Migdos <cyberpython@gmail.com>
 */
public class StopAction extends Action{
    private static StopAction instance = null;

    public static StopAction getInstance(){
        if(instance == null){
            instance = new StopAction();
        }
        return instance;
    }

    private StopAction() {
        super("StopAction", StringResources.getInstance().getString("stop"), StringResources.getInstance().getString("tooltip_stop"), ActionIcon.MEDIA_PLAYBACK_STOP, new Activate() {

            public void onActivate(Action source) {
                MainWindow.getInstance().stop();
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.F7, ModifierType.NONE);
        setSensitive(false);
    }

}


text:
#ifndef TENSORFLOW_C_EAGER_C_API_INTERNAL_H_
#define TENSORFLOW_C_EAGER_C_API_INTERNAL_H_

#include "tensorflow/c/c_api_internal.h"
#include "tensorflow/c/eager/c_api.h"
#include "tensorflow/c/eager/c_api_experimental.h"
#include "tensorflow/c/eager/tfe_cancellation_manager_internal.h"  // IWYU pragma: export
#include "tensorflow/c/eager/tfe_executor_internal.h"  // IWYU pragma: export
#include "tensorflow/c/eager/tfe_monitoring_internal.h"  // IWYU pragma: export
#include "tensorflow/c/eager/tfe_op_attrs_internal.h"  // IWYU pragma: export
#include "tensorflow/c/eager/tfe_tensor_debug_info_internal.h"  // IWYU pragma: export

// TODO(b/154564140): Move this to its own header. This requires splitting
// c_api_experimental.h
struct TFE_ContextOptions {
  TF_SessionOptions session_options;
  // true if async execution is enabled.
  bool async = false;
  TFE_ContextDevicePlacementPolicy device_placement_policy{
      TFE_DEVICE_PLACEMENT_SILENT};
  // If true, use TFRT backend
  bool use_tfrt = false;
  // This option is effective only when use_tfrt is true. If true, TFRT will use
  // native TFRT distributed runtime. Otherwise, TFRT will use current runtime's
  // distributed runtime. Note that TFRT distributed runtime is in development
  // and not functionally complete.
  bool use_tfrt_distributed_runtime = false;
  // Whether to run elementary eager ops wrapped in a call op.
  bool run_eager_op_as_function = false;
};

#endif  // TENSORFLOW_C_EAGER_C_API_INTERNAL_H_


text:
package com.postmen.javasdk.model;

import java.util.List;

import com.google.api.client.util.Key;

public class Manifests {
	@Key("next_token")
	private String nextToken;
	@Key
	private int limit;
	@Key("created_at_min")
	private String createdAtMin;
	@Key("created_at_max")
	private String createdAtMax;
	@Key
	private List<Manifest> manifests;

	public String getNextToken() {
		return nextToken;
	}
	public void setNextToken(String nextToken) {
		this.nextToken = nextToken;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	public String getCreatedAtMin() {
		return createdAtMin;
	}
	public void setCreatedAtMin(String createdAtMin) {
		this.createdAtMin = createdAtMin;
	}
	public String getCreatedAtMax() {
		return createdAtMax;
	}
	public void setCreatedAtMax(String createdAtMax) {
		this.createdAtMax = createdAtMax;
	}
	public List<Manifest> getManifests() {
		return manifests;
	}
	public void setManifests(List<Manifest> manifests) {
		this.manifests = manifests;
	}
}


text:
<?php

/**
 * This file is part of the Spryker Demoshop.
 * For full license information, please view the LICENSE file that was distributed with this source code.
 */

namespace PyzTest\Zed\Tax\Presentation;

use PyzTest\Zed\Tax\PageObject\TaxRateCreatePage;
use PyzTest\Zed\Tax\PageObject\TaxRateListPage;
use PyzTest\Zed\Tax\TaxPresentationTester;

/**
 * Auto-generated group annotations
 * @group PyzTest
 * @group Zed
 * @group Tax
 * @group Presentation
 * @group TaxRateCreateCest
 * Add your own group annotations below this line
 */
class TaxRateCreateCest
{
    /**
     * @param \PyzTest\Zed\Tax\TaxPresentationTester $i
     *
     * @return void
     */
    public function testCreateValidTaxRateShouldShowSuccessMessage(TaxPresentationTester $i)
    {
        $i->wantTo('Create valid tax rate.');
        $i->expect('Tax rate is successfully created');

        $i->createTaxRate(TaxRateCreatePage::TAX_RATE_VALID);
        $i->seeMatches(TaxRateCreatePage::MESSAGE_SUCCESSFUL_ALERT_CREATION, 'div.alert-success');

        $i->removeTaxRateFromDatabase(TaxRateCreatePage::TAX_RATE_VALID);
    }

    /**
     * @param \PyzTest\Zed\Tax\TaxPresentationTester $i
     *
     * @return void
     */
    public function testCreateInvalidTaxRateShouldShowErrorMessages(TaxPresentationTester $i)
    {
        $i->wantTo('Create invalid tax rate');
        $i->expect('Error messages are displayed. Tax rate is not created');

        $i->createTaxRate(TaxRateCreatePage::TAX_RATE_INVALID);
        $i->seeErrorMessages();
    }

    /**
     * @param \PyzTest\Zed\Tax\TaxPresentationTester $i
     *
     * @return void
     */
    public function testBackToListOfTaxRatesShouldOpenTaxRateListPageWithoutSaving(TaxPresentationTester $i)
    {
        $i->wantTo('Create valid tax rate and back to list of tax rates');
        $i->expect('List of tax rates is opened, tax rate is not created');

        $i->createTaxRateWithoutSaving(TaxRateCreatePage::TAX_RATE_VALID_NOT_CREATED);
        $i->click(TaxRateCreatePage::SELECTOR_LIST_OF_TAX_RATES_BUTTON);

        $i->dontSeeMatches(TaxRateCreatePage::MESSAGE_SUCCESSFUL_ALERT_CREATION, 'div.alert-success');

        $i->searchForTaxRate(TaxRateCreatePage::TAX_RATE_VALID_NOT_CREATED);

        $i->waitForText(TaxRateListPage::MESSAGE_EMPTY_TABLE, 10);
    }

    /**
     * @param \PyzTest\Zed\Tax\TaxPresentationTester $i
     *
     * @return void
     */
    public function testCreateTaxRateWhichAlreadyExistsShouldShowErrorMessage(TaxPresentationTester $i)
    {
        $i->wantTo('Create tax rate which already exists');
        $i->expect('Error message is displayed on attempt to create one and the same Tax Rate');

        $i->createTaxRate(TaxRateCreatePage::TAX_RATE_VALID);

        $i->wait(2);

        $i->createTaxRate(TaxRateCreatePage::TAX_RATE_VALID);
        $i->see(TaxRateCreatePage::ERROR_MESSAGE_TAX_RATE_ALREADY_EXISTS);
    }

    /**
     * @param \PyzTest\Zed\Tax\TaxPresentationTester $i
     *
     * @return void
     */
    public function testCreateAlreadyExistedTaxRateShouldShowErrorMessage(TaxPresentationTester $i)
    {
        $i->wantTo('Create tax rate which already exists');
        $i->expect('Error message is displayed on attempt to create one and the same Tax Rate');

        $i->createOneAndTheSameTaxRate(TaxRateCreatePage::TAX_RATE_VALID);

        $i->wait(2);

        $i->see(TaxRateCreatePage::ERROR_MESSAGE_TAX_RATE_ALREADY_EXISTS);
    }
}


text:
package org.lilyproject.repository.api.tutorial;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.joda.time.LocalDate;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.lilyproject.hadooptestfw.HBaseProxy;
import org.lilyproject.hadooptestfw.TestHelper;
import org.lilyproject.repository.api.Blob;
import org.lilyproject.repository.api.BlobManager;
import org.lilyproject.repository.api.BlobStoreAccess;
import org.lilyproject.repository.api.FieldType;
import org.lilyproject.repository.api.IdGenerator;
import org.lilyproject.repository.api.LRepository;
import org.lilyproject.repository.api.LTable;
import org.lilyproject.repository.api.Link;
import org.lilyproject.repository.api.MutationCondition;
import org.lilyproject.repository.api.QName;
import org.lilyproject.repository.api.Record;
import org.lilyproject.repository.api.RecordId;
import org.lilyproject.repository.api.RecordType;
import org.lilyproject.repository.api.Repository;
import org.lilyproject.repository.api.RepositoryManager;
import org.lilyproject.repository.api.Scope;
import org.lilyproject.repository.api.TableManager;
import org.lilyproject.repository.api.TypeManager;
import org.lilyproject.repository.api.ValueType;
import org.lilyproject.repository.impl.BlobManagerImpl;
import org.lilyproject.repository.impl.BlobStoreAccessConfig;
import org.lilyproject.repository.impl.DFSBlobStoreAccess;
import org.lilyproject.repository.impl.HBaseRepositoryManager;
import org.lilyproject.repository.impl.HBaseTypeManager;
import org.lilyproject.repository.impl.RecordFactoryImpl;
import org.lilyproject.repository.impl.SizeBasedBlobStoreAccessFactory;
import org.lilyproject.repository.impl.TableManagerImpl;
import org.lilyproject.repository.impl.id.IdGeneratorImpl;
import org.lilyproject.repository.model.api.RepositoryModel;
import org.lilyproject.repository.model.impl.RepositoryModelImpl;
import org.lilyproject.util.hbase.HBaseTableFactory;
import org.lilyproject.util.hbase.HBaseTableFactoryImpl;
import org.lilyproject.util.hbase.LilyHBaseSchema.Table;
import org.lilyproject.util.io.Closer;
import org.lilyproject.util.repo.PrintUtil;
import org.lilyproject.util.zookeeper.StateWatchingZooKeeper;
import org.lilyproject.util.zookeeper.ZooKeeperItf;

/**
 * The code in this class is used in the repository API tutorial (390-lily). If this
 * code needs updating because of API changes, then the tutorial itself probably needs
 * to be updated too.
 */
public class TutorialTest {
    private static HBaseProxy HBASE_PROXY;

    private static final String BNS = "book";
    private static final String ANS = "article";

    private static TypeManager typeManager;
    private static RepositoryManager repositoryManager;
    private static LRepository repository;
    private static LTable table;
    private static Configuration configuration;
    private static ZooKeeperItf zooKeeper;

    private static HBaseTableFactory hbaseTableFactory;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        TestHelper.setupLogging();
        HBASE_PROXY = new HBaseProxy();
        HBASE_PROXY.start();

        IdGenerator idGenerator = new IdGeneratorImpl();
        configuration = HBASE_PROXY.getConf();
        zooKeeper = new StateWatchingZooKeeper(HBASE_PROXY.getZkConnectString(), 10000);
        hbaseTableFactory = new HBaseTableFactoryImpl(HBASE_PROXY.getConf());

        RepositoryModel repositoryModel = new RepositoryModelImpl(zooKeeper);

        typeManager = new HBaseTypeManager(idGenerator, configuration, zooKeeper, hbaseTableFactory);

        DFSBlobStoreAccess dfsBlobStoreAccess = new DFSBlobStoreAccess(HBASE_PROXY.getBlobFS(), new Path("/lily/blobs"));
        List<BlobStoreAccess> blobStoreAccesses = Collections.<BlobStoreAccess>singletonList(dfsBlobStoreAccess);
        BlobStoreAccessConfig blobStoreAccessConfig = new BlobStoreAccessConfig(dfsBlobStoreAccess.getId());
        SizeBasedBlobStoreAccessFactory blobStoreAccessFactory =
                new SizeBasedBlobStoreAccessFactory(blobStoreAccesses, blobStoreAccessConfig);
        BlobManager blobManager = new BlobManagerImpl(hbaseTableFactory, blobStoreAccessFactory, false);
        repositoryManager = new HBaseRepositoryManager(typeManager, idGenerator,
                new RecordFactoryImpl(), hbaseTableFactory, blobManager, configuration, repositoryModel);

        TableManager repoTableManager =
                new TableManagerImpl(/* TODO multiple repositories */ "default", configuration, hbaseTableFactory);
        if (!repoTableManager.tableExists(Table.RECORD.name)) {
            repoTableManager.createTable(Table.RECORD.name);
        }

        repository = (Repository) repositoryManager.getDefaultRepository().getDefaultTable();
        table = repository.getDefaultTable();
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
        Closer.close(typeManager);
        Closer.close(repository);
        Closer.close(zooKeeper);
        Closer.close(repositoryManager);
        HBASE_PROXY.stop();
    }

    /**
     * This is a "driver" method to run all the tests, because there are dependencies between the tests.
     */
    @Test
    public void test() throws Exception {
        createRecordType();
        updateRecordType();
        createRecord();
        createRecordUserSpecifiedId();
        updateRecord();
        updateRecordViaRead();
        updateRecordConditionally();
        readRecord();
        blob();
        variantRecord();
        linkField();
        complexFields();
    }

    public void createRecordType() throws Exception {
        // (1)
        ValueType stringValueType = typeManager.getValueType("STRING");

        // (2)
        FieldType title = typeManager.newFieldType(stringValueType, new QName(BNS, "title"), Scope.VERSIONED);

        // (3)
        title = typeManager.createFieldType(title);

        // (4)
        RecordType book = typeManager.newRecordType(new QName(BNS, "Book"));
        book.addFieldTypeEntry(title.getId(), true);

        // (5)
        book = typeManager.createRecordType(book);

        // (6)
        PrintUtil.print(book, repository);
    }

    public void updateRecordType() throws Exception {
        FieldType description = typeManager.createFieldType("BLOB", new QName(BNS, "description"), Scope.VERSIONED);
        FieldType authors = typeManager.createFieldType("LIST<STRING>", new QName(BNS, "authors"), Scope.VERSIONED);
        FieldType released = typeManager.createFieldType("DATE", new QName(BNS, "released"), Scope.VERSIONED);
        FieldType pages = typeManager.createFieldType("LONG", new QName(BNS, "pages"), Scope.VERSIONED);
        FieldType sequelTo = typeManager.createFieldType("LINK", new QName(BNS, "sequel_to"), Scope.VERSIONED);
        FieldType manager = typeManager.createFieldType("STRING", new QName(BNS, "manager"), Scope.NON_VERSIONED);
        FieldType reviewStatus = typeManager.createFieldType("STRING", new QName(BNS, "review_status"), Scope.VERSIONED_MUTABLE);

        RecordType book = typeManager.getRecordTypeByName(new QName(BNS, "Book"), null);

        // The order in which fields are added does not matter
        book.addFieldTypeEntry(description.getId(), false);
        book.addFieldTypeEntry(authors.getId(), false);
        book.addFieldTypeEntry(released.getId(), false);
        book.addFieldTypeEntry(pages.getId(), false);
        book.addFieldTypeEntry(sequelTo.getId(), false);
        book.addFieldTypeEntry(manager.getId(), false);
        book.addFieldTypeEntry(reviewStatus.getId(), false);

        // Now we call updateRecordType instead of createRecordType
        book = typeManager.updateRecordType(book);

        PrintUtil.print(book, repository);
    }

    public void createRecord() throws Exception {
        // (1)
        Record record = table.newRecord();

        // (2)
        record.setRecordType(new QName(BNS, "Book"));

        // (3)
        record.setField(new QName(BNS, "title"), "Lily, the definitive guide, 3rd edition");

        // (4)
        record = table.create(record);

        // (5)
        PrintUtil.print(record, repository);
    }

    public void createRecordUserSpecifiedId() throws Exception {
        RecordId id = repository.getIdGenerator().newRecordId("lily-definitive-guide-3rd-edition");
        Record record = table.newRecord(id);
        record.setDefaultNamespace(BNS);
        record.setRecordType("Book");
        record.setField("title", "Lily, the definitive guide, 3rd edition");
        record = table.create(record);

        PrintUtil.print(record, repository);
    }

    public void updateRecord() throws Exception {
        RecordId id = repository.getIdGenerator().newRecordId("lily-definitive-guide-3rd-edition");
        Record record = table.newRecord(id);
        record.setDefaultNamespace(BNS);
        record.setField("title", "Lily, the definitive guide, third edition");
        record.setField("pages", Long.valueOf(912));
        record.setField("manager", "Manager M");
        record = table.update(record);

        PrintUtil.print(record, repository);
    }

    public void updateRecordViaRead() throws Exception {
        RecordId id = repository.getIdGenerator().newRecordId("lily-definitive-guide-3rd-edition");
        Record record = table.read(id);
        record.setDefaultNamespace(BNS);
        record.setField("released", new LocalDate());
        record.setField("authors", Arrays.asList("Author A", "Author B"));
        record.setField("review_status", "reviewed");
        record = table.update(record);

        PrintUtil.print(record, repository);
    }

    public void updateRecordConditionally() throws Exception {
        List<MutationCondition> conditions = new ArrayList<MutationCondition>();
        conditions.add(new MutationCondition(new QName(BNS, "manager"), "Manager Z"));

        RecordId id = repository.getIdGenerator().newRecordId("lily-definitive-guide-3rd-edition");
        Record record = table.read(id);
        record.setField(new QName(BNS, "manager"), "Manager P");
        record = table.update(record, conditions);

        System.out.println(record.getResponseStatus());
    }

    public void readRecord() throws Exception {
        RecordId id = repository.getIdGenerator().newRecordId("lily-definitive-guide-3rd-edition");

        // (1)
        Record record = table.read(id);
        String title = (String) record.getField(new QName(BNS, "title"));
        System.out.println(title);

        // (2)
        record = table.read(id, 1L);
        System.out.println(record.getField(new QName(BNS, "title")));

        // (3)
        record = table.read(id, 1L, new QName(BNS, "title"));
        System.out.println(record.getField(new QName(BNS, "title")));
    }

    public void blob() throws Exception {
        //
        // Write a blob
        //

        String description = "This book gives thorough insight into Lily, ...";
        byte[] descriptionData = description.getBytes("UTF-8");

        // (1)
        Blob blob = new Blob("text/html", (long) descriptionData.length, "description.xml");
        OutputStream os = table.getOutputStream(blob);
        try {
            os.write(descriptionData);
        } finally {
            os.close();
        }

        // (2)
        RecordId id = repository.getIdGenerator().newRecordId("lily-definitive-guide-3rd-edition");
        Record record = table.newRecord(id);
        record.setField(new QName(BNS, "description"), blob);
        record = table.update(record);

        //
        // Read a blob
        //
        InputStream is = null;
        try {
            is = table.getInputStream(record, new QName(BNS, "description"));
            System.out.println("Data read from blob is:");
            Reader reader = new InputStreamReader(is, "UTF-8");
            char[] buffer = new char[20];
            int read;
            while ((read = reader.read(buffer)) != -1) {
                System.out.print(new String(buffer, 0, read));
            }
            System.out.println();
        } finally {
            if (is != null) {
                is.close();
            }
        }
    }

    public void variantRecord() throws Exception {
        // (1)
        IdGenerator idGenerator = repository.getIdGenerator();
        RecordId masterId = idGenerator.newRecordId();

        // (2)
        Map<String, String> variantProps = new HashMap<String, String>();
        variantProps.put("language", "en");

        // (3)
        RecordId enId = idGenerator.newRecordId(masterId, variantProps);

        // (4)
        Record enRecord = table.newRecord(enId);
        enRecord.setRecordType(new QName(BNS, "Book"));
        enRecord.setField(new QName(BNS, "title"), "Car maintenance");
        enRecord = table.create(enRecord);

        // (5)
        RecordId nlId = idGenerator.newRecordId(enRecord.getId().getMaster(), Collections.singletonMap("language", "nl"));
        Record nlRecord = table.newRecord(nlId);
        nlRecord.setRecordType(new QName(BNS, "Book"));
        nlRecord.setField(new QName(BNS, "title"), "Wagen onderhoud");
        nlRecord = table.create(nlRecord);

        // (6)
        Set<RecordId> variants = table.getVariants(masterId);
        for (RecordId variant : variants) {
            System.out.println(variant);
        }
    }

    public void linkField() throws Exception {
        // (1)
        Record record1 = table.newRecord();
        record1.setRecordType(new QName(BNS, "Book"));
        record1.setField(new QName(BNS, "title"), "Fishing 1");
        record1 = table.create(record1);

        // (2)
        Record record2 = table.newRecord();
        record2.setRecordType(new QName(BNS, "Book"));
        record2.setField(new QName(BNS, "title"), "Fishing 2");
        record2.setField(new QName(BNS, "sequel_to"), new Link(record1.getId()));
        record2 = table.create(record2);

        // (3)
        Link sequelToLink = (Link) record2.getField(new QName(BNS, "sequel_to"));
        RecordId sequelTo = sequelToLink.resolve(record2.getId(), repository.getIdGenerator());
        Record linkedRecord = table.read(sequelTo);
        System.out.println(linkedRecord.getField(new QName(BNS, "title")));
    }

    public void complexFields() throws Exception {
        // (1)
        FieldType name = typeManager.createFieldType("STRING", new QName(ANS, "name"), Scope.NON_VERSIONED);
        FieldType email = typeManager.createFieldType("STRING", new QName(ANS, "email"), Scope.NON_VERSIONED);

        RecordType authorType = typeManager.newRecordType(new QName(ANS, "author"));
        authorType.addFieldTypeEntry(name.getId(), true);
        authorType.addFieldTypeEntry(email.getId(), true);
        authorType = typeManager.createRecordType(authorType);

        // (2)
        FieldType title = typeManager.createFieldType("STRING", new QName(ANS, "title"), Scope.NON_VERSIONED);
        FieldType authors = typeManager.createFieldType("LIST<RECORD<{article}author>>",
                new QName(ANS, "authors"), Scope.NON_VERSIONED);
        FieldType body = typeManager.createFieldType("STRING", new QName(ANS, "body"), Scope.NON_VERSIONED);

        RecordType articleType = typeManager.newRecordType(new QName(ANS, "article"));
        articleType.addFieldTypeEntry(title.getId(), true);
        articleType.addFieldTypeEntry(authors.getId(), true);
        articleType.addFieldTypeEntry(body.getId(), true);
        articleType = typeManager.createRecordType(articleType);

        // (3)
        Record author1 = table.newRecord();
        author1.setRecordType(authorType.getName());
        author1.setField(name.getName(), "Author X");
        author1.setField(name.getName(), "author_x@authors.com");

        Record author2 = table.newRecord();
        author2.setRecordType(new QName(ANS, "author"));
        author2.setField(name.getName(), "Author Y");
        author2.setField(name.getName(), "author_y@authors.com");

        // (4)
        Record article = table.newRecord();
        article.setRecordType(articleType.getName());
        article.setField(new QName(ANS, "title"), "Title of the article");
        article.setField(new QName(ANS, "authors"), Lists.newArrayList(author1, author2));
        article.setField(new QName(ANS, "body"), "Body text of the article");
        article = table.create(article);

        PrintUtil.print(article, repository);
    }

}


text:
package kamon.com.monsanto.arch.kamon.spray

import kamon.metric.CounterKey
import kamon.metric.instrument.UnitOfMeasurement

/** An ugly hack. */
package object can {
  def counterKey(name: String, unitOfMeasurement: UnitOfMeasurement = UnitOfMeasurement.Unknown): CounterKey =
    CounterKey(name, unitOfMeasurement)
}


text:
require 'test_helper'

module RailsPages
  class PagesHelperTest < ActionView::TestCase
  end
end


text:
var hello = require("./src/texteditor.js");

hello.sayHello();


text:
var inverseIntersection = (function() {

    var max = Math.max;
    var min = Math.min;

    // Computes the intersection of both rectangle parameters.
    // If there is no intersection, returns false.
    function intersection(r1, r2) {

        var x0 = max(r1.left, r2.left);
        var x1 = min(r1.left + r1.width, r2.left + r2.width);
        var y0 = max(r1.top, r2.top);
        var y1 = min(r1.top + r1.height, r2.top + r2.height);

        if (x0 <= x1 && y0 <= y1) {
            return {
                left: x0,
                top: y0,
                width: x1 - x0,
                height: y1 - y0
            };
        }

        return false;
    }

    // A filter function for rectangles.
    // Take the input array and return only rectangles that have an area.
    function filterWithArea(rectangles) {

        for (var output = [], i = 0; i < rectangles.length; i++) {
            if (rectangles[i].width > 0 && rectangles[i].height > 0) {
                output.push(rectangles[i]);
            }
        }

        return output;
    }

    // If there is an intersection between the child and parent rectangle,
    // return all surrounding rectangles that contain an area.
    // If there is no intersection, return an array containing only the child.
    function splitRectangleOnIntersection(parent, child) {

        var inter = intersection(parent, child);

        if (!inter) {
            return [parent];
        }

        // There will be up to 4 rectangles surrounding this box.
        // Only include ones with an area, since empty ones won't create any future intersections.
        return filterWithArea([
            {
                left: parent.left,
                top: parent.top,
                width: parent.width,
                height: inter.top - parent.top
            },
            {
                left: parent.left,
                top: inter.top + inter.height,
                width: parent.width,
                height: (parent.top + parent.height) - (inter.top + inter.height)
            },
            {
                left: parent.left,
                top: inter.top,
                width: inter.left - parent.left,
                height: inter.height
            },
            {
                left: inter.left + inter.width,
                top: inter.top,
                width: (parent.left + parent.width) - (inter.left + inter.width),
                height: inter.height
            }
        ]);
    }

    // Takes a parent rectangle and an array of child rectangles and returns an array
    // of non-overlapping rectangles that cover the inverse of the original set.
    // A rectangle is defined as an object that contains 'width', 'height', 'left', and 'right' properties.
    return function (parentRectangle, childRectangles) {

        if (!childRectangles.length) {
            return [];
        }

        var outputRectangles = [parentRectangle];

        for (var i = 0; i < childRectangles.length; i++) {
            for (var j = 0, newRectangles = []; j < outputRectangles.length; j++) {
                newRectangles = newRectangles.concat(
                    splitRectangleOnIntersection(outputRectangles[j], childRectangles[i])
                );
            }

            outputRectangles = newRectangles;
        }

        return outputRectangles;
    };

})();