text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/ads/googleads/v11/enums/external_conversion_source.proto

package com.google.ads.googleads.v11.enums;

/**
 *

 * Container for enum describing the external conversion source that is
 * associated with a ConversionAction.
 *

 *
 * Protobuf type {@code google.ads.googleads.v11.enums.ExternalConversionSourceEnum}
 */
public final class ExternalConversionSourceEnum extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.ads.googleads.v11.enums.ExternalConversionSourceEnum)
    ExternalConversionSourceEnumOrBuilder {
private static final long serialVersionUID = 0L;
  // Use ExternalConversionSourceEnum.newBuilder() to construct.
  private ExternalConversionSourceEnum(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private ExternalConversionSourceEnum() {
  }

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

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.ads.googleads.v11.enums.ExternalConversionSourceProto.internal_static_google_ads_googleads_v11_enums_ExternalConversionSourceEnum_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.ads.googleads.v11.enums.ExternalConversionSourceProto.internal_static_google_ads_googleads_v11_enums_ExternalConversionSourceEnum_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.class, com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.Builder.class);
  }

  /**
   *

   * The external conversion source that is associated with a ConversionAction.
   *

   *
   * Protobuf enum {@code google.ads.googleads.v11.enums.ExternalConversionSourceEnum.ExternalConversionSource}
   */
  public enum ExternalConversionSource
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *

     * Not specified.
     *

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

     * Represents value unknown in this version.
     *

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

     * Conversion that occurs when a user navigates to a particular webpage
     * after viewing an ad; Displayed in Google Ads UI as 'Website'.
     *

     *
     * WEBPAGE = 2;
     */
    WEBPAGE(2),
    /**
     *

     * Conversion that comes from linked Google Analytics goal or transaction;
     * Displayed in Google Ads UI as 'Analytics'.
     *

     *
     * ANALYTICS = 3;
     */
    ANALYTICS(3),
    /**
     *

     * Website conversion that is uploaded through ConversionUploadService;
     * Displayed in Google Ads UI as 'Import from clicks'.
     *

     *
     * UPLOAD = 4;
     */
    UPLOAD(4),
    /**
     *

     * Conversion that occurs when a user clicks on a call extension directly on
     * an ad; Displayed in Google Ads UI as 'Calls from ads'.
     *

     *
     * AD_CALL_METRICS = 5;
     */
    AD_CALL_METRICS(5),
    /**
     *

     * Conversion that occurs when a user calls a dynamically-generated phone
     * number (by installed javascript) from an advertiser's website after
     * clicking on an ad; Displayed in Google Ads UI as 'Calls from website'.
     *

     *
     * WEBSITE_CALL_METRICS = 6;
     */
    WEBSITE_CALL_METRICS(6),
    /**
     *

     * Conversion that occurs when a user visits an advertiser's retail store
     * after clicking on a Google ad;
     * Displayed in Google Ads UI as 'Store visits'.
     *

     *
     * STORE_VISITS = 7;
     */
    STORE_VISITS(7),
    /**
     *

     * Conversion that occurs when a user takes an in-app action such as a
     * purchase in an Android app;
     * Displayed in Google Ads UI as 'Android in-app action'.
     *

     *
     * ANDROID_IN_APP = 8;
     */
    ANDROID_IN_APP(8),
    /**
     *

     * Conversion that occurs when a user takes an in-app action such as a
     * purchase in an iOS app;
     * Displayed in Google Ads UI as 'iOS in-app action'.
     *

     *
     * IOS_IN_APP = 9;
     */
    IOS_IN_APP(9),
    /**
     *

     * Conversion that occurs when a user opens an iOS app for the first time;
     * Displayed in Google Ads UI as 'iOS app install (first open)'.
     *

     *
     * IOS_FIRST_OPEN = 10;
     */
    IOS_FIRST_OPEN(10),
    /**
     *

     * Legacy app conversions that do not have an AppPlatform provided;
     * Displayed in Google Ads UI as 'Mobile app'.
     *

     *
     * APP_UNSPECIFIED = 11;
     */
    APP_UNSPECIFIED(11),
    /**
     *

     * Conversion that occurs when a user opens an Android app for the first
     * time; Displayed in Google Ads UI as 'Android app install (first open)'.
     *

     *
     * ANDROID_FIRST_OPEN = 12;
     */
    ANDROID_FIRST_OPEN(12),
    /**
     *

     * Call conversion that is uploaded through ConversionUploadService;
     * Displayed in Google Ads UI as 'Import from calls'.
     *

     *
     * UPLOAD_CALLS = 13;
     */
    UPLOAD_CALLS(13),
    /**
     *

     * Conversion that comes from a linked Firebase event;
     * Displayed in Google Ads UI as 'Firebase'.
     *

     *
     * FIREBASE = 14;
     */
    FIREBASE(14),
    /**
     *

     * Conversion that occurs when a user clicks on a mobile phone number;
     * Displayed in Google Ads UI as 'Phone number clicks'.
     *

     *
     * CLICK_TO_CALL = 15;
     */
    CLICK_TO_CALL(15),
    /**
     *

     * Conversion that comes from Salesforce;
     * Displayed in Google Ads UI as 'Salesforce.com'.
     *

     *
     * SALESFORCE = 16;
     */
    SALESFORCE(16),
    /**
     *

     * Conversion that comes from in-store purchases recorded by CRM;
     * Displayed in Google Ads UI as 'Store sales (data partner)'.
     *

     *
     * STORE_SALES_CRM = 17;
     */
    STORE_SALES_CRM(17),
    /**
     *

     * Conversion that comes from in-store purchases from payment network;
     * Displayed in Google Ads UI as 'Store sales (payment network)'.
     *

     *
     * STORE_SALES_PAYMENT_NETWORK = 18;
     */
    STORE_SALES_PAYMENT_NETWORK(18),
    /**
     *

     * Codeless Google Play conversion;
     * Displayed in Google Ads UI as 'Google Play'.
     *

     *
     * GOOGLE_PLAY = 19;
     */
    GOOGLE_PLAY(19),
    /**
     *

     * Conversion that comes from a linked third-party app analytics event;
     * Displayed in Google Ads UI as 'Third-party app analytics'.
     *

     *
     * THIRD_PARTY_APP_ANALYTICS = 20;
     */
    THIRD_PARTY_APP_ANALYTICS(20),
    /**
     *

     * Conversion that is controlled by Google Attribution.
     *

     *
     * GOOGLE_ATTRIBUTION = 21;
     */
    GOOGLE_ATTRIBUTION(21),
    /**
     *

     * Store Sales conversion based on first-party or third-party merchant data
     * uploads. Displayed in Google Ads UI as 'Store sales (direct upload)'.
     *

     *
     * STORE_SALES_DIRECT_UPLOAD = 23;
     */
    STORE_SALES_DIRECT_UPLOAD(23),
    /**
     *

     * Store Sales conversion based on first-party or third-party merchant
     * data uploads and/or from in-store purchases using cards from payment
     * networks. Displayed in Google Ads UI as 'Store sales'.
     *

     *
     * STORE_SALES = 24;
     */
    STORE_SALES(24),
    /**
     *

     * Conversions imported from Search Ads 360 Floodlight data.
     *

     *
     * SEARCH_ADS_360 = 25;
     */
    SEARCH_ADS_360(25),
    /**
     *

     * Conversions that track local actions from Google's products and services
     * after interacting with an ad.
     *

     *
     * GOOGLE_HOSTED = 27;
     */
    GOOGLE_HOSTED(27),
    /**
     *

     * Conversions reported by Floodlight tags.
     *

     *
     * FLOODLIGHT = 29;
     */
    FLOODLIGHT(29),
    /**
     *

     * Conversions that come from Google Analytics specifically for Search Ads
     * 360. Displayed in Google Ads UI as Analytics (SA360).
     *

     *
     * ANALYTICS_SEARCH_ADS_360 = 31;
     */
    ANALYTICS_SEARCH_ADS_360(31),
    /**
     *

     * Conversion that comes from a linked Firebase event for Search Ads 360.
     *

     *
     * FIREBASE_SEARCH_ADS_360 = 33;
     */
    FIREBASE_SEARCH_ADS_360(33),
    /**
     *

     * Conversion that is reported by Floodlight for DV360.
     *

     *
     * DISPLAY_AND_VIDEO_360_FLOODLIGHT = 34;
     */
    DISPLAY_AND_VIDEO_360_FLOODLIGHT(34),
    UNRECOGNIZED(-1),
    ;

    /**
     *

     * Not specified.
     *

     *
     * UNSPECIFIED = 0;
     */
    public static final int UNSPECIFIED_VALUE = 0;
    /**
     *

     * Represents value unknown in this version.
     *

     *
     * UNKNOWN = 1;
     */
    public static final int UNKNOWN_VALUE = 1;
    /**
     *

     * Conversion that occurs when a user navigates to a particular webpage
     * after viewing an ad; Displayed in Google Ads UI as 'Website'.
     *

     *
     * WEBPAGE = 2;
     */
    public static final int WEBPAGE_VALUE = 2;
    /**
     *

     * Conversion that comes from linked Google Analytics goal or transaction;
     * Displayed in Google Ads UI as 'Analytics'.
     *

     *
     * ANALYTICS = 3;
     */
    public static final int ANALYTICS_VALUE = 3;
    /**
     *

     * Website conversion that is uploaded through ConversionUploadService;
     * Displayed in Google Ads UI as 'Import from clicks'.
     *

     *
     * UPLOAD = 4;
     */
    public static final int UPLOAD_VALUE = 4;
    /**
     *

     * Conversion that occurs when a user clicks on a call extension directly on
     * an ad; Displayed in Google Ads UI as 'Calls from ads'.
     *

     *
     * AD_CALL_METRICS = 5;
     */
    public static final int AD_CALL_METRICS_VALUE = 5;
    /**
     *

     * Conversion that occurs when a user calls a dynamically-generated phone
     * number (by installed javascript) from an advertiser's website after
     * clicking on an ad; Displayed in Google Ads UI as 'Calls from website'.
     *

     *
     * WEBSITE_CALL_METRICS = 6;
     */
    public static final int WEBSITE_CALL_METRICS_VALUE = 6;
    /**
     *

     * Conversion that occurs when a user visits an advertiser's retail store
     * after clicking on a Google ad;
     * Displayed in Google Ads UI as 'Store visits'.
     *

     *
     * STORE_VISITS = 7;
     */
    public static final int STORE_VISITS_VALUE = 7;
    /**
     *

     * Conversion that occurs when a user takes an in-app action such as a
     * purchase in an Android app;
     * Displayed in Google Ads UI as 'Android in-app action'.
     *

     *
     * ANDROID_IN_APP = 8;
     */
    public static final int ANDROID_IN_APP_VALUE = 8;
    /**
     *

     * Conversion that occurs when a user takes an in-app action such as a
     * purchase in an iOS app;
     * Displayed in Google Ads UI as 'iOS in-app action'.
     *

     *
     * IOS_IN_APP = 9;
     */
    public static final int IOS_IN_APP_VALUE = 9;
    /**
     *

     * Conversion that occurs when a user opens an iOS app for the first time;
     * Displayed in Google Ads UI as 'iOS app install (first open)'.
     *

     *
     * IOS_FIRST_OPEN = 10;
     */
    public static final int IOS_FIRST_OPEN_VALUE = 10;
    /**
     *

     * Legacy app conversions that do not have an AppPlatform provided;
     * Displayed in Google Ads UI as 'Mobile app'.
     *

     *
     * APP_UNSPECIFIED = 11;
     */
    public static final int APP_UNSPECIFIED_VALUE = 11;
    /**
     *

     * Conversion that occurs when a user opens an Android app for the first
     * time; Displayed in Google Ads UI as 'Android app install (first open)'.
     *

     *
     * ANDROID_FIRST_OPEN = 12;
     */
    public static final int ANDROID_FIRST_OPEN_VALUE = 12;
    /**
     *

     * Call conversion that is uploaded through ConversionUploadService;
     * Displayed in Google Ads UI as 'Import from calls'.
     *

     *
     * UPLOAD_CALLS = 13;
     */
    public static final int UPLOAD_CALLS_VALUE = 13;
    /**
     *

     * Conversion that comes from a linked Firebase event;
     * Displayed in Google Ads UI as 'Firebase'.
     *

     *
     * FIREBASE = 14;
     */
    public static final int FIREBASE_VALUE = 14;
    /**
     *

     * Conversion that occurs when a user clicks on a mobile phone number;
     * Displayed in Google Ads UI as 'Phone number clicks'.
     *

     *
     * CLICK_TO_CALL = 15;
     */
    public static final int CLICK_TO_CALL_VALUE = 15;
    /**
     *

     * Conversion that comes from Salesforce;
     * Displayed in Google Ads UI as 'Salesforce.com'.
     *

     *
     * SALESFORCE = 16;
     */
    public static final int SALESFORCE_VALUE = 16;
    /**
     *

     * Conversion that comes from in-store purchases recorded by CRM;
     * Displayed in Google Ads UI as 'Store sales (data partner)'.
     *

     *
     * STORE_SALES_CRM = 17;
     */
    public static final int STORE_SALES_CRM_VALUE = 17;
    /**
     *

     * Conversion that comes from in-store purchases from payment network;
     * Displayed in Google Ads UI as 'Store sales (payment network)'.
     *

     *
     * STORE_SALES_PAYMENT_NETWORK = 18;
     */
    public static final int STORE_SALES_PAYMENT_NETWORK_VALUE = 18;
    /**
     *

     * Codeless Google Play conversion;
     * Displayed in Google Ads UI as 'Google Play'.
     *

     *
     * GOOGLE_PLAY = 19;
     */
    public static final int GOOGLE_PLAY_VALUE = 19;
    /**
     *

     * Conversion that comes from a linked third-party app analytics event;
     * Displayed in Google Ads UI as 'Third-party app analytics'.
     *

     *
     * THIRD_PARTY_APP_ANALYTICS = 20;
     */
    public static final int THIRD_PARTY_APP_ANALYTICS_VALUE = 20;
    /**
     *

     * Conversion that is controlled by Google Attribution.
     *

     *
     * GOOGLE_ATTRIBUTION = 21;
     */
    public static final int GOOGLE_ATTRIBUTION_VALUE = 21;
    /**
     *

     * Store Sales conversion based on first-party or third-party merchant data
     * uploads. Displayed in Google Ads UI as 'Store sales (direct upload)'.
     *

     *
     * STORE_SALES_DIRECT_UPLOAD = 23;
     */
    public static final int STORE_SALES_DIRECT_UPLOAD_VALUE = 23;
    /**
     *

     * Store Sales conversion based on first-party or third-party merchant
     * data uploads and/or from in-store purchases using cards from payment
     * networks. Displayed in Google Ads UI as 'Store sales'.
     *

     *
     * STORE_SALES = 24;
     */
    public static final int STORE_SALES_VALUE = 24;
    /**
     *

     * Conversions imported from Search Ads 360 Floodlight data.
     *

     *
     * SEARCH_ADS_360 = 25;
     */
    public static final int SEARCH_ADS_360_VALUE = 25;
    /**
     *

     * Conversions that track local actions from Google's products and services
     * after interacting with an ad.
     *

     *
     * GOOGLE_HOSTED = 27;
     */
    public static final int GOOGLE_HOSTED_VALUE = 27;
    /**
     *

     * Conversions reported by Floodlight tags.
     *

     *
     * FLOODLIGHT = 29;
     */
    public static final int FLOODLIGHT_VALUE = 29;
    /**
     *

     * Conversions that come from Google Analytics specifically for Search Ads
     * 360. Displayed in Google Ads UI as Analytics (SA360).
     *

     *
     * ANALYTICS_SEARCH_ADS_360 = 31;
     */
    public static final int ANALYTICS_SEARCH_ADS_360_VALUE = 31;
    /**
     *

     * Conversion that comes from a linked Firebase event for Search Ads 360.
     *

     *
     * FIREBASE_SEARCH_ADS_360 = 33;
     */
    public static final int FIREBASE_SEARCH_ADS_360_VALUE = 33;
    /**
     *

     * Conversion that is reported by Floodlight for DV360.
     *

     *
     * DISPLAY_AND_VIDEO_360_FLOODLIGHT = 34;
     */
    public static final int DISPLAY_AND_VIDEO_360_FLOODLIGHT_VALUE = 34;

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

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ExternalConversionSource valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static ExternalConversionSource forNumber(int value) {
      switch (value) {
        case 0: return UNSPECIFIED;
        case 1: return UNKNOWN;
        case 2: return WEBPAGE;
        case 3: return ANALYTICS;
        case 4: return UPLOAD;
        case 5: return AD_CALL_METRICS;
        case 6: return WEBSITE_CALL_METRICS;
        case 7: return STORE_VISITS;
        case 8: return ANDROID_IN_APP;
        case 9: return IOS_IN_APP;
        case 10: return IOS_FIRST_OPEN;
        case 11: return APP_UNSPECIFIED;
        case 12: return ANDROID_FIRST_OPEN;
        case 13: return UPLOAD_CALLS;
        case 14: return FIREBASE;
        case 15: return CLICK_TO_CALL;
        case 16: return SALESFORCE;
        case 17: return STORE_SALES_CRM;
        case 18: return STORE_SALES_PAYMENT_NETWORK;
        case 19: return GOOGLE_PLAY;
        case 20: return THIRD_PARTY_APP_ANALYTICS;
        case 21: return GOOGLE_ATTRIBUTION;
        case 23: return STORE_SALES_DIRECT_UPLOAD;
        case 24: return STORE_SALES;
        case 25: return SEARCH_ADS_360;
        case 27: return GOOGLE_HOSTED;
        case 29: return FLOODLIGHT;
        case 31: return ANALYTICS_SEARCH_ADS_360;
        case 33: return FIREBASE_SEARCH_ADS_360;
        case 34: return DISPLAY_AND_VIDEO_360_FLOODLIGHT;
        default: return null;
      }
    }

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

    public final com.google.protobuf.Descriptors.EnumValueDescriptor
        getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }
    public final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptorForType() {
      return getDescriptor();
    }
    public static final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptor() {
      return com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.getDescriptor().getEnumTypes().get(0);
    }

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

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

    private final int value;

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

    // @@protoc_insertion_point(enum_scope:google.ads.googleads.v11.enums.ExternalConversionSourceEnum.ExternalConversionSource)
  }

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum)) {
      return super.equals(obj);
    }
    com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum other = (com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum) obj;

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

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

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

   * Container for enum describing the external conversion source that is
   * associated with a ConversionAction.
   *

   *
   * Protobuf type {@code google.ads.googleads.v11.enums.ExternalConversionSourceEnum}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.ads.googleads.v11.enums.ExternalConversionSourceEnum)
      com.google.ads.googleads.v11.enums.ExternalConversionSourceEnumOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.ads.googleads.v11.enums.ExternalConversionSourceProto.internal_static_google_ads_googleads_v11_enums_ExternalConversionSourceEnum_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.ads.googleads.v11.enums.ExternalConversionSourceProto.internal_static_google_ads_googleads_v11_enums_ExternalConversionSourceEnum_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.class, com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.Builder.class);
    }

    // Construct using com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.newBuilder()
    private Builder() {

    }

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

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

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.ads.googleads.v11.enums.ExternalConversionSourceProto.internal_static_google_ads_googleads_v11_enums_ExternalConversionSourceEnum_descriptor;
    }

    @java.lang.Override
    public com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum getDefaultInstanceForType() {
      return com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum build() {
      com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum buildPartial() {
      com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum result = new com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum(this);
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum) {
        return mergeFrom((com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum other) {
      if (other == com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum.getDefaultInstance()) return this;
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                done = true; // was an endgroup tag
              }
              break;
            } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

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

    // @@protoc_insertion_point(builder_scope:google.ads.googleads.v11.enums.ExternalConversionSourceEnum)
  }

  // @@protoc_insertion_point(class_scope:google.ads.googleads.v11.enums.ExternalConversionSourceEnum)
  private static final com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum();
  }

  public static com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.ads.googleads.v11.enums.ExternalConversionSourceEnum getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}


text:
<!doctype html>

    <meta charset="UTF-8">
    <title>flex全方位解读 - By 张宇亭</title>
    <link rel="stylesheet" media="all" href="./css/nodeppt.css">
    <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="./css/phone.css">

    <link rel="stylesheet" href="./js/highlight/styles/monokai_sublime.css">
    <link rel="stylesheet" href="./css/font-awesome.css">

<link rel="stylesheet" href="./css/theme.moon.css">

    <slides id="container">
        <slide class="slide"   data-on-build="Slide.magic" data-on-enter="Slide.magic.init">

flex全方位解读

</slide>
<slide class="slide" data-transition="vertical3d"  data-on-build="Slide.magic" data-on-enter="Slide.magic.init">

<hgroup>

传统布局

</hgroup>

基于盒状模型

依赖 display属性 + position属性 + float属性。

未知情况不好判断:垂直居中

//已知高度
    .parent {
        position: relative;
    }

    .child {
        position: absolute;
        top: 50 %;
        height: 100 px;
        margin-top: -50px;
    }

//未知高度
    .parent {
        position: relative;
    }

    .child {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    https://codepen.io/zhangyuting1993/pen/BmRQop

<hgroup>

flex

</hgroup>

更佳有效的布局方式

更好的控制项目的对齐和自由分配容器空间,即使它们的大小是未知的或动态的。

.parent {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

</slide>
<slide class="slide" data-transition="zoomin">

基本概念

flexbox 分为flex容器与flex项目

布局基于flex-flow

</slide>
<slide class="slide" data-transition="zoomin"  data-on-build="Slide.magic" data-on-enter="Slide.magic.init">

flex容器属性

display

flex-direction

flex-wrap

flex-flow

justify-content

align-items

align-content

display

.flex-layout {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

flex-direction

这是用来创建方轴,从而定义Flex项目在Flex容器中放置的方向。

单方向的布局概念。Flex项目主要排列方式要么是水平排列,要么是垂直列排列。
```html
flex-direction: row | row-reverse | column | column-reverse</li>
</ul>
<p>.flex-v-direaction{
    -webkit-box-orient: vertical/horizontal;
    -webkit-flex-direction: column;
    flex-direction: column;
}
```
https://codepen.io/zhangyuting1993/pen/xPqVwv

flex-wrap

默认情况之下,Flex项目都尽可能在一行显示。

你可以根据flex-wrap的属性值来改变,让Flex项目多行显示。
flex-wrap: nowrap | wrap | wrap-reverse
.flex-wrap{
  -webkit-box-lines: single/multiple;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

https://codepen.io/zhangyuting1993/pen/WXjodM?editors=1100

flex-flow

这是flex-direction和flex-wrap两个属性的缩写。两个属性决定了伸缩容器的主轴与侧轴。

默认值是row nowrap(中间用空格隔开)
flex-flow: <'flex-direction'> || <'flex-wrap'>

justify-content

用于在主轴上对齐伸缩项目。
justify-content: flex-start | flex-end | center | space-between | space-around
.flex-pack-center {
  -webkit-box-pack: start/end/center/justify;
  -webkit-justify-content: center;
  justify-content: center;
}

align-items

用于在侧轴上对齐伸缩项目。
```html
align-items: flex-start | flex-end | center | baseline | stretch</li>
</ul>
<p>.flex-align-center {
    -webkit-box-align: start/end/center/baseline/stretch;
    -webkit-align-items: center;
    align-items: center;
}
```
https://codepen.io/zhangyuting1993/pen/MOmbLx

align-content

调准伸缩行在伸缩容器里的对齐方式。
```html</li>
</ul>
<p>align-content: flex-start | flex-end | center | space-between | space-around | stretch</p>
<p>.flex-align-content {
    -webkit-align-content: center;
    align-content: center;
}</p>
<p>```
https://code
pen.io/zhangyuting1993/pen/MOmbLx

</slide>
<slide class="slide" data-transition="zoomin"  data-on-build="Slide.magic" data-on-enter="Slide.magic.init">

flex项目属性

order

flex-grow

flex-shrink

flex-basis

flex

align-self

order

控制Flex项目的顺序源
flex-order:1
order:1

https://codepen.io/zhangyuting1993/pen/POmWPR

flex-grow

定义一个Flex项目的扩大比例

https://codepen.io/zhangyuting1993/pen/bYWgEx

flex-shrink

定义一个Flex项目的缩小比例
https://codepen.io/zhangyuting1993/pen/POmWNR?editors=1100

flex-basis

定义了Flex项目在分配Flex容器剩余空间之前的一个默认尺寸.

。如果设置为auto,额外空间会基于flex-grow值做分布。
https://codepen.io/zhangyuting1993/pen/KymaMY

flex

flex是flex-grow,flex-shrink和flex-basis三个属性的缩写

flex-shrink和flex-basis可选

默认为 0 1 auto

flex取值为none时,其相当于取值为0 0 auto。

-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;

https://codepen.io/zhangyuting1993/pen/LOyxxW

flex: 0 auto,flex: initial与flex: 0 1 auto

flex: none与flex: 0 0 auto

伸缩项目不会收缩至比其最小内容尺寸

align-self

align-self则用来在单独的伸缩项目上覆写默认的对齐方式。

align-self: auto | flex-start | flex-end | center | baseline | stretch

-webkit-align-self: center;
align-self:center;

https://codepen.io/zhangyuting1993/pen/OOmWxo

</slide>
<slide class="slide" data-transition="zoomin">

应用举例

https://codepen.io/zhangyuting1993/pen/eeWgMJ

</slide>

    </slides>

<canvas id="drawBoard" class="draw-board" width="900" height="700"></canvas>

        <button class="fa fa-arrow-circle-left" id="_btn-prev"></button>
        <button class="fa fa-arrow-circle-right" id="_btn-next"></button>
        <button class="fa fa-paint-brush" id="_btn-brush"></button>
        <button class="fa fa-compress" id="_btn-overview" data-toggle="fa fa-expand"></button>

    <button class="fa fa-bars" id="_btn-bar"  data-toggle="fa fa-close"></button>

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScintillaNET
{
    /// <summary>
    /// The long line edge display mode.
    /// </summary>
    public enum EdgeMode
    {
        /// <summary>
        /// Long lines are not indicated. This is the default.
        /// </summary>
        None = NativeMethods.EDGE_NONE,

        /// <summary>
        /// Long lines are indicated with a vertical line.
        /// </summary>
        Line = NativeMethods.EDGE_LINE,

        /// <summary>
        /// Long lines are indicated with a background color.
        /// </summary>
        Background = NativeMethods.EDGE_BACKGROUND
    }
}


text:
/**
 * Benchmark dependencies.
 */

var benchmark = require('benchmark')
    , Sender = require('../').Sender
    , suite = new benchmark.Suite('Sender');
require('tinycolor');
require('./util');

/**
 * Setup sender.
 */

suite.on('start', function () {
    sender = new Sender();
    sender._socket = { write: function () {
    } };
});

suite.on('cycle', function () {
    sender = new Sender();
    sender._socket = { write: function () {
    } };
});

/**
 * Benchmarks
 */

framePacket = new Buffer(200 * 1024);
framePacket.fill(99);
suite.add('frameAndSend, unmasked (200 kB)', function () {
    sender.frameAndSend(0x2, framePacket, true, false);
});
suite.add('frameAndSend, masked (200 kB)', function () {
    sender.frameAndSend(0x2, framePacket, true, true);
});

/**
 * Output progress.
 */

suite.on('cycle', function (bench, details) {
    console.log('\n  ' + suite.name.grey, details.name.white.bold);
    console.log('  ' + [
        details.hz.toFixed(2).cyan + ' ops/sec'.grey
        , details.count.toString().white + ' times executed'.grey
        , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey
        ,
    ].join(', '.grey));
});

/**
 * Run/export benchmarks.
 */

if (!module.parent) {
    suite.run();
} else {
    module.exports = suite;
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\HospitalSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'hospital_id') ?>

    <?= $form->field($model, 'name') ?>

    <?= $form->field($model, 'icon') ?>

    <?= $form->field($model, 'location') ?>

        <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
from django.contrib import admin
from djanalytics import models

class DomainInline(admin.TabularInline):
    model = models.Domain
    extra = 1

class ClientAdmin(admin.ModelAdmin):
    list_display = ('name', 'uuid')
    readonly_fields = ('uuid', )
    inlines = [ DomainInline ]


text:
package com.strobel.expressions;

import com.strobel.reflection.Type;
import org.junit.After;
import org.junit.Before;

import java.io.PrintStream;
import java.security.cert.PolicyQualifierInfo;
import java.util.ArrayDeque;
import java.util.Queue;

import static com.strobel.expressions.Expression.lambda;
import static org.junit.Assert.*;

/**
 * @author Mike Strobel
 */
public abstract class AbstractExpressionTest {
    private final static ThreadLocal<Queue<Object>> OUTPUT_QUEUE = new ThreadLocal<Queue<Object>>() {
        @Override
        protected Queue<Object> initialValue() {
            return new ArrayDeque<>();
        }
    };

    private static final ThreadLocal<OutputInfo> THREAD_OUT = new ThreadLocal<OutputInfo>() {
        @Override
        protected OutputInfo initialValue() {
            return new OutputInfo(queue());
        }
    };

    public static void push(final Object value) {
        OUTPUT_QUEUE.get().add(value);
    }

    public static Object dequeue() {
        return OUTPUT_QUEUE.get().poll();
    }

    public static Object peek() {
        return OUTPUT_QUEUE.get().peek();
    }

    public static Queue<Object> queue() {
        return OUTPUT_QUEUE.get();
    }

    public static void clearQueue() {
        OUTPUT_QUEUE.get().clear();
    }

    public static Expression makePush(final Expression value) {
        return Expression.call(
            Expression.call(
                Type.of(AbstractExpressionTest.class),
                "queue"
            ),
            "add",
            value
        );
    }

    public static Expression outExpression() {
        return Expression.field(
            null,
            Type.of(System.class).getField("out")
        );
    }
    public static OutputRecorder outRecorder() {
        return THREAD_OUT.get().recorder;
    }

    @Before
    public void setUp() throws Throwable {
        final OutputInfo outputInfo = THREAD_OUT.get();
        outputInfo.systemStream = System.out;
        System.setOut(outputInfo.recorderStream);
        System.setProperty("com.strobel.reflection.emit.TypeBuilder.DumpGeneratedClasses", "true");
    }

    @After
    public void tearDown() throws Throwable {
        final OutputInfo outputInfo = THREAD_OUT.get();
        outputInfo.recorder.reset();
        System.setOut(outputInfo.systemStream);
        outputInfo.systemStream = null;
        final Queue<Object> queue = OUTPUT_QUEUE.get();
        queue.clear();
    }

    @SuppressWarnings("PackageVisibleField")
    final static class OutputInfo {
        final Queue<Object> outputQueue;
        final OutputRecorder recorder;
        final PrintStream recorderStream;
        PrintStream systemStream;

        OutputInfo(final Queue<Object> outputQueue) {
            this.outputQueue = outputQueue;
            this.recorder = new OutputRecorder(System.out, outputQueue);
            this.recorderStream = new PrintStream(recorder);
        }
    }

    protected static void assertResultTrue(final Expression e) throws Throwable {
        assertTrue((boolean)lambda(e).compileHandle().invokeExact());
    }

    protected static void assertResultFalse(final Expression e) throws Throwable {
        assertFalse((boolean)lambda(e).compileHandle().invokeExact());
    }

    protected static <T> void assertResultEquals(final Expression e, final T result) throws Throwable {
        assertEquals(result, lambda(e).compileHandle().invoke());
    }

    protected static void assertResultEquals(final Expression e, final byte result) throws Throwable {
        assertEquals(result, (byte)lambda(e).compileHandle().invokeExact());
    }

    protected static void assertResultEquals(final Expression e, final char result) throws Throwable {
        assertEquals(result, (char)lambda(e).compileHandle().invokeExact());
    }

    protected static void assertResultEquals(final Expression e, final short result) throws Throwable {
        assertEquals(result, (short)lambda(e).compileHandle().invokeExact());
    }

    protected static void assertResultEquals(final Expression e, final int result) throws Throwable {
        assertEquals(result, (int)lambda(e).compileHandle().invokeExact());
    }

    protected static void assertResultEquals(final Expression e, final long result) throws Throwable {
        assertEquals(result, (long)lambda(e).compileHandle().invokeExact());
    }

    protected static void assertResultEquals(final Expression e, final float result) throws Throwable {
        assertEquals(result, (float)lambda(e).compileHandle().invokeExact(), Double.MIN_NORMAL);
    }

    protected static void assertResultEquals(final Expression e, final double result) throws Throwable {
        assertEquals(result, (double)lambda(e).compileHandle().invokeExact(), Double.MIN_NORMAL);
    }
}


text:
require "optparse"
require "devops-client/options/common_options"

class FilterOptions < CommonOptions

  commands :image => [:add, :delete, :list]

  def initialize args, def_options
    super(args, def_options)
    self.header = I18n.t("headers.filters")
    self.banner_header = "filter"
    p = "PROVIDER"
    self.image_list_params = [p]
    i = "IMAGE [IMAGE ...]"
    self.image_add_params = [p, i]
    self.image_delete_params = [p, i]
  end
end


text:
function printPage(creditCalendar) {
       var printContents = document.getElementById('creditCalendar').innerHTML;
       var originalContents = document.body.innerHTML;
       document.body.innerHTML = "<title></title>" + printContents + "";
       window.print();
       document.body.innerHTML = originalContents;
   }


text:
import React, { Component } from 'react'

import DefaultPage from './DefaultPage'
import styles from '../styles'

const containerStyle = {
  display: 'flex',
  flexDirection: 'row',
  justifyContent: 'space-between',
}

export default class Uber extends Component {
  render() {
    return (
      <DefaultPage {...this.props}>

              Let's start by making the searchbar/header for the app. Let's make sure we smoothly morph from the single searchbar hovering over the map into the double searchbar that sits above the search results.

              To get a really close look at the animation, you can download this video and try scrubbing through it frame-by-frame: full res animation. You can also look at the Uber app (although the animation is a bit different... and more clunky!).

              Start by rendering LocationSearchHeader into the Main container. It will probably be easiest to think of the search header as having two states: expanded and collapsed. You can then use react-native-animatable and the transition prop to animate each element in the header between those two states.

              In collapsed state, the elements are:

White box in the background

Black square

"Where to?" text

              In expanded state, the elements are:

White box in the background, now much larger

Black square

Grey vertical bar

Grey dot

Light grey background with "Work" text

Darker grey background with "Where to?" text

              For elements which exist in the expanded state but not the collapsed state, try animating the opacity between 0 and 1 so they smoothly appear and disappear.

              For simplicity, you don't need to make the search fields actually work yet (i.e. accept user input). Just use View and Text and get it looking correct.

Hints

              It's probably easiest to build the entire header (including both transition states) in just this one component file. You'll want to set the style of each element you render to {`{position: 'absolute'}`}, and render in terms of absolute positions using {`{top, right, bottom, left'}`}, rather than using flexbox.

              You'll also want to use zIndex to make sure elements overlap in the correct way.

      </DefaultPage>
    )
  }
}


text:
Aria.tplScriptDefinition({
    $classpath : "test.aria.templates.textTemplates.complete.MainTextParentScript",
    $statics : {
        MY_STATIC : "MTPSstatic"
    },
    $prototype : {
        myTextScriptFunction : function () {
            return "myTextScriptFunction";
        }
    }
});


text:
(function () {
	'use strict';

	var chai = require('chai');
	var expect = chai.expect;
	var sinon = require('sinon');

	var controller = require('../../app/relationships/relationship.controller');
	var db = require('../../app/database/neo').db;

	describe('Relationship controller', function () {
		var req,
			res;

		beforeEach(function(){
			req = {
				body: {
					fromNode: {name: 'node1'},
					toNode: {name: 'node2'}
				}
			};
		});

		describe('When the first node is not found', function () {
			var find;

			beforeEach(function(){
				sinon.stub(db, 'save');
				find = sinon.stub(db, 'find');
			});

			afterEach(function(){
				db.save.restore();
				find.restore();
			});

			it('Should add a new node1', function () {
				find.withArgs({name: 'node1'}).callsArgWith(1, undefined, []);
				find.withArgs({name: 'node2'}).callsArgWith(1, undefined, [{name: 'node2', id: 1}]);

				controller.create(req, res);

				expect(db.save.calledWith({name: 'node1'}, 'State')).to.be.true;
			});
		});

		describe('When the first node is found', function () {
			var find;

			beforeEach(function(){
				sinon.stub(db, 'save');
				find = sinon.stub(db, 'find');
			});

			afterEach(function(){
				db.save.restore();
				find.restore();
			});

			it('Should not save the node', function () {
				find.withArgs({name: 'node1'}).callsArgWith(1, undefined, [{name: 'node1', id: 1}]);
				find.withArgs({name: 'node2'}).callsArgWith(1, undefined, [{name: 'node2', id: 1}]);

				controller.create(req, res);

				expect(db.save.calledWith({name: 'node1'}, 'State')).to.be.false;
			});
		});

		describe('When the second node is not found', function () {
			var find;

			beforeEach(function(){
				sinon.stub(db, 'save');
				find = sinon.stub(db, 'find');
			});

			afterEach(function(){
				db.save.restore();
				find.restore();
			});

			it('Should add a new node1', function () {
				find.withArgs({name: 'node2'}).callsArgWith(1, undefined, []);
				find.withArgs({name: 'node1'}).callsArgWith(1, undefined, [{name: 'node1', id: 1}]);

				controller.create(req, res);

				expect(db.save.calledWith({name: 'node2'}, 'State')).to.be.true;
			});
		});

		describe('When the second node is found', function () {
			var find;

			beforeEach(function(){
				sinon.stub(db, 'save');
				find = sinon.stub(db, 'find');
			});

			afterEach(function(){
				db.save.restore();
				find.restore();
			});

			it('Should not save the node', function () {
				find.withArgs({name: 'node2'}).callsArgWith(1, undefined, [{name: 'node2', id: 1}]);

				controller.create(req, res);

				expect(db.save.calledWith({name: 'node2'}, 'State')).to.be.false;
			});
		});

		describe('When both nodes are found', function () {
			var find;

			beforeEach(function(){
				sinon.stub(db, 'save');
				find = sinon.stub(db, 'find');
				sinon.stub(db, 'relate');

			});

			afterEach(function(){
				db.save.restore();
				find.restore();
				db.relate.restore();
			});

			it('Should create a new relationship', function (done) {

				var res = {
					sendStatus: function(){
						done();
						expect(db.relate.calledWith([1, 'called', 2])).to.be.true;
					}
				};

				find.withArgs({name: 'node1'}).callsArgWith(1, undefined, [{name: 'node1', id: 1}]);
				find.withArgs({name: 'node2'}).callsArgWith(1, undefined, [{name: 'node2', id: 2}]);

				controller.create(req, res);
			});
		});
	});
})();


text:
// This file contains the WebRTC suppressions for LeakSanitizer.
// You can also pass additional suppressions via LSAN_OPTIONS:
// LSAN_OPTIONS=suppressions=/path/to/suppressions. Please refer to
// http://dev.chromium.org/developers/testing/leaksanitizer for more info.

#if defined(LEAK_SANITIZER)

// Please make sure the code below declares a single string variable
// kLSanDefaultSuppressions which contains LSan suppressions delimited by
// newlines. See http://dev.chromium.org/developers/testing/leaksanitizer
// for the instructions on writing suppressions.
char kLSanDefaultSuppressions[] =

// ============ Leaks in third-party code shared with Chromium =============
// These entries are copied from build/sanitizers/lsan_suppressions.cc in
// Chromium. Please don't add new entries here unless they're present in there.

// False positives in libfontconfig. http://crbug.com/39050
"leak:libfontconfig\n"

// Leaks in Nvidia's libGL.
"leak:libGL.so\n"

// XRandR has several one time leaks.
"leak:libxrandr\n"

// xrandr leak. http://crbug.com/119677
"leak:XRRFindDisplay\n"

// ========== Leaks in third-party code not shared with Chromium ===========

// None known so far.

// ================ Leaks in WebRTC code ================
// PLEASE DO NOT ADD SUPPRESSIONS FOR NEW LEAKS.
// Instead, commits that introduce memory leaks should be reverted. Suppressing
// the leak is acceptable in some cases when reverting is impossible, i.e. when
// enabling leak detection for the first time for a test target with
// pre-existing leaks.

// rtc_unittest
// https://code.google.com/p/webrtc/issues/detail?id=3827 for details.
"leak:rtc::unstarted_task_test_DoNotDeleteTask2_Test::TestBody\n"
"leak:rtc::HttpServer::HandleConnection\n"
"leak:rtc::HttpServer::Connection::onHttpHeaderComplete\n"
"leak:rtc::HttpResponseData::set_success\n"
"leak:rtc::HttpData::changeHeader\n"
// https://code.google.com/p/webrtc/issues/detail?id=4149 for details.
"leak:StartDNSLookup\n"
// https://code.google.com/p/webrtc/issues/detail?id=2527
"leak:buzz::FakeXmppClient::SendStanza\n"
"leak:buzz::XmppTask::XmppTask\n"
"leak:HangoutPubSubClientTest::HangoutPubSubClientTest\n"
"leak:MucRoomConfigTaskTest::SetUp\n"
"leak:MucRoomDiscoveryTaskTest::SetUp\n"
"leak:MucRoomLookupTaskTest::SetUp\n"
"leak:MucRoomUniqueHangoutIdTaskTest::SetUp\n"
"leak:PingTaskTest::SetUp\n"
"leak:PingXmppClient::SendStanza\n"
"leak:PubSubClientTest::PubSubClientTest\n"
"leak:PubSubTasksTest::PubSubTasksTest\n"

// rtc_media_unittests
"leak:cricket::FakeNetworkInterface::SetOption\n"
"leak:CodecTest_TestCodecOperators_Test::TestBody\n"
"leak:VideoEngineTest*::ConstrainNewCodecBody\n"
"leak:VideoMediaChannelTest*::AddRemoveRecvStreams\n"
"leak:WebRtcVideoCapturerTest_TestCapture_Test::TestBody\n"
"leak:WebRtcVideoEngineTestFake_MultipleSendStreamsWithOneCapturer_Test::TestBody\n"
"leak:WebRtcVideoEngineTestFake_SetBandwidthInConference_Test::TestBody\n"
"leak:WebRtcVideoEngineTestFake_SetSendCodecsRejectBadFormat_Test::TestBody\n"

// peerconnection_unittests
// https://code.google.com/p/webrtc/issues/detail?id=2528
"leak:cricket::FakeVideoMediaChannel::~FakeVideoMediaChannel\n"
"leak:cricket::MediaSessionDescriptionFactory::CreateAnswer\n"
"leak:cricket::MediaSessionDescriptionFactory::CreateOffer\n"
"leak:DtmfSenderTest_InsertEmptyTonesToCancelPreviousTask_Test::TestBody\n"
"leak:sigslot::_signal_base2*::~_signal_base2\n"
"leak:testing::internal::CmpHelperEQ\n"
"leak:webrtc::AudioDeviceLinuxALSA::InitMicrophone\n"
"leak:webrtc::AudioDeviceLinuxALSA::InitSpeaker\n"
"leak:webrtc::CreateIceCandidate\n"
"leak:webrtc::FakeConstraints::AddOptional\n"
"leak:webrtc::WebRtcIdentityRequestObserver::OnSuccess\n"
"leak:webrtc::WebRtcSessionDescriptionFactory::InternalCreateAnswer\n"
"leak:webrtc::WebRtcSessionDescriptionFactory::InternalCreateOffer\n"
"leak:PeerConnectionInterfaceTest_SsrcInOfferAnswer_Test::TestBody\n"
"leak:PeerConnectionInterfaceTest_CloseAndTestMethods_Test::TestBody\n"
"leak:WebRtcSdpTest::TestDeserializeRtcpFb\n"
"leak:WebRtcSdpTest::TestSerialize\n"
"leak:WebRtcSdpTest_SerializeSessionDescriptionWithDataChannelAndBandwidth_Test::TestBody\n"
"leak:WebRtcSdpTest_SerializeSessionDescriptionWithBandwidth_Test::TestBody\n"
"leak:WebRtcSessionTest::SetLocalDescriptionExpectError\n"
"leak:WebRtcSessionTest_TestAVOfferWithAudioOnlyAnswer_Test::TestBody\n"

// PLEASE READ ABOVE BEFORE ADDING NEW SUPPRESSIONS.

// End of suppressions.
;  // Please keep this semicolon.

#endif  // LEAK_SANITIZER


text:
package pl.consdata.ico.sqcompanion.config.service.group;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import pl.consdata.ico.sqcompanion.config.AppConfig;
import pl.consdata.ico.sqcompanion.config.deserialization.GroupDeserializer;
import pl.consdata.ico.sqcompanion.config.model.GroupDefinition;
import pl.consdata.ico.sqcompanion.config.model.GroupLightModel;
import pl.consdata.ico.sqcompanion.config.service.SettingsService;
import pl.consdata.ico.sqcompanion.config.validation.ValidationResult;
import pl.consdata.ico.sqcompanion.config.validation.group.GroupValidator;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import static java.util.Optional.ofNullable;

@Service
@RequiredArgsConstructor
@Slf4j
public class GroupConfigService {

    private final AppConfig appConfig;
    private final GroupValidator validator;
    private final SettingsService settingsService;

    public ValidationResult create(String parentUuid, GroupDefinition groupDefinition) {
        ValidationResult validationResult = validator.validate(groupDefinition).and(validator.groupExists(parentUuid));
        if (validationResult.isValid()) {
            GroupDefinition parentGroup = this.appConfig.getGroup(parentUuid);
            if (parentGroup.getGroups() == null) {
                parentGroup.setGroups(new ArrayList<>());
            }
            GroupDeserializer.ensureParams(groupDefinition);
            parentGroup.getGroups().add(groupDefinition);
            return settingsService.save();
        } else {
            log.info("Invalid group definition {} reason: {}", groupDefinition, validationResult);
            return validationResult;
        }
    }

    public ValidationResult update(GroupDefinition groupDefinition) {
        ValidationResult validationResult = validator.validate(groupDefinition).and(validator.groupExists(groupDefinition.getUuid()));
        if (validationResult.isValid()) {
            GroupDefinition group = this.appConfig.getGroup(groupDefinition.getUuid());
            group.setName(groupDefinition.getName());
            group.setDescription(groupDefinition.getDescription());
            return settingsService.save();
        } else {
            log.info("Invalid group definition {} reason: {}", groupDefinition, validationResult);
            return validationResult;
        }
    }

    public ValidationResult delete(String parentUuid, String uuid) {
        ValidationResult validationResult = validator.groupExists(parentUuid);
        if (validationResult.isValid()) {
            GroupDefinition parentGroup = this.appConfig.getGroup(parentUuid);
            if (parentGroup.getGroups() != null) {
                parentGroup.getGroups().removeIf(group -> group.getUuid().equals(uuid));
            }
        } else {
            log.info("Invalid group uuid {} reason: {}", parentUuid, validationResult);
            return validationResult;
        }
        return settingsService.save();
    }

    public GroupDefinition get(String uuid) {
        return this.appConfig.getGroup(uuid);
    }

    public GroupDefinition getRootGroup() {
        return appConfig.getRootGroup();
    }

    public ValidationResult updateRootGroup(GroupDefinition groupDefinition) {
        ValidationResult validationResult = validator.validateRoot(groupDefinition);
        if (validationResult.isValid()) {
            this.appConfig.getRootGroup().setName(groupDefinition.getName());
            this.appConfig.getRootGroup().setDescription(groupDefinition.getDescription());
            return settingsService.save();
        } else {
            log.info("Invalid group definition {} reason: {}", groupDefinition, validationResult);
            return validationResult;
        }
    }

    public List<GroupDefinition> getSubgroups(String uuid) {
        return get(uuid).getGroups();
    }

    public ValidationResult updateSubgroups(String uuid, List<GroupDefinition> groupDefinitions) {
        ValidationResult validationResult = validator.validate(groupDefinitions);
        if (validationResult.isValid()) {
            GroupDefinition group = appConfig.getGroup(uuid);
            group.setGroups(groupDefinitions);
            return settingsService.save();
        } else {
            log.info("Unable to update subgroups, reason: {}", validationResult);
            return validationResult;
        }
    }

    public Optional<GroupDefinition> getGroupParent(String uuid) {
        return ofNullable(appConfig.getGroupParent(uuid));
    }

    public List<GroupLightModel> getAll() {
        return appConfig.getGroupList(appConfig.getRootGroup().getUuid(), appConfig.getRootGroup().getGroups());
    }
}


text:
package org.actorsguildframework;

import java.util.List;

import org.actorsguildframework.annotations.ConcurrencyModel;
import org.actorsguildframework.annotations.Message;
import org.actorsguildframework.annotations.Model;
import org.actorsguildframework.annotations.Prop;
import org.junit.Test;

/**
 * Tests various broken actors.
 */
public class BrokenStatelessActorTest {
	@Model(ConcurrencyModel.Stateless)
	public static class NonFinalFieldActor extends Actor {
		private int a;

		@Message public AsyncResult<Void> dummyMessage() { return noResult(); }
	}

	@Model(ConcurrencyModel.Stateless)
	public static class NonImmutableFieldActor extends Actor {
		private final List<?> a = null;

		@Message public AsyncResult<Void> dummyMessage() { return noResult(); }
	}

	@Model(ConcurrencyModel.Stateless)
	public static abstract class NonImmutablePropActor extends Actor {
		@Prop abstract Object getA();

		@Message public AsyncResult<Void> dummyMessage() { return noResult(); }
	}

	@Model(ConcurrencyModel.Stateless)
	public static abstract class ReadWritePropActor extends Actor {
		@Prop abstract int getA();
		abstract void setA(int a);

		@Message public AsyncResult<Void> dummyMessage() { return noResult(); }
	}

	@Model(ConcurrencyModel.Stateless)
	public static class InheritingNonFinalFieldActor extends NonFinalFieldActor {
		@Message public AsyncResult<Void> dummyMessage2() { return noResult(); }
	}

	@Model(ConcurrencyModel.Stateless)
	public static abstract class InheritingReadWritePropActor extends ReadWritePropActor {
		@Message public AsyncResult<Void> dummyMessage2() { return noResult(); }
	}

	@Test(expected=ConfigurationException.class)
	public void testNonFinalField() {
		DefaultAgent a = new DefaultAgent();
		a.create(NonFinalFieldActor.class);
	}

	@Test(expected=ConfigurationException.class)
	public void testNonImmutableField() {
		DefaultAgent a = new DefaultAgent();
		a.create(NonImmutableFieldActor.class);
	}

	@Test(expected=ConfigurationException.class)
	public void testNonImmutableProp() {
		DefaultAgent a = new DefaultAgent();
		a.create(NonImmutablePropActor.class);
	}

	@Test(expected=ConfigurationException.class)
	public void testReadWriteProp() {
		DefaultAgent a = new DefaultAgent();
		a.create(ReadWritePropActor.class);
	}

	@Test(expected=ConfigurationException.class)
	public void testInheritingNonFinalField() {
		DefaultAgent a = new DefaultAgent();
		a.create(InheritingNonFinalFieldActor.class);
	}

	@Test(expected=ConfigurationException.class)
	public void testInheritingReadWriteProp() {
		DefaultAgent a = new DefaultAgent();
		a.create(InheritingReadWritePropActor.class);
	}
}


text:
(function(){
  'use strict';

  angular.module('app').controller('ToastShowCtrl', ToastShowCtrl);

    ToastShowCtrl.$inject = ['$scope', '$mdToast'];

    function ToastShowCtrl($scope, $mdToast){
      $scope.closeToast = function() {
        $mdToast.hide();
      };
    }
})();


text:
package wurmcraft.wurmatron.common.items;

import com.bioxx.tfc.api.Enums.EnumFoodGroup;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.EnumHelper;

import java.util.ArrayList;
import java.util.HashMap;

public class WTItems {

		public static ArrayList<String> itemMaterialNames = new ArrayList<String>();
		public static ArrayList<String> itemSpecialNames = new ArrayList<String>();
		public static ArrayList<String> itemBasicFoodNames = new ArrayList<String>();
		public static ArrayList<String> itemPillNames = new ArrayList<String>();
		public static ArrayList<String> itemClumpNames = new ArrayList<String>();
		public static ArrayList<String> itemCrystalNames = new ArrayList<String>();
		public static ArrayList<String> itemShardNames = new ArrayList<String>();
		public static ArrayList<String> itemDirtyNames = new ArrayList<String>();
		public static ArrayList<String> itemCastNames = new ArrayList<String>();
		public static ArrayList<String> itemMetalCastNames = new ArrayList<String>();
		public static ArrayList<String> itemTokenNames = new ArrayList<String>();

		public static HashMap<String, EnumChatFormatting> itemSpecialColors = new HashMap<String, EnumChatFormatting>();
		public static HashMap<String, EnumFoodGroup[]> itemBasicFoodGroups = new HashMap<String, EnumFoodGroup[]>();
		public static HashMap<String, EnumFoodGroup[]> itemPillFoodGroups = new HashMap<String, EnumFoodGroup[]>();
		public static HashMap<String, EnumChatFormatting> itemTokenColors = new HashMap<String, EnumChatFormatting>();

		public static Item itemMaterial;
		public static Item itemSpecial;
		public static Item itemBasicFood;
		public static Item itemPill;
		public static ItemWaterJug itemJug_2;
		public static ItemWaterJug itemJug_4;
		public static ItemWaterJug itemJug_6;
		public static ItemWaterJug itemJug_12;
		public static ItemWaterJug itemJug_24;
		public static ItemWaterJug itemJug_48;
		public static Item itemCast;
		public static Item itemMetalCast;
		public static Item itemToken;
		// Credits
		public static Item creditBismuth;
		public static Item creditCopper;
		public static Item creditGold;
		public static Item creditIron;
		public static Item creditLead;
		public static Item creditNickel;
		public static Item creditPlatinum;
		public static Item creditSilver;
		public static Item creditTin;
		public static Item creditZinc;
		// Processing Items
		public static Item itemClump;
		public static Item itemCrystal;
		public static Item itemShard;
		public static Item itemDirty;
		// Dark Matter
		public static Item helmetDarkMatter;
		public static Item chestDarkMatter;
		public static Item leggsDarkMatter;
		public static Item bootsDarkMatter;
		public static final ItemArmor.ArmorMaterial DARKMATTER = EnumHelper.addArmorMaterial("DARKMATTER", -1, new int[] {90, 90, 90, 90}, 500);
		// Red Matter
		public static Item helmetRedMatter;
		public static Item chestRedMatter;
		public static Item leggsRedMatter;
		public static Item bootsRedMatter;
		public static final ItemArmor.ArmorMaterial REDMATTER = EnumHelper.addArmorMaterial("REDMATTER", -1, new int[] {90, 90, 90, 90}, 500);

		public static void registerItems () {
				itemMaterialNames.add("solarCore");
				itemMaterialNames.add("craftingCore");
				itemMaterialNames.add("greenSteel");
				itemMaterialNames.add("energyReactor");
				itemMaterialNames.add("mixedSheet");
				itemMaterialNames.add("pinkSteel");
				itemMaterialNames.add("yellowSteel");
				itemMaterialNames.add("orangeSteel");
				itemMaterialNames.add("purpleSteel");
				itemMaterialNames.add("cyanSteel");
				itemMaterialNames.add("brownSteel");
				itemMaterialNames.add("graySteel");
				itemMaterialNames.add("rainbowSteel");
				itemMaterialNames.add("magicChunk");
				itemMaterialNames.add("quantumCore");
				itemMaterialNames.add("quantumSingularity");
				itemMaterialNames.add("quantumFoam");
				itemMaterialNames.add("halfium");
				itemMaterialNames.add("titanium");
				itemMaterialNames.add("francium");
				itemMaterialNames.add("autocore");
				itemMaterialNames.add("radiationShielding");
				itemMaterialNames.add("stableMagicEssence");
				itemMaterialNames.add("bloodInfused");
				itemMaterialNames.add("natureCore");
				itemMaterialNames.add("natureCoreMK2");
				itemMaterialNames.add("antimatter");
				itemMaterialNames.add("engineCoil");
				itemMaterialNames.add("quarryCore");
				itemMaterialNames.add("gearMixedSheet");
				itemMaterialNames.add("miningCore");
				itemMaterialNames.add("refiningModule");
				itemMaterialNames.add("computationalCore");
				itemMaterialNames.add("machineFrame");
				itemMaterialNames.add("spaceModule");
				itemMaterialNames.add("unstableMatter");
				itemMaterialNames.add("jetpackParts");
				itemMaterialNames.add("electroMagneticShielding");
				itemMaterialNames.add("electroShielding");
				itemMaterialNames.add("wandParts");
				itemMaterialNames.add("pumpkinBits");
				itemMaterialNames.add("mixedGemFlawed");
				itemMaterialNames.add("mixedGem");
				itemMaterialNames.add("mixedGemFlawless");
				itemMaterialNames.add("mixedGemExquisite");
				registerItem(itemMaterial = new ItemMaterial(itemMaterialNames, "itemMaterial"), "itemMaterial");
				itemSpecialColors.put("creativeParts", EnumChatFormatting.DARK_PURPLE);
				itemSpecialColors.put("redMatter", EnumChatFormatting.DARK_RED);
				itemSpecialColors.put("darkMatter", EnumChatFormatting.DARK_PURPLE);
				itemSpecialColors.put("creativePartsEnergy", EnumChatFormatting.DARK_PURPLE);
				itemSpecialNames.add("darkMatter");
				itemSpecialNames.add("redMatter");
				itemSpecialNames.add("creativeParts");
				itemSpecialNames.add("creativePartsEnergy");
				registerItem(itemSpecial = new ItemSpecial(itemSpecialNames, itemSpecialColors).setUnlocalizedName("itemSpecial"), "itemSpecial");
				itemBasicFoodGroups.put("foodFruit", new EnumFoodGroup[] {EnumFoodGroup.Fruit});
				itemBasicFoodGroups.put("foodGrain", new EnumFoodGroup[] {EnumFoodGroup.Grain});
				itemBasicFoodGroups.put("foodProtein", new EnumFoodGroup[] {EnumFoodGroup.Protein});
				itemBasicFoodGroups.put("foodVegetable", new EnumFoodGroup[] {EnumFoodGroup.Vegetable});
				itemBasicFoodGroups.put("foodDairy", new EnumFoodGroup[] {EnumFoodGroup.Dairy});
				itemBasicFoodGroups.put("humanSoul", new EnumFoodGroup[] {EnumFoodGroup.Protein});
				itemBasicFoodGroups.put("melonBread", new EnumFoodGroup[] {EnumFoodGroup.Grain});
				itemBasicFoodGroups.put("galaxyBaggel", new EnumFoodGroup[] {EnumFoodGroup.Grain, EnumFoodGroup.Dairy});
				itemBasicFoodGroups.put("deathMelon", new EnumFoodGroup[] {EnumFoodGroup.Grain, EnumFoodGroup.Grain});
				itemBasicFoodGroups.put("wurm", new EnumFoodGroup[] {EnumFoodGroup.Grain, EnumFoodGroup.Fruit, EnumFoodGroup.Protein, EnumFoodGroup.Vegetable, EnumFoodGroup.Dairy});
				itemBasicFoodNames.add("foodFruit");
				itemBasicFoodNames.add("foodGrain");
				itemBasicFoodNames.add("foodProtein");
				itemBasicFoodNames.add("foodVegetable");
				itemBasicFoodNames.add("foodDairy");
				itemBasicFoodNames.add("humanSoul");
				itemBasicFoodNames.add("melonBread");
				itemBasicFoodNames.add("galaxyBaggel");
				itemBasicFoodNames.add("deathMelon");
				itemBasicFoodNames.add("wurm");
				registerItem(itemBasicFood = new ItemBasicTFCFood(itemBasicFoodNames, itemBasicFoodGroups), "iemBasicFood");
				itemPillFoodGroups.put("pillFruit", new EnumFoodGroup[] {EnumFoodGroup.Fruit});
				itemPillFoodGroups.put("pillGrain", new EnumFoodGroup[] {EnumFoodGroup.Grain});
				itemPillFoodGroups.put("pillProtein", new EnumFoodGroup[] {EnumFoodGroup.Protein});
				itemPillFoodGroups.put("pillVegetable", new EnumFoodGroup[] {EnumFoodGroup.Vegetable});
				itemPillFoodGroups.put("pillDairy", new EnumFoodGroup[] {EnumFoodGroup.Dairy});
				itemPillFoodGroups.put("pillAll", new EnumFoodGroup[] {EnumFoodGroup.Dairy, EnumFoodGroup.Fruit, EnumFoodGroup.Grain, EnumFoodGroup.Protein, EnumFoodGroup.Vegetable});
				itemPillNames.add("pillFruit");
				itemPillNames.add("pillGrain");
				itemPillNames.add("pillProtein");
				itemPillNames.add("pillVegetable");
				itemPillNames.add("pillDairy");
				itemPillNames.add("pillAll");
				registerItem(itemPill = new ItemPill(itemPillNames, itemPillFoodGroups), "itemPill");
				itemClumpNames.add("clumpBismuth");
				itemClumpNames.add("clumpCopper");
				itemClumpNames.add("clumpGold");
				itemClumpNames.add("clumpIron");
				itemClumpNames.add("clumpLead");
				itemClumpNames.add("clumpNickel");
				itemClumpNames.add("clumpPlatinum");
				itemClumpNames.add("clumpSilver");
				itemClumpNames.add("clumpTin");
				itemClumpNames.add("clumpZinc");
				registerItem(itemClump = new ItemClump(itemClumpNames), "itemClump");
				itemCrystalNames.add("crystalBismuth");
				itemCrystalNames.add("crystalCopper");
				itemCrystalNames.add("crystalGold");
				itemCrystalNames.add("crystalIron");
				itemCrystalNames.add("crystalLead");
				itemCrystalNames.add("crystalNickel");
				itemCrystalNames.add("crystalPlatinum");
				itemCrystalNames.add("crystalSilver");
				itemCrystalNames.add("crystalTin");
				itemCrystalNames.add("crystalZinc");
				registerItem(itemCrystal = new ItemCrystal(itemCrystalNames), "itemCrystal");
				itemShardNames.add("shardBismuth");
				itemShardNames.add("shardCopper");
				itemShardNames.add("shardGold");
				itemShardNames.add("shardIron");
				itemShardNames.add("shardLead");
				itemShardNames.add("shardNickel");
				itemShardNames.add("shardPlatinum");
				itemShardNames.add("shardSilver");
				itemShardNames.add("shardTin");
				itemShardNames.add("shardZinc");
				registerItem(itemShard = new ItemShard(itemShardNames), "itemShard");
				itemDirtyNames.add("dirtyBismuth");
				itemDirtyNames.add("dirtyCopper");
				itemDirtyNames.add("dirtyGold");
				itemDirtyNames.add("dirtyIron");
				itemDirtyNames.add("dirtyLead");
				itemDirtyNames.add("dirtyNickel");
				itemDirtyNames.add("dirtyPlatinum");
				itemDirtyNames.add("dirtySilver");
				itemDirtyNames.add("dirtyTin");
				itemDirtyNames.add("dirtyZinc");
				registerItem(itemDirty = new ItemDirty(itemDirtyNames), "itemDirty");
				registerItem(itemJug_2 = new ItemWaterJug(2), "itemJug_2");
				registerItem(itemJug_4 = new ItemWaterJug(4), "itemJug_4");
				registerItem(itemJug_6 = new ItemWaterJug(6), "itemJug_6");
				registerItem(itemJug_12 = new ItemWaterJug(12), "itemJug_12");
				registerItem(itemJug_24 = new ItemWaterJug(24), "itemJug_24");
				registerItem(itemJug_48 = new ItemWaterJug(48), "itemJug_48");
				registerItem(creditBismuth = new ItemCredit("bismuthCredit"), "creditBismuth");
				registerItem(creditCopper = new ItemCredit("copperCredit"), "creditCopper");
				registerItem(creditGold = new ItemCredit("goldCredit"), "creditGold");
				registerItem(creditIron = new ItemCredit("ironCredit"), "creditIron");
				registerItem(creditLead = new ItemCredit("leadCredit"), "creditLead");
				registerItem(creditNickel = new ItemCredit("nickelCredit"), "creditNickel");
				registerItem(creditPlatinum = new ItemCredit("platinumCredit"), "creditPlatinum");
				registerItem(creditSilver = new ItemCredit("silverCredit"), "creditSilver");
				registerItem(creditTin = new ItemCredit("tinCredit"), "creditTin");
				registerItem(creditZinc = new ItemCredit("zincCredit"), "creditZinc");
				itemCastNames.add("doubleIngotCast");
				itemCastNames.add("sheetCast");
				itemCastNames.add("2xsheetCast");
				itemCastNames.add("javelinCast");
				itemCastNames.add("proPickCast");
				itemCastNames.add("pickCast");
				itemCastNames.add("scytheCast");
				itemCastNames.add("hammerCast");
				itemCastNames.add("axeCast");
				itemCastNames.add("shovelCast");
				itemCastNames.add("swordCast");
				itemCastNames.add("sawCast");
				itemCastNames.add("knifeCast");
				itemCastNames.add("tuyereCast");
				itemCastNames.add("hoeCast");
				itemCastNames.add("iceSawCast");
				itemCastNames.add("linkCast");
				itemCastNames.add("boltCast");
				itemCastNames.add("arrowHeadCast");
				itemCastNames.add("warHammerCast");
				itemCastNames.add("poniardCast");
				itemCastNames.add("chiselCast");
				itemCastNames.add("maceCast");
				itemCastNames.add("halberdCast");
				registerItem(itemCast = new ItemMaterial(itemCastNames, "itemCast"), "itemCast");
				itemMetalCastNames.add("metalEmpty");
				itemMetalCastNames.add("metalBismuth");
				itemMetalCastNames.add("metalBismuthBronze");
				itemMetalCastNames.add("metalBlackBronze");
				itemMetalCastNames.add("metalBlackSteel");
				itemMetalCastNames.add("metalBlueSteel");
				itemMetalCastNames.add("metalBrass");
				itemMetalCastNames.add("metalBronze");
				itemMetalCastNames.add("metalCopper");
				itemMetalCastNames.add("metalGold");
				itemMetalCastNames.add("metalIron");
				itemMetalCastNames.add("metalLead");
				itemMetalCastNames.add("metalNickel");
				itemMetalCastNames.add("metalPigIron");
				itemMetalCastNames.add("metalPlatinum");
				itemMetalCastNames.add("metalRedSteel");
				itemMetalCastNames.add("metalRoseGold");
				itemMetalCastNames.add("metalSilver");
				itemMetalCastNames.add("metalSteel");
				itemMetalCastNames.add("metalSterlingSilver");
				itemMetalCastNames.add("metalTin");
				itemMetalCastNames.add("metalZinc");
				registerItem(itemMetalCast = new ItemMaterial(itemMetalCastNames, "itemMetalCast"), "itemMetalCast");
				itemTokenNames.add("token");
				itemTokenColors.put("token", EnumChatFormatting.LIGHT_PURPLE);
				registerItem(itemToken = new ItemToken(itemTokenNames, itemTokenColors).setUnlocalizedName("token"), "token");
				registerItem(helmetDarkMatter = new ArmorDarkMatter(DARKMATTER, 0, 0).setUnlocalizedName("helmetDarkMatter"), "helmetDarkMatter");
				registerItem(chestDarkMatter = new ArmorDarkMatter(DARKMATTER, 0, 1).setUnlocalizedName("chestDarkMatter"), "chestDarkMatter");
				registerItem(leggsDarkMatter = new ArmorDarkMatter(DARKMATTER, 1, 2).setUnlocalizedName("leggingsDarkMatter"), "leggingsDarkMatter");
				registerItem(bootsDarkMatter = new ArmorDarkMatter(DARKMATTER, 0, 3).setUnlocalizedName("bootsDarkMatter"), "bootDarkMatter");
				registerItem(helmetRedMatter = new ArmorRedMatter(REDMATTER, 0, 0).setUnlocalizedName("helmetRedMatter"), "helmetRedMatter");
				registerItem(chestRedMatter = new ArmorRedMatter(REDMATTER, 0, 1).setUnlocalizedName("chestRedMatter"), "chestRedMatter");
				registerItem(leggsRedMatter = new ArmorRedMatter(REDMATTER, 1, 2).setUnlocalizedName("leggingsRedMatter"), "leggingsRedMatter");
				registerItem(bootsRedMatter = new ArmorRedMatter(REDMATTER, 0, 3).setUnlocalizedName("bootsRedMatter"), "bootsRedMatter");
		}

		private static void registerItem (Item item, String name) {
				GameRegistry.registerItem(item, name);
		}
}


text:
package com.lingju.util;

import android.util.Log;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lingju.assistant.entity.action.PlayerEntity;

import org.json.JSONArray;
import org.json.JSONException;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Ken on 2016/12/14.
 */
public class JsonUtils {

    public static final String DATE_FROMAT = "EEE MMM dd HH:mm:ss z yyyy";
    /**
     * 解析单个json
     **/
    public static <T> T getObj(String json, Class<T> clazz) {
        Gson gson = new GsonBuilder()
                .setDateFormat(DATE_FROMAT)
                .create();
        T t = gson.fromJson(json, clazz);
        return t;
    }

    public static <T> PlayerEntity<T> getPlayerEntity(String json, Class<T> clazz) {
        Gson gson = new GsonBuilder()
                .setDateFormat(DATE_FROMAT)
                .create();
        Type type = new ParameterizedTypeImpl(PlayerEntity.class, new Type[]{clazz});
        return gson.fromJson(json, type);
    }

    /**
     * 解析json数组
     **/
    public static <T> List<T> getList(String jsonArray, Class<T> clazz) {
        Gson gson = new GsonBuilder()
                .setDateFormat(DATE_FROMAT)
                .create();
        List<T> list = new ArrayList<>();
        try {
            JSONArray json = new JSONArray(jsonArray);
            for (int i = 0; i < json.length(); i++) {
                T t = gson.fromJson(json.getString(i), clazz);
                list.add(t);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }

    /**
     * 将对象封装成JsonArray对象
     **/
    public static <T> JSONArray bean2JsonArray(List<T> list) {
        try {
            Gson gson = new GsonBuilder()
                    .setDateFormat(DATE_FROMAT)
                    .create();
            String jsonArray = gson.toJson(list);
            JSONArray json = new JSONArray(jsonArray);
            Log.i("LingJu", "json字符串:" + json.toString());
            return json;
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }
}


text:
package org.apache.hyracks.storage.am.common.dataflow;

import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.IOperatorNodePushable;
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider;
import org.apache.hyracks.api.dataflow.value.ITypeTraits;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.job.IOperatorDescriptorRegistry;
import org.apache.hyracks.data.std.primitive.IntegerPointable;
import org.apache.hyracks.dataflow.std.file.IFileSplitProvider;
import org.apache.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import org.apache.hyracks.storage.am.common.api.IPageManagerFactory;
import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallbackFactory;
import org.apache.hyracks.storage.common.IStorageManager;
import org.apache.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;

public class IndexDropOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {

    private static final long serialVersionUID = 1L;

    public IndexDropOperatorDescriptor(IOperatorDescriptorRegistry spec, IStorageManager storageManager,
            IIndexLifecycleManagerProvider lifecycleManagerProvider, IFileSplitProvider fileSplitProvider,
            IIndexDataflowHelperFactory dataflowHelperFactory, IPageManagerFactory pageManagerFactory) {
        // TODO: providing the type traits below is a hack to allow:
        // 1) Type traits not to be specified when creating the drop operator
        // 2) The LSMRTreeDataflowHelper to get acceptable type traits
        // This should eventually not be *hacked*, but I don't know the proper fix yet. -zheilbron
        super(spec, 0, 0, null, storageManager, lifecycleManagerProvider, fileSplitProvider, new ITypeTraits[] {
                IntegerPointable.TYPE_TRAITS, IntegerPointable.TYPE_TRAITS },
                new IBinaryComparatorFactory[] { null }, null, dataflowHelperFactory, null, false, false,
                null, NoOpLocalResourceFactoryProvider.INSTANCE, NoOpOperationCallbackFactory.INSTANCE,
                NoOpOperationCallbackFactory.INSTANCE, pageManagerFactory);
    }

    @Override
    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
        return new IndexDropOperatorNodePushable(this, ctx, partition);
    }
}


text:
#include <LuminoEditor/Plugin.hpp>
#include "AssetEditor/AssetEditorModel.hpp"
#include "StartupView.hpp"
#include "ToolPanesArea.hpp"
#include "DocumentManager.hpp"

//==============================================================================
// Document

Document::Document()
{
}

ln::Result Document::init()
{
    Object::init();
    m_mainFrame = ln::makeObject<ln::UIContainerElement>();

    // SaveCommand などは m_mainFrame にアタッチしたい。
    // m_mainFrame が focus を持てるようにしておかないと、もし Document 内に Focusable な UIElement が1つも無いと、
    // コマンドを実行できなくなる。
    m_mainFrame->setFocusable(true);

    //m_mainFrame->getGridLayoutInfo()->layoutWeight = 1; // fill in box layout
    return true;
}

//bool Document::close()
//{
//	return onClosing();
//}

bool Document::onClosing()
{
	return true;
}

//==============================================================================
// DocumentManager

DocumentManager::DocumentManager()
{
}

ln::Result DocumentManager::init()
{
    UIControl::init();
    //setLayoutPanel(ln::makeObject<ln::UIVBoxLayout>());

    m_mainLayout = ln::makeObject<ln::UIBoxLayout3>();
    //addElement(m_mainLayout);

    m_documentTabBar = ln::makeObject<ln::UITabBar>();
    m_documentTabBar->setVAlignment(ln::VAlignment::Top);
    m_documentTabBar->connectOnSelectionChanged(ln::bind(this, &DocumentManager::documentTabBar_SelectionChanged));
    m_documentTabBar->setBackgroundColor(ln::Color::Azure);
    //m_documentTabBar->setHeight(30);
    //m_documentTabBar->setVisibility(ln::UIVisibility::Collapsed);
	m_documentTabBar->getGridLayoutInfo()->layoutWeight = 0;	// 'auto'
    m_mainLayout->addChild(m_documentTabBar);

    m_switchLayout = ln::makeObject<ln::UISwitchLayout>();
    m_switchLayout->setActiveIndex(-1);
    m_switchLayout->getGridLayoutInfo()->layoutWeight = 1;  // fill in box layout
    m_mainLayout->addChild(m_switchLayout);

    m_startupView = ln::makeObject<StartupView>();
    addElement(m_startupView);
    //m_startupView->setHeight(300);
    //m_mainLayout->addChild(m_startupView);

    m_modePanesArea = ln::makeObject<ToolPanesArea>();
    m_toolPanesArea = ln::makeObject<ToolPanesArea>();
    m_inspectorPanesArea = ln::makeObject<ToolPanesArea>();

    return true;
}

void DocumentManager::addDocument(Document* doc)
{
    if (m_documents.size() == 0) {
        removeElement(m_startupView);
        addElement(m_mainLayout);
    }

    m_documents.add(doc);
    m_switchLayout->addChild(doc->mainFrame());

	auto tab = ln::makeObject2<DocumentTab>(doc);
	m_documentTabs.add(tab);

    m_documentTabBar->addTab(tab);
    m_documentTabBar->setSelectedTab(tab);
}

void DocumentManager::removeDocument(Document* doc)
{
	for (auto& tab : m_documentTabs) {
		if (tab->document() == doc) {
			m_documentTabs.remove(tab);
			m_switchLayout->removeChild(doc->mainFrame());
			m_documentTabBar->removeTab(tab);
			break;
		}
	}
}

void DocumentManager::setActiveDocument(Document* doc)
{
    if (doc) {
        m_activeDocument = doc;
        m_switchLayout->setActive(doc->mainFrame());

        if (auto assetEditorDoc = dynamic_cast<AssetEditorDocument*>(doc)) {
            auto list = assetEditorDoc->editor()->getEditorPanes(lna::EditorPaneKind::Mode);
            if (list) {
                for (auto& pane : list) {
                    m_modePanesArea->addPane(pane);
                }
            }
            list = assetEditorDoc->editor()->getEditorPanes(lna::EditorPaneKind::Inspector);
            if (list) {
                for (auto& pane : list) {
                    m_inspectorPanesArea->addPane(pane);
                }
            }
            list = assetEditorDoc->editor()->getEditorPanes(lna::EditorPaneKind::Tool);
            if (list) {
                for (auto& pane : list) {
                    m_toolPanesArea->addPane(pane);
                }
            }
        }

        m_activeDocument->mainFrame()->focus();
    }
    else {
        LN_NOTIMPLEMENTED();
    }
}

bool DocumentManager::closeAllTabs()
{
	auto closeList = m_documentTabs;
	for (auto& tab : closeList) {
		if (tab->document()->onClosing()) {
			removeDocument(tab->document());
		}
		else {
			return false;
		}
	}
	return true;
}

void DocumentManager::documentTabBar_SelectionChanged(ln::UISelectionChangedEventArgs* e)
{
    auto tab = m_documentTabBar->selectedTab();
    auto doc = tab->data()->getObject<Document>();
    setActiveDocument(doc);
}

//==============================================================================
// AssetEditorDocument

AssetEditorDocument::AssetEditorDocument()
{
}

ln::Result AssetEditorDocument::init(ln::AssetModel* asset, lna::AssetEditorModel* editorModel)
{
    if (!Document::init()) return false;
    m_asset = asset;
    m_editor = editorModel;

    m_editor->onOpened(m_asset, mainFrame());
    return true;
}

//==============================================================================
// DocumentTab

DocumentTab::DocumentTab(Document* document)
	: m_document(document)
{
	//auto tab = ln::makeObject<ln::UITabItem>();
	auto text = ln::makeObject<ln::UITextBlock>();
	text->setText(u"Tab");  // TODO: AssetEditor から、Document 経由で設定したい。プロパティ変更を scribe する必要があるかも。
	/*tab->*/addElement(text);
	/*tab->*/setData(ln::makeVariant(document));
}


text:
% TITLE: Lipsum text with two figures and math
% AUTHOR: Adrian Schrader
% Created on: 31/7/15

\section{Figures}
\subsection{Column wide figure}
\lipsum[1]
\lipsum*[2]\footnote{This is an unnecessary footnote. Thanks!}

\begin{figure}[h]
  \centering
  \includegraphics[width=\linewidth]{img/plot}
  \caption{Plot of of $ f(t) $ in Maple}~\label{img:function}
\end{figure}

\lipsum[3]
\lipsum[4]

\subsection{Page wide figure}
\lipsum[5]

\begin{figure*}[ht]
  \centering
  \includegraphics[width=\linewidth]{img/example2}
  \caption{Another Random cat picture from Google \protect\url{https://static.pexels.com/photos/4067/animal-pet-cute-cat.jpg}}~\label{img:cat2}
\end{figure*}

\section{Typesetting}
\lipsum[6]

\subsection{Formula and Equations}
\begin{align}
    f(t) &= s_0 \cdot e^{-\frac{t}{\tau}} \cdot \cos(\omega_s t) \cdot \Theta(t) \nonumber \\
    &= s_0 \cdot e^{-\frac{t}{\tau}} \cdot \frac{1}{2} \Big( e^{i \omega_s t} + e^{-i \omega_s t} \Big) \cdot \Theta(t)\\
    \tilde{f}(\omega) &= \mathcal{F}(f)(\omega) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} f(t) \cdot e^{-i \omega t} dt \nonumber \\
    &= \frac{s_0}{\sqrt{2\pi}} \frac{\frac{1}{\tau} + i \omega}{ {( \frac{1}{\tau} + i \omega )}^2 + \omega_s^2}
\end{align}

\subsection{Source code}
\begin{listing}
  \begin{minted}{java}
    public static void main(String[] args) {
      return;
    }
  \end{minted}
  \caption{Standard main method of every java program}~\label{lst:javamain}
\end{listing}

\lipsum[9-14]
\lipsum[2]~\cite{book:handbook}


text:
"use strict";

var gulp = require('gulp'),
    vinylPaths = require('vinyl-paths'),
    del = require('del'),
    bower = require('gulp-bower'),
    livereload = require('gulp-livereload'),
    rename = require('gulp-rename'),
    es = require('event-stream'),
    rs = require('run-sequence'),

    minifyCss = require('gulp-minify-css'),
    usemin = require('gulp-usemin'),
    uglify = require('gulp-uglify'),
    minifyHtml = require('gulp-minify-html'),

    ngmin = require('gulp-ng-annotate'),
    connect = require('gulp-connect'),
    proxy = require('proxy-middleware'),
    flatten = require('gulp-flatten'),
    replace = require('gulp-replace');

var webRoot = 'web/',
    folders = {
        resource : 'src/SymfonyAngularSeed/FrontendBundle/Resources/web/',
        index :  'src/SymfonyAngularSeed/FrontendBundle/Resources/views/Default/',
	    tmp : webRoot + '.tmp/',
        node : 'node_modules/',
        symfony_vendor : 'vendor/',
        bin : 'bin/',
        lib : 'lib/',
        css : 'css/',
        images : 'images/',
        scripts : 'scripts/',
        views : 'views/'
    },
    files = {
        index: 'index.html.twig'
    };

// Clean Tasks
gulp.task('clean:lib', function() {
	return gulp.src(webRoot + folders.lib, { read : false })
        .pipe(vinylPaths(del));
});

gulp.task('clean:resource', function() {
	return gulp.src([
        webRoot + folders.css,
        webRoot + folders.images,
        webRoot + folders.scripts,
        webRoot + folders.views
    ], { read : false }).pipe(vinylPaths(del));
});

gulp.task('clean:tmp', function() {
	return gulp.src(folders.tmp, { read : false })
        .pipe(vinylPaths(del));
});

gulp.task('clean:tmp:usemin', function() {
	return gulp.src([
        folders.tmp + folders.scripts,
        folders.tmp + files.index
    ], { read : false }).pipe(vinylPaths(del));
});

gulp.task('clean:tmp:others', function() {
	return gulp.src([
        folders.tmp + folders.images,
        folders.tmp + folders.css,
        folders.tmp + folders.views
    ], { read : false }).pipe(vinylPaths(del));
});

gulp.task('clean:bower', function() {
	return gulp.src([
        folders.resource + folders.lib + '*',
        '!' + folders.resource + folders.lib + '.gitkeep',
    ], { read : false }).pipe(vinylPaths(del));

});

gulp.task('clean:node', function() {
	return gulp.src(folders.node, { read : false })
        .pipe(vinylPaths(del));
});

gulp.task('clean:symfony', function() {
	return gulp.src([folders.bin, folders.symfony_vendor ], { read : false 	})
        .pipe(vinylPaths(del));
});

gulp.task('clean:index', function() {
	return gulp.src(folders.index + files.index, { read : false })
        .pipe(vinylPaths(del));
});

// Tasks
gulp.task('resources:dev', [ 'clean:resource' ], function() {
	return gulp.src([
        folders.resource + folders.css + '**/*.css',
        folders.resource + folders.images + '**/*',
        folders.resource + folders.scripts + '**/*.js',
        folders.resource + folders.views + '**/*.html'
    ], { base : folders.resource }).pipe(gulp.dest(webRoot));
});

gulp.task('lib:dev', [ 'clean:lib' ], function() {
	return gulp.src(folders.resource + folders.lib + '**/*', { base : folders.resource })
        .pipe(gulp.dest(webRoot));
});

gulp.task('index:dev', [ 'clean:index' ], function() {
	return gulp.src(folders.index + files.index + '.dist')
        .pipe(replace(/<script data-usemin=\"js_vendor\" src=\"([0-9a-zA-Z\-_\s\.\/]*)\"><\/script>/g,
            '<script src="{{ asset(\'$1\') }}"></script>'))
        .pipe(replace(/<script data-usemin=\"js_app\" src=\"([0-9a-zA-Z\-_\s\.\/]*)\"><\/script>/g,
            '<script src="{{ asset(\'$1\') }}"></script>'))
        .pipe(rename(files.index))
        .pipe(gulp.dest(folders.index));
});

gulp.task('usemin:index', [ 'clean:tmp:usemin' ], function() {
    return gulp.src(folders.index + files.index + '.dist')
        .pipe(replace(/<script data-usemin=\"js_vendor\" src=\"([0-9a-zA-Z\-_\s\.\/]*)\.js\"><\/script>/g,
            '<script src="../../' + folders.resource + '$1.min.js"></script>'))
        .pipe(replace(/<script data-usemin=\"js_app\" src=\"([0-9a-zA-Z\-_\s\.\/]*)\.js\"><\/script>/g,
            '<script src="../../' + folders.resource + '$1.js"></script>'))
        .pipe(gulp.dest(folders.tmp));
});

gulp.task('usemin', [ 'usemin:index' ], function() {
    return gulp.src(folders.tmp + files.index + '.dist').pipe(usemin({
            html : [ minifyHtml({
                empty : true,
                conditionals : true,
                spare : true,
                quotes : true
            })],
            js_vendor : [ 'concat' ],
            js_app : [ ngmin(), uglify(), 'concat' ]
        }))
        .pipe(gulp.dest(folders.tmp));
});

gulp.task('resources:others', [ 'clean:tmp:others' ], function() {
	return gulp.src([
        folders.resource + folders.css + '**/*.css',
        folders.resource + folders.images + '**/*',
        folders.resource + folders.views + '**/*.html'
    ], { base : folders.resource }).pipe(gulp.dest(folders.tmp));
});

gulp.task('resources', [ 'usemin', 'resources:others', 'clean:resource', 'clean:lib' ], function() {
	var stream1 = gulp.src([
            folders.tmp + folders.css + '**/*.css',
            folders.tmp + folders.images + '**/*',
            folders.tmp + folders.scripts + '**/*.js',
            folders.tmp + folders.views + '**/*.html'
        ], { base : folders.tmp }).pipe(gulp.dest(webRoot));

    var stream2 = gulp.src(folders.tmp + files.index + '.dist')
        .pipe(replace(/<script src=\"([0-9a-zA-Z\-_\s\.\/]*)\"><\/script>/g,
            '<script src="{{ asset(\'$1\') }}"></script>'))
        .pipe(rename(files.index))
        .pipe(gulp.dest(folders.index));

    return es.merge(stream1, stream2);
});

gulp.task('finalization', function(callback) {
    rs('resources', 'clean:tmp', callback);
});

gulp.task('bower', [ 'clean:bower'], function() {
	return bower();
});

// High level tasks
gulp.task('build', [ 'finalization' ]);
gulp.task('build:dev', [ 'resources:dev', 'lib:dev', 'index:dev' ]);
gulp.task('install', [ 'bower' ]);
gulp.task('clean:all', [ 'clean:lib', 'clean:resource', 'clean:install', 'clean:node', 'clean:symfony', 'clean:index' ]);

// LiveReload
gulp.task('watch', function () {
    // Starts the server
    livereload.listen();
    gulp.watch([folders.resource + '**/*', '!' + folders.resource + folders.lib + '**/*' ], ['resources:dev'])
        .on('change', livereload.changed);
});

// Default task
gulp.task('default', function() {
	gulp.run('build');
});