text:
/**
 */
package com.mguidi.soa.soa.impl;

import com.mguidi.soa.soa.PrimitiveFeature;
import com.mguidi.soa.soa.PrimitiveType;
import com.mguidi.soa.soa.SoaPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 *
 * An implementation of the model object 'Primitive Feature'.
 *
 *

 * The following features are implemented:
 *

 *
{@link com.mguidi.soa.soa.impl.PrimitiveFeatureImpl#getType Type}

 *

 *

 *
 * @generated
 */
public class PrimitiveFeatureImpl extends FeatureTypeImpl implements PrimitiveFeature
{
  /**
   * The default value of the '{@link #getType() Type}' attribute.
   *
   *
   * @see #getType()
   * @generated
   * @ordered
   */
  protected static final PrimitiveType TYPE_EDEFAULT = PrimitiveType.STRING;

  /**
   * The cached value of the '{@link #getType() Type}' attribute.
   *
   *
   * @see #getType()
   * @generated
   * @ordered
   */
  protected PrimitiveType type = TYPE_EDEFAULT;

  /**
   *
   *
   * @generated
   */
  protected PrimitiveFeatureImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return SoaPackage.Literals.PRIMITIVE_FEATURE;
  }

  /**
   *
   *
   * @generated
   */
  public PrimitiveType getType()
  {
    return type;
  }

  /**
   *
   *
   * @generated
   */
  public void setType(PrimitiveType newType)
  {
    PrimitiveType oldType = type;
    type = newType == null ? TYPE_EDEFAULT : newType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, SoaPackage.PRIMITIVE_FEATURE__TYPE, oldType, type));
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case SoaPackage.PRIMITIVE_FEATURE__TYPE:
        return getType();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case SoaPackage.PRIMITIVE_FEATURE__TYPE:
        setType((PrimitiveType)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case SoaPackage.PRIMITIVE_FEATURE__TYPE:
        setType(TYPE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case SoaPackage.PRIMITIVE_FEATURE__TYPE:
        return type != TYPE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (type: ");
    result.append(type);
    result.append(')');
    return result.toString();
  }

} //PrimitiveFeatureImpl


text:
//@HEADER
// ************************************************************************
//
//                Shards : Shared Discretization Tools
//                 Copyright 2008 Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Carter Edwards (hcedwar@sandia.gov),
//                    Pavel Bochev (pbboche@sandia.gov), or
//                    Denis Ridzal (dridzal@sandia.gov).
//
// ************************************************************************
//@HEADER

/** \file
    \brief  Example of the CellTools class.
    \author Created by P. Bochev, H. Carter Edwards and D. Ridzal
*/
#include <iostream>
#include <iomanip>
#include "Shards_CellTopology.hpp"

using namespace std;
using namespace shards;

/** \brief  Prints the vector with the selected topologies.

    \param  topologies      [in]    - vector containing the selected topologies
    \param  cellType        [in]    - enum for the selected cell type
    \param  topologyType    [in]    - enum for the selected topology type
  */
void printSelectTopologies(const std::vector<CellTopology>&   topologies,
                     const ECellType                    cellType = ALL_CELLS,
                     const ETopologyType                topologyType = ALL_TOPOLOGIES);

int main(int argc, char *argv[]) {
  std::cout \
  << "===============================================================================\n" \
  << "|                                                                             |\n" \
  << "|     Example use of the Shards package:                                      |\n" \
  << "|                                                                             |\n" \
  << "|    1) Query of the available cell topologies                                |\n" \
  << "|                                                                             |\n" \
  << "|  Questions? Contact  Pavel Bochev (pbboche@sandia.gov)                      |\n" \
  << "|                      H. Carter Edwards (hcedwar@sandia.gov)                 |\n" \
  << "|                      Denis Ridzal (dridzal@sandia.gov).                     |\n" \
  << "|                                                                             |\n" \
  << "|  shards's website:   http://trilinos.sandia.gov/packages/shards             |\n" \
  << "|  Trilinos website:   http://trilinos.sandia.gov                             |\n" \
  << "|                                                                             |\n" \
  << "===============================================================================\n\n";

  /*************************************************************************************************
    *                                                                                *
    *  Cell type enums:     ALL_CELLS,       STANDARD_CELL,  NONSTANDARD_CELL                      *
    *  Topology type enums: ALL_TOPOLOGIES,  BASE_TOPOLOGY,  EXTENDED_TOPOLOGY                     *
    *                                                                                *
    ***********************************************************************************************/
  std::vector<CellTopology> topologies;

  std::cout \
    << "===============================================================================\n"\
    << "| EXAMPLE 1: Queries of predefined 0D, 1D, 2D and 3D cell topologies          |\n"\
    << "===============================================================================\n";

  for(int cellDim = 0; cellDim < 4; cellDim++){

    std::cout << "************ Selected cell dimension = " << cellDim << " ************\n";

    // All cells
    shards::getTopologies(topologies, cellDim);
    printSelectTopologies(topologies);

    // All standard cells
    shards::getTopologies(topologies, cellDim, STANDARD_CELL);
    printSelectTopologies(topologies,          STANDARD_CELL);

    // All standard cells with base topology
    shards::getTopologies(topologies, cellDim, STANDARD_CELL, BASE_TOPOLOGY);
    printSelectTopologies(topologies,          STANDARD_CELL, BASE_TOPOLOGY);

    // All standard cells with extended topology
    shards::getTopologies(topologies, cellDim, STANDARD_CELL, EXTENDED_TOPOLOGY);
    printSelectTopologies(topologies,          STANDARD_CELL, EXTENDED_TOPOLOGY);

    // All non-standard cells
    shards::getTopologies(topologies, cellDim, NONSTANDARD_CELL);
    printSelectTopologies(topologies,          NONSTANDARD_CELL);

    // All non-standard 0D cells with base topology
    shards::getTopologies(topologies, cellDim, NONSTANDARD_CELL, BASE_TOPOLOGY);
    printSelectTopologies(topologies,          NONSTANDARD_CELL, BASE_TOPOLOGY);

    // All non-standard cells with extended topology
    shards::getTopologies(topologies, cellDim,  NONSTANDARD_CELL, EXTENDED_TOPOLOGY);
    printSelectTopologies(topologies,           NONSTANDARD_CELL, EXTENDED_TOPOLOGY);

  }

  std::cout \
    << "===============================================================================\n"\
    << "| EXAMPLE 2: Query of all predefined cell topologies                          |\n"\
    << "===============================================================================\n";

  // This query uses default argument values for all input arguments:
  shards::getTopologies(topologies);
  printSelectTopologies(topologies);

return 0;
}

/***************************************************************************************************
  *                                                                                *
  *    Helper function                                                                             *
  *                                                                                *
  *************************************************************************************************/
void printSelectTopologies(const std::vector<CellTopology>&   topologies,
                     const ECellType                          cellType,
                     const ETopologyType                      topologyType)
{

  std::cout << "List of " << shards::ECellTypeToString(cellType) << " ";

  // If topologies contains all 33 predefined topologies do not print cell dimension
  if( topologies.size() == 33 ) {
    std::cout << "cells and ";
  }
  else if ( ! topologies.empty() ) {
    std::cout << topologies[0].getDimension() << "D cells and ";

  }
  std::cout << shards::ETopologyTypeToString(topologyType) << " topology types  (total of "
  << topologies.size() << " cells)\n";

  std::cout << "-------------------------------------------------------------------------------\n";
  std::cout << setw(25) << " Cell Topology " << setw(25) << " Base topology" << setw(30) << "|\n";
  std::cout << "-------------------------------------------------------------------------------\n";

  for(unsigned i = 0; i < topologies.size(); i++){
    std::cout << setw(25) << topologies[i].getName() << setw(25) << topologies[i].getBaseName() << "\n";
  }
  std::cout << "===============================================================================\n\n";
}

redpajama_set_name: RedPajamaGithub


text:
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.

This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.

Downloads and unpacks the source code archive from Cachito and sets appropriate build args.
"""

import base64
import os
import tarfile
from shlex import quote

from atomic_reactor.constants import REMOTE_SOURCE_DIR, CACHITO_ENV_FILENAME
from atomic_reactor.download import download_url
from atomic_reactor.plugin import PreBuildPlugin
from atomic_reactor.plugins.pre_reactor_config import get_cachito
from atomic_reactor.util import get_retrying_requests_session
from atomic_reactor.utils.cachito import CFG_TYPE_B64

class DownloadRemoteSourcePlugin(PreBuildPlugin):
    key = 'download_remote_source'
    is_allowed_to_fail = False
    REMOTE_SOURCE = 'unpacked_remote_sources'

    def __init__(self, tasker, workflow, remote_source_url=None,
                 remote_source_build_args=None,
                 remote_source_configs=None):
        """
        :param tasker: ContainerTasker instance
        :param workflow: DockerBuildWorkflow instance
        :param remote_source_url: URL to download source archive from
        :param remote_source_build_args: dict of container build args
                                         to be used when building the image
        :param remote_source_configs: URL to fetch a list with configuration files data to be
                                      injected in the exploded remote sources dir
        """
        super(DownloadRemoteSourcePlugin, self).__init__(tasker, workflow)
        self.url = remote_source_url
        self.buildargs = remote_source_build_args or {}
        self.remote_source_conf_url = remote_source_configs

    def get_remote_source_config(self, session, url, insecure=False):
        """Get the configuration files associated with the remote sources

        :param session: the requests HTTP session object.
        :param url: str, URL to cachito remote source configurations
        :param insecure: bool, whether to verify SSL certificates
        :return: list[dict], configuration data for the given request.
                 Entries include path, type, and content.
        """
        self.log.info('Checking for additional configurations at %s', url)
        response = session.get(url, verify=not insecure)
        response.raise_for_status()
        return response.json()

    def generate_cachito_env_file(self):
        """
        Generate cachito.env file with exported environment variables received from
        cachito request.
        """

        self.log.info('Creating %s file with environment variables '
                      'received from cachito request', CACHITO_ENV_FILENAME)

        # Use dedicated dir in container build workdir for cachito.env
        abs_path = os.path.join(self.workflow.builder.df_dir,
                                self.REMOTE_SOURCE, CACHITO_ENV_FILENAME)
        with open(abs_path, 'w') as f:
            f.write('#!/bin/bash\n')
            for env_var, value in self.buildargs.items():
                f.write('export {}={}\n'.format(env_var, quote(value)))

    def run(self):
        """
        Run the plugin.
        """
        if not self.url:
            self.log.info('No remote source url to download, skipping plugin')
            return

        session = get_retrying_requests_session()

        # Download the source code archive
        cachito_config = get_cachito(self.workflow)
        insecure_ssl_conn = cachito_config.get('insecure', False)
        archive = download_url(
            self.url, self.workflow.source.workdir, session=session, insecure=insecure_ssl_conn
        )

        # Unpack the source code archive into a dedicated dir in container build workdir
        dest_dir = os.path.join(self.workflow.builder.df_dir, self.REMOTE_SOURCE)
        if not os.path.exists(dest_dir):
            os.makedirs(dest_dir)
        else:
            raise RuntimeError('Conflicting path {} already exists in the dist-git repository'
                               .format(self.REMOTE_SOURCE))

        with tarfile.open(archive) as tf:
            tf.extractall(dest_dir)

        config_files = (
            self.get_remote_source_config(session, self.remote_source_conf_url, insecure_ssl_conn)
            if self.remote_source_conf_url else []
        )

        # Inject cachito provided configuration files
        for config in config_files:
            config_path = os.path.join(dest_dir, config['path'])
            if config['type'] == CFG_TYPE_B64:
                data = base64.b64decode(config['content'])
                with open(config_path, 'wb') as f:
                    f.write(data)
            else:
                err_msg = "Unknown cachito configuration file data type '{}'".format(config['type'])
                raise ValueError(err_msg)

            os.chmod(config_path, 0o444)

        # Set build args
        self.workflow.builder.buildargs.update(self.buildargs)

        # Create cachito.env file with environment variables received from cachito request
        self.generate_cachito_env_file()

        # To copy the sources into the build image, Dockerfile should contain
        # COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR
        args_for_dockerfile_to_add = {
            'REMOTE_SOURCE': self.REMOTE_SOURCE,
            'REMOTE_SOURCE_DIR': REMOTE_SOURCE_DIR,
            }
        self.workflow.builder.buildargs.update(args_for_dockerfile_to_add)

        return archive


text:
/**
 * gulpfile.js
 *
 * @author Andrew Bowler
 */

var gulp = require('gulp');
var browserify = require('browserify');
var babel = require('gulp-babel');
var source = require('vinyl-source-stream');
var livereload = require('gulp-livereload');
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');

var files = {
  js: ['./js/*.js'],
};

var paths = {
  build: './build'
};

/**
 * Compiles and minifies all JavaScript files once.
 */
gulp.task('production', function () {
  browserify("js/app.js")
  .transform('babelify', {
    presets: ['es2015', 'react']
  })
  .bundle()
  .pipe(source('bundle.js'))
  .pipe(streamify(uglify()))
  .pipe(gulp.dest(paths.build))
  .pipe(livereload());
});

/**
 * Compiles unminified JavaScript for development
 */
gulp.task('dev', function() {
  browserify("js/app.js")
  .transform('babelify', {
    presets: ['es2015', 'react']
  })
  .bundle()
  .pipe(source('bundle.js'))
  .pipe(gulp.dest(paths.build))
  .pipe(livereload());
});

/**
 * Watches for changes in the JavaScript and re-runs gulp dev
 */
gulp.task('watch', function() {
  livereload.listen();
  gulp.watch(files.js, ['dev']);
});

gulp.task('default', ['watch', 'dev']);


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!--TODO get vector icons for all interests-->
    <integer-array name="filter_interest_icon">
        <item>@drawable/ic_interest_artscrafts</item>
        <item>@drawable/ic_interest_auto</item>
        <item>@drawable/ic_interest_boardgame</item>
        <item>@drawable/ic_interest_cooking</item>
        <item>@drawable/ic_interest_currentaffairs</item>
        <item>@drawable/ic_interest_dancing</item>
        <item>@drawable/ic_interest_diyprojects</item>
        <item>@drawable/ic_interest_fashion</item>
        <item>@drawable/ic_interest_fitness</item>
        <item>@drawable/ic_interest_food</item>
        <item>@drawable/ic_interest_gadget</item>
        <item>@drawable/ic_interest_gardening</item>
        <item>@drawable/ic_interest_movies</item>
        <item>@drawable/ic_interest_music</item>
        <item>@drawable/ic_interest_parenting</item>
        <item>@drawable/ic_interest_pets</item>
        <item>@drawable/ic_interest_photography</item>
        <item>@drawable/ic_interest_reading</item>
        <item>@drawable/ic_interest_spirituality</item>
        <item>@drawable/ic_interest_sports</item>
        <item>@drawable/ic_interest_travel</item>
        <item>@drawable/ic_interest_videogames</item>
    </integer-array>

    <integer-array name="filter_interest_pics">
        <item>@drawable/interest_artcrafts</item>
        <item>@drawable/interest_auto</item>
        <item>@drawable/interest_boardgames</item>
        <item>@drawable/interest_cooking</item>
        <item>@drawable/interest_currentaffairs</item>
        <item>@drawable/interest_dancing</item>
        <item>@drawable/interest_diy</item>
        <item>@drawable/interest_fashion</item>
        <item>@drawable/interest_fitness</item>
        <item>@drawable/interest_food</item>
        <item>@drawable/interest_gadgets</item>
        <item>@drawable/interest_gardening</item>
        <item>@drawable/interest_movies</item>
        <item>@drawable/interest_music</item>
        <item>@drawable/interest_parenting</item>
        <item>@drawable/interest_pets</item>
        <item>@drawable/interest_photography</item>
        <item>@drawable/interest_reading</item>
        <item>@drawable/interest_spirituality</item>
        <item>@drawable/interest_sport</item>
        <item>@drawable/interest_travel</item>
        <item>@drawable/interest_videogames</item>
    </integer-array>

    <integer-array name="filter_interest_color">
        <item>@color/red_a700</item>
        <item>@color/pink_a700</item>
        <item>@color/purple_a700</item>
        <item>@color/deep_purple_a700</item>
        <item>@color/indigo_a700</item>
        <item>@color/blue_a700</item>
        <item>@color/light_blue_a700</item>
        <item>@color/cyan_a700</item>
        <item>@color/teal_a700</item>
        <item>@color/green_a700</item>
        <item>@color/light_green_a700</item>
        <item>@color/lime_a700</item>
        <item>@color/yellow_a700</item>
        <item>@color/amber_a700</item>
        <item>@color/orange_a700</item>
        <item>@color/deep_orange_a700</item>
        <item>@color/red_a200</item>
        <item>@color/pink_a200</item>
        <item>@color/purple_a200</item>
        <item>@color/deep_purple_a200</item>
        <item>@color/brown_400</item>
        <item>@color/brown_700</item>
    </integer-array>
</resources>


text:
describe('Slider', function () {
    'use strict';

    var element;
    beforeEach(function () {
        this.addMatchers({
            toBeWixed: function() {
                var $element = this.actual.find('.uilib-slider');
                var $preLabel = this.actual.find('.uilib-slider-preLabel');
                var $postLabel = this.actual.find('.uilib-slider-postLabel');
                var $pin = this.actual.find('.uilib-slider-pin');
                var pinWidth = $pin.css('width') === '19px';
                return $element && $preLabel.length && $postLabel.length && $pin.length && pinWidth;
            }
        });
    });
    beforeEach(function(){
        element = $('

').appendTo('body')[0];
    });

    afterEach(function(){
        Wix.UI.destroy(element, true);
    });

    it('should apply wix markup to given wix-ctrl', function(){
        Wix.UI.initializePlugin(element);
        var $slider = $(".uilib-slider");
        expect($slider).toBeWixed();
    });

    describe('Default Options', function () {
        beforeEach(function(){
            Wix.UI.initializePlugin(element);
        });

        it('should not show the tooltip by default', function(){
            var $toolTip = $(element).find('.uilib-slider-tooltip');
            expect($toolTip.length).toBe(0);
        });

        it('should not show a tool tip when you click on the pin by default', function(){
            var $element = $(element);
            var $pin = $element.find(".uilib-slider-pin");
            var $tooltip = $element.find(".uilib-slider-tooltip");

            expect($tooltip.length).toEqual(0);
            $pin.mousedown();
            expect($tooltip.length).toEqual(0);
        });
    });

    it('should set the tooltip value according to the model value when toolTip is set to true', function(){
        var $element = $(element);
        $element.attr('wix-options', '{toolTip:true}');
        Wix.UI.initializePlugin(element);
        var $tooltip = $element.find(".uilib-slider-tooltip");
        Wix.UI.set('numOfItems', 20);
        expect($tooltip.find("div.uilib-text").text()).toEqual('20');
    });

    it('should show a tooltip when the pin moves and hide it when it is static', function(){
        var $element = $(element);
        $element.attr('wix-options', '{toolTip:true}');
        Wix.UI.initializePlugin(element);

        var $pin = $element.find(".uilib-slider-pin");
        var $tooltip = $element.find(".uilib-slider-tooltip");

        expect($tooltip.css('display')).toBe('none');

        $pin.mousedown();
        expect($tooltip.css('display')).toBe('block');

        $(document.body).mouseup();
        expect($tooltip.css('display')).toBe('none');
    });
});


text:
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js';
import 'chrome://resources/cr_elements/cr_icons_css.m.js';
import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js';
import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js';
import 'chrome://resources/cr_elements/icons.m.js';
import 'chrome://resources/cr_elements/policy/cr_tooltip_icon.m.js';
import 'chrome://resources/cr_elements/shared_style_css.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';
import 'chrome://resources/js/action_link.js';
import 'chrome://resources/cr_elements/action_link_css.m.js';
import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
import 'chrome://resources/polymer/v3_0/paper-spinner/paper-spinner-lite.js';
import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
import './host_permissions_toggle_list.js';
import './runtime_host_permissions.js';
import './shared_style.js';
import './shared_vars.js';
import './strings.m.js';
import './toggle_row.js';

import {CrLinkRowElement} from 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js';
import {CrToggleElement} from 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js';
import {CrTooltipIconElement} from 'chrome://resources/cr_elements/policy/cr_tooltip_icon.m.js';
import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {afterNextRender, DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {getTemplate} from './detail_view.html.js';

import {ItemDelegate} from './item.js';
import {ItemMixin} from './item_mixin.js';
import {computeInspectableViewLabel, EnableControl, getEnableControl, getItemSource, getItemSourceString, isEnabled, userCanChangeEnablement} from './item_util.js';
import {navigation, Page} from './navigation_helper.js';
import {ExtensionsToggleRowElement} from './toggle_row.js';

export interface ExtensionsDetailViewElement {
  $: {
    closeButton: HTMLElement,
    description: HTMLElement,
    enableToggle: CrToggleElement,
    extensionsActivityLogLink: HTMLElement,
    extensionsOptions: CrLinkRowElement,
    parentDisabledPermissionsToolTip: CrTooltipIconElement,
    source: HTMLElement,
  };
}

const ExtensionsDetailViewElementBase = ItemMixin(PolymerElement);

export class ExtensionsDetailViewElement extends
    ExtensionsDetailViewElementBase {
  static get is() {
    return 'extensions-detail-view';
  }

  static get template() {
    return getTemplate();
  }

  static get properties() {
    return {
      /**
       * The underlying ExtensionInfo for the details being displayed.
       */
      data: Object,

      size_: String,

      delegate: Object,

      /** Whether the user has enabled the UI's developer mode. */
      inDevMode: Boolean,

      /**
       * Whether enhanced site controls have been enabled (through a feature
       * flag). For this page, there are some changes to the site permissions
       * section.
       */
      enableEnhancedSiteControls: Boolean,

      /** Whether "allow in incognito" option should be shown. */
      incognitoAvailable: Boolean,

      /** Whether "View Activity Log" link should be shown. */
      showActivityLog: Boolean,

      /** Whether the user navigated to this page from the activity log page. */
      fromActivityLog: Boolean,
    };
  }

  static get observers() {
    return ['onItemIdChanged_(data.id, delegate)'];
  }

  data: chrome.developerPrivate.ExtensionInfo;
  delegate: ItemDelegate;
  inDevMode: boolean;
  enableEnhancedSiteControls: boolean;
  incognitoAvailable: boolean;
  showActivityLog: boolean;
  fromActivityLog: boolean;
  private size_: string;

  override connectedCallback() {
    super.connectedCallback();
  }

  override ready() {
    super.ready();
    this.addEventListener('view-enter-start', this.onViewEnterStart_);
  }

  /**
   * Focuses the extensions options button. This should be used after the
   * dialog closes.
   */
  focusOptionsButton() {
    this.$.extensionsOptions.focus();
  }

  /**
   * Focuses the back button when page is loaded.
   */
  private onViewEnterStart_() {
    const elementToFocus = this.fromActivityLog ?
        this.$.extensionsActivityLogLink :
        this.$.closeButton;

    afterNextRender(this, () => focusWithoutInk(elementToFocus));
  }

  private onItemIdChanged_() {
    // Clear the size, since this view is reused, such that no obsolete size
    // is displayed.:
    this.size_ = '';
    this.delegate.getExtensionSize(this.data.id).then(size => {
      this.size_ = size;
    });
  }

  private onActivityLogTap_() {
    navigation.navigateTo({page: Page.ACTIVITY_LOG, extensionId: this.data.id});
  }

  private getDescription_(description: string, fallback: string): string {
    return description || fallback;
  }

  private getBackButtonAriaLabel_(): string {
    return loadTimeData.getStringF(
        'itemDetailsBackButtonAriaLabel', this.data.name);
  }

  private getBackButtonAriaRoleDescription_(): string {
    return loadTimeData.getStringF(
        'itemDetailsBackButtonRoleDescription', this.data.name);
  }

  private onCloseButtonTap_() {
    navigation.navigateTo({page: Page.LIST});
  }

  private isEnabled_(): boolean {
    return isEnabled(this.data.state);
  }

  private isEnableToggleEnabled_(): boolean {
    return userCanChangeEnablement(this.data);
  }

  private hasDependentExtensions_(): boolean {
    return this.data.dependentExtensions.length > 0;
  }

  private hasSevereWarnings_(): boolean {
    return this.data.disableReasons.corruptInstall ||
        this.data.disableReasons.suspiciousInstall ||
        this.data.disableReasons.updateRequired || !!this.data.blacklistText ||
        this.data.runtimeWarnings.length > 0;
  }

  private computeEnabledStyle_(): string {
    return this.isEnabled_() ? 'enabled-text' : '';
  }

  private computeEnabledText_(
      state: chrome.developerPrivate.ExtensionState, onText: string,
      offText: string): string {
    // TODO(devlin): Get the full spectrum of these strings from bettes.
    return isEnabled(state) ? onText : offText;
  }

  private computeInspectLabel_(view: chrome.developerPrivate.ExtensionView):
      string {
    return computeInspectableViewLabel(view);
  }

  private shouldShowOptionsLink_(): boolean {
    return !!this.data.optionsPage;
  }

  private shouldShowOptionsSection_(): boolean {
    return this.data.incognitoAccess.isEnabled ||
        this.data.fileAccess.isEnabled || this.data.errorCollection.isEnabled;
  }

  private shouldShowIncognitoOption_(): boolean {
    return this.data.incognitoAccess.isEnabled && this.incognitoAvailable;
  }

  private onEnableToggleChange_() {
    this.delegate.setItemEnabled(this.data.id, this.$.enableToggle.checked);
    this.$.enableToggle.checked = this.isEnabled_();
  }

  private onInspectTap_(
      e: DomRepeatEvent<chrome.developerPrivate.ExtensionView>) {
    this.delegate.inspectItemView(this.data.id, e.model.item);
  }

  private onExtensionOptionsTap_() {
    this.delegate.showItemOptionsPage(this.data);
  }

  private onReloadTap_() {
    this.delegate.reloadItem(this.data.id).catch(loadError => {
      this.dispatchEvent(new CustomEvent(
          'load-error', {bubbles: true, composed: true, detail: loadError}));
    });
  }

  private onRemoveTap_() {
    this.delegate.deleteItem(this.data.id);
  }

  private onRepairTap_() {
    this.delegate.repairItem(this.data.id);
  }

  private onLoadPathTap_() {
    this.delegate.showInFolder(this.data.id);
  }

  private onAllowIncognitoChange_() {
    this.delegate.setItemAllowedIncognito(
        this.data.id,
        this.shadowRoot!
            .querySelector<ExtensionsToggleRowElement>(
                '#allow-incognito')!.checked);
  }

  private onAllowOnFileUrlsChange_() {
    this.delegate.setItemAllowedOnFileUrls(
        this.data.id,
        this.shadowRoot!
            .querySelector<ExtensionsToggleRowElement>(
                '#allow-on-file-urls')!.checked);
  }

  private onCollectErrorsChange_() {
    this.delegate.setItemCollectsErrors(
        this.data.id,
        this.shadowRoot!
            .querySelector<ExtensionsToggleRowElement>(
                '#collect-errors')!.checked);
  }

  private onExtensionWebSiteTap_() {
    this.delegate.openUrl(this.data.manifestHomePageUrl);
  }

  private onViewInStoreTap_() {
    this.delegate.openUrl(this.data.webStoreUrl);
  }

  private computeDependentEntry_(
      item: chrome.developerPrivate.DependentExtension): string {
    return loadTimeData.getStringF('itemDependentEntry', item.name, item.id);
  }

  private computeSourceString_(): string {
    return this.data.locationText ||
        getItemSourceString(getItemSource(this.data));
  }

  private hasPermissions_(): boolean {
    return this.data.permissions.simplePermissions.length > 0 ||
        this.hasRuntimeHostPermissions_();
  }

  private getNoPermissionsString_(): string {
    const showPermissionsAndSiteAccessStrings =
        this.enableEnhancedSiteControls && !this.showSiteAccessContent_();
    return loadTimeData.getString(
        showPermissionsAndSiteAccessStrings ?
            'itemPermissionsAndSiteAccessEmpty' :
            'itemPermissionsEmpty');
  }

  private hasRuntimeHostPermissions_(): boolean {
    return !!this.data.permissions.runtimeHostPermissions;
  }

  // Returns whether the site access section should be shown. This includes the
  // "no site access" message shown in the section if
  // |enableEnhancedSiteControls| is not enabled.
  private showSiteAccessSection_(): boolean {
    return !this.enableEnhancedSiteControls || this.showSiteAccessContent_();
  }

  private showSiteAccessContent_(): boolean {
    return this.showFreeformRuntimeHostPermissions_() ||
        this.showHostPermissionsToggleList_();
  }

  private showFreeformRuntimeHostPermissions_(): boolean {
    return this.hasRuntimeHostPermissions_() &&
        this.data.permissions.runtimeHostPermissions!.hasAllHosts;
  }

  private showHostPermissionsToggleList_(): boolean {
    return this.hasRuntimeHostPermissions_() &&
        !this.data.permissions.runtimeHostPermissions!.hasAllHosts;
  }

  private showReloadButton_(): boolean {
    return getEnableControl(this.data) === EnableControl.RELOAD;
  }

  private showRepairButton_(): boolean {
    return getEnableControl(this.data) === EnableControl.REPAIR;
  }

  private showEnableToggle_(): boolean {
    const enableControl = getEnableControl(this.data);
    // We still show the toggle even if we also show the repair button in the
    // detail view, because the repair button appears just beneath it.
    return enableControl === EnableControl.ENABLE_TOGGLE ||
        enableControl === EnableControl.REPAIR;
  }

  private showAllowlistWarning_(): boolean {
    // Only show the allowlist warning if there is no blocklist warning. It
    // would be redundant since all blocklisted items are necessarily not
    // included in the Safe Browsing allowlist.
    return this.data.showSafeBrowsingAllowlistWarning &&
        !this.data.blacklistText;
  }
}

declare global {
  interface HTMLElementTagNameMap {
    'extensions-detail-view': ExtensionsDetailViewElement;
  }
}

customElements.define(
    ExtensionsDetailViewElement.is, ExtensionsDetailViewElement);


text:
<HTML>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://terravista.uveais.ca/news/index.php">
<HEAD>
<TITLE>Welcome to Terra Vista News</TITLE>
</HEAD>
<BODY BGCOLOR="#000fff" TEXT="#ffff00" LINK="#00ffff" VLINK="#000000" ALINK="#000000"></BODY>

</HTML>


text:
import 'whatwg-fetch';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import createHistory from 'history/createBrowserHistory';
import configureStore from './store/configureStore';
import { ConnectedRouter } from 'react-router-redux';
import getRoutes from './routes';

const history = createHistory();
const store = configureStore(window.INITIAL_STATE, history);

ReactDOM.render(
    <Provider store={store}>
        <ConnectedRouter history={history} children={getRoutes(store)} />
    </Provider>,
    document.getElementById('root')
)


text:
package com.cgutman.adblib;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.EncodedKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;

import javax.crypto.Cipher;

/**
 * This class encapsulates the ADB cryptography functions and provides
 * an interface for the storage and retrieval of keys.
 *
 * @author Cameron Gutman
 */
public class AdbCrypto {

    /**
     * An RSA keypair encapsulated by the AdbCrypto object
     */
    private KeyPair keyPair;

    /**
     * The base 64 conversion interface to use
     */
    private AdbBase64 base64;

    /**
     * The ADB RSA key length in bits
     */
    public static final int KEY_LENGTH_BITS = 2048;

    /**
     * The ADB RSA key length in bytes
     */
    public static final int KEY_LENGTH_BYTES = KEY_LENGTH_BITS / 8;

    /**
     * The ADB RSA key length in words
     */
    public static final int KEY_LENGTH_WORDS = KEY_LENGTH_BYTES / 4;

    /**
     * The RSA signature padding as an int array
     */
    public static final int[] SIGNATURE_PADDING_AS_INT = new int[]
            {
                    0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
                    0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00,
                    0x04, 0x14
            };

    /**
     * The RSA signature padding as a byte array
     */
    public static byte[] SIGNATURE_PADDING;

    static {
        SIGNATURE_PADDING = new byte[SIGNATURE_PADDING_AS_INT.length];

        for (int i = 0; i < SIGNATURE_PADDING.length; i++)
            SIGNATURE_PADDING[i] = (byte) SIGNATURE_PADDING_AS_INT[i];
    }

    /**
     * Converts a standard RSAPublicKey object to the special ADB format
     *
     * @param pubkey RSAPublicKey object to convert
     * @return Byte array containing the converted RSAPublicKey object
     */
    private static byte[] convertRsaPublicKeyToAdbFormat(RSAPublicKey pubkey) {
        /*
		 * ADB literally just saves the RSAPublicKey struct to a file.
		 *
		 * typedef struct RSAPublicKey {
         * int len; // Length of n[] in number of uint32_t
         * uint32_t n0inv;  // -1 / n[0] mod 2^32
         * uint32_t n[RSANUMWORDS]; // modulus as little endian array
         * uint32_t rr[RSANUMWORDS]; // R^2 as little endian array
         * int exponent; // 3 or 65537
         * } RSAPublicKey;
		 */

		/* ------ This part is a Java-ified version of RSA_to_RSAPublicKey from adb_host_auth.c ------ */
        BigInteger r32, r, rr, rem, n, n0inv;

        r32 = BigInteger.ZERO.setBit(32);
        n = pubkey.getModulus();
        r = BigInteger.ZERO.setBit(KEY_LENGTH_WORDS * 32);
        rr = r.modPow(BigInteger.valueOf(2), n);
        rem = n.remainder(r32);
        n0inv = rem.modInverse(r32);

        int myN[] = new int[KEY_LENGTH_WORDS];
        int myRr[] = new int[KEY_LENGTH_WORDS];
        BigInteger res[];
        for (int i = 0; i < KEY_LENGTH_WORDS; i++) {
            res = rr.divideAndRemainder(r32);
            rr = res[0];
            rem = res[1];
            myRr[i] = rem.intValue();

            res = n.divideAndRemainder(r32);
            n = res[0];
            rem = res[1];
            myN[i] = rem.intValue();
        }

		/* ------------------------------------------------------------------------------------------- */

        ByteBuffer bbuf = ByteBuffer.allocate(524).order(ByteOrder.LITTLE_ENDIAN);

        bbuf.putInt(KEY_LENGTH_WORDS);
        bbuf.putInt(n0inv.negate().intValue());
        for (int i : myN)
            bbuf.putInt(i);
        for (int i : myRr)
            bbuf.putInt(i);

        bbuf.putInt(pubkey.getPublicExponent().intValue());
        return bbuf.array();
    }

    /**
     * Creates a new AdbCrypto object from a key pair loaded from files.
     *
     * @param base64     Implementation of base 64 conversion interface required by ADB
     * @param privateKey File containing the RSA private key
     * @param publicKey  File containing the RSA public key
     * @return New AdbCrypto object
     * @throws IOException              If the files cannot be read
     * @throws NoSuchAlgorithmException If an RSA key factory cannot be found
     * @throws InvalidKeySpecException  If a PKCS8 or X509 key spec cannot be found
     */
    public static AdbCrypto loadAdbKeyPair(AdbBase64 base64, File privateKey, File publicKey) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
        AdbCrypto crypto = new AdbCrypto();

        int privKeyLength = (int) privateKey.length();
        int pubKeyLength = (int) publicKey.length();
        byte[] privKeyBytes = new byte[privKeyLength];
        byte[] pubKeyBytes = new byte[pubKeyLength];

        FileInputStream privIn = new FileInputStream(privateKey);
        FileInputStream pubIn = new FileInputStream(publicKey);

        privIn.read(privKeyBytes);
        pubIn.read(pubKeyBytes);

        privIn.close();
        pubIn.close();

        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
        EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(privKeyBytes);
        EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(pubKeyBytes);

        crypto.keyPair = new KeyPair(keyFactory.generatePublic(publicKeySpec),
                keyFactory.generatePrivate(privateKeySpec));
        crypto.base64 = base64;

        return crypto;
    }

    /**
     * Creates a new AdbCrypto object by generating a new key pair.
     *
     * @param base64 Implementation of base 64 conversion interface required by ADB
     * @return A new AdbCrypto object
     * @throws NoSuchAlgorithmException If an RSA key factory cannot be found
     */
    public static AdbCrypto generateAdbKeyPair(AdbBase64 base64) throws NoSuchAlgorithmException {
        AdbCrypto crypto = new AdbCrypto();

        KeyPairGenerator rsaKeyPg = KeyPairGenerator.getInstance("RSA");
        rsaKeyPg.initialize(KEY_LENGTH_BITS);

        crypto.keyPair = rsaKeyPg.genKeyPair();
        crypto.base64 = base64;

        return crypto;
    }

    /**
     * Signs the ADB SHA1 payload with the private key of this object.
     *
     * @param payload SHA1 payload to sign
     * @return Signed SHA1 payload
     * @throws GeneralSecurityException If signing fails
     */
    public byte[] signAdbTokenPayload(byte[] payload) throws GeneralSecurityException {
        Cipher c = Cipher.getInstance("RSA/ECB/NoPadding");

        c.init(Cipher.ENCRYPT_MODE, keyPair.getPrivate());

        c.update(SIGNATURE_PADDING);

        return c.doFinal(payload);
    }

    /**
     * Gets the RSA public key in ADB format.
     *
     * @return Byte array containing the RSA public key in ADB format.
     * @throws IOException If the key cannot be retrived
     */
    public byte[] getAdbPublicKeyPayload() throws IOException {
        byte[] convertedKey = convertRsaPublicKeyToAdbFormat((RSAPublicKey) keyPair.getPublic());
        StringBuilder keyString = new StringBuilder(720);

		/* The key is base64 encoded with a user@host suffix and terminated with a NUL */
        keyString.append(base64.encodeToString(convertedKey));
        keyString.append(" unknown@unknown");
        keyString.append('\0');

        return keyString.toString().getBytes("UTF-8");
    }

    /**
     * Saves the AdbCrypto's key pair to the specified files.
     *
     * @param privateKey The file to store the encoded private key
     * @param publicKey  The file to store the encoded public key
     * @throws IOException If the files cannot be written
     */
    public void saveAdbKeyPair(File privateKey, File publicKey) throws IOException {
        FileOutputStream privOut = new FileOutputStream(privateKey);
        FileOutputStream pubOut = new FileOutputStream(publicKey);

        privOut.write(keyPair.getPrivate().getEncoded());
        pubOut.write(keyPair.getPublic().getEncoded());

        privOut.close();
        pubOut.close();
    }
}


text:
module WebConsole
  # Returns the Ruby bindings of Kernel#callers locations.
  #
  # The list of bindings here doesn't map 1 to 1 with Kernel#callers, as we
  # can't build Ruby bindings for C functions or the equivalent native
  # implementations in JRuby and Rubinius.
  #
  # This method needs to be overridden by every integration.
  def self.caller_bindings
    raise NotImplementedError
  end
end

class Exception
  # Returns an array of the exception backtrace locations bindings.
  #
  # The list won't map to the traces in #backtrace 1 to 1, because we can't
  # build bindings for every trace (C functions, for example).
  #
  # Every integration should the instance variable.
  def bindings
    @bindings || []
  end
end

case RUBY_ENGINE
when 'rbx'
  require 'web_console/integration/rubinius'
when 'jruby'
  require 'web_console/integration/jruby'
when 'ruby'
  require 'web_console/integration/cruby'
end


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

namespace Axiom.Runtime
{
    public class StructureTerm : AbstractTerm
    {

        private string _name;
        public override string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        private int _arity;
        public override int Arity
        {
            get { return _arity; }
            set { _arity = value; }
        }

        public StructureTerm()
        {

        }

        public StructureTerm(string name, int arity)
        {
            _name = name;
            _arity = arity;
        }

        public override bool Unify(AbstractTerm term)
        {
            if (term.IsReference)
            {
                term.Assign(this);
                return true;
            }
            if (term.IsStructure)
            {
                if (term.Name != _name || term.Arity != _arity)
                {
                    return false;
                }

                for (int i = 0; i < _arity; i++)
                {
                    if (!this[i].Unify(term[i]))
                    {
                        return false;
                    }
                }
                return true;
            }

            return false;
        }

        public override void Bind(AbstractTerm term)
        {
            // do nothing
        }

        public override object Data()
        {
            return _name.Replace("'", "");
        }

        public override AbstractTerm Dereference()
        {
            return this;
        }

        public override AbstractTerm Reference()
        {
            return this;
        }

        public override AbstractTerm this[int index]
        {
            get { return GetArgumentIndex(index); }
        }

        private AbstractTerm GetArgumentIndex(int index)
        {
            AbstractTerm term = this;

            if (index == 0)
                return (AbstractTerm)_next ;

            for (int i = 0; i <= index; i++)
            {
                term = (AbstractTerm)term.Next;
            }

            return term;
        }

        public override bool IsReference
        {
            get { return false; }
        }

        public override bool IsConstant
        {
            get { return false; }
        }

        public override bool IsList
        {
            get { return false; }
        }

        public override bool IsObject
        {
            get { return false; }
        }

        public override bool IsStructure
        {
            get { return true; }
        }

        public override string ToString()
        {
            string str = _name + "(";
            for (int i = 0; i < _arity; i++)
            {
                AbstractTerm term = (AbstractTerm)this[i];
                str += term.ToString();
                if (i == _arity - 1)
                {
                    str += ")";
                }
                else
                {
                    str += ",";
                }
            }
            return str;
        }
    }
}


text:
<?php
require_once('Field.class.php');

class Checkbox extends Field
{
	const DEFAULT_VALUE = 'on';

	function __construct($name, array $attributes = NULL) {
		parent::__construct($name, $attributes);
	}

	function getValue() {
		$rawValue = $this->getRawValue();
		if (is_null($rawValue)) return FALSE;
		return $rawValue == self::DEFAULT_VALUE ? TRUE : $rawValue;
	}

	function setValue($value) {
		if ($value)
			$this->setRawValue($value === TRUE ? self::DEFAULT_VALUE : $value);
		else
			$this->setRawValue(NULL);
	}

	function isChecked() {
		return !is_null($this->getRawValue());
	}

	function setChecked($checked) {
		$this->setRawValue($checked ? self::DEFAULT_VALUE : NULL);
	}

	function validate() {
		if ($this->isRequired() && !$this->isChecked()) {
			$this->setErrorMessage('field-error-not-checked');
			return;
		}
	}

	function render() {
		$html = new HtmlBuilder();
		$html->startTag('input')
			->attrRaw('type', 'checkbox')
			->attr('name', $this->getName())
			->attr('id', $this->getId())
			->attr('value', $this->getRawValue());
		if ($this->isChecked()) $html->attrRaw('checked', 'checked');
		if (!$this->isValid()) $html->attrRaw('class', 'error');
		$html->endEmptyElement();
		return $html->getHtml();
	}
}
?>


text:
int main() {
    char TextoUm[10]; //note a mudança aqui
    char *TextoDois = malloc(10); //note a mudança aqui
    printf("Digite um nome para \"TextoUm\":\n");
    scanf("%s", TextoUm);
    printf("O texto digitado foi: %s", TextoUm);
    printf("\nDigite um nome para \"TextoDois\":\n");
    scanf("%s", TextoDois);
    printf("O texto digitado foi: %s", TextoDois);
}

//https://pt.stackoverflow.com/q/168882/101


text:
from telex import plugin
from telex.callbacks.msgreceived import command, expand

class EchoPlugin(plugin.TelexPlugin):

    @command('echo')
    @expand('^\S+ (?:count *= *(?P<count>\d+) |)(?P<text>.*)')
    def test_callback(self, count, text, *, bot, msg):
        if not count:
            count = 1
        if count > 20:
            self.respond_to_msg(msg, "Maximum count is 20")
        else:
            for i in range(0,int(count)):
                self.respond_to_msg(msg, text)


text:
package org.apache.ignite.internal.util.lang;

import org.apache.ignite.*;
import org.apache.ignite.internal.util.typedef.*;

/**
 * Convenient reducer subclass that allows for thrown grid exception. This class
 * implements {@link #apply()} method that calls {@link #applyx()} method and
 * properly wraps {@link IgniteCheckedException} into {@link GridClosureException} instance.
 * @see RX3
 */
public abstract class IgniteReducer3X<E1, E2, E3, R> implements IgniteReducer3<E1, E2, E3, R> {
    /** */
    private static final long serialVersionUID = 0L;

    /** {@inheritDoc} */
    @Override public R apply() {
        try {
            return applyx();
        }
        catch (IgniteCheckedException e) {
            throw F.wrap(e);
        }
    }

    /**
     * Reducer body that can throw {@link IgniteCheckedException}.
     *
     * @return Reducer return value.
     * @throws IgniteCheckedException Thrown in case of any error condition inside of the reducer.
     */
    public abstract R applyx() throws IgniteCheckedException;
}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AgGridModule } from 'ag-grid-angular/main';

import { TransactionTableGridComponent } from './transaction-table-grid.component';
import { TransactionTableGridContainerComponent } from './transaction-table-grid-container.component';
import { TransactionMetaDataService } from './transaction-meta-data.service';
import { MessagePopupModule } from 'app/core/components/message-popup';

@NgModule({
    declarations: [
        TransactionTableGridComponent,
        TransactionTableGridContainerComponent
    ],
    imports: [
        CommonModule,
        AgGridModule.withComponents([]),
        MessagePopupModule
    ],
    exports: [
        TransactionTableGridContainerComponent
    ],
    providers: [
        TransactionMetaDataService
    ]
})
export class TransactionTableGridModule { }


text:
""" Imports and provides the 'correct' version of readline for the platform.

Readline is used throughout IPython as 'import IPython.rlineimpl as readline'.

In addition to normal readline stuff, this module provides have_readline
boolean and _outputfile variable used in genutils.

$Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $"""

import sys

try:
    from readline import *
    import readline as _rl
    have_readline = True
except ImportError:
    try:
        from pyreadline import *
        import pyreadline as _rl
        have_readline = True
    except ImportError:
        have_readline = False

if sys.platform == 'win32' and have_readline:
    try:
        _outputfile=_rl.GetOutputFile()
    except AttributeError:
        print "Failed GetOutputFile"
        have_readline = False

# Test to see if libedit is being used instead of GNU readline.
# Thanks to Boyd Waters for this patch.
uses_libedit = False
if sys.platform == 'darwin' and have_readline:
    import commands
    (status, result) = commands.getstatusoutput( "otool -L %s | grep libedit" % _rl.__file__ )
    if status == 0 and len(result) > 0:
        # we are bound to libedit - new in Leopard
        _rl.parse_and_bind("bind ^I rl_complete")
        print "Leopard libedit detected."
        uses_libedit = True

# the clear_history() function was only introduced in Python 2.4 and is
# actually optional in the readline API, so we must explicitly check for its
# existence.  Some known platforms actually don't have it.  This thread:
# http://mail.python.org/pipermail/python-dev/2003-August/037845.html
# has the original discussion.

if have_readline:
    try:
        _rl.clear_history
    except AttributeError:
        def clear_history(): pass
        _rl.clear_history = clear_history


text:
package com.oprisnik.semdroid.grouper.opcode;

import com.googlecode.dex2jar.DexOpcodes;
import com.googlecode.dex2jar.OdexOpcodes;

/**
 * Opcode grouper template.
 */
public class FieldBasedOpcodeGrouperTemplate extends FieldBasedOpcodeGrouper {

    // Define your opcode groups here...
    // e.g. :
    public static final int OP_IF = DexOpcodes.OP_IF_EQ;

    @Override
    public int getOpcodeGroup(int opcode) {
        // OP_IGNORE can be used to ignore the opcode
        // return your opcode groups defined above.
        switch (opcode) {
            case DexOpcodes.OP_NOP:
                return 0;
            case DexOpcodes.OP_MOVE:
                return 0;
            case DexOpcodes.OP_MOVE_RESULT:
                return 0;
            case DexOpcodes.OP_MOVE_EXCEPTION:
                return 0;
            case DexOpcodes.OP_RETURN_VOID:
                return 0;
            case DexOpcodes.OP_RETURN:
                return 0;
            case DexOpcodes.OP_CONST:
                return 0;
            case DexOpcodes.OP_CONST_STRING:
                return 0;
            case DexOpcodes.OP_CONST_CLASS:
                return 0;
            case DexOpcodes.OP_MONITOR_ENTER:
                return 0;
            case DexOpcodes.OP_MONITOR_EXIT:
                return 0;
            case DexOpcodes.OP_CHECK_CAST:
                return 0;
            case DexOpcodes.OP_INSTANCE_OF:
                return 0;
            case DexOpcodes.OP_ARRAY_LENGTH:
                return 0;
            case DexOpcodes.OP_NEW_INSTANCE:
                return 0;
            case DexOpcodes.OP_NEW_ARRAY:
                return 0;
            case DexOpcodes.OP_FILLED_NEW_ARRAY:
                return 0;
            case DexOpcodes.OP_FILL_ARRAY_DATA:
                return 0;
            case DexOpcodes.OP_THROW:
                return 0;
            case DexOpcodes.OP_GOTO:
                return 0;
            case DexOpcodes.OP_PACKED_SWITCH:
                return 0;
            case DexOpcodes.OP_SPARSE_SWITCH:
                return 0;
            case DexOpcodes.OP_CMPL:
                return 0;
            case DexOpcodes.OP_CMPG:
                return 0;
            case DexOpcodes.OP_CMP:
                return 0;
            case DexOpcodes.OP_IF_EQ:
                return 0;
            case DexOpcodes.OP_IF_NE:
                return 0;
            case DexOpcodes.OP_IF_LT:
                return 0;
            case DexOpcodes.OP_IF_GE:
                return 0;
            case DexOpcodes.OP_IF_GT:
                return 0;
            case DexOpcodes.OP_IF_LE:
                return 0;
            case DexOpcodes.OP_IF_EQZ:
                return 0;
            case DexOpcodes.OP_IF_NEZ:
                return 0;
            case DexOpcodes.OP_IF_LTZ:
                return 0;
            case DexOpcodes.OP_IF_GEZ:
                return 0;
            case DexOpcodes.OP_IF_GTZ:
                return 0;
            case DexOpcodes.OP_IF_LEZ:
                return 0;
            case DexOpcodes.OP_AGET:
                return 0;
            case DexOpcodes.OP_APUT:
                return 0;
            case DexOpcodes.OP_IGET:
                return 0;
            case DexOpcodes.OP_IPUT:
                return 0;
            case DexOpcodes.OP_SGET:
                return 0;
            case DexOpcodes.OP_SPUT:
                return 0;
            case DexOpcodes.OP_INVOKE_VIRTUAL:
                return 0;
            case DexOpcodes.OP_INVOKE_SUPER:
                return 0;
            case DexOpcodes.OP_INVOKE_DIRECT:
                return 0;
            case DexOpcodes.OP_INVOKE_STATIC:
                return 0;
            case DexOpcodes.OP_INVOKE_INTERFACE:
                return 0;
            case DexOpcodes.OP_NEG:
                return 0;
            case DexOpcodes.OP_NOT:
                return 0;
            case DexOpcodes.OP_X_TO_Y:
                return 0;
            case DexOpcodes.OP_ADD:
                return 0;
            case DexOpcodes.OP_SUB:
                return 0;
            case DexOpcodes.OP_MUL:
                return 0;
            case DexOpcodes.OP_DIV:
                return 0;
            case DexOpcodes.OP_REM:
                return 0;
            case DexOpcodes.OP_AND:
                return 0;
            case DexOpcodes.OP_OR:
                return 0;
            case DexOpcodes.OP_XOR:
                return 0;
            case DexOpcodes.OP_SHL:
                return 0;
            case DexOpcodes.OP_SHR:
                return 0;
            case DexOpcodes.OP_USHR:
                return 0;
            case DexOpcodes.OP_ADD_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_RSUB_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_MUL_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_DIV_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_REM_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_AND_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_OR_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_XOR_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_SHL_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_SHR_INT_LIT_X:
                return 0;
            case DexOpcodes.OP_USHR_INT_LIT_X:
                return 0;

            // ODEX:
            case OdexOpcodes.OP_THROW_VERIFICATION_ERROR:
                return 0;
            case OdexOpcodes.OP_EXECUTE_INLINE:
                return 0;
            case OdexOpcodes.OP_INVOKE_SUPER_QUICK:
                return 0;
            case OdexOpcodes.OP_INVOKE_VIRTUAL_QUICK:
                return 0;
            case OdexOpcodes.OP_IGET_QUICK:
                return 0;
            case OdexOpcodes.OP_IPUT_QUICK:
                return 0;
        }
        return OP_IGNORE;
    }

}


text:
package org.elasticsearch.index.mapper;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.AnalyzerWrapper;
import org.apache.lucene.analysis.CachingTokenFilter;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter;
import org.apache.lucene.analysis.shingle.FixedShingleFilter;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.AutomatonQuery;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.ConstantScoreQuery;
import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.PrefixQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.spans.FieldMaskingSpanQuery;
import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper;
import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.util.automaton.Automata;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.Operations;
import org.elasticsearch.common.collect.Iterators;
import org.elasticsearch.index.analysis.AnalyzerScope;
import org.elasticsearch.index.analysis.IndexAnalyzers;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.similarity.SimilarityProvider;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static org.elasticsearch.index.mapper.TextFieldMapper.TextFieldType.hasGaps;

/**
 * Mapper for a text field that optimizes itself for as-you-type completion by indexing its content into subfields. Each subfield
 * modifies the analysis chain of the root field to index terms the user would create as they type out the value in the root field
 *
 * The structure of these fields is
 *
 * <pre>
 *     [ SearchAsYouTypeFieldMapper, SearchAsYouTypeFieldType, unmodified analysis ]
 *     ├── [ ShingleFieldMapper, ShingleFieldType, analysis wrapped with 2-shingles ]
 *     ├── ...
 *     ├── [ ShingleFieldMapper, ShingleFieldType, analysis wrapped with max_shingle_size-shingles ]
 *     └── [ PrefixFieldMapper, PrefixFieldType, analysis wrapped with max_shingle_size-shingles and edge-ngrams ]
 * </pre>
 */
public class SearchAsYouTypeFieldMapper extends FieldMapper {

    public static final String CONTENT_TYPE = "search_as_you_type";
    private static final int MAX_SHINGLE_SIZE_LOWER_BOUND = 2;
    private static final int MAX_SHINGLE_SIZE_UPPER_BOUND = 4;
    private static final String PREFIX_FIELD_SUFFIX = "._index_prefix";

    public static class Defaults {
        public static final int MIN_GRAM = 1;
        public static final int MAX_GRAM = 20;
        public static final int MAX_SHINGLE_SIZE = 3;
    }

    public static final TypeParser PARSER
        = new TypeParser((n, c) -> new Builder(n, c.getIndexAnalyzers()));

    private static Builder builder(FieldMapper in) {
        return ((SearchAsYouTypeFieldMapper)in).builder;
    }

    public static class Builder extends FieldMapper.Builder {

        private final Parameter<Boolean> index = Parameter.indexParam(m -> builder(m).index.get(), true);
        private final Parameter<Boolean> store = Parameter.storeParam(m -> builder(m).store.get(), false);

        // This is only here because for some reason the initial impl of this always serialized
        // `doc_values=false`, even though it cannot be set; and so we need to continue
        // serializing it forever because of mapper assertions in mixed clusters.
        private final Parameter<Boolean> docValues = Parameter.docValuesParam(m -> false, false)
            .setValidator(v -> {
                if (v) {
                    throw new MapperParsingException("Cannot set [doc_values] on field of type [search_as_you_type]");
                }
            })
            .alwaysSerialize();

        private final Parameter<Integer> maxShingleSize = Parameter.intParam("max_shingle_size", false,
            m -> builder(m).maxShingleSize.get(), Defaults.MAX_SHINGLE_SIZE)
            .setValidator(v -> {
                if (v < MAX_SHINGLE_SIZE_LOWER_BOUND || v > MAX_SHINGLE_SIZE_UPPER_BOUND) {
                    throw new MapperParsingException("[max_shingle_size] must be at least [" + MAX_SHINGLE_SIZE_LOWER_BOUND
                        + "] and at most " + "[" + MAX_SHINGLE_SIZE_UPPER_BOUND + "], got [" + v + "]");
                }
            })
            .alwaysSerialize();

        final TextParams.Analyzers analyzers;
        final Parameter<SimilarityProvider> similarity = TextParams.similarity(m -> builder(m).similarity.get());

        final Parameter<String> indexOptions = TextParams.indexOptions(m -> builder(m).indexOptions.get());
        final Parameter<Boolean> norms = TextParams.norms(true, m -> builder(m).norms.get());
        final Parameter<String> termVectors = TextParams.termVectors(m -> builder(m).termVectors.get());

        private final Parameter<Map<String, String>> meta = Parameter.metaParam();

        public Builder(String name, IndexAnalyzers indexAnalyzers) {
            super(name);
            this.analyzers = new TextParams.Analyzers(indexAnalyzers, m -> builder(m).analyzers);
        }

        @Override
        protected List<Parameter<?>> getParameters() {
            return List.of(index, store, docValues, maxShingleSize,
                analyzers.indexAnalyzer, analyzers.searchAnalyzer, analyzers.searchQuoteAnalyzer, similarity,
                indexOptions, norms, termVectors, meta);
        }

        @Override
        public SearchAsYouTypeFieldMapper build(ContentPath contentPath) {

            FieldType fieldType = new FieldType();
            fieldType.setIndexOptions(TextParams.toIndexOptions(index.getValue(), indexOptions.getValue()));
            fieldType.setOmitNorms(norms.getValue() == false);
            fieldType.setStored(store.getValue());
            TextParams.setTermVectorParams(termVectors.getValue(), fieldType);

            Map<String, NamedAnalyzer> indexAnalyzers = new HashMap<>();

            NamedAnalyzer indexAnalyzer = analyzers.getIndexAnalyzer();
            NamedAnalyzer searchAnalyzer = analyzers.getSearchAnalyzer();

            SearchAsYouTypeFieldType ft = new SearchAsYouTypeFieldType(buildFullName(contentPath), fieldType, similarity.getValue(),
                analyzers.getSearchAnalyzer(), analyzers.getSearchQuoteAnalyzer(), meta.getValue());

            indexAnalyzers.put(ft.name(), indexAnalyzer);

            // set up the prefix field
            FieldType prefixft = new FieldType();
            prefixft.setIndexOptions(fieldType.indexOptions());
            prefixft.setOmitNorms(true);
            prefixft.setStored(false);
            final String fullName = buildFullName(contentPath);
            // wrap the root field's index analyzer with shingles and edge ngrams
            final Analyzer prefixIndexWrapper =
                SearchAsYouTypeAnalyzer.withShingleAndPrefix(indexAnalyzer.analyzer(), maxShingleSize.getValue());
            // wrap the root field's search analyzer with only shingles
            final NamedAnalyzer prefixSearchWrapper = new NamedAnalyzer(searchAnalyzer.name(), searchAnalyzer.scope(),
                SearchAsYouTypeAnalyzer.withShingle(searchAnalyzer.analyzer(), maxShingleSize.getValue()));
            // don't wrap the root field's search quote analyzer as prefix field doesn't support phrase queries
            TextSearchInfo prefixSearchInfo = new TextSearchInfo(prefixft, similarity.getValue(), prefixSearchWrapper, searchAnalyzer);
            final PrefixFieldType prefixFieldType = new PrefixFieldType(fullName, prefixSearchInfo, Defaults.MIN_GRAM, Defaults.MAX_GRAM);
            final NamedAnalyzer prefixAnalyzer = new NamedAnalyzer(indexAnalyzer.name(), AnalyzerScope.INDEX, prefixIndexWrapper);
            final PrefixFieldMapper prefixFieldMapper = new PrefixFieldMapper(prefixft, prefixFieldType);
            indexAnalyzers.put(prefixFieldType.name(), prefixAnalyzer);

            // set up the shingle fields
            final ShingleFieldMapper[] shingleFieldMappers = new ShingleFieldMapper[maxShingleSize.getValue() - 1];
            final ShingleFieldType[] shingleFieldTypes = new ShingleFieldType[maxShingleSize.getValue() - 1];
            for (int i = 0; i < shingleFieldMappers.length; i++) {
                final int shingleSize = i + 2;
                FieldType shingleft = new FieldType(fieldType);
                shingleft.setStored(false);
                String fieldName = getShingleFieldName(buildFullName(contentPath), shingleSize);
                // wrap the root field's index, search, and search quote analyzers with shingles
                final SearchAsYouTypeAnalyzer shingleIndexWrapper =
                    SearchAsYouTypeAnalyzer.withShingle(indexAnalyzer.analyzer(), shingleSize);
                final NamedAnalyzer shingleSearchWrapper = new NamedAnalyzer(searchAnalyzer.name(), searchAnalyzer.scope(),
                    SearchAsYouTypeAnalyzer.withShingle(searchAnalyzer.analyzer(), shingleSize));
                final NamedAnalyzer shingleSearchQuoteWrapper = new NamedAnalyzer(searchAnalyzer.name(), searchAnalyzer.scope(),
                    SearchAsYouTypeAnalyzer.withShingle(searchAnalyzer.analyzer(), shingleSize));
                TextSearchInfo textSearchInfo
                    = new TextSearchInfo(shingleft, similarity.getValue(), shingleSearchWrapper, shingleSearchQuoteWrapper);
                final ShingleFieldType shingleFieldType = new ShingleFieldType(fieldName, shingleSize, textSearchInfo);
                shingleFieldType.setPrefixFieldType(prefixFieldType);
                shingleFieldTypes[i] = shingleFieldType;
                NamedAnalyzer shingleAnalyzer = new NamedAnalyzer(indexAnalyzer.name(), AnalyzerScope.INDEX, shingleIndexWrapper);
                shingleFieldMappers[i] = new ShingleFieldMapper(shingleft, shingleFieldType);
                indexAnalyzers.put(shingleFieldType.name(), shingleAnalyzer);
            }
            ft.setPrefixField(prefixFieldType);
            ft.setShingleFields(shingleFieldTypes);
            return new SearchAsYouTypeFieldMapper(name, ft, copyTo.build(), indexAnalyzers, prefixFieldMapper, shingleFieldMappers, this);
        }
    }

    private static int countPosition(TokenStream stream) throws IOException {
        assert stream instanceof CachingTokenFilter;
        PositionIncrementAttribute posIncAtt = stream.getAttribute(PositionIncrementAttribute.class);
        stream.reset();
        int positionCount = 0;
        while (stream.incrementToken()) {
            if (posIncAtt.getPositionIncrement() != 0) {
                positionCount += posIncAtt.getPositionIncrement();
            }
        }
        return positionCount;
    }

    /**
     * The root field type, which most queries should target as it will delegate queries to subfields better optimized for the query. When
     * handling phrase queries, it analyzes the query text to find the appropriate sized shingle subfield to delegate to. When handling
     * prefix or phrase prefix queries, it delegates to the prefix subfield
     */
    static class SearchAsYouTypeFieldType extends StringFieldType {

        final FieldType fieldType;
        PrefixFieldType prefixField;
        ShingleFieldType[] shingleFields = new ShingleFieldType[0];

        SearchAsYouTypeFieldType(String name, FieldType fieldType, SimilarityProvider similarity,
                                 NamedAnalyzer searchAnalyzer, NamedAnalyzer searchQuoteAnalyzer, Map<String, String> meta) {
            super(name, fieldType.indexOptions() != IndexOptions.NONE, fieldType.stored(), false,
                new TextSearchInfo(fieldType, similarity, searchAnalyzer, searchQuoteAnalyzer), meta);
            this.fieldType = fieldType;
        }

        public void setPrefixField(PrefixFieldType prefixField) {
            this.prefixField = prefixField;
        }

        public void setShingleFields(ShingleFieldType[] shingleFields) {
            this.shingleFields = shingleFields;
        }

        @Override
        public String typeName() {
            return CONTENT_TYPE;
        }

        private ShingleFieldType shingleFieldForPositions(int positions) {
            final int indexFromShingleSize = Math.max(positions - 2, 0);
            return shingleFields[Math.min(indexFromShingleSize, shingleFields.length - 1)];
        }

        @Override
        public ValueFetcher valueFetcher(SearchExecutionContext context, String format) {
            return SourceValueFetcher.toString(name(), context, format);
        }

        @Override
        public Query prefixQuery(String value, MultiTermQuery.RewriteMethod method, boolean caseInsensitive,
                                 SearchExecutionContext context) {
            if (prefixField == null || prefixField.termLengthWithinBounds(value.length()) == false) {
                return super.prefixQuery(value, method, caseInsensitive, context);
            } else {
                final Query query = prefixField.prefixQuery(value, method, caseInsensitive, context);
                if (method == null
                    || method == MultiTermQuery.CONSTANT_SCORE_REWRITE
                    || method == MultiTermQuery.CONSTANT_SCORE_BOOLEAN_REWRITE) {
                    return new ConstantScoreQuery(query);
                } else {
                    return query;
                }
            }
        }

        private void checkForPositions() {
            if (getTextSearchInfo().hasPositions() == false) {
                throw new IllegalStateException("field:[" + name() + "] was indexed without position data; cannot run PhraseQuery");
            }
        }

        @Override
        public Query phraseQuery(TokenStream stream, int slop, boolean enablePositionIncrements,
                SearchExecutionContext context) throws IOException {
            checkForPositions();
            int numPos = countPosition(stream);
            if (shingleFields.length == 0 || slop > 0 || hasGaps(stream) || numPos <= 1) {
                return TextFieldMapper.createPhraseQuery(stream, name(), slop, enablePositionIncrements);
            }
            final ShingleFieldType shingleField = shingleFieldForPositions(numPos);
            stream = new FixedShingleFilter(stream, shingleField.shingleSize);
            return shingleField.phraseQuery(stream, 0, true, context);
        }

        @Override
        public Query multiPhraseQuery(TokenStream stream, int slop, boolean enablePositionIncrements,
                SearchExecutionContext context) throws IOException {
            checkForPositions();
            int numPos = countPosition(stream);
            if (shingleFields.length == 0 || slop > 0 || hasGaps(stream) || numPos <= 1) {
                return TextFieldMapper.createPhraseQuery(stream, name(), slop, enablePositionIncrements);
            }
            final ShingleFieldType shingleField = shingleFieldForPositions(numPos);
            stream = new FixedShingleFilter(stream, shingleField.shingleSize);
            return shingleField.multiPhraseQuery(stream, 0, true, context);
        }

        @Override
        public Query phrasePrefixQuery(TokenStream stream, int slop, int maxExpansions,
                SearchExecutionContext context) throws IOException {
            int numPos = countPosition(stream);
            if (numPos > 1) {
                checkForPositions();
            }
            if (shingleFields.length == 0 || slop > 0 || hasGaps(stream) || numPos <= 1) {
                return TextFieldMapper.createPhrasePrefixQuery(stream, name(), slop, maxExpansions,
                    null, null);
            }
            final ShingleFieldType shingleField = shingleFieldForPositions(numPos);
            stream = new FixedShingleFilter(stream, shingleField.shingleSize);
            return shingleField.phrasePrefixQuery(stream, 0, maxExpansions, context);
        }

        @Override
        public SpanQuery spanPrefixQuery(String value, SpanMultiTermQueryWrapper.SpanRewriteMethod method, SearchExecutionContext context) {
            if (prefixField != null && prefixField.termLengthWithinBounds(value.length())) {
                return new FieldMaskingSpanQuery(new SpanTermQuery(new Term(prefixField.name(), indexedValueForSearch(value))), name());
            } else {
                SpanMultiTermQueryWrapper<?> spanMulti =
                    new SpanMultiTermQueryWrapper<>(new PrefixQuery(new Term(name(), indexedValueForSearch(value))));
                spanMulti.setRewriteMethod(method);
                return spanMulti;
            }
        }
    }

    /**
     * The prefix field type handles prefix and phrase prefix queries that are delegated to it by the other field types in a
     * search_as_you_type structure
     */
    static final class PrefixFieldType extends StringFieldType {

        final int minChars;
        final int maxChars;
        final String parentField;

        PrefixFieldType(String parentField, TextSearchInfo textSearchInfo, int minChars, int maxChars) {
            super(parentField + PREFIX_FIELD_SUFFIX, true, false, false, textSearchInfo, Collections.emptyMap());
            this.minChars = minChars;
            this.maxChars = maxChars;
            this.parentField = parentField;
        }

        boolean termLengthWithinBounds(int length) {
            return length >= minChars - 1 && length <= maxChars;
        }

        @Override
        public Query prefixQuery(String value, MultiTermQuery.RewriteMethod method, boolean caseInsensitive,
                                 SearchExecutionContext context) {
            if (value.length() >= minChars) {
                if(caseInsensitive) {
                    return super.termQueryCaseInsensitive(value, context);
                }
                return super.termQuery(value, context);
            }
            List<Automaton> automata = new ArrayList<>();
            automata.add(Automata.makeString(value));
            for (int i = value.length(); i < minChars; i++) {
                automata.add(Automata.makeAnyChar());
            }
            Automaton automaton = Operations.concatenate(automata);
            AutomatonQuery query = new AutomatonQuery(new Term(name(), value + "*"), automaton);
            query.setRewriteMethod(method);
            return new BooleanQuery.Builder()
                .add(query, BooleanClause.Occur.SHOULD)
                .add(new TermQuery(new Term(parentField, value)), BooleanClause.Occur.SHOULD)
                .build();
        }

        @Override
        public ValueFetcher valueFetcher(SearchExecutionContext context, String format) {
            // Because this internal field is modelled as a multi-field, SourceValueFetcher will look up its
            // parent field in _source. So we don't need to use the parent field name here.
            return SourceValueFetcher.toString(name(), context, format);
        }

        @Override
        public String typeName() {
            return "prefix";
        }

        @Override
        public String toString() {
            return super.toString() + ",prefixChars=" + minChars + ":" + maxChars;
        }
    }

    static final class PrefixFieldMapper extends FieldMapper {

        final FieldType fieldType;

        PrefixFieldMapper(FieldType fieldType, PrefixFieldType mappedFieldType) {
            super(mappedFieldType.name(), mappedFieldType, MultiFields.empty(), CopyTo.empty());
            this.fieldType = fieldType;
        }

        @Override
        public PrefixFieldType fieldType() {
            return (PrefixFieldType) super.fieldType();
        }

        FieldType getLuceneFieldType() {
            return fieldType;
        }

        @Override
        protected void parseCreateField(ParseContext context) {
            throw new UnsupportedOperationException();
        }

        @Override
        public Builder getMergeBuilder() {
            return null;
        }

        @Override
        protected String contentType() {
            return "prefix";
        }

        @Override
        public String toString() {
            return fieldType().toString();
        }
    }

    static final class ShingleFieldMapper extends FieldMapper {

        private final FieldType fieldType;

        ShingleFieldMapper(FieldType fieldType, ShingleFieldType mappedFieldtype) {
            super(mappedFieldtype.name(), mappedFieldtype, MultiFields.empty(), CopyTo.empty());
            this.fieldType = fieldType;
        }

        FieldType getLuceneFieldType() {
            return fieldType;
        }

        @Override
        public ShingleFieldType fieldType() {
            return (ShingleFieldType) super.fieldType();
        }

        @Override
        protected void parseCreateField(ParseContext context) {
            throw new UnsupportedOperationException();
        }

        @Override
        public Builder getMergeBuilder() {
            return null;
        }

        @Override
        protected String contentType() {
            return "shingle";
        }
    }

    /**
     * The shingle field type handles phrase queries and delegates prefix and phrase prefix queries to the prefix field
     */
    static class ShingleFieldType extends StringFieldType {
        final int shingleSize;
        PrefixFieldType prefixFieldType;

        ShingleFieldType(String name, int shingleSize, TextSearchInfo textSearchInfo) {
            super(name, true, false, false, textSearchInfo, Collections.emptyMap());
            this.shingleSize = shingleSize;
        }

        void setPrefixFieldType(PrefixFieldType prefixFieldType) {
            this.prefixFieldType = prefixFieldType;
        }

        @Override
        public ValueFetcher valueFetcher(SearchExecutionContext context, String format) {
            // Because this internal field is modelled as a multi-field, SourceValueFetcher will look up its
            // parent field in _source. So we don't need to use the parent field name here.
            return SourceValueFetcher.toString(name(), context, format);
        }

        @Override
        public String typeName() {
            return CONTENT_TYPE;
        }

        @Override
        public Query prefixQuery(String value, MultiTermQuery.RewriteMethod method, boolean caseInsensitive,
                                 SearchExecutionContext context) {
            if (prefixFieldType == null || prefixFieldType.termLengthWithinBounds(value.length()) == false) {
                return super.prefixQuery(value, method, caseInsensitive, context);
            } else {
                final Query query = prefixFieldType.prefixQuery(value, method, caseInsensitive, context);
                if (method == null
                    || method == MultiTermQuery.CONSTANT_SCORE_REWRITE
                    || method == MultiTermQuery.CONSTANT_SCORE_BOOLEAN_REWRITE) {
                    return new ConstantScoreQuery(query);
                } else {
                    return query;
                }
            }
        }

        @Override
        public Query phraseQuery(TokenStream stream, int slop, boolean enablePositionIncrements,
                SearchExecutionContext context) throws IOException {
            return TextFieldMapper.createPhraseQuery(stream, name(), slop, enablePositionIncrements);
        }

        @Override
        public Query multiPhraseQuery(TokenStream stream, int slop, boolean enablePositionIncrements,
                SearchExecutionContext context) throws IOException {
            return TextFieldMapper.createPhraseQuery(stream, name(), slop, enablePositionIncrements);
        }

        @Override
        public Query phrasePrefixQuery(TokenStream stream, int slop, int maxExpansions,
                SearchExecutionContext context) throws IOException {
            final String prefixFieldName = slop > 0
                ? null
                : prefixFieldType.name();
            return TextFieldMapper.createPhrasePrefixQuery(stream, name(), slop, maxExpansions,
                prefixFieldName, prefixFieldType::termLengthWithinBounds);
        }

        @Override
        public SpanQuery spanPrefixQuery(String value, SpanMultiTermQueryWrapper.SpanRewriteMethod method, SearchExecutionContext context) {
            if (prefixFieldType != null && prefixFieldType.termLengthWithinBounds(value.length())) {
                return new FieldMaskingSpanQuery(new SpanTermQuery(new Term(prefixFieldType.name(), indexedValueForSearch(value))), name());
            } else {
                SpanMultiTermQueryWrapper<?> spanMulti =
                    new SpanMultiTermQueryWrapper<>(new PrefixQuery(new Term(name(), indexedValueForSearch(value))));
                spanMulti.setRewriteMethod(method);
                return spanMulti;
            }
        }
    }

    private final int maxShingleSize;
    private final PrefixFieldMapper prefixField;
    private final ShingleFieldMapper[] shingleFields;
    private final Builder builder;

    public SearchAsYouTypeFieldMapper(String simpleName,
                                      SearchAsYouTypeFieldType mappedFieldType,
                                      CopyTo copyTo,
                                      Map<String, NamedAnalyzer> indexAnalyzers,
                                      PrefixFieldMapper prefixField,
                                      ShingleFieldMapper[] shingleFields,
                                      Builder builder) {
        super(simpleName, mappedFieldType, indexAnalyzers, MultiFields.empty(), copyTo, false, null);
        this.prefixField = prefixField;
        this.shingleFields = shingleFields;
        this.maxShingleSize = builder.maxShingleSize.getValue();
        this.builder = builder;
    }

    @Override
    protected void parseCreateField(ParseContext context) throws IOException {
        final String value = context.parser().textOrNull();
        if (value == null) {
            return;
        }

        if (this.builder.index.get() == false && this.builder.store.get() == false) {
            return;
        }

        context.doc().add(new Field(fieldType().name(), value, fieldType().fieldType));
        if (this.builder.index.get()) {
            for (ShingleFieldMapper subFieldMapper : shingleFields) {
                context.doc().add(new Field(subFieldMapper.fieldType().name(), value, subFieldMapper.getLuceneFieldType()));
            }
            context.doc().add(new Field(prefixField.fieldType().name(), value, prefixField.getLuceneFieldType()));
        }
        if (fieldType().fieldType.omitNorms()) {
            context.addToFieldNames(fieldType().name());
        }
    }

    @Override
    protected String contentType() {
        return CONTENT_TYPE;
    }

    public FieldMapper.Builder getMergeBuilder() {
        return new Builder(simpleName(), builder.analyzers.indexAnalyzers).init(this);
    }

    public static String getShingleFieldName(String parentField, int shingleSize) {
        return parentField + "._" + shingleSize + "gram";
    }

    @Override
    public SearchAsYouTypeFieldType fieldType() {
        return (SearchAsYouTypeFieldType) super.fieldType();
    }

    public int maxShingleSize() {
        return maxShingleSize;
    }

    public PrefixFieldMapper prefixField() {
        return prefixField;
    }

    public ShingleFieldMapper[] shingleFields() {
        return shingleFields;
    }

    @Override
    public Iterator<Mapper> iterator() {
        List<Mapper> subIterators = new ArrayList<>();
        subIterators.add(prefixField);
        subIterators.addAll(Arrays.asList(shingleFields));
        @SuppressWarnings("unchecked") Iterator<Mapper> concat = Iterators.concat(super.iterator(), subIterators.iterator());
        return concat;
    }

    /**
     * An analyzer wrapper to add a shingle token filter, an edge ngram token filter or both to its wrapped analyzer. When adding an edge
     * ngrams token filter, it also adds a {@link TrailingShingleTokenFilter} to add extra position increments at the end of the stream
     * to induce the shingle token filter to create tokens at the end of the stream smaller than the shingle size
     */
    static class SearchAsYouTypeAnalyzer extends AnalyzerWrapper {

        private final Analyzer delegate;
        private final int shingleSize;
        private final boolean indexPrefixes;

        private SearchAsYouTypeAnalyzer(Analyzer delegate,
                                        int shingleSize,
                                        boolean indexPrefixes) {

            super(delegate.getReuseStrategy());
            this.delegate = Objects.requireNonNull(delegate);
            this.shingleSize = shingleSize;
            this.indexPrefixes = indexPrefixes;
        }

        static SearchAsYouTypeAnalyzer withShingle(Analyzer delegate, int shingleSize) {
            return new SearchAsYouTypeAnalyzer(delegate, shingleSize, false);
        }

        static SearchAsYouTypeAnalyzer withShingleAndPrefix(Analyzer delegate, int shingleSize) {
            return new SearchAsYouTypeAnalyzer(delegate, shingleSize, true);
        }

        @Override
        protected Analyzer getWrappedAnalyzer(String fieldName) {
            return delegate;
        }

        @Override
        protected TokenStreamComponents wrapComponents(String fieldName, TokenStreamComponents components) {
            TokenStream tokenStream = components.getTokenStream();
            if (indexPrefixes) {
                tokenStream = new TrailingShingleTokenFilter(tokenStream, shingleSize - 1);
            }
            tokenStream = new FixedShingleFilter(tokenStream, shingleSize, " ", "");
            if (indexPrefixes) {
                tokenStream = new EdgeNGramTokenFilter(tokenStream, Defaults.MIN_GRAM, Defaults.MAX_GRAM, true);
            }
            return new TokenStreamComponents(components.getSource(), tokenStream);
        }

        public int shingleSize() {
            return shingleSize;
        }

        public boolean indexPrefixes() {
            return indexPrefixes;
        }

        @Override
        public String toString() {
            return "<" + getClass().getCanonicalName() + " shingleSize=[" + shingleSize + "] indexPrefixes=[" + indexPrefixes + "]>";
        }

        private static class TrailingShingleTokenFilter extends TokenFilter {

            private final int extraPositionIncrements;
            private final PositionIncrementAttribute positionIncrementAttribute;

            TrailingShingleTokenFilter(TokenStream input, int extraPositionIncrements) {
                super(input);
                this.extraPositionIncrements = extraPositionIncrements;
                this.positionIncrementAttribute = addAttribute(PositionIncrementAttribute.class);
            }

            @Override
            public boolean incrementToken() throws IOException {
                return input.incrementToken();
            }

            @Override
            public void end() throws IOException {
                super.end();
                positionIncrementAttribute.setPositionIncrement(extraPositionIncrements);
            }
        }
    }
}


text:
<!DOCTYPE html>

        <title> scheduler: focus and blur events</title>

FAILED (This TC requires JavaScript enabled)

        <form><input type="button" onclick="log('click event')" onfocus="log('focus event')" onblur="log('blur event')"><input type="button" onfocus="log('focus el 2 event')" onblur="log('blur event')"></form>


text:
package org.xlcloud.console.virtualClusterDefinitions.converters;

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

import javax.faces.bean.RequestScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.inject.Named;

import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;

/**
 * It converts string representing the JSON array to List of Strings and vice versa.
 * @author Konrad Król, AMG.net
 */
@Named
@RequestScoped
public class JsonArrayConverter implements Converter {

    private Logger LOG = Logger.getLogger(JsonArrayConverter.class);

    /** {@inheritDoc} */
    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        List<String> values = new ArrayList<String>();

        try {
            JSONArray jsonArray = new JSONArray(value);
            for(int i=0; i< jsonArray.length(); i++) {
                values.add(jsonArray.getString(i));
            }
        } catch (JSONException e) {
            LOG.error(e, e);
            throw new RuntimeException(e.getMessage(), e);
        }

        return values;
    }

    /** {@inheritDoc} */
    @SuppressWarnings( "unchecked" )
    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        return getAsString((List<String>) value);
    }

    /**
     * Returns a string representing a json array which contain all elements from the given list
     * @param value
     *  - list to be parsed
     * @return list parsed to json array
     */
    public String getAsString(List<String> value) {
        JSONArray jsonArray = new JSONArray(value);
        return jsonArray.toString();
    }
}


text:
#import <UIKit/UIKit.h>

@class APCDashboardTableViewCell;

@protocol APCDashboardTableViewCellDelegate <NSObject>

@optional
- (void)dashboardTableViewCellDidTapExpand:(APCDashboardTableViewCell *)cell;

- (void)dashboardTableViewCellDidTapMoreInfo:(APCDashboardTableViewCell *)cell;

- (void)dashboardTableViewCellDidTapLegendTitle:(APCDashboardTableViewCell *)cell;

@end

@interface APCDashboardTableViewCell : UITableViewCell

@property (weak, nonatomic) IBOutlet UIView *tintView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIButton *resizeButton;
@property (weak, nonatomic) IBOutlet UIButton *infoButton;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelWidthConstraint;
@property (strong, nonatomic) UIColor *tintColor;
@property (strong, nonatomic) NSString *title;

@property (weak, nonatomic) id <APCDashboardTableViewCellDelegate> delegate;

- (IBAction)infoTapped:(id)sender;
- (IBAction)expandTapped:(id)sender;
- (IBAction)legendLabelTapped:(id)sender;

@end


text:
package de.tototec.sbuild.addons

/**
 * Addons for the Java toolchain.
 */
package object java {

}


text:
<input type="text" ng-model="searchRole" placeholder="Search Roles..." class="search-query" />

            Name

            {{role.name}}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
    <title>顶部导航组件</title>

    <link rel="stylesheet" href="/assets/blend2/dist/boost.css" />
    <link rel="stylesheet" href="/assets/blend2/dist/sample.css">

            顶部导航组件

            标题区

            按钮
            按钮2