text:
/* micropolisJS. Adapted by Graeme McCutcheon from Micropolis.
 *
 * This code is released under the GNU GPL v3, with some additional terms.
 * Please see the files LICENSE and COPYING for details. Alternatively,
 * consult http://micropolisjs.graememcc.co.uk/LICENSE and
 * http://micropolisjs.graememcc.co.uk/COPYING
 *
 */
Micro.Traffic = function(map, spriteManager) {
    this._map = map;
    this._stack = [];
    this._spriteManager = spriteManager;
}

Micro.Traffic.prototype = {

    constructor: Micro.Traffic,

    makeTraffic : function(x, y, blockMaps, destFn) {
        this._stack = [];

        var pos = new this._map.Position(x, y);

        if (this.findPerimeterRoad(pos)) {
            if (this.tryDrive(pos, destFn)) {
                this.addToTrafficDensityMap(blockMaps);
                return Micro.ROUTE_FOUND;
            }
            return Micro.NO_ROUTE_FOUND;
        } else {
            return Micro.NO_ROAD_FOUND;
        }
    },
    addToTrafficDensityMap : function(blockMaps) {
        var trafficDensityMap = blockMaps.trafficDensityMap;

        while (this._stack.length > 0) {
            var pos = this._stack.pop();

            // Could this happen?!?
            if (!this._map.testBounds(pos.x, pos.y)) continue;

            var tileValue = this._map.getTileValue(pos.x, pos.y);

            if (tileValue >= Tile.ROADBASE && tileValue < Tile.POWERBASE) {
                // Update traffic density.
                var traffic = trafficDensityMap.worldGet(pos.x, pos.y);
                traffic += 50;
                traffic = Math.min(traffic, 240);
                trafficDensityMap.worldSet(pos.x, pos.y, traffic);

                // Attract traffic copter to the traffic
                if (traffic >= 240 && Random.getRandom(5) === 0) {
                    var sprite = this._spriteManager.getSprite(Micro.SPRITE_HELICOPTER);
                    if (sprite !== null) {
                        sprite.destX = Micro.worldToPix(pos.x);
                        sprite.destY = Micro.worldToPix(pos.y);
                    }
                }
            }
        }
    },
    findPerimeterRoad : function(pos) {
        for (var i = 0; i < 12; i++) {
          var xx = pos.x + Micro.perimX[i];
          var yy = pos.y + Micro.perimY[i];

            if (this._map.testBounds(xx, yy)) {
                if (Micro.isDriveable(this._map.getTileValue(xx, yy))) {
                    pos.x = xx;
                    pos.y = yy;
                    return true;
                }
            }
        }
        return false;
    },
    tryDrive : function(startPos, destFn) {
        var dirLast = Direction.INVALID;
        var drivePos = new this._map.Position(startPos);

        /* Maximum distance to try */
        for (var dist = 0; dist < Micro.MAX_TRAFFIC_DISTANCE; dist++) {
            var  dir = this.tryGo(drivePos, dirLast);
            if (dir != Direction.INVALID) {
                drivePos.move(dir);
                dirLast = Direction.rotate180(dir);
                if (dist & 1) this._stack.push(new this._map.Position(drivePos));
                if (this.driveDone(drivePos, destFn)) return true;
            } else {
                if (this._stack.length > 0) {
                    this._stack.pop();
                    dist += 3;
                } else {
                    return false;
                }
            }
        }
        return false;
    },
    tryGo : function(pos, dirLast) {
        var  directions = [];
        // Find connections from current position.
        var dir = Direction.NORTH;
        var count = 0;
        for (var i = 0; i < 4; i++) {
            if (dir != dirLast && Micro.isDriveable(this._map.getTileFromMapOrDefault(pos, dir, Tile.DIRT))) {
                // found a road in an allowed direction
                directions[i] = dir;
                count++;
            } else {
                directions[i] = Direction.INVALID;
            }
            dir = Direction.rotate90(dir);
        }
        if (count === 0) return Direction.INVALID;
        if (count === 1) {
            for (i = 0; i < 4; i++) {
                if (directions[i] != Direction.INVALID) return directions[i];
            }
        }
        i = Random.getRandom16() & 3;
        while (directions[i] === Direction.INVALID) i = (i + 1) & 3;
        return directions[i];
    },
    driveDone : function(pos, destFn) {
        if (pos.y > 0) { if (destFn(this._map.getTileValue(pos.x, pos.y - 1))) return true; }
        if (pos.x < (this._map.width - 1)) { if (destFn(this._map.getTileValue(pos.x + 1, pos.y))) return true; }
        if (pos.y < (this._map.height - 1)) { if (destFn(this._map.getTileValue(pos.x, pos.y + 1)))  return true; }
        if (pos.x > 0) { if (destFn(this._map.getTileValue(pos.x - 1, pos.y))) return true; }
        return false;
    }
}


text:
package moves

import (
	"errors"

	"github.com/jkomoros/boardgame"
	"github.com/jkomoros/boardgame/moves/interfaces"
)

type sourceDestinationStacker interface {
	interfaces.SourceStacker
	interfaces.DestinationStacker
}

//MoveCountComponents is a move that will move components, one at a time, from
//SourceStack() to DestinationStack() until TargetCount() components have been
//moved. It is like DealComponents or CollectComponnets, except instead of
//working on a certain stack for each player, it operates on two fixed stacks.
//Other MoveComponents-style moves derive from this. When using it you must
//implement interfaces.SourceStacker and interfaces.DestinationStacker
//to encode which stacks to use. You may also want to override TargetCount()
//if you want to move more than one component.
//
//In practice it is most common to just use this move (and its subclasses)
//directly, and pass configuration for SourceStack, DestinationStack, and
//TargetCount with WithSourceProperty, WithDestinationProperty, and
//WithTargetCount to auto.Config.
//
//boardgame:codegen
type MoveCountComponents struct {
	ApplyCountTimes
}

//ValidConfiguration checks to make sure that SourceStack and DestinationStack
//both exist and return non-nil stacks.
func (m *MoveCountComponents) ValidConfiguration(exampleState boardgame.State) error {
	if err := m.ApplyCountTimes.ValidConfiguration(exampleState); err != nil {
		return err
	}

	theSourceDestinationStacker, ok := m.TopLevelStruct().(sourceDestinationStacker)

	if !ok {
		return errors.New("embeddingMove doesn't have Source/Destination stacker")
	}

	if theSourceDestinationStacker.DestinationStack(exampleState) == nil {
		return errors.New("DestinationStack returned nil")
	}

	if theSourceDestinationStacker.SourceStack(exampleState) == nil {
		return errors.New("SourceStack returned nil")
	}

	return nil
}

//SourceStack by default just returns the property on GameState with the name
//passed to DefaultConfig by WithSourceProperty. If that is not sufficient,
//override this in your embedding struct.
func (m *MoveCountComponents) SourceStack(state boardgame.State) boardgame.Stack {
	config := m.CustomConfiguration()

	stackName, ok := config[configPropSourceProperty]

	if !ok {
		return nil
	}

	strStackName, ok := stackName.(string)

	if !ok {
		return nil
	}

	stack, err := state.GameState().ReadSetter().StackProp(strStackName)

	if err != nil {
		return nil
	}

	return stack
}

//DestinationStack by default just returns the property on GameState with the
//name passed to DefaultConfig by WithDestinationProperty. If that is not sufficient,
//override this in your embedding struct.
func (m *MoveCountComponents) DestinationStack(state boardgame.State) boardgame.Stack {
	config := m.CustomConfiguration()

	stackName, ok := config[configPropDestinationProperty]

	if !ok {
		return nil
	}

	strStackName, ok := stackName.(string)

	if !ok {
		return nil
	}

	stack, err := state.GameState().ReadSetter().StackProp(strStackName)

	if err != nil {
		return nil
	}

	return stack
}

//stacks returns the source and desitnation so you don't have to do the cast.
func (m *MoveCountComponents) stacks(state boardgame.ImmutableState) (source, destination boardgame.Stack) {

	//TODO: this is a total hack
	mState := state.(boardgame.State)

	stacker, ok := m.TopLevelStruct().(sourceDestinationStacker)

	if !ok {
		return nil, nil
	}

	return stacker.SourceStack(mState), stacker.DestinationStack(mState)

}

func (m *MoveCountComponents) stackNames(state boardgame.ImmutableState) (starter, destination string) {

	var sourceStack boardgame.ImmutableStack
	var destinationStack boardgame.ImmutableStack

	if state != nil {
		sourceStack, destinationStack = m.stacks(state)
	}

	return stackName(m, configPropSourceProperty, sourceStack, state), stackName(m, configPropDestinationProperty, destinationStack, state)
}

//Legal checks that source and destiantion stacks exist, that enough components
//to move exist.
func (m *MoveCountComponents) Legal(state boardgame.ImmutableState, proposer boardgame.PlayerIndex) error {
	if err := m.ApplyCountTimes.Legal(state, proposer); err != nil {
		return err
	}

	source, destination := m.stacks(state)

	if source == nil {
		return errors.New("Source was nil")
	}

	if destination == nil {
		return errors.New("Destination was nil")
	}

	if source.NumComponents() < 1 {
		return errors.New("the stack to draw from doesn't have any components to move")
	}

	if destination.SlotsRemaining() < 1 {
		return errors.New("the destination stack doesn't have any slots to move the component to")
	}

	return nil

}

//Apply by default moves one component from SourceStack() to
//DestinationStack(). You likely do not need to override this method.
func (m *MoveCountComponents) Apply(state boardgame.State) error {

	source, destination := m.stacks(state)

	if source == nil {
		return errors.New("Source was nil")
	}

	if destination == nil {
		return errors.New("Destination was nil")
	}

	first := source.First()

	if first == nil {
		return errors.New("unexpected error: no first object to move")
	}

	return first.MoveToNextSlot(destination)

}

//FallbackName returns a string based on the names of the player
//stack name, game stack name, and target count.
func (m *MoveCountComponents) FallbackName(g *boardgame.GameManager) string {

	source, destination := m.stackNames(g.ExampleState())

	return "Move " + targetCountString(m.TopLevelStruct()) + " Components From " + source + " To " + destination
}

//FallbackHelpText returns a string based on the names of the player
//stack name, game stack name, and target count.
func (m *MoveCountComponents) FallbackHelpText() string {
	source, destination := m.stackNames(nil)

	return "Moves " + targetCountString(m.TopLevelStruct()) + " components from " + source + " to " + destination
}

//MoveComponentsUntilCountReached is a move that will move components, one at
//a time, from SourceStack() to DestinationStack() until the target stack is
//up to having TargetCount components in it. See also
//MoveComponentsUntilCountLeft for a slightly different end condition.
//
//boardgame:codegen
type MoveComponentsUntilCountReached struct {
	MoveCountComponents
}

//Count returns the number of components in DestinationStack().
func (m *MoveComponentsUntilCountReached) Count(state boardgame.ImmutableState) int {

	_, targetStack := m.stacks(state)

	if targetStack == nil {
		return 0
	}

	return targetStack.NumComponents()
}

//FallbackName returns a string based on the names of the player
//stack name, game stack name, and target count.
func (m *MoveComponentsUntilCountReached) FallbackName(g *boardgame.GameManager) string {

	source, destination := m.stackNames(g.ExampleState())

	return "Move Components From " + source + " Until " + destination + " Has " + targetCountString(m.TopLevelStruct())
}

//FallbackHelpText returns a string based on the names of the player
//stack name, game stack name, and target count.
func (m *MoveComponentsUntilCountReached) FallbackHelpText() string {
	source, destination := m.stackNames(nil)

	return "Moves components from " + source + " to " + destination + " until " + destination + " has " + targetCountString(m.TopLevelStruct())
}

//MoveComponentsUntilCountLeft is a move that will move components, one at a
//time, from SourceStack() to DestinationStack() until the source stack is
//down to having  TargetCount components in it. Its primary difference from
//MoveComponentsUntilCountReached is that its target is based on reducing the
//size of SourceStack to a target size.
//
//boardgame:codegen
type MoveComponentsUntilCountLeft struct {
	MoveCountComponents
}

//Count returns the number of components in the SourceStack().
func (m *MoveComponentsUntilCountLeft) Count(state boardgame.ImmutableState) int {
	targetStack, _ := m.stacks(state)

	if targetStack == nil {
		return 0
	}

	return targetStack.NumComponents()
}

//FallbackName returns a string based on the names of the player
//stack name, game stack name, and target count.
func (m *MoveComponentsUntilCountLeft) FallbackName(g *boardgame.GameManager) string {

	source, destination := m.stackNames(g.ExampleState())

	return "Move Components To " + destination + " Until " + source + " Has " + targetCountString(m.TopLevelStruct())
}

//FallbackHelpText returns a string based on the names of the player
//stack name, game stack name, and target count.
func (m *MoveComponentsUntilCountLeft) FallbackHelpText() string {
	source, destination := m.stackNames(nil)

	return "Moves components from " + source + " to " + destination + " until " + source + " has " + targetCountString(m.TopLevelStruct()) + " left"
}

//MoveAllComponents is simply a MoveComponentsUntilCountLeft that overrides
//TargetCount() to return 0. It's effectively the equivalent of
//stack.MoveAllTo, just broken into individual moves. A simple convenience
//since that combination is common.
//
//boardgame:codegen
type MoveAllComponents struct {
	MoveComponentsUntilCountLeft
}

//TargetCount returns 0, no matter what was passed with WithTargetCount. This
//is the primary behavior of this move, compared to
//MoveComponentsUntilCountLeft.
func (m *MoveAllComponents) TargetCount(state boardgame.ImmutableState) int {
	return 0
}

//FallbackName returns "Move All Components From SOURCESTACKNAME To
//DESTINATIONSTACKNAME"
func (m *MoveAllComponents) FallbackName(g *boardgame.GameManager) string {

	source, destination := m.stackNames(g.ExampleState())

	return "Move All Components From " + source + " To " + destination
}

//FallbackHelpText returns "Moves all components from SOURCESTACKNAME to
//DESTINATIONSTACKNAME"
func (m *MoveAllComponents) FallbackHelpText() string {
	source, destination := m.stackNames(nil)

	return "Moves all components from " + source + " to " + destination
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Scene</title>
<meta name="date" content="2015-07-06">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

engine.core

Class Scene

java.lang.Object

engine.core.Scene

public abstract class Scene
extends java.lang.Object

Represents an entire game scene, including any objects or players.

 This can almost be thought of as a game level. The difference is this can
 also represent other interactive game aspects, such as the title screen and
 main menu.

Author:

Benny Bobaganoosh (thebennybox@gmail.com)

Constructor Summary

Constructors

Constructor and Description

Scene(ISpatialStructure<Entity> structure)

Creates a new Scene.

Method Summary

Methods

Modifier and Type
Method and Description

abstract void
render(IRenderContext target)

Renders the scene

abstract boolean
update(double delta)

Updates this scene.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Scene

public Scene(ISpatialStructure<Entity> structure)

Creates a new Scene.

Parameters:

structure - The spatial structure storing everything in this scene.

Method Detail

update

public abstract boolean update(double delta)

Updates this scene.

Parameters:

delta - How much time has passed since the last update.

Returns:

Whether or not the scene has "ended." This can be anything that
         prompts the engine shutting down.

render

public abstract void render(IRenderContext target)

Renders the scene

Parameters:

target - The context used for rendering.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package org.apache.ibatis.reflection.wrapper;

import java.util.List;

import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.property.PropertyTokenizer;

/**
 * @author Clinton Begin
 */
/**
 * 对象包装器
 *
 */
public interface ObjectWrapper {

    //get
  Object get(PropertyTokenizer prop);

  //set
  void set(PropertyTokenizer prop, Object value);

  //查找属性
  String findProperty(String name, boolean useCamelCaseMapping);

  //取得getter的名字列表
  String[] getGetterNames();

  //取得setter的名字列表
  String[] getSetterNames();

  //取得setter的类型
  Class<?> getSetterType(String name);

  //取得getter的类型
  Class<?> getGetterType(String name);

  //是否有指定的setter
  boolean hasSetter(String name);

  //是否有指定的getter
  boolean hasGetter(String name);

  //实例化属性
  MetaObject instantiatePropertyValue(String name, PropertyTokenizer prop, ObjectFactory objectFactory);

  //是否是集合
  boolean isCollection();

  //添加属性
  public void add(Object element);

  //添加属性
  public <E> void addAll(List<E> element);

}


text:
class Diagnosis < ActiveRecordShared

	acts_as_list
	default_scope :order => :position

	acts_like_a_hash

	validates_presence_of   :code
	validates_uniqueness_of :code

	#	Return description
	def to_s
		description
	end

	#	Returns boolean of comparison
	#	true only if key == 'other'
	def is_other?
		key == 'other'
	end

end


text:
from __future__ import unicode_literals

import mock
import os
import sys
from tempfile import NamedTemporaryFile

import pexpect
import pytest
import six

from dallinger.config import Configuration
from dallinger.config import get_config, LOCAL_CONFIG

@pytest.mark.usefixtures('experiment_dir')
class TestConfiguration(object):

    def test_register_new_variable(self):
        config = Configuration()
        config.register('num_participants', int)
        config.extend({'num_participants': 1})
        config.ready = True
        assert config.get('num_participants', 1)

    def test_register_duplicate_variable_raises(self):
        config = Configuration()
        config.register('num_participants', int)
        with pytest.raises(KeyError):
            config.register('num_participants', int)

    def test_register_unknown_type_raises(self):
        config = Configuration()
        with pytest.raises(TypeError):
            config.register('num_participants', object)

    def test_type_mismatch(self):
        config = Configuration()
        config.register('num_participants', int)
        with pytest.raises(TypeError):
            config.extend({'num_participants': 1.0})

    def test_type_mismatch_with_cast_types(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        config.extend({'num_participants': 1.0}, cast_types=True)
        assert config.get('num_participants', 1) == 1

    def test_type_cast_types_failure_raises(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        with pytest.raises(TypeError):
            config.extend({'num_participants': 'A NUMBER'}, cast_types=True)

    def test_get_before_ready_is_not_possible(self):
        config = Configuration()
        config.register('num_participants', int)
        config.extend({'num_participants': 1})
        with pytest.raises(RuntimeError):
            config.get('num_participants', 1)

    def test_layering_of_configs(self):
        config = Configuration()
        config.register('num_participants', int)
        config.extend({'num_participants': 1})
        config.ready = True
        assert config.get('num_participants', 1) == 1
        config.extend({'num_participants': 2})
        assert config.get('num_participants', 1) == 2

    def test_setting_unknown_key_is_ignored(self):
        config = Configuration()
        config.ready = True
        config.extend({'num_participants': 1})
        config.get('num_participants', None)

    def test_setting_by_set(self):
        config = Configuration()
        config.ready = True
        config.set("mode", "live")

    def test_setting_by_assignment(self):
        config = Configuration()
        config.ready = True
        config["mode"] = "live"

    def test_get_without_default_raises(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        with pytest.raises(KeyError):
            config.get('num_participants')

    def test_get_has_default_value(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        assert config.get('num_participants', 10) == 10

    def test_dict_access(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        config.extend({'num_participants': 1})
        assert config['num_participants'] == 1

    def test_attribute_access(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        config.extend({'num_participants': 1})
        assert config.num_participants == 1

    def test_attribute_setting(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        config.num_participants = 1
        assert config.num_participants == 1

    def test_strict_extending_blocks_unknown_keys(self):
        config = Configuration()
        config.register('num_participants', int)
        config.ready = True
        with pytest.raises(KeyError):
            config.extend({'unknown_key': 1}, strict=True)

    def test_setting_values_supports_synonyms(self):
        config = Configuration()
        config.register('num_participants', int, synonyms={'n', })
        config.ready = True
        config.extend({'n': 1})
        assert config.get('num_participants') == 1

    def test_loading_keys_from_config_file(self):
        config = Configuration()
        config.register('num_participants', int, synonyms={'n', })
        config.register('deploy_worldwide', bool, synonyms={'worldwide', })
        with NamedTemporaryFile() as configfile:
            configfile.write(b"""
[Example Section]
num_participants = 10
worldwide = false
""")
            configfile.flush()
            config.load_from_file(configfile.name)
        config.ready = True
        assert config.get('num_participants') == 10
        assert config.get('deploy_worldwide') is False

    def test_loading_keys_from_environment_variables(self):
        config = Configuration()
        config.register('num_participants', int, synonyms={'n', })
        os.environ['num_participants'] = '1'
        try:
            config.load_from_environment()
        finally:
            del os.environ['num_participants']
        config.ready = True
        assert config.get('num_participants') == 1

    def test_experiment_defined_parameters(self):
        try:
            python = pexpect.spawn("python", encoding='utf-8')
            python.read_nonblocking(10000)
            python.setecho(False)
            python.sendline('from dallinger.experiment_server import experiment_server')
            python.sendline('config = experiment_server._config()')
            python.sendline('print(config.types)')
            if six.PY3:
                python.expect_exact("custom_parameter': <class 'int'>")
            else:
                python.expect_exact("custom_parameter': <type 'int'>")
        finally:
            python.sendcontrol('d')
            python.read()

    def test_reload_config(self):
        # replicate the experiment API runner config loading
        config = get_config()
        config.register_extra_parameters()
        config.load_from_file(LOCAL_CONFIG)
        # Failse with _reset()
        config.clear()
        config.register_extra_parameters()
        config.load_from_file(LOCAL_CONFIG)

    def test_custom_experiment_module_set_and_retained(self):
        config = get_config()
        with mock.patch.dict('sys.modules', dallinger_experiment=None):
            config.register_extra_parameters()
            assert sys.modules['dallinger_experiment'] is not None
        exp_module = mock.Mock()
        with mock.patch.dict('sys.modules', dallinger_experiment=exp_module):
            config.clear()
            config.register_extra_parameters()
            assert sys.modules['dallinger_experiment'] is exp_module

    def test_local_base_url(self):
        from dallinger.utils import get_base_url
        config = get_config()
        config.ready = True
        config.set('host', 'localhost')
        config.set('base_port', 5000)
        assert(get_base_url() == 'http://localhost:5000')

    def test_remote_base_url(self):
        from dallinger.utils import get_base_url
        config = get_config()
        config.ready = True
        config.set('host', 'https://dlgr-bogus.herokuapp.com')
        assert(get_base_url() == 'https://dlgr-bogus.herokuapp.com')

    def test_remote_base_url_always_ssl(self):
        from dallinger.utils import get_base_url
        config = get_config()
        config.ready = True
        config.set('host', 'http://dlgr-bogus.herokuapp.com')
        assert(get_base_url() == 'https://dlgr-bogus.herokuapp.com')

    def test_write_omits_sensitive_keys_if_filter_sensitive(self, in_tempdir):
        config = get_config()
        config.set('aws_region', 'some region')
        config.set('aws_secret_access_key', 'foo')
        config.ready = True
        config.write(filter_sensitive=True)
        with open(LOCAL_CONFIG) as txt:
            contents = txt.read()
        assert 'aws_region' in contents
        assert 'aws_secret_access_key' not in contents

    def test_write_includes_all_keys_if_filter_sensitive_false(self, in_tempdir):
        config = get_config()
        config.set('aws_region', 'some region')
        config.set('aws_secret_access_key', 'foo')
        config.ready = True
        config.write(filter_sensitive=False)
        with open(LOCAL_CONFIG) as txt:
            contents = txt.read()
        assert 'aws_region' in contents
        assert 'aws_secret_access_key' in contents


text:
package ws.epigraph.gdata;

import ws.epigraph.lang.TextLocation;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
 * @author Konstantin Sobolev
 */
public class GEnumDatum extends GDatum {
  private final @NotNull String value;

  public GEnumDatum(@NotNull String value, @NotNull TextLocation location) {
    super(null, location);
    this.value = value;
  }

  public @NotNull String value() { return value; }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    GEnumDatum gEnumDatum = (GEnumDatum) o;
    return Objects.equals(value, gEnumDatum.value);
  }

  @Override
  public int hashCode() { return Objects.hash(super.hashCode(), value); }

  @Override
  public String toString() { return "#" + value; }
}


text:
<?php
namespace accounting\aplication;

use accounting\model\AccountId;
use accounting\model\AccountRepository;
use accounting\model\Money;

class ModifyAccountTotal
{
	private $repo;
	private $idGenerator;

	public function __construct(AccountRepository $repo, AccountId $accountId)
	{
		$this->repo = $repo;
		$this->idGenerator = $accountId;
	}

	public function execute($uuid, $newTotal)
	{
		if (is_string($uuid)) {
			$idGenerator = $this->idGenerator;
			$uuid = $idGenerator::fromString($uuid);
		}
		$account = $this->repo->findById($uuid);
		$account->setTotal(new Money($newTotal));
		$account->setModificationDate(new \DateTime);
		$this->repo->add($account);
		$this->repo->save();
	}
}


text:
import Light from './Light';
import { AmbientLight as THREEAmbientLight } from 'three';
import { AMBIENTLIGHT } from './Lights';

const DEFAULT_POSITION = { x: 0, y: 0, z: 0 };
const DEFAULT_INTENSITY = 0.5;
const WHITE = 0xffffff;

export default class LightAmbient extends Light {

    constructor(options) {
        const {
            color = WHITE,
            intensity = DEFAULT_INTENSITY,
            name
        } = options;
        super({ color, intensity, name });

        this.options = options;
        this.setLight({ color, intensity });
    }

    setLight({
        light,
        color = WHITE,
        intensity = DEFAULT_INTENSITY
    }) {
        if (light) {
            this.light = light;
        } else {
            this.light = new THREEAmbientLight(color, intensity);
        }

        if (this.hasBody()) {
            this.postLightCreation();
        }
    }

    postLightCreation() {
        const {
            position = DEFAULT_POSITION
        } = this.options;

        this.setPosition(position);
        this.addToScene();
    }

    addHelper() {
        this.helper = true;
        this.addHolder('ambientlightholder');
    }

    update(dt) {
        super.update(dt);
        if (this.hasHelper()) {
            this.setPosition(this.holder.getPosition(), { updateHolder: false });
        }
    }

    toJSON() {
        return {
            ...super.toJSON(),
            type: AMBIENTLIGHT
        }
    }
}


text:
namespace SDKTemplate
{
    [Windows::Foundation::Metadata::WebHostHidden]
    public ref class Scenario1_FindUsers sealed
    {
    public:
        Scenario1_FindUsers();
    protected:
        virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
        void ShowProperties();
    private:
        MainPage^ rootPage = MainPage::Current;
        Platform::Collections::Vector<UserViewModel^>^ models = ref new Platform::Collections::Vector<UserViewModel^>();
        int nextUserNumber = 1;

        concurrency::task<void> AddNextUserAsync(Platform::Collections::VectorViewIterator<Windows::System::User^> current, Windows::Foundation::Collections::IVectorView<Windows::System::User^>^ users);
    };
}


text:
var oauthModule = require('./oauth2');

module.exports =
oauthModule.submodule('angellist')
  .configurable({
      scope: 'specify types of access: (no scope), user, public_repo, repo, gist'
  })

  .oauthHost('https://angel.co')
  .apiHost('https://api.angel.co/1')

  .authPath('/api/oauth/authorize')
  .authQueryParam('response_type', 'code')

  .accessTokenPath('/api/oauth/token')
  .accessTokenParam('grant_type', 'authorization_code')

  .entryPath('/auth/angellist')
  .callbackPath('/auth/angellist/callback')

  .fetchOAuthUser( function (accessToken) {
    var p = this.Promise();
    this.oauth.get(this.apiHost() + '/me', accessToken, function (err, data) {
      if (err) return p.fail(err);
      var oauthUser = JSON.parse(data);
      p.fulfill(oauthUser);
    })
    return p;
  })
  .moduleErrback( function (err, seqValues) {
    if (err instanceof Error) {
      var next = seqValues.next;
      return next(err);
    } else if (err.extra) {
      var angellistResponse = err.extra.res
        , serverResponse = seqValues.res;
      serverResponse.writeHead(
          angellistResponse.statusCode
        , angellistResponse.headers);
      serverResponse.end(err.extra.data);
    } else if (err.statusCode) {
      var serverResponse = seqValues.res;
      serverResponse.writeHead(err.statusCode);
      serverResponse.end(err.data);
    } else {
      console.error(err);
      throw new Error('Unsupported error type');
    }
  });


text:
package org.yeastrc.paws.dto;

import java.util.List;

public class DisopredParsedDisorderedResiduesPredictions {

	private List<DisopredParsedDisorderedResiduesPredictionEntry> entries;

	private String filename;
	private List<String> fileHeaderLines;

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public List<String> getFileHeaderLines() {
		return fileHeaderLines;
	}

	public void setFileHeaderLines(List<String> fileHeaderLines) {
		this.fileHeaderLines = fileHeaderLines;
	}

	public List<DisopredParsedDisorderedResiduesPredictionEntry> getEntries() {
		return entries;
	}

	public void setEntries(
			List<DisopredParsedDisorderedResiduesPredictionEntry> entries) {
		this.entries = entries;
	}
}


text:
#include <windows.h>
#include <errno.h>

#include "usb.h"

#define LIBUSB_DLL_NAME "libusb0.dll"

typedef usb_dev_handle * (*usb_open_t)(struct usb_device *dev);
typedef int (*usb_close_t)(usb_dev_handle *dev);
typedef int (*usb_get_string_t)(usb_dev_handle *dev, int index, int langid,
                                char *buf, size_t buflen);
typedef int (*usb_get_string_simple_t)(usb_dev_handle *dev, int index,
                                       char *buf, size_t buflen);
typedef int (*usb_get_descriptor_by_endpoint_t)(usb_dev_handle *udev, int ep,
        unsigned char type,
        unsigned char index,
        void *buf, int size);
typedef int (*usb_get_descriptor_t)(usb_dev_handle *udev, unsigned char type,
                                    unsigned char index, void *buf, int size);
typedef int (*usb_bulk_write_t)(usb_dev_handle *dev, int ep, char *bytes,
                                int size, int timeout);
typedef int (*usb_bulk_read_t)(usb_dev_handle *dev, int ep, char *bytes,
                               int size, int timeout);
typedef int (*usb_interrupt_write_t)(usb_dev_handle *dev, int ep, char *bytes,
                                     int size, int timeout);
typedef int (*usb_interrupt_read_t)(usb_dev_handle *dev, int ep, char *bytes,
                                    int size, int timeout);
typedef int (*usb_control_msg_t)(usb_dev_handle *dev, int requesttype,
                                 int request, int value, int index,
                                 char *bytes, int size, int timeout);
typedef int (*usb_set_configuration_t)(usb_dev_handle *dev, int configuration);
typedef int (*usb_claim_interface_t)(usb_dev_handle *dev, int interface);
typedef int (*usb_release_interface_t)(usb_dev_handle *dev, int interface);
typedef int (*usb_set_altinterface_t)(usb_dev_handle *dev, int alternate);
typedef int (*usb_resetep_t)(usb_dev_handle *dev, unsigned int ep);
typedef int (*usb_clear_halt_t)(usb_dev_handle *dev, unsigned int ep);
typedef int (*usb_reset_t)(usb_dev_handle *dev);
typedef char * (*usb_strerror_t)(void);
typedef void (*usb_init_t)(void);
typedef void (*usb_set_debug_t)(int level);
typedef int (*usb_find_busses_t)(void);
typedef int (*usb_find_devices_t)(void);
typedef struct usb_device * (*usb_device_t)(usb_dev_handle *dev);
typedef struct usb_bus * (*usb_get_busses_t)(void);
typedef int (*usb_install_service_np_t)(void);
typedef int (*usb_uninstall_service_np_t)(void);
typedef int (*usb_install_driver_np_t)(const char *inf_file);
typedef const struct usb_version * (*usb_get_version_t)(void);
typedef int (*usb_isochronous_setup_async_t)(usb_dev_handle *dev,
        void **context,
        unsigned char ep, int pktsize);
typedef int (*usb_bulk_setup_async_t)(usb_dev_handle *dev, void **context,
                                      unsigned char ep);
typedef int (*usb_interrupt_setup_async_t)(usb_dev_handle *dev, void **context,
        unsigned char ep);
typedef int (*usb_submit_async_t)(void *context, char *bytes, int size);
typedef int (*usb_reap_async_t)(void *context, int timeout);
typedef int (*usb_free_async_t)(void **context);

static usb_open_t _usb_open = NULL;
static usb_close_t _usb_close = NULL;
static usb_get_string_t _usb_get_string = NULL;
static usb_get_string_simple_t _usb_get_string_simple = NULL;
static usb_get_descriptor_by_endpoint_t _usb_get_descriptor_by_endpoint = NULL;
static usb_get_descriptor_t _usb_get_descriptor = NULL;
static usb_bulk_write_t _usb_bulk_write = NULL;
static usb_bulk_read_t _usb_bulk_read = NULL;
static usb_interrupt_write_t _usb_interrupt_write = NULL;
static usb_interrupt_read_t _usb_interrupt_read = NULL;
static usb_control_msg_t _usb_control_msg = NULL;
static usb_set_configuration_t _usb_set_configuration = NULL;
static usb_claim_interface_t _usb_claim_interface = NULL;
static usb_release_interface_t _usb_release_interface = NULL;
static usb_set_altinterface_t _usb_set_altinterface = NULL;
static usb_resetep_t _usb_resetep = NULL;
static usb_clear_halt_t _usb_clear_halt = NULL;
static usb_reset_t _usb_reset = NULL;
static usb_strerror_t _usb_strerror = NULL;
static usb_init_t _usb_init = NULL;
static usb_set_debug_t _usb_set_debug = NULL;
static usb_find_busses_t _usb_find_busses = NULL;
static usb_find_devices_t _usb_find_devices = NULL;
static usb_device_t _usb_device = NULL;
static usb_get_busses_t _usb_get_busses = NULL;
static usb_install_service_np_t _usb_install_service_np = NULL;
static usb_uninstall_service_np_t _usb_uninstall_service_np = NULL;
static usb_install_driver_np_t _usb_install_driver_np = NULL;
static usb_get_version_t _usb_get_version = NULL;
static usb_isochronous_setup_async_t _usb_isochronous_setup_async = NULL;
static usb_bulk_setup_async_t _usb_bulk_setup_async = NULL;
static usb_interrupt_setup_async_t _usb_interrupt_setup_async = NULL;
static usb_submit_async_t _usb_submit_async = NULL;
static usb_reap_async_t _usb_reap_async = NULL;
static usb_free_async_t _usb_free_async = NULL;

void usb_init(void)
{
    HINSTANCE libusb_dll  = LoadLibrary(LIBUSB_DLL_NAME);

    if (!libusb_dll)
        return;

    _usb_open = (usb_open_t)
                GetProcAddress(libusb_dll, "usb_open");
    _usb_close = (usb_close_t)
                 GetProcAddress(libusb_dll, "usb_close");
    _usb_get_string = (usb_get_string_t)
                      GetProcAddress(libusb_dll, "usb_get_string");
    _usb_get_string_simple = (usb_get_string_simple_t)
                             GetProcAddress(libusb_dll, "usb_get_string_simple");
    _usb_get_descriptor_by_endpoint = (usb_get_descriptor_by_endpoint_t)
                                      GetProcAddress(libusb_dll, "usb_get_descriptor_by_endpoint");
    _usb_get_descriptor = (usb_get_descriptor_t)
                          GetProcAddress(libusb_dll, "usb_get_descriptor");
    _usb_bulk_write = (usb_bulk_write_t)
                      GetProcAddress(libusb_dll, "usb_bulk_write");
    _usb_bulk_read = (usb_bulk_read_t)
                     GetProcAddress(libusb_dll, "usb_bulk_read");
    _usb_interrupt_write = (usb_interrupt_write_t)
                           GetProcAddress(libusb_dll, "usb_interrupt_write");
    _usb_interrupt_read = (usb_interrupt_read_t)
                          GetProcAddress(libusb_dll, "usb_interrupt_read");
    _usb_control_msg = (usb_control_msg_t)
                       GetProcAddress(libusb_dll, "usb_control_msg");
    _usb_set_configuration = (usb_set_configuration_t)
                             GetProcAddress(libusb_dll, "usb_set_configuration");
    _usb_claim_interface = (usb_claim_interface_t)
                           GetProcAddress(libusb_dll, "usb_claim_interface");
    _usb_release_interface = (usb_release_interface_t)
                             GetProcAddress(libusb_dll, "usb_release_interface");
    _usb_set_altinterface = (usb_set_altinterface_t)
                            GetProcAddress(libusb_dll, "usb_set_altinterface");
    _usb_resetep = (usb_resetep_t)
                   GetProcAddress(libusb_dll, "usb_resetep");
    _usb_clear_halt = (usb_clear_halt_t)
                      GetProcAddress(libusb_dll, "usb_clear_halt");
    _usb_reset = (usb_reset_t)
                 GetProcAddress(libusb_dll, "usb_reset");
    _usb_strerror = (usb_strerror_t)
                    GetProcAddress(libusb_dll, "usb_strerror");
    _usb_init = (usb_init_t)
                GetProcAddress(libusb_dll, "usb_init");
    _usb_set_debug = (usb_set_debug_t)
                     GetProcAddress(libusb_dll, "usb_set_debug");
    _usb_find_busses = (usb_find_busses_t)
                       GetProcAddress(libusb_dll, "usb_find_busses");
    _usb_find_devices = (usb_find_devices_t)
                        GetProcAddress(libusb_dll, "usb_find_devices");
    _usb_device = (usb_device_t)
                  GetProcAddress(libusb_dll, "usb_device");
    _usb_get_busses = (usb_get_busses_t)
                      GetProcAddress(libusb_dll, "usb_get_busses");
    _usb_install_service_np = (usb_install_service_np_t)
                              GetProcAddress(libusb_dll, "usb_install_service_np");
    _usb_uninstall_service_np = (usb_uninstall_service_np_t)
                                GetProcAddress(libusb_dll, "usb_uninstall_service_np");
    _usb_install_driver_np = (usb_install_driver_np_t)
                             GetProcAddress(libusb_dll, "usb_install_driver_np");
    _usb_get_version = (usb_get_version_t)
                       GetProcAddress(libusb_dll, "usb_get_version");
    _usb_isochronous_setup_async = (usb_isochronous_setup_async_t)
                                   GetProcAddress(libusb_dll, "usb_isochronous_setup_async");
    _usb_bulk_setup_async = (usb_bulk_setup_async_t)
                            GetProcAddress(libusb_dll, "usb_bulk_setup_async");
    _usb_interrupt_setup_async = (usb_interrupt_setup_async_t)
                                 GetProcAddress(libusb_dll, "usb_interrupt_setup_async");
    _usb_submit_async = (usb_submit_async_t)
                        GetProcAddress(libusb_dll, "usb_submit_async");
    _usb_reap_async = (usb_reap_async_t)
                      GetProcAddress(libusb_dll, "usb_reap_async");
    _usb_free_async = (usb_free_async_t)
                      GetProcAddress(libusb_dll, "usb_free_async");

    if (_usb_init)
        _usb_init();
}

usb_dev_handle *usb_open(struct usb_device *dev)
{
    if (_usb_open)
        return _usb_open(dev);
    else
        return NULL;
}

int usb_close(usb_dev_handle *dev)
{
    if (_usb_close)
        return _usb_close(dev);
    else
        return -ENOFILE;
}

int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf,
                   size_t buflen)
{
    if (_usb_get_string)
        return _usb_get_string(dev, index, langid, buf, buflen);
    else
        return -ENOFILE;
}

int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf,
                          size_t buflen)
{
    if (_usb_get_string_simple)
        return _usb_get_string_simple(dev, index, buf, buflen);
    else
        return -ENOFILE;
}

int usb_get_descriptor_by_endpoint(usb_dev_handle *udev, int ep,
                                   unsigned char type, unsigned char index,
                                   void *buf, int size)
{
    if (_usb_get_descriptor_by_endpoint)
        return _usb_get_descriptor_by_endpoint(udev, ep, type, index, buf, size);
    else
        return -ENOFILE;
}

int usb_get_descriptor(usb_dev_handle *udev, unsigned char type,
                       unsigned char index, void *buf, int size)
{
    if (_usb_get_descriptor)
        return _usb_get_descriptor(udev, type, index, buf, size);
    else
        return -ENOFILE;
}

int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size,
                   int timeout)
{
    if (_usb_bulk_write)
        return _usb_bulk_write(dev, ep, bytes, size, timeout);
    else
        return -ENOFILE;
}

int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
                  int timeout)
{
    if (_usb_bulk_read)
        return _usb_bulk_read(dev, ep, bytes, size, timeout);
    else
        return -ENOFILE;
}

int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size,
                        int timeout)
{
    if (_usb_interrupt_write)
        return _usb_interrupt_write(dev, ep, bytes, size, timeout);
    else
        return -ENOFILE;
}

int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size,
                       int timeout)
{
    if (_usb_interrupt_read)
        return _usb_interrupt_read(dev, ep, bytes, size, timeout);
    else
        return -ENOFILE;
}

int usb_control_msg(usb_dev_handle *dev, int requesttype, int request,
                    int value, int index, char *bytes, int size,
                    int timeout)
{
    if (_usb_control_msg)
        return _usb_control_msg(dev, requesttype, request, value, index, bytes,
                                size, timeout);
    else
        return -ENOFILE;
}

int usb_set_configuration(usb_dev_handle *dev, int configuration)
{
    if (_usb_set_configuration)
        return _usb_set_configuration(dev, configuration);
    else
        return -ENOFILE;
}

int usb_claim_interface(usb_dev_handle *dev, int interface)
{
    if (_usb_claim_interface)
        return _usb_claim_interface(dev, interface);
    else
        return -ENOFILE;
}

int usb_release_interface(usb_dev_handle *dev, int interface)
{
    if (_usb_release_interface)
        return _usb_release_interface(dev, interface);
    else
        return -ENOFILE;
}

int usb_set_altinterface(usb_dev_handle *dev, int alternate)
{
    if (_usb_set_altinterface)
        return _usb_set_altinterface(dev, alternate);
    else
        return -ENOFILE;
}

int usb_resetep(usb_dev_handle *dev, unsigned int ep)
{
    if (_usb_resetep)
        return _usb_resetep(dev, ep);
    else
        return -ENOFILE;
}

int usb_clear_halt(usb_dev_handle *dev, unsigned int ep)
{
    if (_usb_clear_halt)
        return _usb_clear_halt(dev, ep);
    else
        return -ENOFILE;
}

int usb_reset(usb_dev_handle *dev)
{
    if (_usb_reset)
        return _usb_reset(dev);
    else
        return -ENOFILE;
}

char *usb_strerror(void)
{
    if (_usb_strerror)
        return _usb_strerror();
    else
        return NULL;
}

void usb_set_debug(int level)
{
    if (_usb_set_debug)
        return _usb_set_debug(level);
}

int usb_find_busses(void)
{
    if (_usb_find_busses)
        return _usb_find_busses();
    else
        return -ENOFILE;
}

int usb_find_devices(void)
{
    if (_usb_find_devices)
        return _usb_find_devices();
    else
        return -ENOFILE;
}

struct usb_device *usb_device(usb_dev_handle *dev)
{
    if (_usb_device)
        return _usb_device(dev);
    else
        return NULL;
}

struct usb_bus *usb_get_busses(void)
{
    if (_usb_get_busses)
        return _usb_get_busses();
    else
        return NULL;
}

int usb_install_service_np(void)
{
    if (_usb_install_service_np)
        return _usb_install_service_np();
    else
        return -ENOFILE;
}

int usb_uninstall_service_np(void)
{
    if (_usb_uninstall_service_np)
        return _usb_uninstall_service_np();
    else
        return -ENOFILE;
}

int usb_install_driver_np(const char *inf_file)
{
    if (_usb_install_driver_np)
        return _usb_install_driver_np(inf_file);
    else
        return -ENOFILE;
}

const struct usb_version *usb_get_version(void)
{
    if (_usb_get_version)
        return _usb_get_version();
    else
        return NULL;
}

int usb_isochronous_setup_async(usb_dev_handle *dev, void **context,
                                unsigned char ep, int pktsize)
{
    if (_usb_isochronous_setup_async)
        return _usb_isochronous_setup_async(dev, context, ep, pktsize);
    else
        return -ENOFILE;
}

int usb_bulk_setup_async(usb_dev_handle *dev, void **context,
                         unsigned char ep)
{
    if (_usb_bulk_setup_async)
        return _usb_bulk_setup_async(dev, context, ep);
    else
        return -ENOFILE;
}

int usb_interrupt_setup_async(usb_dev_handle *dev, void **context,
                              unsigned char ep)
{
    if (_usb_interrupt_setup_async)
        return _usb_interrupt_setup_async(dev, context, ep);
    else
        return -ENOFILE;
}

int usb_submit_async(void *context, char *bytes, int size)
{
    if (_usb_submit_async)
        return _usb_submit_async(context, bytes, size);
    else
        return -ENOFILE;
}

int usb_reap_async(void *context, int timeout)
{
    if (_usb_reap_async)
        return _usb_reap_async(context, timeout);
    else
        return -ENOFILE;
}

int usb_free_async(void **context)
{
    if (_usb_free_async)
        return _usb_free_async(context);
    else
        return -ENOFILE;
}


text:
/**
 * "First, solve the problem. Then, write the code. -John Johnson"
 * "Or use Vangav M"
 * www.vangav.com
 * */

/**
 * MIT License
 *
 * Copyright (c) 2016 Vangav
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 * */

/**
 * Community
 * Facebook Group: Vangav Open Source - Backend
 *   fb.com/groups/575834775932682/
 * Facebook Page: Vangav
 *   fb.com/vangav.f
 *
 * Third party communities for Vangav Backend
 *   - play framework
 *   - cassandra
 *   - datastax
 *
 * Tag your question online (e.g.: stack overflow, etc ...) with
 *   #vangav_backend
 *   to easier find questions/answers online
 * */

package com.vangav.backend.networks.rest_client;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;

/**
 * @author mustapha
 * fb.com/mustapha.abdallah
 */
/**
 * FutureResponse is used to hold future response of asynchronous requests
 */
public class FutureResponse<T> {

  private static final String kSingletonEntryKey =
    "00000000-0000-1000-0000-000000000000";

  private CountDownLatch countDownLatch;
  private Map<T, RestAsync> entries;

  /**
   * Constructor FutureResponse
   * for singular requests
   * @param countDownLatch
   * @param restAsync
   * @return new FutureResponse Object
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  public FutureResponse (
    CountDownLatch countDownLatch,
    RestAsync restAsync) throws Exception {

    this.countDownLatch = countDownLatch;
    this.entries = new HashMap<T, RestAsync>();

    this.entries.put(
      (T)kSingletonEntryKey,
      restAsync);
  }

  /**
   * Constructor FutureResponse
   * for multiple requests
   * @param countDownLatch
   * @param entries
   * @return new FutureResponse Object
   * @throws Exception
   */
  public FutureResponse (
    CountDownLatch countDownLatch,
    Map<T, RestAsync> entries) throws Exception {

    this.countDownLatch = countDownLatch;
    this.entries = entries;
  }

  /**
   * get
   * gets RestAsnc Object for single request FutureResponse Objects
   * @return RestAsync Object
   * @throws Exception
   */
  public RestAsync get () throws Exception {

    this.countDownLatch.await();

    return this.entries.get(kSingletonEntryKey);
  }

  /**
   * getAll
   * gets all RestAsync Objects for multi-request FutureResponse Objects
   * @return all RestAsync Objects
   * @throws Exception
   */
  public Map<T, RestAsync> getAll () throws Exception {

    this.countDownLatch.await();

    return this.entries;
  }
}


text:
namespace RawData
{
    public class Engine
    {
        public int Speed { get; set; }

        public int Power { get; set; }

        public Engine(int speed, int power)
        {
            this.Speed = speed;
            this.Power = power;
        }
    }
}


text:
This template creates 2 VMs with in an Availability Set with 2 Fault Domains. For more information on managing your availability, see here:

http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-manage-availability/


text:
'use babel';

import IntelliHelponView from './intelli-helpon-view';
import { CompositeDisposable } from 'atom';

export default {

  intelliHelponView: null,
  modalPanel: null,
  subscriptions: null,
  wordCount : 0,
  activate(state) {
    this.intelliHelponView = new IntelliHelponView(state.intelliHelponViewState);
    this.modalPanel = atom.workspace.addModalPanel({
      item: this.intelliHelponView.getElement(),
      visible: false
    });

    // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
    this.subscriptions = new CompositeDisposable();

    // Register command that toggles this view
    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'intelli-helpon:toggle': () => this.toggle()
    }));
  },

  deactivate() {
    this.modalPanel.destroy();
    this.subscriptions.dispose();
    this.intelliHelponView.destroy();
  },

  serialize() {
    return {
      intelliHelponViewState: this.intelliHelponView.serialize()
    };
  },

  toggle() {
    if(this.modalPanel.isVisible())
      this.modalPanel.hide();
    else{
      atom.keymaps.add('escape', "intelli-helpon:toggle", 1);
      editor = atom.workspace.getActiveTextEditor();
      filenameArr = editor.getFileName().split(".");
      fileType = filenameArr[filenameArr.length-1];
      //alert('You want to find about '+ fileType);//js, md, json, less, java, cpp, h, c
      selection = editor.getSelectedText();
      filetypeMap = {'js':'JavaScript', 'c':'C', 'cpp':'CPP', 'java':'Java'};
      typeMark = "UnSpecific";
      if (fileType in filetypeMap){
          typeMark = filetypeMap[fileType];
      }
      this.intelliHelponView.loadData(selection, typeMark);
      this.intelliHelponView.setHeader(selection);
      this.modalPanel.show();
    }
  }
};


text:
require('proof')(7, async okay => {
    await require('./harness')(okay, 'transaction-lifetime-blocked')
    await harness(async function () {

        var db, db_got_versionchange, db2,
            events = [],
            t = async_test(),
            dbname = location + '-' + t.name;

        t.step(function() {
            indexedDB.deleteDatabase(dbname);

            var openrq = indexedDB.open(dbname, 3);

            // 1
            openrq.onupgradeneeded = t.step_func(function(e) {
                events.push("open." + e.type);
                e.target.result.createObjectStore('store');
            });

            // 2
            openrq.onsuccess = t.step_func(function(e) {
                db = e.target.result;

                events.push("open." + e.type);

                // 3
                db.onversionchange = t.step_func(function(e) {
                    events.push("db." + e.type);

                    assert_equals(e.oldVersion, 3, "old version");
                    assert_equals(e.newVersion, 4, "new version");
                    // Do not close db here (as we should)
                });

                // Errors
                db.onerror = fail(t, "db.error");
                db.abort = fail(t, "db.abort");

                step_timeout(t.step_func(OpenSecond), 10);
            });

            // Errors
            openrq.onerror = fail(t, "open.error");
            openrq.onblocked = fail(t, "open.blocked");

        });

        function OpenSecond (e) {
            assert_equals(db2, undefined);
            assert_equals(db + "", "[object IDBDatabase]");
            assert_array_equals(db.objectStoreNames, [ "store" ]);

            var openrq2 = indexedDB.open(dbname, 4);

            // 4
            openrq2.onblocked = t.step_func(function(e) {
                events.push("open2." + e.type);
                // We're closing connection from the other open()
                db.close();
            });

            // 5
            openrq2.onupgradeneeded = t.step_func(function(e) {
                db2 = e.target.result;

                events.push("open2." + e.type);

                assert_equals(db2 + "", "[object IDBDatabase]");

                // Errors
                db2.onversionchange = fail(t, "db2.versionchange");
                db2.onerror = fail(t, "db2.error");
                db2.abort = fail(t, "db2.abort");
            });

            // 6
            openrq2.onsuccess = t.step_func(function(e) {
                events.push("open2." + e.type);

                assert_array_equals(events,
                    [ "open.upgradeneeded",
                      "open.success",
                      "db.versionchange",
                      "open2.blocked",
                      "open2.upgradeneeded",
                      "open2.success",
                    ]);

                step_timeout(function() { t.done(); }, 10);
            });

            // Errors
            openrq2.onerror = fail(t, "open2.error");
        }

        // Cleanup
        add_completion_callback(function(tests) {
            if (db2) db2.close();
            indexedDB.deleteDatabase(dbname);
        })

    })
})


text:
{{#partial "page"}}

        {{#if cart.items.length}}

                {{> components/cart/content}}

                {{> components/cart/totals}}

            {{#if cart.show_primary_checkout_button}}

                    {{lang 'cart.checkout.button'}}
                    {{#if cart.show_multiple_address_shipping}}

                            {{lang 'cart.preview.checkout_multiple'}}

                    {{/if}}

            {{else}}

                    {{lang 'cart.continue_shopping'}}

            {{/if}}

                {{> components/cart/status-messages}}

            {{#if cart.additional_checkout_buttons}}

                    {{#each cart.additional_checkout_buttons}}
                        {{{this}}}
                    {{/each}}

            {{/if}}
        {{else}}

{{lang 'cart.checkout.empty_cart'}}

        {{/if}}

        {{{snippet 'cart'}}}

{{/partial}}
{{> layout/base}}


text:
/*
	SWFUpload.Gears : http://www.swfupload.org, http://swfupload.googlecode.com

	mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/

	SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
	http://www.opensource.org/licenses/mit-license.php

	SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
	http://www.opensource.org/licenses/mit-license.php

	--------------------------------

	Summary:
		It is an API compatible SWFUpload class that wraps Google Gears instead of Flash. This SWFUpload plugin is not actually a plugin.

	Features:
		* Use Google Gears to handle uploads
		* Separately Namespaced to allow fallback to SWFUpload
		* Adds an event for gears loading failed (swfupload_load_failed_handler)

	Usage:
		This library supplies DOM Ready loading by overridding the SWFUpload.Gears.onload function:

		<script type="text/javascript">
			var swfu;
			SWFUpload.onload = function () {
				swfu = new SWFUpload({
					swfupload_load_failed_handler: swfuploadLoadFailed
				});
			};
		</script>

	Notes:
		* Other SWFUpload Plugins are not compatible with SWFUpload.Gears.
		* Since the Flash button is simulated when using Gears there might be slight UI differences
		  in different web browsers.
		* Since Google Gears does not apply the same security restrictions the selectFile() and selectFiles() methods are
		  available and working if Gears loading is successful.
		* SWFUpload.Gears maintains API compatibility so event handlers and settings objects for SWFUpload.Gears are fully compatible with SWFUpload. This
		  allows for easy fall back to SWFUpload if SWFUpload.Gears fails to load.
*/

var SWFUpload;
if (SWFUpload == undefined) {
	SWFUpload = function (settings) {
		this.initSWFUpload(settings);
	};
}

/* ******************* */
/* Constructor & Init  */
/* ******************* */

var SWFUpload.Gears = function (settings) {
	this.initSWFUpload(settings);
};

SWFUpload.Gears.prototype.initSWFUpload = function (settings) {
	try {
		this.customSettings = {};	// A container where developers can place their own settings associated with this instance.
		this.settings = settings;
		this.eventQueue = [];
		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
		this.movieElement = null;

		// Setup global control tracking
		SWFUpload.instances[this.movieName] = this;

		// Load the settings.  Load the Flash movie.
		this.initSettings();
		this.loadGears();
		this.displayDebugInfo();
	} catch (ex) {
		delete SWFUpload.instances[this.movieName];
		throw ex;
	}
};

/* *************** */
/* Static Members  */
/* *************** */
SWFUpload.instances = {};
SWFUpload.movieCount = 0;
SWFUpload.Gears.version = "0.1 for SWFUpload v2.2.0";
SWFUpload.QUEUE_ERROR = {
	QUEUE_LIMIT_EXCEEDED	  		: -100,
	FILE_EXCEEDS_SIZE_LIMIT  		: -110,
	ZERO_BYTE_FILE			  		: -120,
	INVALID_FILETYPE		  		: -130
};
SWFUpload.UPLOAD_ERROR = {
	HTTP_ERROR				  		: -200,
	MISSING_UPLOAD_URL	      		: -210,
	IO_ERROR				  		: -220,
	SECURITY_ERROR			  		: -230,
	UPLOAD_LIMIT_EXCEEDED	  		: -240,
	UPLOAD_FAILED			  		: -250,
	SPECIFIED_FILE_ID_NOT_FOUND		: -260,
	FILE_VALIDATION_FAILED	  		: -270,
	FILE_CANCELLED			  		: -280,
	UPLOAD_STOPPED					: -290
};
SWFUpload.FILE_STATUS = {
	QUEUED		 : -1,
	IN_PROGRESS	 : -2,
	ERROR		 : -3,
	COMPLETE	 : -4,
	CANCELLED	 : -5
};
SWFUpload.BUTTON_ACTION = {
	SELECT_FILE  : -100,
	SELECT_FILES : -110,
	START_UPLOAD : -120
};

/* ******************** */
/* Instance Members  */
/* ******************** */

// Private: initSettings ensures that all the
// settings are set, getting a default value if one was not assigned.
SWFUpload.Gears.prototype.initSettings = function () {
	this.ensureDefault = function (settingName, defaultValue) {
		this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
	};

	// Upload backend settings
	this.ensureDefault("upload_url", "");
	this.ensureDefault("file_post_name", "Filedata");
	this.ensureDefault("post_params", {});
	this.ensureDefault("use_query_string", false);
	this.ensureDefault("requeue_on_error", false);

	// File Settings
	this.ensureDefault("file_types", "*.*");
	this.ensureDefault("file_types_description", "All Files");
	this.ensureDefault("file_size_limit", 0);	// Default zero means "unlimited"
	this.ensureDefault("file_upload_limit", 0);
	this.ensureDefault("file_queue_limit", 0);

	// Flash Settings
	this.ensureDefault("flash_url", "");
	this.ensureDefault("prevent_swf_caching", true);

	// Button Settings
	this.ensureDefault("button_image_url", "");
	this.ensureDefault("button_width", 1);
	this.ensureDefault("button_height", 1);
	this.ensureDefault("button_text", "");
	this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
	this.ensureDefault("button_text_top_padding", 0);
	this.ensureDefault("button_text_left_padding", 0);
	this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
	this.ensureDefault("button_disabled", false);
	this.ensureDefault("button_placeholder_id", null);

	// Debug Settings
	this.ensureDefault("debug", false);
	this.settings.debug_enabled = this.settings.debug;	// Here to maintain v2 API

	// Event Handlers
	this.settings.return_upload_start_handler = this.returnUploadStart;
	this.ensureDefault("swfupload_load_failed_handler", null);
	this.ensureDefault("swfupload_loaded_handler", null);
	this.ensureDefault("file_dialog_start_handler", null);
	this.ensureDefault("file_queued_handler", null);
	this.ensureDefault("file_queue_error_handler", null);
	this.ensureDefault("file_dialog_complete_handler", null);

	this.ensureDefault("upload_start_handler", null);
	this.ensureDefault("upload_progress_handler", null);
	this.ensureDefault("upload_error_handler", null);
	this.ensureDefault("upload_success_handler", null);
	this.ensureDefault("upload_complete_handler", null);

	this.ensureDefault("debug_handler", this.debugMessage);

	this.ensureDefault("custom_settings", {});

	// Other settings
	this.customSettings = this.settings.custom_settings;

	delete this.ensureDefault;
};

SWFUpload.Gears.prototype.loadGears = function () {
	// Check to see if gears is available, if not trigger the failed event

	// FIXME -- How do we handle a user permission rejection?
	if (!window.google || !google.gears) {
		this.queueEvent("swfupload_load_failed_handler");
	} else {

		if (this.settings.button_placeholder_id !== "") {
			this.replaceWithGears();
		} else {
			this.appendGears();
		}
	}
};

// Private: appendGears doesn't actually need to do anything except cause gears to set up
SWFUpload.Gears.prototype.appendFlash = function () {
	this.getGears();
};

// Private: replaceWithFlash replaces the button_placeholder element with the flash movie.
// For this release we are not going to replace any HTML elements. The element can just access SWFUpload.Gears like
// we did with Flash Player 9
SWFUpload.Gears.prototype.replaceWithFlash = function () {
	this.getGears();

	/*
	var targetElement, tempParent;

	// Make sure an element with the ID we are going to use doesn't already exist
	if (document.getElementById(this.movieName) !== null) {
		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
	}

	// Get the element where we will be placing the flash movie
	targetElement = document.getElementById(this.settings.button_placeholder_id);

	if (targetElement == undefined) {
		throw "Could not find the placeholder element.";
	}

	// Append the container and load the flash
	var button = document.createElement("button");
	button.id = this.movieName;
	button.cssName = "swfupload";
	var buttonInnards = document.createElement("div");
	buttonInnards.innerHTML = this.settings.button_text;
	button.style.overflow = "hidden";
	buttonInnards.style.overflow = "hidden";
	button.style.marginTop = this.settings.button_text_top_padding + "px";
	button.style.marginLeft = this.settings.button_text_left_padding + "px";
	button.style.width = this.settings.button_width + "px";
	button.style.height = this.settings.button_height + "px";

	targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
	*/

};

SWFUpload.Gears.prototype.getGears = function () {

};

// Public: getMovieElement retrieves the "gearsMovie" that emulates the Flash Movie
SWFUpload.Gears.prototype.getMovieElement = function () {
	return this.movieElement;
};

// Private: buildParamString takes the name/value pairs in the post_params setting object
// and joins them up in to a string formatted "name=value&name=value"
SWFUpload.Gears.prototype.buildParamString = function () {
	var postParams = this.settings.post_params;
	var paramStringPairs = [];

	if (typeof(postParams) === "object") {
		for (var name in postParams) {
			if (postParams.hasOwnProperty(name)) {
				paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
			}
		}
	}

	return paramStringPairs.join("&");
};

// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
// all references to the SWF, and other objects so memory is properly freed.
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
SWFUpload.Gears.prototype.destroy = function () {
	try {
		// Make sure Flash is done before we try to remove it
		this.stopUpload();

		// Remove the SWFUpload DOM nodes
		var movieElement = null;
		try {
			movieElement = this.getMovieElement();
		} catch (ex) {
		}

		// Destroy references
		SWFUpload.instances[this.movieName] = null;
		delete SWFUpload.instances[this.movieName];

		delete this.movieElement;
		delete this.settings;
		delete this.customSettings;
		delete this.eventQueue;
		delete this.movieName;

		return true;
	} catch (ex1) {
		return false;
	}
};

// Public: displayDebugInfo prints out settings and configuration
// information about this SWFUpload instance.
// This function (and any references to it) can be deleted when placing
// SWFUpload in production.
SWFUpload.Gears.prototype.displayDebugInfo = function () {
	this.debug(
		[
			"---SWFUpload Instance Info---\n",
			"Version: ", SWFUpload.version, "\n",
			"Movie Name: ", this.movieName, "\n",
			"Settings:\n",
			"\t", "upload_url:               ", this.settings.upload_url, "\n",
			"\t", "flash_url:                ", this.settings.flash_url, "\n",
			"\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
			"\t", "file_post_name:           ", this.settings.file_post_name, "\n",
			"\t", "post_params:              ", this.settings.post_params.toString(), "\n",
			"\t", "file_types:               ", this.settings.file_types, "\n",
			"\t", "file_types_description:   ", this.settings.file_types_description, "\n",
			"\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",
			"\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",
			"\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",
			"\t", "debug:                    ", this.settings.debug.toString(), "\n",

			"\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",

			"\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
			"\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
			"\t", "button_width:             ", this.settings.button_width.toString(), "\n",
			"\t", "button_height:            ", this.settings.button_height.toString(), "\n",
			"\t", "button_text:              ", this.settings.button_text.toString(), "\n",
			"\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",
			"\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",
			"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
			"\t", "button_action:            ", this.settings.button_action.toString(), "\n",
			"\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",

			"\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",
			"Event Handlers:\n",
			"\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
			"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
			"\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
			"\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
			"\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
			"\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
			"\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
			"\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
			"\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
			"\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"
		].join("")
	);
};

/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
	the maintain v2 API compatibility
*/
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
SWFUpload.Gears.prototype.addSetting = function (name, value, default_value) {
    if (value == undefined) {
        return (this.settings[name] = default_value);
    } else {
        return (this.settings[name] = value);
	}
};

// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
SWFUpload.Gears.prototype.getSetting = function (name) {
    if (this.settings[name] != undefined) {
        return this.settings[name];
	}

    return "";
};

// Private: callFlash handles function calls made to the Flash element.
// Calls are made with a setTimeout for some functions to work around
// bugs in the ExternalInterface library.
SWFUpload.Gears.prototype.callFlash = function (functionName, argumentArray) {
	argumentArray = argumentArray || [];

	var movieElement = this.getMovieElement();
	var returnValue;

	if (typeof movieElement[functionName] === "function") {
		return movieElement[functionName].call(this, argumentArray);
	} else {
		throw "Invalid function name: " + functionName;
	}
};

/* *****************************
	-- Flash control methods --
	Your UI should use these
	to operate SWFUpload
   ***************************** */

// Public: selectFile causes a File Selection Dialog window to appear.  This
// dialog only allows 1 file to be selected. WARNING: this function does not work in Flash Player 10
SWFUpload.Gears.prototype.selectFile = function () {
	this.callFlash("SelectFile");
};

// Public: selectFiles causes a File Selection Dialog window to appear/ This
// dialog allows the user to select any number of files
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
// If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
// for this bug.  WARNING: this function does not work in Flash Player 10
SWFUpload.Gears.prototype.selectFiles = function () {
	this.callFlash("SelectFiles");
};

// Public: startUpload starts uploading the first file in the queue unless
// the optional parameter 'fileID' specifies the ID
SWFUpload.Gears.prototype.startUpload = function (fileID) {
	this.callFlash("StartUpload", [fileID]);
};

/* Cancels a the file upload.  You must specify a file_id */
// Public: cancelUpload cancels any queued file.  The fileID parameter
// must be specified.
SWFUpload.Gears.prototype.cancelUpload = function (fileID) {
	this.callFlash("CancelUpload", [fileID]);
};

// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
// If nothing is currently uploading then nothing happens.
SWFUpload.Gears.prototype.stopUpload = function () {
	this.callFlash("StopUpload");
};

/* ************************
 * Settings methods
 *   These methods change the SWFUpload settings.
 *   SWFUpload settings should not be changed directly on the settings object
 *   since many of the settings need to be passed to Flash in order to take
 *   effect.
 * *********************** */

// Public: getStats gets the file statistics object.
SWFUpload.Gears.prototype.getStats = function () {
	return this.callFlash("GetStats");
};

// Public: setStats changes the SWFUpload statistics.  You shouldn't need to
// change the statistics but you can.  Changing the statistics does not
// affect SWFUpload accept for the successful_uploads count which is used
// by the upload_limit setting to determine how many files the user may upload.
SWFUpload.Gears.prototype.setStats = function (statsObject) {
	this.callFlash("SetStats", [statsObject]);
};

// Public: getFile retrieves a File object by ID or Index.  If the file is
// not found then 'null' is returned.
SWFUpload.Gears.prototype.getFile = function (fileID) {
	if (typeof(fileID) === "number") {
		return this.callFlash("GetFileByIndex", [fileID]);
	} else {
		return this.callFlash("GetFile", [fileID]);
	}
};

// Public: addFileParam sets a name/value pair that will be posted with the
// file specified by the Files ID.  If the name already exists then the
// exiting value will be overwritten.
SWFUpload.Gears.prototype.addFileParam = function (fileID, name, value) {
	return this.callFlash("AddFileParam", [fileID, name, value]);
};

// Public: removeFileParam removes a previously set (by addFileParam) name/value
// pair from the specified file.
SWFUpload.Gears.prototype.removeFileParam = function (fileID, name) {
	this.callFlash("RemoveFileParam", [fileID, name]);
};

// Public: setUploadUrl changes the upload_url setting.
SWFUpload.Gears.prototype.setUploadURL = function (url) {
	this.settings.upload_url = url.toString();
	this.callFlash("SetUploadURL", [url]);
};

// Public: setPostParams changes the post_params setting
SWFUpload.Gears.prototype.setPostParams = function (paramsObject) {
	this.settings.post_params = paramsObject;
	this.callFlash("SetPostParams", [paramsObject]);
};

// Public: addPostParam adds post name/value pair.  Each name can have only one value.
SWFUpload.Gears.prototype.addPostParam = function (name, value) {
	this.settings.post_params[name] = value;
	this.callFlash("SetPostParams", [this.settings.post_params]);
};

// Public: removePostParam deletes post name/value pair.
SWFUpload.Gears.prototype.removePostParam = function (name) {
	delete this.settings.post_params[name];
	this.callFlash("SetPostParams", [this.settings.post_params]);
};

// Public: setFileTypes changes the file_types setting and the file_types_description setting
SWFUpload.Gears.prototype.setFileTypes = function (types, description) {
	this.settings.file_types = types;
	this.settings.file_types_description = description;
	this.callFlash("SetFileTypes", [types, description]);
};

// Public: setFileSizeLimit changes the file_size_limit setting
SWFUpload.Gears.prototype.setFileSizeLimit = function (fileSizeLimit) {
	this.settings.file_size_limit = fileSizeLimit;
	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
};

// Public: setFileUploadLimit changes the file_upload_limit setting
SWFUpload.Gears.prototype.setFileUploadLimit = function (fileUploadLimit) {
	this.settings.file_upload_limit = fileUploadLimit;
	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
};

// Public: setFileQueueLimit changes the file_queue_limit setting
SWFUpload.Gears.prototype.setFileQueueLimit = function (fileQueueLimit) {
	this.settings.file_queue_limit = fileQueueLimit;
	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
};

// Public: setFilePostName changes the file_post_name setting
SWFUpload.Gears.prototype.setFilePostName = function (filePostName) {
	this.settings.file_post_name = filePostName;
	this.callFlash("SetFilePostName", [filePostName]);
};

// Public: setUseQueryString changes the use_query_string setting
SWFUpload.Gears.prototype.setUseQueryString = function (useQueryString) {
	this.settings.use_query_string = useQueryString;
	this.callFlash("SetUseQueryString", [useQueryString]);
};

// Public: setRequeueOnError changes the requeue_on_error setting
SWFUpload.Gears.prototype.setRequeueOnError = function (requeueOnError) {
	this.settings.requeue_on_error = requeueOnError;
	this.callFlash("SetRequeueOnError", [requeueOnError]);
};

// Public: setDebugEnabled changes the debug_enabled setting
SWFUpload.Gears.prototype.setDebugEnabled = function (debugEnabled) {
	this.settings.debug_enabled = debugEnabled;
	this.callFlash("SetDebugEnabled", [debugEnabled]);
};

// Public: setButtonImageURL loads a button image sprite
SWFUpload.Gears.prototype.setButtonImageURL = function (buttonImageURL) {
	if (buttonImageURL == undefined) {
		buttonImageURL = "";
	}

	this.settings.button_image_url = buttonImageURL;
	this.callFlash("SetButtonImageURL", [buttonImageURL]);
};

// Public: setButtonDimensions resizes the Flash Movie and button
SWFUpload.Gears.prototype.setButtonDimensions = function (width, height) {
	this.settings.button_width = width;
	this.settings.button_height = height;

	var movie = this.getMovieElement();
	if (movie != undefined) {
		movie.style.width = width + "px";
		movie.style.height = height + "px";
	}

	this.callFlash("SetButtonDimensions", [width, height]);
};
// Public: setButtonText Changes the text overlaid on the button
SWFUpload.Gears.prototype.setButtonText = function (html) {
	this.settings.button_text = html;
	this.callFlash("SetButtonText", [html]);
};
// Public: setButtonTextPadding changes the top and left padding of the text overlay
SWFUpload.Gears.prototype.setButtonTextPadding = function (left, top) {
	this.settings.button_text_top_padding = top;
	this.settings.button_text_left_padding = left;
	this.callFlash("SetButtonTextPadding", [left, top]);
};

// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
SWFUpload.Gears.prototype.setButtonTextStyle = function (css) {
	this.settings.button_text_style = css;
	this.callFlash("SetButtonTextStyle", [css]);
};
// Public: setButtonDisabled disables/enables the button
SWFUpload.Gears.prototype.setButtonDisabled = function (isDisabled) {
	this.settings.button_disabled = isDisabled;
	this.callFlash("SetButtonDisabled", [isDisabled]);
};
// Public: setButtonAction sets the action that occurs when the button is clicked
SWFUpload.Gears.prototype.setButtonAction = function (buttonAction) {
	this.settings.button_action = buttonAction;
	this.callFlash("SetButtonAction", [buttonAction]);
};

/* *******************************
	Flash Event Interfaces
	These functions are used by Flash to trigger the various
	events.

	All these functions a Private.

	Because the ExternalInterface library is buggy the event calls
	are added to a queue and the queue then executed by a setTimeout.
	This ensures that events are executed in a determinate order and that
	the ExternalInterface bugs are avoided.
******************************* */

SWFUpload.Gears.prototype.queueEvent = function (handlerName, argumentArray) {
	// Warning: Don't call this.debug inside here or you'll create an infinite loop

	if (argumentArray == undefined) {
		argumentArray = [];
	} else if (!(argumentArray instanceof Array)) {
		argumentArray = [argumentArray];
	}

	var self = this;
	if (typeof this.settings[handlerName] === "function") {
		// Queue the event
		this.eventQueue.push(function () {
			this.settings[handlerName].apply(this, argumentArray);
		});

		// Execute the next queued event
		setTimeout(function () {
			self.executeNextEvent();
		}, 0);

	} else if (this.settings[handlerName] !== null) {
		throw "Event handler " + handlerName + " is unknown or is not a function";
	}
};

// Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
// we must queue them in order to garentee that they are executed in order.
SWFUpload.Gears.prototype.executeNextEvent = function () {
	// Warning: Don't call this.debug inside here or you'll create an infinite loop

	var  f = this.eventQueue ? this.eventQueue.shift() : null;
	if (typeof(f) === "function") {
		f.apply(this);
	}
};

// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
SWFUpload.Gears.prototype.unescapeFilePostParams = function (file) {
	var reg = /[$]([0-9a-f]{4})/i;
	var unescapedPost = {};
	var uk;

	if (file != undefined) {
		for (var k in file.post) {
			if (file.post.hasOwnProperty(k)) {
				uk = k;
				var match;
				while ((match = reg.exec(uk)) !== null) {
					uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
				}
				unescapedPost[uk] = file.post[k];
			}
		}

		file.post = unescapedPost;
	}

	return file;
};

SWFUpload.Gears.prototype.flashReady = function () {
	// Check that the movie element is loaded correctly with its ExternalInterface methods defined
	var movieElement = this.getMovieElement();
	if (typeof movieElement.StartUpload !== "function") {
		throw "ExternalInterface methods failed to initialize.";
	}

	// Fix IE Flash/Form bug
	if (window[this.movieName] == undefined) {
		window[this.movieName] = movieElement;
	}

	this.queueEvent("swfupload_loaded_handler");
};

/* This is a chance to do something before the browse window opens */
SWFUpload.Gears.prototype.fileDialogStart = function () {
	this.queueEvent("file_dialog_start_handler");
};

/* Called when a file is successfully added to the queue. */
SWFUpload.Gears.prototype.fileQueued = function (file) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("file_queued_handler", file);
};

/* Handle errors that occur when an attempt to queue a file fails. */
SWFUpload.Gears.prototype.fileQueueError = function (file, errorCode, message) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
};

/* Called after the file dialog has closed and the selected files have been queued.
	You could call startUpload here if you want the queued files to begin uploading immediately. */
SWFUpload.Gears.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued) {
	this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued]);
};

SWFUpload.Gears.prototype.uploadStart = function (file) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("return_upload_start_handler", file);
};

SWFUpload.Gears.prototype.returnUploadStart = function (file) {
	var returnValue;
	if (typeof this.settings.upload_start_handler === "function") {
		file = this.unescapeFilePostParams(file);
		returnValue = this.settings.upload_start_handler.call(this, file);
	} else if (this.settings.upload_start_handler != undefined) {
		throw "upload_start_handler must be a function";
	}

	// Convert undefined to true so if nothing is returned from the upload_start_handler it is
	// interpretted as 'true'.
	if (returnValue === undefined) {
		returnValue = true;
	}

	returnValue = !!returnValue;

	this.callFlash("ReturnUploadStart", [returnValue]);
};

SWFUpload.Gears.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
};

SWFUpload.Gears.prototype.uploadError = function (file, errorCode, message) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_error_handler", [file, errorCode, message]);
};

SWFUpload.Gears.prototype.uploadSuccess = function (file, serverData) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_success_handler", [file, serverData]);
};

SWFUpload.Gears.prototype.uploadComplete = function (file) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_complete_handler", file);
};

/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
   internal debug console.  You can override this event and have messages written where you want. */
SWFUpload.Gears.prototype.debug = function (message) {
	this.queueEvent("debug_handler", message);
};

/* **********************************
	Debug Console
	The debug console is a self contained, in page location
	for debug message to be sent.  The Debug Console adds
	itself to the body if necessary.

	The console is automatically scrolled as messages appear.

	If you are using your own debug handler or when you deploy to production and
	have debug disabled you can remove these functions to reduce the file size
	and complexity.
********************************** */

// Private: debugMessage is the default debug_handler.  If you want to print debug messages
// call the debug() function.  When overriding the function your own function should
// check to see if the debug setting is true before outputting debug information.
SWFUpload.Gears.prototype.debugMessage = function (message) {
	if (this.settings.debug) {
		var exceptionMessage, exceptionValues = [];

		// Check for an exception object and print it nicely
		if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
			for (var key in message) {
				if (message.hasOwnProperty(key)) {
					exceptionValues.push(key + ": " + message[key]);
				}
			}
			exceptionMessage = exceptionValues.join("\n") || "";
			exceptionValues = exceptionMessage.split("\n");
			exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
			SWFUpload.Console.writeLine(exceptionMessage);
		} else {
			SWFUpload.Console.writeLine(message);
		}
	}
};

SWFUpload.Gears.Console = {};
SWFUpload.Gears.Console.writeLine = function (message) {
	var console, documentForm;

	try {
		console = document.getElementById("SWFUpload_Console");

		if (!console) {
			documentForm = document.createElement("form");
			document.getElementsByTagName("body")[0].appendChild(documentForm);

			console = document.createElement("textarea");
			console.id = "SWFUpload_Console";
			console.style.fontFamily = "monospace";
			console.setAttribute("wrap", "off");
			console.wrap = "off";
			console.style.overflow = "auto";
			console.style.width = "700px";
			console.style.height = "350px";
			console.style.margin = "5px";
			documentForm.appendChild(console);
		}

		console.value += message + "\n";

		console.scrollTop = console.scrollHeight - console.clientHeight;
	} catch (ex) {
		alert("Exception: " + ex.name + " Message: " + ex.message);
	}
};

/* ***************************************************************************
	GearsMovie object emulates a Flash generated object with the
	SWFUpload ExternalInterface methods exposted.

	Note: The object is _not_ a DOM Node (like the SWFUpload object element)
	and any attempts to treat it as such will fail.
   *************************************************************************** */

// In general you shouldn't be accessing this class directly (it's private) but if you do we've
// marked Public and Private methods
SWFUpload.Gears.GearsMovie = function (swfuploadGearsInstance) {
	this.swfuploadGearsInstance = swfuploadGearsInstance;
	this.gearsDesktop = google.gears.factory.create("beta.desktop");
	this.gearsUploader = null;

	this.fileQueue = [];
	this.allFiles = [];
	this.currentFile = null;
	this.fileCounter = 0;
};

// Public
SWFUpload.Gears.GearsMovie.prototype.SelectFile = function () {
	// FIXME - Call SWFUpload file dialog start event

	this.gearsDesktop.openFiles(this.selectFilesHandler, { singleFile : true, [this.swfuploadGearsInstance.settings.file_types] })	// FIXME -- file_types isn't in the right format
};

// Public
SWFUpload.Gears.GearsMovie.prototype.SelectFiles = function () {
	// FIXME - Call SWFUpload file dialog start event

	this.gearsDesktop.openFiles(this.selectFilesHandler, { singleFile : false, [this.swfuploadGearsInstance.settings.file_types] })	// FIXME -- file_types isn't in the right format
};

// Private
SWFUpload.Gears.GearsMovie.prototype.selectFilesHandler = function (files) {
	// FIXME -- check if "THIS" is the right context

	// Go through each file
	for (var i = 0; i < files.length; i++) {
		var file = files[i];
		var gearsFile = new SWFupload.Gears.GearsFile();
		gearsFile.id = this.swfuploadGearsInstance.movieName + "_" + this.fileCounter++;
		gearsFile.name = file.name;
		gearsFile.size = file.blob.length;
		gearsFile.filestatus = SWFUpload.FILE_STATUS.QUEUED;
		gearsFile.file = file;

		// Check it

		this.fileQueue.push(gearsFile);
		this.allFiles[gearsFile.id] = gearsFile;
		// Trigger fileQueued event or fileQueueError event

	}

	// Trigger fileDialogComplete event
};

SWFUpload.Gears.GearsMovie.prototype.StartUpload = function (idOrIndex) {
	if (this.gearsUploader !== null) return;

	if (idOrIndex == undefined) {
		this.currentFile = this.fileQueue.shift();

		this.gearsUploader = google.gears.factory.create('beta.httprequest');
		this.gearsUploader.onreadystatechange = this.readyStateChangeHandler;
		this.gearsUploader.open("POST", this.swfuploadGearsInstance.settings.upload_url);

		this.gearsUploader.setRequestHeader('Content-Disposition', 'attachment; filename="' + this.currentFile.name + '"');	// FIXME -- need to escape quotes
		this.gearsUploader.setRequestHeader('Content-Type', 'application/octet-stream');
		//this.gearsUploader.setRequestHeader('Content-Range', 'bytes ' + byteRange); // HUH?

		this.gearsUploader.send(this.currentFile.file.blob);	// FIXME - send the file

	} else {

	} // FIXME -- do the ID search
};

SWFUpload.Gears.GearsMovie.prototype.readyStateChangeHandler = function () {
	// this is probably the HTTPRequest object rather than the GearsMovie
	if (this.readyState === 4) {
		alert(this.status + " " + this.responseText);
	}
};

SWFUpload.Gears.GearsFile = function () {
	this.name = "";
	this.size = "";
	this.post = {};
	this.type = "";
	this.creationdate = null;
	this.modificationdate = null;

	this.file = null;	// Private
}

// Copyright 2007, Google Inc.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//  1. Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//  2. Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//  3. Neither the name of Google Inc. nor the names of its contributors may be
//     used to endorse or promote products derived from this software without
//     specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Sets up google.gears.*, which is *the only* supported way to access Gears.
//
// Circumvent this file at your own risk!
//
// In the future, Gears may automatically define google.gears.* without this
// file. Gears may use these objects to transparently fix bugs and compatibility
// issues. Applications that use the code below will continue to work seamlessly
// when that happens.

(function () {
  // We are already defined. Hooray!
  if (window.google && google.gears) {
    return;
  }

  var factory = null;

  // Firefox
  if (typeof GearsFactory != 'undefined') {
    factory = new GearsFactory();
  } else {
    // IE
    try {
      factory = new ActiveXObject('Gears.Factory');
      // privateSetGlobalObject is only required and supported on WinCE.
      if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {
        factory.privateSetGlobalObject(this);
      }
    } catch (e) {
      // Safari
      if ((typeof navigator.mimeTypes != 'undefined')
           && navigator.mimeTypes["application/x-googlegears"]) {
        factory = document.createElement("object");
        factory.style.display = "none";
        factory.width = 0;
        factory.height = 0;
        factory.type = "application/x-googlegears";
        document.documentElement.appendChild(factory);
      }
    }
  }

  // *Do not* define any objects if Gears is not installed. This mimics the
  // behavior of Gears defining the objects in the future.
  if (!factory) {
    return;
  }

  // Now set up the objects, being careful not to overwrite anything.
  //
  // Note: In Internet Explorer for Windows Mobile, you can't add properties to
  // the window object. However, global objects are automatically added as
  // properties of the window object in all browsers.
  if (!window.google) {
    google = {};
  }

  if (!google.gears) {
    google.gears = {factory: factory};
  }
})();


text:
package org.zstack.sdk;

import org.zstack.sdk.AccessKeyInventory;

public class CreateAccessKeyResult {
    public AccessKeyInventory inventory;
    public void setInventory(AccessKeyInventory inventory) {
        this.inventory = inventory;
    }
    public AccessKeyInventory getInventory() {
        return this.inventory;
    }

}


text:
<?php
namespace Hook\Model;

/**
 * RequestLog
 *
 * @see Hook\Model\Model
 */
class RequestLog extends Model
{
}