text:
package galaxyspace.systems.SolarSystem.planets.ceres.dimension;

import java.util.List;

import com.google.common.collect.Lists;

import asmodeuscore.core.astronomy.dimension.world.gen.ChunkProviderSpaceLakes;
import asmodeuscore.core.astronomy.dimension.world.gen.MapGenCaves;
import asmodeuscore.core.astronomy.dimension.world.gen.dungeons.standart.DungeonConfiguration;
import galaxyspace.core.GSBlocks;
import galaxyspace.core.configs.GSConfigCore;
import galaxyspace.core.prefab.blocks.DungeonBlocks;
import galaxyspace.systems.SolarSystem.planets.ceres.blocks.CeresBlocks;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.BiomeDecoratorCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.MapGenDungeonCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.dungeon.CorridorCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.dungeon.RoomBossCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.dungeon.RoomChestCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.dungeon.RoomEmptyCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.dungeon.RoomSpawnerCeres;
import galaxyspace.systems.SolarSystem.planets.ceres.world.gen.dungeon.RoomTreasureCeres;
import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair;
import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeAdaptive;
import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace;
import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkPrimer;

public class ChunkProviderCeres extends ChunkProviderSpaceLakes {

    private List<MapGenBaseMeta> worldGenerators;

    private final MapGenCaves caveGenerator = new MapGenCaves(GSBlocks.CERES_BLOCKS.getStateFromMeta(0), GSBlocks.CERES_BLOCKS.getStateFromMeta(1));

    private IBlockState top = GSBlocks.CERES_BLOCKS.getDefaultState().withProperty(CeresBlocks.BASIC_TYPE, CeresBlocks.EnumCeresBlocks.CERES_DUNGEON_TOP);
    private IBlockState floor = GSBlocks.CERES_BLOCKS.getDefaultState().withProperty(CeresBlocks.BASIC_TYPE, CeresBlocks.EnumCeresBlocks.CERES_DUNGEON_FLOOR);
    private IBlockState bricks = GSBlocks.DUNGEON_BLOCKS.getDefaultState().withProperty(DungeonBlocks.BASIC_TYPE, DungeonBlocks.EnumDungeonBlocks.CERES_BRICKS);
    private final MapGenDungeonCeres dungeonGenerator = new MapGenDungeonCeres(new DungeonConfiguration(bricks, top, floor, 30, 8, 16, 7, 7, CorridorCeres.class, RoomEmptyCeres.class, RoomSpawnerCeres.class, RoomChestCeres.class, RoomBossCeres.class, RoomTreasureCeres.class));

	@Override
	protected List<MapGenBaseMeta> getWorldGenerators()
	{
		List<MapGenBaseMeta> generators = Lists.newArrayList();
		generators.add(this.caveGenerator);
		return generators;
	}

	public ChunkProviderCeres(World par1World, long seed, boolean mapFeaturesEnabled)
	{
		super(par1World, seed, mapFeaturesEnabled);
	}

	@Override
	protected BiomeDecoratorSpace getBiomeGenerator() {
	    return new BiomeDecoratorCeres();
	}
	//This should be a custom biome for your mod, but I'm opting to go desert instead out of quickness
	//and the fact that biomes are outside the scope of this tutorial

	@Override
	protected Biome[] getBiomesForGeneration() {
	    return new Biome[]{BiomeAdaptive.biomeDefault};
	}

	@Override
	public int getCraterProbability() {
	    return 300;
	}

	@Override
	public double getHeightModifier() {
	    return 20;
	}

	@Override
	public void onChunkProvider(int cX, int cZ, ChunkPrimer primer) {
		if(GSConfigCore.enableDungeonsGeneration) this.dungeonGenerator.generate(this.worldObj, cX, cZ, primer);
	}

	@Override
	public void onPopulate(int cX, int cZ) {
		if(GSConfigCore.enableDungeonsGeneration) this.dungeonGenerator.generateStructure(this.worldObj, this.rand, new ChunkPos(cX, cZ));
	}

	@Override
	public void recreateStructures(Chunk chunkIn, int x, int z) {
		if(GSConfigCore.enableDungeonsGeneration) this.dungeonGenerator.generate(this.worldObj, x, z, null);
	}

	@Override
	public double getMountainHeightModifier() {
	    return 0;
	}

	@Override
	public int getWaterLevel() {
	    return 80;
	}

	@Override
	public double getSmallFeatureHeightModifier() {
	    return 1;
	}

	@Override
	public double getValleyHeightModifier() {
	    return 0;
	}

	@Override
	protected BlockMetaPair getGrassBlock() {
		return new BlockMetaPair(GSBlocks.CERES_BLOCKS, (byte) 0);
	}

	@Override
	protected BlockMetaPair getDirtBlock() {
		return new BlockMetaPair(GSBlocks.CERES_BLOCKS, (byte) 1);
	}

	@Override
	protected BlockMetaPair getStoneBlock() {
		return new BlockMetaPair(GSBlocks.CERES_BLOCKS, (byte) 1);
	}

	@Override
	protected boolean enableBiomeGenBaseBlock() {
		return false;
	}

	@Override
	public boolean canGenerateWaterBlock() {
		return false;
	}

	@Override
	public boolean canGenerateIceBlock() {
		return true;
	}

	@Override
	protected BlockMetaPair getWaterBlock() {
		return null;
	}

	@Override
	protected GenType getGenType() {
		return GenType.GC;
	}
}


text:
from alembic.autogenerate.api import compare_metadata
from casexml.apps.case.models import CommCareCase
from corehq.apps.userreports.exceptions import TableRebuildError
from corehq.apps.userreports.models import DataSourceConfiguration, CustomDataSourceConfiguration
from corehq.apps.userreports.sql import create_engine, IndicatorSqlAdapter, metadata
from corehq.apps.userreports.tasks import rebuild_indicators
from dimagi.utils.logging import notify_error
from fluff.signals import get_migration_context, get_tables_to_rebuild
from pillowtop.couchdb import CachedCouchDB
from pillowtop.listener import PythonPillow

class ConfigurableIndicatorPillow(PythonPillow):

    def __init__(self):
        # run_ptop never passes args to __init__ so make that explicit by not supporting any
        # todo: this will need to not be hard-coded if we ever split out forms and cases into their own domains
        couch_db = CachedCouchDB(CommCareCase.get_db().uri, readonly=False)
        super(ConfigurableIndicatorPillow, self).__init__(couch_db=couch_db)
        self.bootstrapped = False

    @classmethod
    def get_sql_engine(cls):
        # todo: switch to connection_manager
        engine = getattr(cls, '_engine', None)
        if not engine:
            cls._engine = create_engine()
        return cls._engine

    def get_all_configs(self):
        return DataSourceConfiguration.all()

    def run(self):
        self.bootstrap()
        super(ConfigurableIndicatorPillow, self).run()

    def bootstrap(self, configs=None):
        # sets up the initial stuff
        if configs is None:
            configs = self.get_all_configs()

        self.tables = [IndicatorSqlAdapter(config) for config in configs]
        self.rebuild_tables_if_necessary()
        self.bootstrapped = True

    def rebuild_tables_if_necessary(self):
        table_map = {t.get_table().name: t for t in self.tables}
        engine = self.get_sql_engine()
        with engine.begin() as connection:
            migration_context = get_migration_context(connection, table_map.keys())
            diffs = compare_metadata(migration_context, metadata)

        tables_to_rebuild = get_tables_to_rebuild(diffs, table_map.keys())
        for table_name in tables_to_rebuild:
            table = table_map[table_name]
            try:
                self.rebuild_table(table)
            except TableRebuildError, e:
                notify_error(unicode(e))

    def rebuild_table(self, table):
        table.rebuild_table()

    def python_filter(self, doc):
        # filtering is done manually per indicator see change_transport
        return True

    def change_trigger(self, changes_dict):
        if not self.bootstrapped:
            self.bootstrap()
        if changes_dict.get('deleted', False):
            # we don't currently support hard-deletions at all.
            # we may want to change this at some later date but seem ok for now.
            # see https://github.com/dimagi/commcare-hq/pull/6944 for rationale
            pass
        return super(ConfigurableIndicatorPillow, self).change_trigger(changes_dict)

    def change_transport(self, doc):
        for table in self.tables:
            if table.config.filter(doc):
                table.save(doc)
            elif table.config.deleted_filter(doc):
                table.delete(doc)

    def set_checkpoint(self, change):
        # override this to rebootstrap the tables
        super(ConfigurableIndicatorPillow, self).set_checkpoint(change)

        # todo: may want to consider adjusting the frequency or using another mechanism for this
        self.bootstrap()

class CustomDataSourcePillow(ConfigurableIndicatorPillow):

    def get_all_configs(self):
        return CustomDataSourceConfiguration.all()

    def rebuild_table(self, table):
        super(CustomDataSourcePillow, self).rebuild_table(table)
        rebuild_indicators.delay(table.config.get_id)

redpajama_set_name: RedPajamaGithub


text:
import { IconContainer, IconProps } from "@components/Icon/lib/Container";
import { Shield } from "@clair/icons";
import { getStyleMergedComponent } from "@src/utils";

export const IconShield = getStyleMergedComponent<IconProps>({
  template: Shield
})(IconContainer);


text:
from django.utils.safestring import mark_safe
from django.template import Library

import json

register = Library()

def jsonify(object):
    return mark_safe(json.dumps(object))

register.filter('jsonify', jsonify)
jsonify.is_safe = True


text:
package com.amazonaws.codegen.emitters;

import com.amazonaws.codegen.internal.Constants;

import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.text.edits.TextEdit;

import java.util.HashMap;
import java.util.Map;

/**
 * Formats the generated java source code. Uses Eclipse JDT core plugin from the Eclipse SDK.
 */
@SuppressWarnings("unchecked")
public class JavaCodeFormatter implements ContentProcessor {

    private final CodeFormatter codeFormatter;

    private static final Map<String, Object> DEFAULT_FORMATTER_OPTIONS;

    static {
        DEFAULT_FORMATTER_OPTIONS = DefaultCodeFormatterConstants.getEclipseDefaultSettings();

        DEFAULT_FORMATTER_OPTIONS.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8);
        DEFAULT_FORMATTER_OPTIONS.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8);
        DEFAULT_FORMATTER_OPTIONS.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8);
        DEFAULT_FORMATTER_OPTIONS.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR,
                JavaCore.SPACE);
        DEFAULT_FORMATTER_OPTIONS.put(
                DefaultCodeFormatterConstants.FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION,
                DefaultCodeFormatterConstants.FALSE);
        DEFAULT_FORMATTER_OPTIONS.put(
                DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS,
                DefaultCodeFormatterConstants.createAlignmentValue(true,
                        DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
                        DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
        DEFAULT_FORMATTER_OPTIONS.put(
                DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
                DefaultCodeFormatterConstants.createAlignmentValue(false,
                        DefaultCodeFormatterConstants.WRAP_COMPACT,
                        DefaultCodeFormatterConstants.INDENT_DEFAULT));
        // Formats custom file headers if provided
        DEFAULT_FORMATTER_OPTIONS
                .put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER,
                        DefaultCodeFormatterConstants.TRUE);
        DEFAULT_FORMATTER_OPTIONS.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "160");
        DEFAULT_FORMATTER_OPTIONS.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "120");
    }

    /**
     * Creates a JavaCodeFormatter using the default formatter options.
     */
    public JavaCodeFormatter() {
        this(new HashMap<>());
    }

    /**
     * Creates a JavaCodeFormatter using the default formatter options and
     * optionally applying user provided options on top.
     *
     * @param overrideOptions user provided options to apply on top of defaults
     */
    public JavaCodeFormatter(final Map<String, Object> overrideOptions) {
        Map formatterOptions = new HashMap<>(DEFAULT_FORMATTER_OPTIONS);
        if (overrideOptions != null) {
            formatterOptions.putAll(overrideOptions);
        }

        this.codeFormatter = ToolFactory.createCodeFormatter(formatterOptions,
                ToolFactory.M_FORMAT_EXISTING);
    }

    public String apply(String contents) {
        final TextEdit edit = codeFormatter.format(
                CodeFormatter.K_COMPILATION_UNIT
                        | CodeFormatter.F_INCLUDE_COMMENTS, contents, 0,
                contents.length(), 0, Constants.LINE_SEPARATOR);

        if (edit == null) {
            // TODO log a fatal or warning here. Throwing an exception is causing the actual freemarker error to be lost
            return contents;
        }

        IDocument document = new Document(contents);

        try {
            edit.apply(document);
        } catch (Exception e) {
            throw new RuntimeException(
                    "Failed to format the generated source code.", e);
        }

        return document.get();
    }
}


text:
@interface NWPDFTests : SenTestCase @end

@implementation NWPDFTests

- (void)testRun {
}

@end


text:
package com.opengsn.controller.model;

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

import javax.xml.bind.annotation.XmlRootElement;

import com.opengsn.controller.ControllerException;
import com.opengsn.services.cloudmanager.model.VM;
import com.opengsn.services.utils.ObjectSerializer;

/**
 * A VMList contains a set of VirtualMachines.
 * Each VirtualMachine is identified by its IP address.
 * @author knguyen
 *
 */
@XmlRootElement (name = "VMList")
public class VMList
{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	private List<VirtualMachine> vms = null;

	public VMList() {
	}

	public List<VirtualMachine> getVMs() {
		return this.vms;
	}

	public void setVMs(List<VirtualMachine> vms) {
		this.vms = vms;
	}

	public void sort() {
		java.util.Collections.sort(vms);
	}

	public void addVM(VirtualMachine v) {
		if (this.vms == null)
			this.vms = new ArrayList<VirtualMachine>();
		this.vms.add(v);
	}

	public VirtualMachine getVM(String ip) {
		if (this.vms == null)
			return null;

		Iterator<VirtualMachine> it = this.vms.iterator();
		while (it.hasNext()) {
			VirtualMachine v = (VirtualMachine)it.next();
			if (v.getVM().getIp().compareTo(ip) == 0)
				return v;
		}

		return null;
	}

	public void removeVM(VM vm) {
	}

	public void removeVM(String ip) throws ControllerException {
		if (this.vms == null)
			throw new ControllerException("ControllerException: VM: " + ip + " not found.");

		Iterator<VirtualMachine> it = this.vms.iterator();
		while (it.hasNext()) {
			VirtualMachine v = (VirtualMachine)it.next();
			if (v.getVM().getIp().compareTo(ip) == 0) {
				it.remove();
				return;
			}
		}
		throw new ControllerException("ControllerException: VM: " + ip + " not found.");
	}

	public String toXML() {
		return ObjectSerializer.toXml(this);
	}
}


text:
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.org/robstoll/angular-seed.svg?branch=master)](https://travis-ci.org/robstoll/angular-seed)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/robstoll/angular-seed?svg=true)](https://ci.appveyor.com/project/robstoll/angular-seed)
[![Dependency Status](https://david-dm.org/robstoll/angular-seed.svg)](https://david-dm.org/robstoll/angular-seed)
[![devDependency Status](https://david-dm.org/robstoll/angular-seed/dev-status.svg)](https://david-dm.org/robstoll/angular-seed?type=dev)

This is a seed project for angular based projects. It is itself based on [mgechev's angular-seed](https://github.com/mgechev/angular-seed/).

**TODO, complete the following steps**

1. Setup up the project as described in the [README-seed](README-seed.md)
2. Delete the text above and write your own [Introduction](#introduction)
3. Update the links of the badges above (to reflect your repository)
4. Update LICENSE file (and section 'License' below)
5. Update package.json file (name, version, description, author ...)
6. Modify .travis.yml (or remove it if you do not use travis)
    1. Change the path in after_failure so it reflects your repository
    2. Uncomment the part about gitter in the notifications section and adjust the url in case you use gitter
7. Modify appveyor.yml (or remove it if you do not use appveyor)
    1. Uncomment the notifications section and adjust the gitter url in case you use gitter
8. Well done, now you can delete this list

# Contributing

We appreciate that you want to contribute by either report bugs, suggest a new feature or by a pull request.
Please see the [CONTRIBUTING](.github/CONTRIBUTING.md) file for guidelines.

# Based on robstoll's angular-seed

This project is/was using [robstoll's angular-seed](https://github.com/robstoll/angular-seed) (short angular-seed)
-- which in turn is based on [mgechev's angular-seed](https://github.com/mgechev/angular-seed/) -- to start off.

See [README-seed](README-seed.md) for information how this project was set up with angular-seed
and how you can get updates of angular-seed.
Please refer to [mgechev's repository](https://github.com/mgechev/angular-seed/) for further details and help.

# License

Work is licensed under: [MIT](LICENSE)
Seed is licensed under: [MIT](LICENSE-seed)


text:
RSpec.shared_examples "referenced feature visibility" do |*related_features|
  let(:feature_fields) do
    related_features.map { |feature| (feature + "_access_level").to_sym }
  end

  before { link['data-project'] = project.id.to_s }

  context "when feature is disabled" do
    it "does not create reference" do
      set_features_fields_to(ProjectFeature::DISABLED)
      expect(subject.nodes_visible_to_user(user, [link])).to eq([])
    end
  end

  context "when feature is enabled only for team members" do
    before { set_features_fields_to(ProjectFeature::PRIVATE) }

    it "does not create reference for non member" do
      non_member = create(:user)

      expect(subject.nodes_visible_to_user(non_member, [link])).to eq([])
    end

    it "creates reference for member" do
      project.team << [user, :developer]

      expect(subject.nodes_visible_to_user(user, [link])).to eq([link])
    end
  end

  context "when feature is enabled" do
    # The project is public
    it "creates reference" do
      set_features_fields_to(ProjectFeature::ENABLED)

      expect(subject.nodes_visible_to_user(user, [link])).to eq([link])
    end
  end

  def set_features_fields_to(visibility_level)
    feature_fields.each { |field| project.project_feature.update_attribute(field, visibility_level) }
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.example.mac.currenttemperaturefinder.MainActivity">

    <ProgressBar
            android:id="@+id/progress_loader"
            style="?android:attr/progressBarStyle"
            android:layout_width="97dp"
            android:layout_height="49dp"
            android:layout_centerInParent="true"
            app:layout_constraintLeft_toLeftOf="@+id/activity_main"
            android:layout_marginStart="16dp"
            app:layout_constraintTop_toTopOf="@+id/activity_main"
            android:layout_marginTop="16dp"
            app:layout_constraintRight_toRightOf="@+id/activity_main"
            android:layout_marginEnd="16dp"
            app:layout_constraintBottom_toTopOf="@+id/lat"
            android:layout_marginBottom="8dp"
            app:layout_constraintVertical_bias="0.19"/>

    <TextView
            android:layout_width="209dp"
            android:layout_height="64dp"
            android:id="@+id/lat"
            android:visibility="invisible"
            android:textAppearance="@android:style/TextAppearance.Material.Large"
            android:textColor="@color/colorPrimary"
            android:textAlignment="center"
            app:layout_constraintLeft_toLeftOf="@+id/activity_main"
            android:layout_marginStart="16dp"
            app:layout_constraintTop_toTopOf="@+id/activity_main"
            android:layout_marginTop="96dp"
            app:layout_constraintRight_toRightOf="@+id/activity_main"
            android:layout_marginEnd="16dp"/>

    <TextView
            android:layout_width="216dp"
            android:layout_height="67dp"
            android:id="@+id/lon"
            android:visibility="invisible"
            android:textAppearance="@android:style/TextAppearance.Material.Large"
            android:textColor="@color/colorPrimary"
            android:textAlignment="center"
            app:layout_constraintLeft_toLeftOf="@+id/activity_main"
            android:layout_marginStart="16dp"
            app:layout_constraintTop_toBottomOf="@+id/lat"
            android:layout_marginTop="24dp"
            app:layout_constraintRight_toRightOf="@+id/activity_main"
            android:layout_marginEnd="16dp"
            app:layout_constraintHorizontal_bias="0.52"/>

    <TextView
            android:layout_width="314dp"
            android:layout_height="57dp"
            android:id="@+id/temp"
            android:visibility="invisible"
            android:textAppearance="@android:style/TextAppearance.Material.Large"
            android:textColor="@color/colorPrimary"
            android:textAlignment="center"
            app:layout_constraintLeft_toLeftOf="@+id/activity_main"
            android:layout_marginStart="16dp"
            app:layout_constraintTop_toBottomOf="@+id/lon"
            android:layout_marginTop="8dp"
            app:layout_constraintRight_toRightOf="@+id/activity_main"
            android:layout_marginEnd="16dp"
            app:layout_constraintBottom_toBottomOf="@+id/activity_main"
            android:layout_marginBottom="16dp"
            app:layout_constraintHorizontal_bias="0.59"
            app:layout_constraintVertical_bias="0.19"/>

    <ProgressBar
            android:id="@+id/progress_loader1"
            style="?android:attr/progressBarStyle"
            android:layout_width="97dp"
            android:layout_height="49dp"
            android:visibility="invisible"
            app:layout_constraintLeft_toLeftOf="@+id/activity_main"
            android:layout_marginStart="16dp"
            app:layout_constraintTop_toBottomOf="@+id/lon"
            android:layout_marginTop="8dp"
            app:layout_constraintRight_toRightOf="@+id/activity_main"
            android:layout_marginEnd="16dp"
            app:layout_constraintBottom_toTopOf="@+id/temp"
            android:layout_marginBottom="8dp"
            app:layout_constraintVertical_bias="0.060000002"/>

</android.support.constraint.ConstraintLayout>


text:
<?php

namespace PayPal\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for ModifiedFieldType StructType
 * @subpackage Structs
 * @author WsdlToPhp <contact@wsdltophp.com>
 */
class ModifiedFieldType extends AbstractStructBase
{
    /**
     * The Field
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * @var string
     */
    public $Field;
    /**
     * The ModifyType
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * @var string
     */
    public $ModifyType;
    /**
     * Constructor method for ModifiedFieldType
     * @uses ModifiedFieldType::setField()
     * @uses ModifiedFieldType::setModifyType()
     * @param string $field
     * @param string $modifyType
     */
    public function __construct($field = null, $modifyType = null)
    {
        $this
            ->setField($field)
            ->setModifyType($modifyType);
    }
    /**
     * Get Field value
     * @return string|null
     */
    public function getField()
    {
        return $this->Field;
    }
    /**
     * Set Field value
     * @param string $field
     * @return \PayPal\StructType\ModifiedFieldType
     */
    public function setField($field = null)
    {
        // validation for constraint: string
        if (!is_null($field) && !is_string($field)) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($field, true), gettype($field)), __LINE__);
        }
        $this->Field = $field;
        return $this;
    }
    /**
     * Get ModifyType value
     * @return string|null
     */
    public function getModifyType()
    {
        return $this->ModifyType;
    }
    /**
     * Set ModifyType value
     * @uses \PayPal\EnumType\ModifyCodeType::valueIsValid()
     * @uses \PayPal\EnumType\ModifyCodeType::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $modifyType
     * @return \PayPal\StructType\ModifiedFieldType
     */
    public function setModifyType($modifyType = null)
    {
        // validation for constraint: enumeration
        if (!\PayPal\EnumType\ModifyCodeType::valueIsValid($modifyType)) {
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\ModifyCodeType', is_array($modifyType) ? implode(', ', $modifyType) : var_export($modifyType, true), implode(', ', \PayPal\EnumType\ModifyCodeType::getValidValues())), __LINE__);
        }
        $this->ModifyType = $modifyType;
        return $this;
    }
}


text:
filename: /packages/material-ui/src/GridListTile/GridListTile.js
---

# GridListTile API

The API documentation of the GridListTile React component. Learn more about the properties and the CSS customization points.

```js
import GridListTile from '@material-ui/core/GridListTile';
```

## Props

| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| children | node |  | Theoretically you can pass any node as children, but the main use case is to pass an img, in which case GridListTile takes care of making the image "cover" available space (similar to `background-size: cover` or to `object-fit: cover`). |
| classes | object |  | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| cols | number | 1 | Width of the tile in number of grid cells. |
| component | elementType | 'li' | The component used for the root node. Either a string to use a DOM element or a component. |
| rows | number | 1 | Height of the tile in number of grid cells. |

The `ref` is forwarded to the root element.

Any other properties supplied will be provided to the root element (native element).

## CSS

You can override all the class names injected by Material-UI thanks to the `classes` property.
This property accepts the following keys:

| Name | Description |
|:-----|:------------|
| root | Styles applied to the root element.
| tile | Styles applied to the `div` element that wraps the children.
| imgFullHeight | Styles applied to an `img` element child, if needed to ensure it covers the tile.
| imgFullWidth | Styles applied to an `img` element child, if needed to ensure it covers the tile.

Have a look at the [overriding styles with classes](/customization/components/#overriding-styles-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/GridListTile/GridListTile.js)
for more detail.

If using the `overrides` [key of the theme](/customization/themes/#css),
you need to use the following style sheet name: `MuiGridListTile`.

## Notes

The component is fully [StrictMode](https://reactjs.org/docs/strict-mode.html) compatible.

## Demos

- [Grid List](/components/grid-list/)


text:
+++
Title = "Izael Effemberg"
Twitter = "IzaelEffemberg"
image = ""
type = "speaker"
linktitle = "izael-effemberg"

+++

Engenheiro de Software; tecnologista consultor; ThoughtWorker com muitor amor; embaixador da diversidade e um constante aprendiz no mundo ágil de desenvolvimento de software.


text:
package org.apache.ecs.vxml;

/**
    This class implements the if element

    @author Written by Carol Jones
*/
public class If extends VXMLElement
{

    /**
	Basic constructor. You need to set the attributes using the
	set* methods.
    */
    public If()
    {
	super("if");
    }

    /**
	This constructor creates a <if> tag.
	@param cond the cond="" attribute
    */
    public If(String cond)
    {
	this();
	setCond(cond);
    }

    /**
	Sets the cond="" attribute
	@param cond the cond="" attribute
    */
    public If setCond(String cond)
    {
	addAttribute("cond", cond);
	return this;
    }

}


text:
typedef NS_ENUM (NSInteger, KBRPClientStatus) {
  KBRPClientStatusClosed,
  KBRPClientStatusOpening,
  KBRPClientStatusOpen
};

typedef NS_OPTIONS (NSInteger, KBRClientOptions) {
  KBRClientOptionsAutoRetry = 1 << 0,
};

typedef void (^KBRPClientOnPassphrase)(NSString *passphrase);
typedef void (^KBRPClientOnSecret)(NSString *secret);

@class KBRPClient;

@protocol KBRPClientDelegate
- (void)RPClientWillConnect:(KBRPClient *)RPClient;
- (void)RPClientDidConnect:(KBRPClient *)RPClient;
- (void)RPClientDidDisconnect:(KBRPClient *)RPClient;

// Return YES to retry, NO to stop
- (BOOL)RPClient:(KBRPClient *)RPClient didErrorOnConnect:(NSError *)error connectAttempt:(NSInteger)connectAttempt;

- (void)RPClient:(KBRPClient *)RPClient didLog:(NSString *)message;

- (void)RPClient:(KBRPClient *)RPClient didRequestSecretForPrompt:(NSString *)prompt info:(NSString *)info details:(NSString *)details previousError:(NSString *)previousError completion:(KBRPClientOnSecret)completion;
@end

@interface KBRPClient : NSObject <MPMessagePackClientDelegate>

@property (weak) id<KBRPClientDelegate> delegate;

@property (readonly) KBEnvConfig *config;
@property (readonly) KBRPClientStatus status;

- (instancetype)initWithConfig:(KBEnvConfig *)config options:(KBRClientOptions)options;

- (void)sendRequestWithMethod:(NSString *)method params:(NSDictionary *)params messageId:(NSNumber *)messageId completion:(MPRequestCompletion)completion;

// @deprecated
- (void)sendRequestWithMethod:(NSString *)method params:(NSDictionary *)params sessionId:(NSNumber *)sessionId completion:(MPRequestCompletion)completion;
- (void)registerMethod:(NSString *)method sessionId:(NSNumber *)sessionId requestHandler:(MPRequestHandler)requestHandler;
- (void)unregister:(NSNumber *)sessionId;
- (NSNumber *)nextMessageId;

- (void)open:(KBCompletion)completion;

- (void)close;

@end

@interface KBRPCCoder : NSObject <MPMessagePackCoder>
@end


text:
package com.intellij.util.xml.impl;

import javax.annotation.Nonnull;

import com.intellij.psi.xml.XmlElement;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;

/**
 * @author peter
 */
public class RootDomParentStrategy implements DomParentStrategy {
  private final DomFileElementImpl myFileElement;

  public RootDomParentStrategy(final DomFileElementImpl fileElement) {
    myFileElement = fileElement;
  }

  @Nonnull
  public DomInvocationHandler getParentHandler() {
    throw new UnsupportedOperationException("Method getParentHandler is not yet implemented in " + getClass().getName());
  }

  public XmlTag getXmlElement() {
    return myFileElement.getRootTag();
  }

  @Nonnull
  public DomParentStrategy refreshStrategy(final DomInvocationHandler handler) {
    return this;
  }

  @Nonnull
  public DomParentStrategy setXmlElement(@Nonnull final XmlElement element) {
    return this;
  }

  @Nonnull
  public DomParentStrategy clearXmlElement() {
    return this;
  }

  @Override
  public String checkValidity() {
    return myFileElement.checkValidity();
  }

  @Override
  public XmlFile getContainingFile(DomInvocationHandler handler) {
    return myFileElement.getFile();
  }

  @Override
  public boolean isPhysical() {
    return true;
  }

  public boolean equals(final Object o) {
    if (this == o) return true;
    if (!(o instanceof RootDomParentStrategy)) return false;

    final RootDomParentStrategy that = (RootDomParentStrategy)o;

    if (!myFileElement.equals(that.myFileElement)) return false;

    return true;
  }

  public int hashCode() {
    return myFileElement.hashCode();
  }
}


text:
package eu.fp7.scase.reviews.utilities;

/* This class models the HypermediaLink datatype that is used to send links back to client so as to be
able to forward the application state.*/

public class HypermediaLink{

    private String LinkURI; // LinkURI is the URI that the client has to follow to perfom some aciton
    private String LinkRel; // LinkRel is a string that show the relation of the entity at that LinkURI with the current one
    private String LinkVerb; // LinkVerb refers to the HTTP verb to be used on that LinkURI
    private String LinkType; // LinkType denotes the hierarchical relation of the resource at that LinkURI. Can be either Parent, Sibling, Children
    private int IdType;

    public HypermediaLink(){}

    public HypermediaLink(String strLinkURI, String strLinkRel, String strLinkVerb, String strLinkType, int iIdType){
        this.LinkURI = strLinkURI;
        this.LinkRel = strLinkRel;
        this.LinkVerb = strLinkVerb;
        this.LinkType = strLinkType;
        this.IdType = iIdType;
    }

    public HypermediaLink(String strLinkURI, String strLinkRel, String strLinkVerb, String strLinkType){
        this.LinkURI = strLinkURI;
        this.LinkRel = strLinkRel;
        this.LinkVerb = strLinkVerb;
        this.LinkType = strLinkType;
    }

    /* Setter and getter function follow*/
    public void setLinkURI(String strLinkURI){
        this.LinkURI = strLinkURI;
    }

    public void setLinkRel(String strLinkRel){
        this.LinkRel = strLinkRel;
    }

    public void setLinkVerb(String strLinkVerb){
        this.LinkVerb = strLinkVerb;
    }

    public void setLinkType(String strLinkType){
        this.LinkType = strLinkType;
    }

    public void setIdType(int iIdType){
        this.IdType = iIdType;
    }

    public String getLinkURI(){
        return this.LinkURI;
    }

    public String getLinkRel(){
        return this.LinkRel;
    }

    public String getLinkVerb(){
        return this.LinkVerb;
    }

    public String getLinkType(){
        return this.LinkType;
    }

    public int getIdType(){
        return this.IdType;
    }
}


text:
<?php
  interface EstadoDaConta {
    public function saca(Conta $conta, $valor);
    public function deposita(Conta $conta, $valor);
  }

  class Positivo implements EstadoDaConta {
    public void saca(Conta $conta, $valor) {
      $conta->saldo -= $valor;
      if($conta->saldo < 0) $conta->estado = new Negativo();
    }

    public void deposita(Conta $conta, $valor) {
      $conta->saldo += $valor * 0.98;
    }
  }

  class Negativo implements EstadoDaConta {
    public function saca(Conta $conta, $valor) {
      throw new Exception("Sua conta está no vermelho. Não é possível sacar!");
    }

    public function deposita(Conta $conta, $valor) {
      $conta->saldo += $valor * 0.95;
      if($conta->saldo > 0) $conta->estado = new Positivo();
    }
  }

  class Conta {
    private $titular;
    private $saldo;
    protected $estado;

    function __construct($titular, $saldo) {
      $this->titular = $titular;
      $this->saldo = $saldo;
    }

    public function getTitular() {
      return $this->titular;
    }

    public function getSaldo() {
      return $this->titular;
    }

    public function setTitular($nome) {
      $this->titular = $nome;
    }

    public function setSaldo($valor) {
      $this->saldo = $valor;
    }

    public function saca($valor) {
      $estado->saca($this, $valor);
    }

    public function deposita($valor) {
      $estado->deposita($this, $valor);
    }
  }

  class Formato {
    public static $XML = 1;
    public static $CSV = 2;
    public static $PORCENTO = 3;
  }

  class Requisicao {
    private $formato;

    function __construct($formato) {
      $this->formato = $formato;
    }

    public function getFormato() {
      return $this->formato;
    }

    public function setFormato($formato) {
      $this->formato = $formato;
    }
  }

  interface Resposta {
    public function responde(Requisicao $req, Conta $conta);
    public function setProxima(Resposta $resposta);
  }

  class RespostaEmXml implements Resposta {
    private $outraReposta;

    public function responde(Requisicao $req, Conta $conta) {
      if($req->getFormato() == Formato::XML) {
        echo "<conta><titular>" . $conta->getTitular() . "</titular><saldo>" . $conta->getSaldo() . "</saldo></conta>";
      } else {
        $outraResposta->responde($req, $conta);
      }
    }

    public function setProxima(Resposta $resposta) {
      $this->resposta = $resposta;
    }
  }

  class RespostaEmCsv implements Resposta {
    private $outraReposta;

    public function responde(Requisicao $req, Conta $conta) {
      if($req->getFormato() == Formato::CSV) {
        echo $conta->getTitular() .";" . $conta->getSaldo();
      } else {
        $outraResposta->responde($req, $conta);
      }
    }

    public function setProxima(Resposta $resposta) {
      $this->resposta = $resposta;
    }
  }

  class RespostaEmPorcento implements Resposta {
    private $outraReposta;

    public function responde(Requisicao $req, Conta $conta) {
      if($req->getFormato() == Formato::PORCENTO) {
        echo $conta->getTitular() . "%" . $conta->getSaldo());
      } else {
        $outraResposta->responde($req, $conta);
      }
    }

    public function setProxima(Resposta $resposta) {
      $this->resposta = $resposta;
    }
  }
?>


text:
using System;
using System.Web;
using System.Web.Routing;

namespace Microsoft.Owin.Host.SystemWeb
{
    internal sealed class OwinRoute : RouteBase
    {
        private readonly string _pathBase;
        private readonly Func<OwinAppContext> _appAccessor;

        internal OwinRoute(string pathBase, Func<OwinAppContext> appAccessor)
        {
            _pathBase = Utils.NormalizePath(HttpRuntime.AppDomainAppVirtualPath) + Utils.NormalizePath(pathBase);
            _appAccessor = appAccessor;
        }

        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }

            string requestPath = httpContext.Request.CurrentExecutionFilePath + httpContext.Request.PathInfo;

            int requestPathLength = requestPath.Length;
            int pathBaseLength = _pathBase.Length;
            if (requestPathLength < pathBaseLength)
            {
                return null;
            }
            if (requestPathLength > pathBaseLength && requestPath[pathBaseLength] != '/')
            {
                return null;
            }
            if (!requestPath.StartsWith(_pathBase, StringComparison.OrdinalIgnoreCase))
            {
                return null;
            }

            return new RouteData(this, new OwinRouteHandler(_pathBase, requestPath.Substring(pathBaseLength), _appAccessor));
        }

        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            return null;
        }
    }
}


text:
package org.cuacfm.members.web.training;

import java.security.Principal;
import java.util.List;

import org.cuacfm.members.model.accountservice.AccountService;
import org.cuacfm.members.model.inscription.Inscription;
import org.cuacfm.members.model.trainingservice.TrainingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/** The Class TrainingListController. */
@Controller
public class TrainingUserListController {

	private static final String TRAINING_VIEW_NAME = "training/traininguserlist";

	@Autowired
	private AccountService accountService;

	@Autowired
	private TrainingService trainingService;

	private List<Inscription> inscriptions;

	/**
	 * Instantiates a new training Controller.
	 */
	public TrainingUserListController() {
		super();
	}

	/**
	 * List of Training.
	 *
	 * @return the list
	 */
	@ModelAttribute("inscriptions")
	public List<Inscription> inscriptions() {
		return inscriptions;
	}

	/**
	 * Trainings.
	 *
	 * @param model the model
	 * @param principal Principal
	 * @return the string
	 */

	@RequestMapping(value = "trainingUserList")
	public String trainings(Model model, Principal principal) {

		// List of Trainings
		Long accountId = accountService.findByLogin(principal.getName()).getId();
		inscriptions = trainingService.getInscriptionsByAccountId(accountId);
		model.addAttribute("inscriptions", inscriptions);

		return TRAINING_VIEW_NAME;
	}
}


text:
import java.util.*;

public class Main {
  private Map<Integer, List<String>> test(String... list) {
    Map<Integer, List<String>> map = new HashMap<>();
    for(String s : l<caret>ist) {
      map.computeIfAbsent(s.length(), k -> new ArrayList<>()).add(s);
    }
    return map;
  }
}


text:
<?php

/**
 * @file
 * Stub file for "html" theme hook [pre]process functions.
 */

/**
 * Pre-processes variables for the "html" theme hook.
 *
 * See template for list of available variables.
 *
 * @param array $variables
 *   An associative array of variables, passed by reference.
 *
 * @see html.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_html(array &$variables) {
  // Backport from Drupal 8 RDFa/HTML5 implementation.
  // @see https://www.drupal.org/node/1077566
  // @see https://www.drupal.org/node/1164926

  // Create a dedicated attributes array for the HTML element.
  // By default, core does not provide a way to target the HTML element.
  // The only arrays currently available technically belong to the BODY element.
  $variables['html_attributes_array'] = array(
    'lang' => $variables['language']->language,
    'dir' => $variables['language']->dir,
  );

  // Override existing RDF namespaces to use RDFa 1.1 namespace prefix bindings.
  if (function_exists('rdf_get_namespaces')) {
    $rdf = array('prefix' => array());
    foreach (rdf_get_namespaces() as $prefix => $uri) {
      $rdf['prefix'][] = $prefix . ': ' . $uri;
    }
    if (!$rdf['prefix']) {
      $rdf = array();
    }
    $variables['rdf_namespaces'] = drupal_attributes($rdf);
  }

  // Create a dedicated attributes array for the BODY element.
  if (!isset($variables['body_attributes_array'])) {
    $variables['body_attributes_array'] = array();
  }

  // Ensure there is at least a class array.
  if (!isset($variables['body_attributes_array']['class'])) {
    $variables['body_attributes_array']['class'] = array();
  }

  // Navbar position.
  switch (bootstrap_setting('navbar_position')) {
    case 'fixed-top':
      $variables['body_attributes_array']['class'][] = 'navbar-is-fixed-top';
      break;

    case 'fixed-bottom':
      $variables['body_attributes_array']['class'][] = 'navbar-is-fixed-bottom';
      break;

    case 'static-top':
      $variables['body_attributes_array']['class'][] = 'navbar-is-static-top';
      break;
  }
}

/**
 * Processes variables for the "html" theme hook.
 *
 * See template for list of available variables.
 *
 * **WARNING**: It is not recommended that this function be copied to a
 * sub-theme. There is rarely any need to process the same variables twice.
 *
 * If you need to add something to the "html_attributes_array" or
 * "body_attributes_array" arrays, you should do so in a hook_preprocess_html()
 * function since process functions will always run after all preprocess
 * functions have been executed.
 *
 * If there is a need to implement a hook_process_html() function in your
 * sub-theme (to process your own custom variables), ensure that it doesn't
 * add this base theme's logic and risk introducing breakage and performance
 * issues.
 *
 * @param array $variables
 *   An associative array of variables, passed by reference.
 *
 * @see html.tpl.php
 *
 * @ingroup theme_process
 */
function bootstrap_process_html(array &$variables) {
  // Merge in (not reference!) core's ambiguous and separate "attribute" and
  // "class" arrays. These arrays are meant for the BODY element, but it must
  // be done at the process level in case sub-themes wish to add classes to
  // core's non-standard arrays (which are for the BODY element only).
  // @see https://www.drupal.org/node/2868426
  $variables['body_attributes_array'] = drupal_array_merge_deep($variables['body_attributes_array'], $variables['attributes_array']);

  // Use this project's class helper (to eliminate any duplicate classes).
  _bootstrap_add_class($variables['classes_array'], $variables, 'body_attributes_array');

  // Finally, convert the arrays into proper attribute strings.
  $variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
  $variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']);
}


text:
sap.ui.define(
    [
        "openui5/googlemaps/Marker"
    ],
    function(Marker) {
        "use strict";
        QUnit.module("Marker - defaults test");
        QUnit.test("a basic test example", function(assert) {
            var value = "hello";
            QUnit.assert.equal(value, "hello", "We expect value to be hello");
        });

    });


text:
package com.apkplugin.android.utils;

import java.lang.reflect.Method;
import java.util.HashMap;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.XmlResourceParser;
import android.os.Bundle;

import com.apkplugin.android.constanst.PluginConst;
import com.apkplugin.android.proxy.BaseProxyActivity;
import com.apkplugin.android.proxy.BaseProxyFragmentActivity;
import com.apkplugin.android.proxy.BaseProxyListActivity;
import com.apkplugin.android.service.BaseProxyService;

/**
 * 代理工具,用于查找代理类和继承类之间的关系
 *
 * @author wangbx
 *
 */
public class ProxyActionUtil {
	private static ProxyActionUtil proxyUtil = null;
	/**
	 * ACTION 与启动代理模型对应表
	 */
	private HashMap<String, ProxyActionModel> PROXY_ACTION_VS_CLASSES_MAP = null;
	/**
	 * 上下文对象
	 */
	private Context context;

	/**
	 * 插件代理类模型,包含了代理启动类路径和action name
	 *
	 * @author wangbx
	 *
	 */
	public static class ProxyActionModel {
		/**
		 * 类名
		 */
		public String proxyClassName;
		/**
		 * ACTION 名称
		 */
		public String proxyActionName;

		public ProxyActionModel() {
		}

		public ProxyActionModel(String proxyActionName, String proxyClassName) {
			this.proxyClassName = proxyClassName;
			this.proxyActionName = proxyActionName;
		}
	}

	private ProxyActionUtil(Context context) {
		this.context = context;
		PROXY_ACTION_VS_CLASSES_MAP = new HashMap<String, ProxyActionModel>();
	}

	/**
	 * 取得ProxyUtil实例对象
	 *
	 * @param context
	 * @return
	 */
	public static ProxyActionUtil getInstance(Context context) {
		if (proxyUtil == null) {
			proxyUtil = new ProxyActionUtil(context);
		}
		return proxyUtil;
	}

	/**
	 * 注册actionname 与代理 类名关系
	 *
	 * @param proxyActionName
	 * @param proxyClassName
	 */
	public void registerProxyActionAndClass(String proxyActionName,
			String proxyClassName) {
		String TAG = "ProxyUtil:registerProxyActionAndClass";
		PluginLog.d(TAG, "register proxyActionName :" + proxyActionName
				+ " proxyClassName:" + proxyClassName);
		PROXY_ACTION_VS_CLASSES_MAP.put(proxyActionName, new ProxyActionModel(
				proxyActionName, proxyClassName));
	}

	/**
	 * 注册代理关系模型
	 *
	 * @param proxyAction
	 */
	public void registerProxyModel(ProxyActionModel proxyAction) {
		String TAG = "ProxyUtil:registerProxyModel";
		if (proxyAction != null && proxyAction.proxyActionName != null) {
			PluginLog.d(TAG, "register proxyActionName :"
					+ proxyAction.proxyActionName + " proxyClassName:"
					+ proxyAction.proxyClassName);
			PROXY_ACTION_VS_CLASSES_MAP.put(proxyAction.proxyActionName,
					proxyAction);
		}
	}

	/**
	 * 通过类名找到对应的启动ACTION
	 *
	 * @param context
	 * @param apkPath
	 *            插件的路径
	 * @param classPath
	 *            插件中的某个类路径
	 * @return
	 */
	public String getProxyClassAction(String apkPath, String classPath) {
		HostClassLoader mLocalClassLoader = HostClassLoader.getClassLoader(
				apkPath, context, context.getClassLoader());
		try {
			Class<?> localClass = mLocalClassLoader.loadClass(classPath);
			if (localClass == null) {
				return null;
			}
			// 反射类名实例,调用getProxyAction,取得代理类的action名称
			Object object = localClass.newInstance();
			Method method = localClass.getMethod("getProxyAction",
					new Class[] {});
			if (method != null) {
				Object result = method.invoke(object, new Object[] {});
				if (result != null) {
					object = null;
					method = null;
					return result.toString();
				}
			}
			object = null;
			method = null;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
		}
		return null;
	}

	/**
	 * 取得要启动的className对应的Intent
	 *
	 * @param mProxyActivity
	 *            代理Activity
	 * @param thisActivity
	 *            实际的Activity
	 * @param mDexPath
	 *            apk路径
	 * @param className
	 *            类名
	 * @param bundle
	 *            参数bundle
	 * @return
	 */
	public Intent getStartActivityIntent(Activity mProxyActivity,
			Activity thisActivity, String mDexPath, String className,
			Bundle bundle) {
		if (mProxyActivity == thisActivity) {
			Intent intent = new Intent();
			if (bundle != null) {
				intent.putExtras(bundle);
			}
			intent.setClassName(thisActivity, className);
			return intent;
		} else {
			Intent intent = getProxyIntent(mDexPath, className);
			if (bundle != null) {
				intent.putExtras(bundle);
			}
			return intent;
		}

	}

	/**
	 * 取得某个插件类对应的 启动代理类的Intent
	 *
	 * @param context
	 * @param apkPath
	 *            插件路径
	 * @param classPath
	 *            插件类路径
	 * @return
	 */
	public Intent getProxyIntent(String apkPath, String classPath) {
		String TAG = "ProxyUtil:getProxyIntent";
		PluginLog.d(TAG, "Get Plugin Intent ,apk path:" + apkPath
				+ " class path:" + classPath);
		String action = getProxyClassAction(apkPath, classPath);
		PluginLog.d(TAG, "Get proxy action :" + action);
		if (action == null) {
			return null;
		}
		// 取得对应的代理模型
		ProxyActionModel pp = PROXY_ACTION_VS_CLASSES_MAP.get(action);
		if (pp == null) {
			PluginLog.d(TAG, "can not register " + action
					+ " relate class,return null ");
			return null;
		}

		Intent i = new Intent(action);
		i.addCategory(Intent.ACTION_DEFAULT);
		i.setComponent(new ComponentName(context, pp.proxyClassName));
		i.putExtra(PluginConst.EXTRA_DEX_PATH, apkPath);
		i.putExtra(PluginConst.EXTRA_CLASS, classPath);
		i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		return i;
	}

	/**
	 * 判断某个类是否是我们的代理类
	 *
	 * @param className
	 *            类路径
	 * @return
	 */
	private boolean isProxyClasses(String className) {
		if (className == null) {
			return false;
		}
		if (className.startsWith(".")) {
			className = context.getPackageName() + className;
		}
		try {

			Class class1 = Class.forName(className);
			class1 = class1.getSuperclass();
			if (class1 == null) {
				return false;
			}
			String sucls = class1.getName();
			// BaseProxyActivity 的子类
			if (sucls.equals(BaseProxyActivity.class.getName())) {
				return true;
			} else if (sucls.equals(BaseProxyFragmentActivity.class.getName())) {
				// BaseProxyFragmentActivity 的子类
				return true;
			} else if (sucls.equals(BaseProxyListActivity.class.getName())) {
				// BaseProxyListActivity 的子类
				return true;
			} else if (sucls.equals(BaseProxyService.class.getName())) {
				// BaseProxyService 的子类
				return true;
			}
			return isProxyClasses(sucls);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}

	/**
	 * 初始化 宿主程序中间的,代理类和Action对应关系,此方法解析的是宿主的android manifest.xml
	 *
	 * @param context
	 */
	public void initHostClassInAndroidManifest() {
		// 如果已经初始化过了,就不处理
		if (PROXY_ACTION_VS_CLASSES_MAP != null
				&& !PROXY_ACTION_VS_CLASSES_MAP.isEmpty()) {
			return;
		}
		XmlResourceParser xmlParser = null;
		String prefix = "http://schemas.android.com/apk/res/android";
		ProxyActionModel actionModel = null;
		try {
			Method openXmlResourceParser = AssetManager.class
					.getDeclaredMethod("openXmlResourceParser", new Class[] {
							int.class, String.class });
			xmlParser = (XmlResourceParser) openXmlResourceParser.invoke(
					context.getAssets(), new Object[] { 0,
							"AndroidManifest.xml" });
			while (xmlParser.getEventType() != XmlResourceParser.END_DOCUMENT) {
				String tagName = xmlParser.getName();
				// 开始标签
				if (xmlParser.getEventType() == XmlResourceParser.START_TAG) {
					// 处理一级节点
					if ("activity".equals(tagName)) {
						String name = xmlParser.getAttributeValue(prefix,
								"name");
						if (isProxyClasses(name)) {
							actionModel = new ProxyActionModel();
							actionModel.proxyClassName = name;
						}

					} else if ("receiver".equals(tagName)) {

					}
					if ("service".equals(tagName)) {

					}
					if ("action".equals(tagName)) {
						if (actionModel != null) {
							actionModel.proxyActionName = xmlParser
									.getAttributeValue(prefix, "name");
						}
					}
				} else if (xmlParser.getEventType() == XmlResourceParser.END_TAG) {
					if ("activity".equals(tagName)) {
						if (actionModel != null) {
							registerProxyModel(actionModel);
							actionModel = null;
						}
					}
				}
				xmlParser.next();
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (xmlParser != null) {
				xmlParser.close();
			}

		}
	}

}


text:
The good, the bad, the ugly

"What is the point of splitting user stories, if you have to do everything anyway?"

Why user stories must be splitted?

Before Sprint
1 - In refinement, to have a flow, otherwise is waterfall

During
1 - We discovered new things. These things we do not know if they are important, or if the made other thing less important. Example:
1.1 - This new things are tech stuff, so the effort increase Example:
1.2 - This new thing will require upfront work, so we have an internal dependency. Address this first and the rest later. Example:

2 - We did not discover new things, still this dam thing is taking longer then expected. Example:

Splitting does not mean "leaving for the next sprint", but it means that we are returning undone work to the backlog to be discussed, refined, estimated and prioritized again.

Respect the other things on the backlog that are waiting for their chance to come to the world!

Objection: Yes, but then I will have to test all over again, that is overkill
Objection: I want the whole cake, no matter if you split in 8 or 16 pieces.


text:
001
017
018    package org.apache.commons.codec.language.bm;
019
020    import java.io.InputStream;
021    import java.util.ArrayList;
022    import java.util.Arrays;
023    import java.util.Collections;
024    import java.util.Comparator;
025    import java.util.EnumMap;
026    import java.util.HashMap;
027    import java.util.HashSet;
028    import java.util.List;
029    import java.util.Map;
030    import java.util.Scanner;
031    import java.util.Set;
032    import java.util.regex.Matcher;
033    import java.util.regex.Pattern;
034
035    /**
036     * A phoneme rule.
037     * <p>
038     * Rules have a pattern, left context, right context, output phoneme, set of languages for which they apply
039     * and a logical flag indicating if all languages must be in play. A rule matches if:
040     * <ul>
041     * <li>the pattern matches at the current position</li>
042     * <li>the string up until the beginning of the pattern matches the left context</li>
043     * <li>the string from the end of the pattern matches the right context</li>
044     * <li>logical is ALL and all languages are in scope; or</li>
045     * <li>logical is any other value and at least one language is in scope</li>
046     * </ul>
047     * <p>
048     * Rules are typically generated by parsing rules resources. In normal use, there will be no need for the user
049     * to explicitly construct their own.
050     * <p>
051     * Rules are immutable and thread-safe.
052     * <p>
053     * <b>Rules resources</b>
054     * <p>
055     * Rules are typically loaded from resource files. These are UTF-8 encoded text files. They are systematically
056     * named following the pattern:
057     * <blockquote>org/apache/commons/codec/language/bm/${NameType#getName}_${RuleType#getName}_${language}.txt</blockquote>
058     * <p>
059     * The format of these resources is the following:
060     * <ul>
061     * <li><b>Rules:</b> whitespace separated, double-quoted strings. There should be 4 columns to each row, and these
062     * will be interpreted as:
063     * <ol>
064     * <li>pattern</li>
065     * <li>left context</li>
066     * <li>right context</li>
067     * <li>phoneme</li>
068     * </ol>
069     * </li>
070     * <li><b>End-of-line comments:</b> Any occurrence of '//' will cause all text following on that line to be discarded
071     * as a comment.</li>
072     * <li><b>Multi-line comments:</b> Any line starting with '/*' will start multi-line commenting mode. This will skip
073     * all content until a line ending in '*' and '/' is found.</li>
074     * <li><b>Blank lines:</b> All blank lines will be skipped.</li>
075     * </ul>
076     *
077     * @since 1.6
078     * @version $Id: Rule.java 1435550 2013-01-19 14:09:52Z tn $
079     */
080    public class Rule {
081
082        public static final class Phoneme implements PhonemeExpr {
083            public static final Comparator<Phoneme> COMPARATOR = new Comparator<Phoneme>() {
084                @Override
085                public int compare(final Phoneme o1, final Phoneme o2) {
086                    for (int i = 0; i < o1.phonemeText.length(); i++) {
087                        if (i >= o2.phonemeText.length()) {
088                            return +1;
089                        }
090                        final int c = o1.phonemeText.charAt(i) - o2.phonemeText.charAt(i);
091                        if (c != 0) {
092                            return c;
093                        }
094                    }
095
096                    if (o1.phonemeText.length() < o2.phonemeText.length()) {
097                        return -1;
098                    }
099
100                    return 0;
101                }
102            };
103
104            private final CharSequence phonemeText;
105            private final Languages.LanguageSet languages;
106
107            public Phoneme(final CharSequence phonemeText, final Languages.LanguageSet languages) {
108                this.phonemeText = phonemeText;
109                this.languages = languages;
110            }
111
112            public Phoneme append(final CharSequence str) {
113                return new Phoneme(this.phonemeText.toString() + str.toString(), this.languages);
114            }
115
116            public Languages.LanguageSet getLanguages() {
117                return this.languages;
118            }
119
120            @Override
121            public Iterable<Phoneme> getPhonemes() {
122                return Collections.singleton(this);
123            }
124
125            public CharSequence getPhonemeText() {
126                return this.phonemeText;
127            }
128
129            public Phoneme join(final Phoneme right) {
130                return new Phoneme(this.phonemeText.toString() + right.phonemeText.toString(),
131                                   this.languages.restrictTo(right.languages));
132            }
133        }
134
135        public interface PhonemeExpr {
136            Iterable<Phoneme> getPhonemes();
137        }
138
139        public static final class PhonemeList implements PhonemeExpr {
140            private final List<Phoneme> phonemes;
141
142            public PhonemeList(final List<Phoneme> phonemes) {
143                this.phonemes = phonemes;
144            }
145
146            @Override
147            public List<Phoneme> getPhonemes() {
148                return this.phonemes;
149            }
150        }
151
152        /**
153         * A minimal wrapper around the functionality of Pattern that we use, to allow for alternate implementations.
154         */
155        public static interface RPattern {
156            boolean isMatch(CharSequence input);
157        }
158
159        public static final RPattern ALL_STRINGS_RMATCHER = new RPattern() {
160            @Override
161            public boolean isMatch(final CharSequence input) {
162                return true;
163            }
164        };
165
166        public static final String ALL = "ALL";
167
168        private static final String DOUBLE_QUOTE = "\"";
169
170        private static final String HASH_INCLUDE = "#include";
171
172        private static final Map<NameType, Map<RuleType, Map<String, List<Rule>>>> RULES =
173                new EnumMap<NameType, Map<RuleType, Map<String, List<Rule>>>>(NameType.class);
174
175        static {
176            for (final NameType s : NameType.values()) {
177                final Map<RuleType, Map<String, List<Rule>>> rts =
178                        new EnumMap<RuleType, Map<String, List<Rule>>>(RuleType.class);
179
180                for (final RuleType rt : RuleType.values()) {
181                    final Map<String, List<Rule>> rs = new HashMap<String, List<Rule>>();
182
183                    final Languages ls = Languages.getInstance(s);
184                    for (final String l : ls.getLanguages()) {
185                        try {
186                            rs.put(l, parseRules(createScanner(s, rt, l), createResourceName(s, rt, l)));
187                        } catch (final IllegalStateException e) {
188                            throw new IllegalStateException("Problem processing " + createResourceName(s, rt, l), e);
189                        }
190                    }
191                    if (!rt.equals(RuleType.RULES)) {
192                        rs.put("common", parseRules(createScanner(s, rt, "common"), createResourceName(s, rt, "common")));
193                    }
194
195                    rts.put(rt, Collections.unmodifiableMap(rs));
196                }
197
198                RULES.put(s, Collections.unmodifiableMap(rts));
199            }
200        }
201
202        private static boolean contains(final CharSequence chars, final char input) {
203            for (int i = 0; i < chars.length(); i++) {
204                if (chars.charAt(i) == input) {
205                    return true;
206                }
207            }
208            return false;
209        }
210
211        private static String createResourceName(final NameType nameType, final RuleType rt, final String lang) {
212            return String.format("org/apache/commons/codec/language/bm/%s_%s_%s.txt",
213                                 nameType.getName(), rt.getName(), lang);
214        }
215
216        private static Scanner createScanner(final NameType nameType, final RuleType rt, final String lang) {
217            final String resName = createResourceName(nameType, rt, lang);
218            final InputStream rulesIS = Languages.class.getClassLoader().getResourceAsStream(resName);
219
220            if (rulesIS == null) {
221                throw new IllegalArgumentException("Unable to load resource: " + resName);
222            }
223
224            return new Scanner(rulesIS, ResourceConstants.ENCODING);
225        }
226
227        private static Scanner createScanner(final String lang) {
228            final String resName = String.format("org/apache/commons/codec/language/bm/%s.txt", lang);
229            final InputStream rulesIS = Languages.class.getClassLoader().getResourceAsStream(resName);
230
231            if (rulesIS == null) {
232                throw new IllegalArgumentException("Unable to load resource: " + resName);
233            }
234
235            return new Scanner(rulesIS, ResourceConstants.ENCODING);
236        }
237
238        private static boolean endsWith(final CharSequence input, final CharSequence suffix) {
239            if (suffix.length() > input.length()) {
240                return false;
241            }
242            for (int i = input.length() - 1, j = suffix.length() - 1; j >= 0; i--, j--) {
243                if (input.charAt(i) != suffix.charAt(j)) {
244                    return false;
245                }
246            }
247            return true;
248        }
249
250        /**
251         * Gets rules for a combination of name type, rule type and languages.
252         *
253         * @param nameType
254         *            the NameType to consider
255         * @param rt
256         *            the RuleType to consider
257         * @param langs
258         *            the set of languages to consider
259         * @return a list of Rules that apply
260         */
261        public static List<Rule> getInstance(final NameType nameType, final RuleType rt,
262                                             final Languages.LanguageSet langs) {
263            return langs.isSingleton() ? getInstance(nameType, rt, langs.getAny()) :
264                                         getInstance(nameType, rt, Languages.ANY);
265        }
266
267        /**
268         * Gets rules for a combination of name type, rule type and a single language.
269         *
270         * @param nameType
271         *            the NameType to consider
272         * @param rt
273         *            the RuleType to consider
274         * @param lang
275         *            the language to consider
276         * @return a list rules for a combination of name type, rule type and a single language.
277         */
278        public static List<Rule> getInstance(final NameType nameType, final RuleType rt, final String lang) {
279            final List<Rule> rules = RULES.get(nameType).get(rt).get(lang);
280
281            if (rules == null) {
282                throw new IllegalArgumentException(String.format("No rules found for %s, %s, %s.",
283                                                   nameType.getName(), rt.getName(), lang));
284            }
285
286            return rules;
287        }
288
289        private static Phoneme parsePhoneme(final String ph) {
290            final int open = ph.indexOf("[");
291            if (open >= 0) {
292                if (!ph.endsWith("]")) {
293                    throw new IllegalArgumentException("Phoneme expression contains a '[' but does not end in ']'");
294                }
295                final String before = ph.substring(0, open);
296                final String in = ph.substring(open + 1, ph.length() - 1);
297                final Set<String> langs = new HashSet<String>(Arrays.asList(in.split("[+]")));
298
299                return new Phoneme(before, Languages.LanguageSet.from(langs));
300            } else {
301                return new Phoneme(ph, Languages.ANY_LANGUAGE);
302            }
303        }
304
305        private static PhonemeExpr parsePhonemeExpr(final String ph) {
306            if (ph.startsWith("(")) { // we have a bracketed list of options
307                if (!ph.endsWith(")")) {
308                    throw new IllegalArgumentException("Phoneme starts with '(' so must end with ')'");
309                }
310
311                final List<Phoneme> phs = new ArrayList<Phoneme>();
312                final String body = ph.substring(1, ph.length() - 1);
313                for (final String part : body.split("[|]")) {
314                    phs.add(parsePhoneme(part));
315                }
316                if (body.startsWith("|") || body.endsWith("|")) {
317                    phs.add(new Phoneme("", Languages.ANY_LANGUAGE));
318                }
319
320                return new PhonemeList(phs);
321            } else {
322                return parsePhoneme(ph);
323            }
324        }
325
326        private static List<Rule> parseRules(final Scanner scanner, final String location) {
327            final List<Rule> lines = new ArrayList<Rule>();
328            int currentLine = 0;
329
330            boolean inMultilineComment = false;
331            while (scanner.hasNextLine()) {
332                currentLine++;
333                final String rawLine = scanner.nextLine();
334                String line = rawLine;
335
336                if (inMultilineComment) {
337                    if (line.endsWith(ResourceConstants.EXT_CMT_END)) {
338                        inMultilineComment = false;
339                    }
340                } else {
341                    if (line.startsWith(ResourceConstants.EXT_CMT_START)) {
342                        inMultilineComment = true;
343                    } else {
344                        // discard comments
345                        final int cmtI = line.indexOf(ResourceConstants.CMT);
346                        if (cmtI >= 0) {
347                            line = line.substring(0, cmtI);
348                        }
349
350                        // trim leading-trailing whitespace
351                        line = line.trim();
352
353                        if (line.length() == 0) {
354                            continue; // empty lines can be safely skipped
355                        }
356
357                        if (line.startsWith(HASH_INCLUDE)) {
358                            // include statement
359                            final String incl = line.substring(HASH_INCLUDE.length()).trim();
360                            if (incl.contains(" ")) {
361                                throw new IllegalArgumentException("Malformed import statement '" + rawLine + "' in " +
362                                                                   location);
363                            } else {
364                                lines.addAll(parseRules(createScanner(incl), location + "->" + incl));
365                            }
366                        } else {
367                            // rule
368                            final String[] parts = line.split("\\s+");
369                            if (parts.length != 4) {
370                                throw new IllegalArgumentException("Malformed rule statement split into " + parts.length +
371                                                                   " parts: " + rawLine + " in " + location);
372                            } else {
373                                try {
374                                    final String pat = stripQuotes(parts[0]);
375                                    final String lCon = stripQuotes(parts[1]);
376                                    final String rCon = stripQuotes(parts[2]);
377                                    final PhonemeExpr ph = parsePhonemeExpr(stripQuotes(parts[3]));
378                                    final int cLine = currentLine;
379                                    final Rule r = new Rule(pat, lCon, rCon, ph) {
380                                        private final int myLine = cLine;
381                                        private final String loc = location;
382
383                                        @Override
384                                        public String toString() {
385                                            final StringBuilder sb = new StringBuilder();
386                                            sb.append("Rule");
387                                            sb.append("{line=").append(myLine);
388                                            sb.append(", loc='").append(loc).append('\'');
389                                            sb.append('}');
390                                            return sb.toString();
391                                        }
392                                    };
393                                    lines.add(r);
394                                } catch (final IllegalArgumentException e) {
395                                    throw new IllegalStateException("Problem parsing line '" + currentLine + "' in " +
396                                                                    location, e);
397                                }
398                            }
399                        }
400                    }
401                }
402            }
403
404            return lines;
405        }
406
407        /**
408         * Attempts to compile the regex into direct string ops, falling back to Pattern and Matcher in the worst case.
409         *
410         * @param regex
411         *            the regular expression to compile
412         * @return an RPattern that will match this regex
413         */
414        private static RPattern pattern(final String regex) {
415            final boolean startsWith = regex.startsWith("^");
416            final boolean endsWith = regex.endsWith("$");
417            final String content = regex.substring(startsWith ? 1 : 0, endsWith ? regex.length() - 1 : regex.length());
418            final boolean boxes = content.contains("[");
419
420            if (!boxes) {
421                if (startsWith && endsWith) {
422                    // exact match
423                    if (content.length() == 0) {
424                        // empty
425                        return new RPattern() {
426                            @Override
427                            public boolean isMatch(final CharSequence input) {
428                                return input.length() == 0;
429                            }
430                        };
431                    } else {
432                        return new RPattern() {
433                            @Override
434                            public boolean isMatch(final CharSequence input) {
435                                return input.equals(content);
436                            }
437                        };
438                    }
439                } else if ((startsWith || endsWith) && content.length() == 0) {
440                    // matches every string
441                    return ALL_STRINGS_RMATCHER;
442                } else if (startsWith) {
443                    // matches from start
444                    return new RPattern() {
445                        @Override
446                        public boolean isMatch(final CharSequence input) {
447                            return startsWith(input, content);
448                        }
449                    };
450                } else if (endsWith) {
451                    // matches from start
452                    return new RPattern() {
453                        @Override
454                        public boolean isMatch(final CharSequence input) {
455                            return endsWith(input, content);
456                        }
457                    };
458                }
459            } else {
460                final boolean startsWithBox = content.startsWith("[");
461                final boolean endsWithBox = content.endsWith("]");
462
463                if (startsWithBox && endsWithBox) {
464                    String boxContent = content.substring(1, content.length() - 1);
465                    if (!boxContent.contains("[")) {
466                        // box containing alternatives
467                        final boolean negate = boxContent.startsWith("^");
468                        if (negate) {
469                            boxContent = boxContent.substring(1);
470                        }
471                        final String bContent = boxContent;
472                        final boolean shouldMatch = !negate;
473
474                        if (startsWith && endsWith) {
475                            // exact match
476                            return new RPattern() {
477                                @Override
478                                public boolean isMatch(final CharSequence input) {
479                                    return input.length() == 1 && contains(bContent, input.charAt(0)) == shouldMatch;
480                                }
481                            };
482                        } else if (startsWith) {
483                            // first char
484                            return new RPattern() {
485                                @Override
486                                public boolean isMatch(final CharSequence input) {
487                                    return input.length() > 0 && contains(bContent, input.charAt(0)) == shouldMatch;
488                                }
489                            };
490                        } else if (endsWith) {
491                            // last char
492                            return new RPattern() {
493                                @Override
494                                public boolean isMatch(final CharSequence input) {
495                                    return input.length() > 0 &&
496                                           contains(bContent, input.charAt(input.length() - 1)) == shouldMatch;
497                                }
498                            };
499                        }
500                    }
501                }
502            }
503
504            return new RPattern() {
505                Pattern pattern = Pattern.compile(regex);
506
507                @Override
508                public boolean isMatch(final CharSequence input) {
509                    final Matcher matcher = pattern.matcher(input);
510                    return matcher.find();
511                }
512            };
513        }
514
515        private static boolean startsWith(final CharSequence input, final CharSequence prefix) {
516            if (prefix.length() > input.length()) {
517                return false;
518            }
519            for (int i = 0; i < prefix.length(); i++) {
520                if (input.charAt(i) != prefix.charAt(i)) {
521                    return false;
522                }
523            }
524            return true;
525        }
526
527        private static String stripQuotes(String str) {
528            if (str.startsWith(DOUBLE_QUOTE)) {
529                str = str.substring(1);
530            }
531
532            if (str.endsWith(DOUBLE_QUOTE)) {
533                str = str.substring(0, str.length() - 1);
534            }
535
536            return str;
537        }
538
539        private final RPattern lContext;
540
541        private final String pattern;
542
543        private final PhonemeExpr phoneme;
544
545        private final RPattern rContext;
546
547        /**
548         * Creates a new rule.
549         *
550         * @param pattern
551         *            the pattern
552         * @param lContext
553         *            the left context
554         * @param rContext
555         *            the right context
556         * @param phoneme
557         *            the resulting phoneme
558         */
559        public Rule(final String pattern, final String lContext, final String rContext, final PhonemeExpr phoneme) {
560            this.pattern = pattern;
561            this.lContext = pattern(lContext + "$");
562            this.rContext = pattern("^" + rContext);
563            this.phoneme = phoneme;
564        }
565
566        /**
567         * Gets the left context. This is a regular expression that must match to the left of the pattern.
568         *
569         * @return the left context Pattern
570         */
571        public RPattern getLContext() {
572            return this.lContext;
573        }
574
575        /**
576         * Gets the pattern. This is a string-literal that must exactly match.
577         *
578         * @return the pattern
579         */
580        public String getPattern() {
581            return this.pattern;
582        }
583
584        /**
585         * Gets the phoneme. If the rule matches, this is the phoneme associated with the pattern match.
586         *
587         * @return the phoneme
588         */
589        public PhonemeExpr getPhoneme() {
590            return this.phoneme;
591        }
592
593        /**
594         * Gets the right context. This is a regular expression that must match to the right of the pattern.
595         *
596         * @return the right context Pattern
597         */
598        public RPattern getRContext() {
599            return this.rContext;
600        }
601
602        /**
603         * Decides if the pattern and context match the input starting at a position. It is a match if the
604         * <code>lContext</code> matches <code>input</code> up to <code>i</code>, <code>pattern</code> matches at i and
605         * <code>rContext</code> matches from the end of the match of <code>pattern</code> to the end of <code>input</code>.
606         *
607         * @param input
608         *            the input String
609         * @param i
610         *            the int position within the input
611         * @return true if the pattern and left/right context match, false otherwise
612         */
613        public boolean patternAndContextMatches(final CharSequence input, final int i) {
614            if (i < 0) {
615                throw new IndexOutOfBoundsException("Can not match pattern at negative indexes");
616            }
617
618            final int patternLength = this.pattern.length();
619            final int ipl = i + patternLength;
620
621            if (ipl > input.length()) {
622                // not enough room for the pattern to match
623                return false;
624            }
625
626            // evaluate the pattern, left context and right context
627            // fail early if any of the evaluations is not successful
628            if (!input.subSequence(i, ipl).equals(this.pattern)) {
629                return false;
630            } else if (!this.rContext.isMatch(input.subSequence(ipl, input.length()))) {
631                return false;
632            }
633            return this.lContext.isMatch(input.subSequence(0, i));
634        }
635    }


text:
using Lucene.Net.Util;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lucene.Net.Index
{

    /// <summary>
    /// A <see cref="FilterAtomicReader"/> that exposes only a subset
    /// of fields from the underlying wrapped reader.
    /// </summary>
    public sealed class FieldFilterAtomicReader : FilterAtomicReader
    {
        private readonly ISet<string> fields;
        private readonly bool negate;
        private readonly FieldInfos fieldInfos;

        public FieldFilterAtomicReader(AtomicReader @in, ISet<string> fields, bool negate)
            : base(@in)
        {
            this.fields = fields;
            this.negate = negate;
            List<FieldInfo> filteredInfos = new List<FieldInfo>();
            foreach (FieldInfo fi in @in.FieldInfos)
            {
                if (HasField(fi.Name))
                {
                    filteredInfos.Add(fi);
                }
            }
            fieldInfos = new FieldInfos(filteredInfos.ToArray());
        }

        internal bool HasField(string field)
        {
            return negate ^ fields.Contains(field);
        }

        public override FieldInfos FieldInfos => fieldInfos;

        public override Fields GetTermVectors(int docID)
        {
            Fields f = base.GetTermVectors(docID);
            if (f is null)
            {
                return null;
            }
            f = new FieldFilterFields(this, f);
            // we need to check for emptyness, so we can return
            // null:
            using var iter = f.GetEnumerator();
            return iter.MoveNext() ? f : null;
        }

        public override void Document(int docID, StoredFieldVisitor visitor)
        {
            base.Document(docID, new StoredFieldVisitorAnonymousClass(this, visitor));
        }

        private sealed class StoredFieldVisitorAnonymousClass : StoredFieldVisitor
        {
            private readonly FieldFilterAtomicReader outerInstance;

            private readonly StoredFieldVisitor visitor;

            public StoredFieldVisitorAnonymousClass(FieldFilterAtomicReader outerInstance, StoredFieldVisitor visitor)
            {
                this.outerInstance = outerInstance;
                this.visitor = visitor;
            }

            public override void BinaryField(FieldInfo fieldInfo, byte[] value)
            {
                visitor.BinaryField(fieldInfo, value);
            }

            public override void StringField(FieldInfo fieldInfo, string value)
            {
                visitor.StringField(fieldInfo, value);
            }

            public override void Int32Field(FieldInfo fieldInfo, int value)
            {
                visitor.Int32Field(fieldInfo, value);
            }

            public override void Int64Field(FieldInfo fieldInfo, long value)
            {
                visitor.Int64Field(fieldInfo, value);
            }

            public override void SingleField(FieldInfo fieldInfo, float value)
            {
                visitor.SingleField(fieldInfo, value);
            }

            public override void DoubleField(FieldInfo fieldInfo, double value)
            {
                visitor.DoubleField(fieldInfo, value);
            }

            public override Status NeedsField(FieldInfo fieldInfo)
            {
                return outerInstance.HasField(fieldInfo.Name) ? visitor.NeedsField(fieldInfo) : Status.NO;
            }
        }

        public override Fields Fields
        {
            get
            {
                Fields f = base.Fields;
                return (f is null) ? null : new FieldFilterFields(this, f);
            }
        }

        public override NumericDocValues GetNumericDocValues(string field)
        {
            return HasField(field) ? base.GetNumericDocValues(field) : null;
        }

        public override BinaryDocValues GetBinaryDocValues(string field)
        {
            return HasField(field) ? base.GetBinaryDocValues(field) : null;
        }

        public override SortedDocValues GetSortedDocValues(string field)
        {
            return HasField(field) ? base.GetSortedDocValues(field) : null;
        }

        public override NumericDocValues GetNormValues(string field)
        {
            return HasField(field) ? base.GetNormValues(field) : null;
        }

        public override IBits GetDocsWithField(string field)
        {
            return HasField(field) ? base.GetDocsWithField(field) : null;
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("FieldFilterAtomicReader(reader=");
            sb.Append(m_input).Append(", fields=");
            if (negate)
            {
                sb.Append('!');
            }
            return sb.Append(fields).Append(')').ToString();
        }

        private class FieldFilterFields : FilterFields
        {
            private readonly FieldFilterAtomicReader outerInstance;

            public FieldFilterFields(FieldFilterAtomicReader outerInstance, Fields @in)
                : base(@in)
            {
                this.outerInstance = outerInstance;
            }

            // this information is not cheap, return -1 like MultiFields does:
            public override int Count => -1;

            public override IEnumerator<string> GetEnumerator()
            {
                // LUCENENET: Performance is better and code simpler with simple where clause
                // and yield return.
                foreach (var field in m_input.Where((f) => outerInstance.HasField(f)))
                    yield return field;
            }

            public override Terms GetTerms(string field)
            {
                return outerInstance.HasField(field) ? base.GetTerms(field) : null;
            }
        }
    }
}


text:
Mobify.js is an open source library for improving the performance of websites
by providing responsive images, and optimized JS/CSS. It does this by
using [capture.js](https://github.com/mobify/capturejs) to control the resources
on the page, and uses [resizeImages.js](https://github.com/mobify/imageresize-client),
[jazzcat.js](https://github.com/mobify/jazzcat-client), and
[cssOptimize.js](https://github.com/mobify/css-optimize) to change the resources on the
page to point to Mobify's proxy services to optimize the resources.

For instructions on how to use the library, follow the instructions on [mobifyjs.com](http://www.mobifyjs.com/)
or build the docs site manually in the instructions below.

## Development

### Building

Mobify.js uses Bower, Grunt.js and Require.js to build the library, and manage all of the dependencies. First, you will need to install the grunt-cli globally:

    npm install -g grunt-cli

And then download the latest code from git and install the dependancies:

    git clone https://github.com/mobify/mobifyjs.git
    cd mobifyjs
    npm install
    bower install

Now, to build the library, simply run the following command:

    grunt build

Open the `build` folder to see the generated Mobify.js libraries.

Mobify.js is built with AMD modules using almond.js.

In order to build Mobify.js during development without having to run
`grunt build` everytime you change a file, run the following command:

    grunt serve

This will run a development server on http://localhost:3000 using connect,
and build the library every time the files in `src` change.

To see how the project is setup to build, open up `Gruntfile.js` and have a look!

#### Build Setup

Require.js is used to build Mobify.js.

 - src/config.js # The require.js base config for all build mobify.js builds
 - src/mobify-library.js # Defines how to build the full mobify.js library

There is also an example custom build file to make it simple to build a custom
mobify.js library (or to compile the library with executable code):

 - mobify-custom.js.example

To create a custom build, run the following:

    `cp mobify-custom.js.example mobify-custom.js`

Then, run `grunt serve` as normal. The output of the custom build will be
located in `build/custom`.

**Note: We use a `mobifyjs` symlink to resolve paths so they can be the same
locally as they are on the CDN. This can be problematic for Windows.**

### Tests

Tests for Mobify.js are written in QUnit. To run them individually, run
`grunt serve` and then go to `http://localhost:3000/tests/capture.html`
or any other of the QUnit tests in the /tests/ folder.

To run all of the tests in an automated fashion using Phantomjs
(the headless webkit browser) run the following command:

    grunt test

It's also important when developing not to run into any regressions on all of the
supported browsers. The Gruntfile is setup to be able to run qunit tests
on many browsers we support (in order to do this yourself, you will need to set
`SAUCE_USERNAME` and `SAUCE_KEY` in your environment variables).

    grunt saucelabs

## Deploying

By default, the deploy command is set to deploy Mobify.js to cdn.mobify.com. To deploy
here, ensure `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are set in your
environment variables.

    grunt deploy

## Browser support

Using Capturing:

 - All Webkit browsers (Safari, Chrome, Netfront, etc)
 - Firefox - version 4 and up
 - Opera - 11 and up (previous versions untested)
 - IE - 10 and up

Not Using Capturing:

Support for using the API without Capturing has not been tested, but it will
at minimum support the browsers listed above (as well, it should cover many
older browsers)

##  Docs

The compiled documentation for Mobify.js can be found online at [mobifyjs.com](http://www.mobifyjs.com/).

The static site is built with [Jekyll](http://jekyllrb.com/). Run the following commands to get the docs running locally:

    gem install jekyll
    grunt jekyll

Then navigate to http://localhost:4000/mobifyjs/docs/.


text:
class CreateApiKeys < ActiveRecord::Migration
  def change
    create_table :api_keys do |t|
      t.uuid :project_id
      t.string :value
      t.integer :scope
      t.boolean :revoked, default: false
      t.timestamps null: false
    end
  end
end


text:
package client

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
	"testing"

	"github.com/docker/docker/api/types"
	"github.com/docker/docker/api/types/swarm"
	"golang.org/x/net/context"
)

func TestSecretCreateError(t *testing.T) {
	client := &Client{
		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
	}
	_, err := client.SecretCreate(context.Background(), swarm.SecretSpec{})
	if err == nil || err.Error() != "Error response from daemon: Server error" {
		t.Fatalf("expected a Server Error, got %v", err)
	}
}

func TestSecretCreate(t *testing.T) {
	expectedURL := "/secrets/create"
	client := &Client{
		client: newMockClient(func(req *http.Request) (*http.Response, error) {
			if !strings.HasPrefix(req.URL.Path, expectedURL) {
				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
			}
			if req.Method != "POST" {
				return nil, fmt.Errorf("expected POST method, got %s", req.Method)
			}
			b, err := json.Marshal(types.SecretCreateResponse{
				ID: "test_secret",
			})
			if err != nil {
				return nil, err
			}
			return &http.Response{
				StatusCode: http.StatusCreated,
				Body:       ioutil.NopCloser(bytes.NewReader(b)),
			}, nil
		}),
	}

	r, err := client.SecretCreate(context.Background(), swarm.SecretSpec{})
	if err != nil {
		t.Fatal(err)
	}
	if r.ID != "test_secret" {
		t.Fatalf("expected `test_secret`, got %s", r.ID)
	}
}


text:
//*******************************************************************
// License:  MIT
//
// See LICENSE.txt file in the top level directory for more details.
// class ossimImageGaussianFilter : tile source
//*******************************************************************
// $Id: ossimImageGaussianFilter.h 15766 2009-10-20 12:37:09Z gpotts $
#ifndef ossimImageGaussianFilter_HEADER
#define ossimImageGaussianFilter_HEADER

#include <ossim/imaging/ossimImageSourceFilter.h>
#include <ossim/imaging/ossimConvolutionFilter1D.h>

/**
 * class for symmetric Gaussian filtering
 * implemented as two separable horizontal/vertical gaussian filters
 *
 * PROPERTIES:
 * -GaussStd is the standard deviation of the gaussian
 *  (filter widths are equal to 2*floor(2.5*GaussStd+0.5)+1)
 * -strictNoData selects the behaviour for NODATA pixels
 *   true  : any NODATA pixels in the convolution will Nullify the center pixel
 *   false : center pixel will be NODATA only if it was NODATA before
 *     other NODATA pixels are processed as zero in the convolution calculation
 */
class OSSIM_DLL ossimImageGaussianFilter : public ossimImageSourceFilter
{
public:
  /**
   * own methods
   */
   ossimImageGaussianFilter();

   inline ossim_float64 getGaussStd()const { return theGaussStd; }
   void setGaussStd(const ossim_float64& v);

   inline bool isStrictNoData()const { return theStrictNoData; }
   void setStrictNoData(bool aStrict);

  /**
   * inherited methods
   */
   virtual void initialize();

   virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect &tileRect,ossim_uint32 resLevel=0);

   virtual void connectInputEvent(ossimConnectionEvent &event);
   virtual void disconnectInputEvent(ossimConnectionEvent &event);

   virtual void setProperty(ossimRefPtr<ossimProperty> property);
   virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
   virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;

   virtual bool loadState(const ossimKeywordlist& kwl,const char* prefix = 0);
   virtual bool saveState(ossimKeywordlist& kwl,const char* prefix = 0)const;

protected:
   virtual ~ossimImageGaussianFilter();
  /**
   * protected methods
   */
   void initializeProcesses();
   void updateKernels();

  /**
   * parameters
   */
   ossim_float64 theGaussStd;
   bool          theStrictNoData;

  /**
   * subprocesses
   */
   ossimRefPtr<ossimConvolutionFilter1D> theHF; //horizontal filter
   ossimRefPtr<ossimConvolutionFilter1D> theVF; //vertical filter

TYPE_DATA
};

#endif /* #ifndef ossimImageGaussianFilter_HEADER */