text:
using content::UserMetricsAction;

namespace options2 {

LanguageOptionsHandlerCommon::LanguageOptionsHandlerCommon() {
}

LanguageOptionsHandlerCommon::~LanguageOptionsHandlerCommon() {
}

void LanguageOptionsHandlerCommon::GetLocalizedValues(
    DictionaryValue* localized_strings) {
  DCHECK(localized_strings);
  string16 product_name = GetProductName();
  localized_strings->SetString("add_button",
      l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_BUTTON));
  localized_strings->SetString("languages",
      l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES));
  localized_strings->SetString("please_add_another_language",
      l10n_util::GetStringUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_PLEASE_ADD_ANOTHER_LANGUAGE));
  localized_strings->SetString("remove_button",
      l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON));
  localized_strings->SetString("add_language_instructions",
      l10n_util::GetStringUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_INSTRUCTIONS));
  localized_strings->SetString("cannot_be_displayed_in_this_language",
      l10n_util::GetStringFUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_CANNOT_BE_DISPLAYED_IN_THIS_LANGUAGE,
          product_name));
  localized_strings->SetString("is_displayed_in_this_language",
      l10n_util::GetStringFUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE,
          product_name));
  localized_strings->SetString("display_in_this_language",
      l10n_util::GetStringFUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE,
          product_name));
  localized_strings->SetString("this_language_is_currently_in_use",
      l10n_util::GetStringFUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_THIS_LANGUAGE_IS_CURRENTLY_IN_USE,
          product_name));
  localized_strings->SetString("restart_required",
          l10n_util::GetStringUTF16(IDS_OPTIONS_RELAUNCH_REQUIRED));
  // OS X uses the OS native spellchecker so no need for these strings.
#if !defined(OS_MACOSX)
  localized_strings->SetString("use_this_for_spell_checking",
      l10n_util::GetStringUTF16(
          IDS_OPTIONS_SETTINGS_USE_THIS_FOR_SPELL_CHECKING));
  localized_strings->SetString("cannot_be_used_for_spell_checking",
      l10n_util::GetStringUTF16(
          IDS_OPTIONS_SETTINGS_CANNOT_BE_USED_FOR_SPELL_CHECKING));
  localized_strings->SetString("is_used_for_spell_checking",
      l10n_util::GetStringUTF16(
          IDS_OPTIONS_SETTINGS_IS_USED_FOR_SPELL_CHECKING));
  localized_strings->SetString("enable_spell_check",
          l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SPELLCHECK));
  localized_strings->SetString("enable_auto_spell_correction",
          l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION));
#endif  // !OS_MACOSX
  localized_strings->SetString("add_language_title",
          l10n_util::GetStringUTF16(IDS_OPTIONS_LANGUAGES_ADD_TITLE));
  localized_strings->SetString("add_language_select_label",
          l10n_util::GetStringUTF16(IDS_OPTIONS_LANGUAGES_ADD_SELECT_LABEL));
  localized_strings->SetString("restart_button",
      l10n_util::GetStringUTF16(
          IDS_OPTIONS_SETTINGS_LANGUAGES_RELAUNCH_BUTTON));

  // The following are resources, rather than local strings.
  std::string application_locale = g_browser_process->GetApplicationLocale();
  localized_strings->SetString("currentUiLanguageCode", application_locale);
  std::string prospective_locale =
      g_browser_process->local_state()->GetString(prefs::kApplicationLocale);
  localized_strings->SetString("prospectiveUiLanguageCode",
      !prospective_locale.empty() ? prospective_locale : application_locale);
  localized_strings->Set("spellCheckLanguageCodeSet",
                         GetSpellCheckLanguageCodeSet());
  localized_strings->Set("uiLanguageCodeSet", GetUILanguageCodeSet());

  const CommandLine& command_line = *CommandLine::ForCurrentProcess();
  bool experimental_spell_check_features =
      command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures);
  localized_strings->SetBoolean("experimentalSpellCheckFeatures",
                                experimental_spell_check_features);
}

void LanguageOptionsHandlerCommon::RegisterMessages() {
  web_ui()->RegisterMessageCallback("languageOptionsOpen",
      base::Bind(
          &LanguageOptionsHandlerCommon::LanguageOptionsOpenCallback,
          base::Unretained(this)));
  web_ui()->RegisterMessageCallback("spellCheckLanguageChange",
      base::Bind(
          &LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback,
          base::Unretained(this)));
  web_ui()->RegisterMessageCallback("uiLanguageChange",
      base::Bind(
          &LanguageOptionsHandlerCommon::UiLanguageChangeCallback,
          base::Unretained(this)));
}

DictionaryValue* LanguageOptionsHandlerCommon::GetUILanguageCodeSet() {
  DictionaryValue* dictionary = new DictionaryValue();
  const std::vector<std::string>& available_locales =
      l10n_util::GetAvailableLocales();
  for (size_t i = 0; i < available_locales.size(); ++i) {
    dictionary->SetBoolean(available_locales[i], true);
  }
  return dictionary;
}

DictionaryValue* LanguageOptionsHandlerCommon::GetSpellCheckLanguageCodeSet() {
  DictionaryValue* dictionary = new DictionaryValue();
  std::vector<std::string> spell_check_languages;
  SpellCheckCommon::SpellCheckLanguages(&spell_check_languages);
  for (size_t i = 0; i < spell_check_languages.size(); ++i) {
    dictionary->SetBoolean(spell_check_languages[i], true);
  }
  return dictionary;
}

void LanguageOptionsHandlerCommon::LanguageOptionsOpenCallback(
    const ListValue* args) {
  content::RecordAction(UserMetricsAction("LanguageOptions_Open"));
}

void LanguageOptionsHandlerCommon::UiLanguageChangeCallback(
    const ListValue* args) {
  const std::string language_code = UTF16ToASCII(ExtractStringValue(args));
  CHECK(!language_code.empty());
  const std::string action = base::StringPrintf(
      "LanguageOptions_UiLanguageChange_%s", language_code.c_str());
  content::RecordComputedAction(action);
  SetApplicationLocale(language_code);
  StringValue language_value(language_code);
  web_ui()->CallJavascriptFunction("options.LanguageOptions.uiLanguageSaved",
                                   language_value);
}

void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback(
    const ListValue* args) {
  const std::string language_code = UTF16ToASCII(ExtractStringValue(args));
  CHECK(!language_code.empty());
  const std::string action = base::StringPrintf(
      "LanguageOptions_SpellCheckLanguageChange_%s", language_code.c_str());
  content::RecordComputedAction(action);
}

}  // namespace options2


text:
'use strict';

var React = require('react');
var SvgIcon = require('../../svg-icon');

var ContentAdd = React.createClass({
  displayName: 'ContentAdd',

  render: function render() {
    return React.createElement(
      SvgIcon,
      this.props,
      React.createElement('path', { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" })
    );
  }

});

module.exports = ContentAdd;

redpajama_set_name: RedPajamaGithub


text:
require "akashi/ec2/base"
require "akashi/ec2/ami"
require "akashi/ec2/key_pair"
require "akashi/ec2/monkey_patch"
require "akashi/ec2/instance"

module Akashi
  class Ec2
  end
end


text:
Made in [![Appus Studio] (https://github.com/vladimir-yerokhin-appus/DiaphragmView/blob/master/readme_files/appus_logo.png)] (http://appus.pro)

Customizable custom view which looks and works like photocamera diaphragm.
Can be used, for example, in photoeditos or like animated UI elemet.

* [Customization](#customization)
* [Demo](#demo)
* [Getting Started](#getting-started)
* [Info](#info)

# Customization

* diaphragm_background_color - petals color
* diaphragm_border_color - border color
* diaphragm_border_width - (int value)
* diaphragm_default_opening_value - the value to which the diaphragm will be revealed initially (float value from 0f to 1f)
* diaphragm_size - diaphragm diameter (value in dp)
* diaphragm_petals_count - quantity of diaphragm petals (int value from 3 to ...)
* diaphragm_is_shoots_auto - turns on / off the diaphragm's auto-shootting
* diaphragm_auto_shot_delay - delay between autimatic shoots (in milliseconds)

# Demo

![](https://github.com/vladimir-yerokhin-appus/DiaphragmView/blob/master/readme_files/diaphragm_view.gif)

# Getting Started

##Setup:

   Just add dependence to main build.gradle:

        dependencies {
                compile 'pro.appus:diaphragmview:1.2'
        }

##Usage example:

   Just add view into your layout's .xml.

        <pro.appus.diaphragmsample.view.DiaphragmView
        	android:layout_width="wrap_content"
        	android:layout_height="wrap_content"

        	app:diaphragm_background_color="@color/colorAccent"
        	app:diaphragm_border_color="@android:color/white"
        	app:diaphragm_default_opening_value="0.5"
        	app:diaphragm_size="200dp"
        	app:diaphragm_border_width="3"
        	app:diaphragm_petals_count="9"  />

   And also, the DiaphragmView can be controlled from the code:

   * setOpeningValue(float openingValue) - sets diaphragm's opening value, for example, by SeekBar
   * getOpeningValue() - gets current diaphragm's opening value
   * setDiaphragmPetalsCount(int diaphragmPetalsCount) - sets diaphragm's petals number
   * reset() - returns the DiaphragmView to its original state

# Info

## Developed By

[Vladimir Yerokhin](https://github.com/vladimir-yerokhin-appus), Appus Studio

[Alexey Kubas](https://github.com/alexey-kubas-appus), Appus Studio

## License

```
Copyright 2015 Appus Studio.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```


text:
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var stylus = require('stylus');
var nib = require('nib');
var i18n = require('i18n');
//var basicAuth = require('basic-auth-connect');

var routes = require('./routes/index');
var adminDashboard = require('./routes/admin');

// i18n configure
i18n.configure({
  locales: ['ru'],
  defaultLocale: 'ru',
  cookie: 'photolib-yellowfish',
  directory: __dirname + '/locales',
  updateFiles: false
});

var app = express();
app.disable('x-powered-by');

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// app.disable('etag');

app.use(favicon(__dirname + '/public/favicon.png'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));

app.use(cookieParser());
app.use(i18n.init);

function compile(str, path) {
  return stylus(str)
    .set('filename', path)
    .use(nib());
}

app.use(stylus.middleware(
  {
    src: path.join(__dirname, 'public'),
    compile: compile
  }
));

app.use(express.static(path.join(__dirname, 'public')));

app.use('/', routes);

/*app.use(basicAuth(function(user, pass, fn){
 User.authenticate({ user: user, pass: pass }, fn);
 }))*/
app.use('/admin', adminDashboard);

// catch 404 and forward to error handler
app.use(function (req, res) {
  var err = new Error('Not Found');
  err.status = 404;
  res.render('404', {title: res.__("404")});
});

app.use(function (err, req, res, next) {
  err.status = err.status || 500;
  res.status(err.status);

  res.render('error', {
    title: err.status + " " + err.message
  });

});

module.exports = app;


text:
<?php

namespace Mage\Catalog\Test\Block\Product\ProductList;

use Magento\Mtf\Block\Block;

/**
 * Bottom toolbar the product list page.
 */
class BottomToolbar extends Block
{
    /**
     * Selector next active element.
     *
     * @var string
     */
    protected $nextPageSelector = 'li.current + li a';

    /**
     * Go to the next page.
     *
     * @return bool
     */
    public function nextPage()
    {
        $nextPageItem = $this->_rootElement->find($this->nextPageSelector);

        if ($nextPageItem->isVisible()) {
            $nextPageItem->click();
            return true;
        }
        return false;
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var Subject_1 = require("rxjs/Subject");
var TerminalService = (function () {
    function TerminalService() {
        this.commandSource = new Subject_1.Subject();
        this.responseSource = new Subject_1.Subject();
        this.commandHandler = this.commandSource.asObservable();
        this.responseHandler = this.responseSource.asObservable();
    }
    TerminalService.prototype.sendCommand = function (command) {
        if (command) {
            this.commandSource.next(command);
        }
    };
    TerminalService.prototype.sendResponse = function (response) {
        if (response) {
            this.responseSource.next(response);
        }
    };
    return TerminalService;
}());
TerminalService.decorators = [
    { type: core_1.Injectable },
];
/** @nocollapse */
TerminalService.ctorParameters = function () { return []; };
exports.TerminalService = TerminalService;
//# sourceMappingURL=terminalservice.js.map


text:
package com.jivesoftware.os.jive.utils.id;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Preconditions;

/**
 * Represents a tenant in the system.
 */
public class TenantId implements Comparable<TenantId> {
    private final String tenantId;

    @JsonCreator
    public TenantId(String tenantId) {
        Preconditions.checkNotNull(tenantId);
        tenantId = tenantId.trim();
        Preconditions.checkArgument(tenantId.length() > 0);
        this.tenantId = tenantId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        TenantId tenantId = (TenantId) o;
        return this.tenantId.equals(tenantId.tenantId);
    }

    @Override
    public int hashCode() {
        return tenantId != null ? tenantId.hashCode() : 0;
    }

    @JsonValue
    public String toStringForm() {
        return tenantId;
    }

    @Override
    public String toString() {
        return tenantId;
    }

    @Override
    public int compareTo(TenantId o) {
        return this.tenantId.compareTo(o.tenantId);
    }
}


text:
<?php

namespace CondensedQuery\Parser;

class Token extends Procedure
{
	/**
	 * @param String $char
	 * @return String
	 */
	protected function _process()
	{
		switch($this->_char){
			case parent::OP_OB:
				if($this->getFunction()) 	return parent::RESPONSE_NEW;
			default:
				if($this->_token())			return parent::RESPONSE_NEXT;
				else 						return parent::RESPONSE_END;
		}

		throw new Exception('Invalid char!', $this);
	}

	/**
	 * @param Element $function
	 * @return String
	 */
	public function save(Element $function)
	{
		$this->_buffer = $function->flush();
		return parent::RESPONSE_END;
	}

	/**
	 * @return Element
	 */
	public function sub()
	{
		return $this->_function;
	}

	/**
	 * @return Mixed
	 */
	public function flush()
	{
		switch($this->_buffer){
			case parent::VALUE_NULL:	return null;
			case parent::VALUE_TRUE:	return true;
			case parent::VALUE_FALSE:	return false;
			default:
				if(preg_match("/^\d+$/", $this->_buffer)) return (int) $this->_buffer;
				if(preg_match("/^\d+\.{1}\d+$/", $this->_buffer)) return (float) $this->_buffer;
				return $this->_buffer;
		}
	}
}


text:
<?php
namespace LeagueWrap\Dto\StaticData;

use LeagueWrap\Dto\AbstractListDto;

class Block extends AbstractListDto {

	protected $listKey = 'items';

	public function __construct(array $info)
	{
		if (isset($info['items']))
		{
			$items = [];
			foreach ($info['items'] as $key => $item)
			{
				$items[$key] = new BlockItem($item);
			}
			$info['items'] = $items;
		}
		parent::__construct($info);
	}

	public function item($key)
	{
		if ( ! isset($this->info['items'][$key]))
		{
			return null;
		}

		return $this->info['items'][$key];
	}
}


text:
import pexpect
import sys
import re
from getpass import getpass

def main():
    ip = '184.105.247.71'
    username = 'pyclass'
    password = getpass()

    ssh_conn = pexpect.spawn('ssh -l {} {}'.format(username, ip))
    ssh_conn.logfile = sys.stdout
    ssh_conn.timeout = 10
    ssh_conn.expect('ssword:')
    ssh_conn.sendline(password)

    ssh_conn.expect('#')
    ssh_conn.sendline('term len 0')
    ssh_conn.expect('#')
    print 'current value for logging buffered'
    ssh_conn.sendline('sho run | i buffered')
    print ssh_conn.after

    ssh_conn.expect('#')
    ssh_conn.sendline('conf t')
    ssh_conn.expect('#')
    ssh_conn.sendline('logging buffered 99999')
    ssh_conn.expect('#')
    ssh_conn.sendline('end')
    ssh_conn.expect('#')
    print 'new value for logging buffered'
    ssh_conn.sendline('sho run | i buffered')
    ssh_conn.expect('#')
    print ssh_conn.after

if __name__ == "__main__":
    main()


text:
import cherrypy
import jinja2
import time
from datetime import datetime
from jinja2 import Environment, FileSystemLoader
import braubuddy

class API(object):
    """
    Braubuddy API
    """

    @cherrypy.expose
    @cherrypy.tools.json_out()
    def index(self, **kwargs):
        """
        Return recent status data as tuples.
        """
        try:
            since = int(kwargs.get('since', 0))
        except ValueError:
            since = 0
        try:
            before = int(kwargs.get('before', 0))
        except ValueError:
            before = 0
        try:
            limit = int(kwargs.get('limit', 0))
        except ValueError:
            limit = 0
        return braubuddy.RECENT_DATA.get_datapoints(
            since=since, before=before, limit=limit)

    @cherrypy.expose
    def set(self, temp):
        """
        Set target temperature.
        """
        if temp:
            # Set components temp to new temp.
            # TODO: Implement this when auth functionality exists for API.
            pass
        return 'Temperature set to {0}'.format(temp)

class Dashboard(object):
    """
    Braubuddy Dashboard.
    """

    def __init__(self):
        self.j2env = Environment(
            loader=FileSystemLoader(braubuddy.TEMPLATE_DIR))

    @cherrypy.expose
    def index(self):
        '''
        Braubuddy dashboard displaying:
            * current temperature
            * current heat level
            * current cool level
            * target temperature
            * last cycle time
            * hourly temperature chart
            * daily temperature chart
        '''
        template = self.j2env.get_template('braubuddy.html')
        return template.render(
            title=cherrypy.config['dashboard_title'],
            frequency=cherrypy.config['frequency'],
            units=braubuddy.utils.abbreviate_temp_units(
                cherrypy.config['units']),
            show_footer=cherrypy.config['dashboard_footer'],
            year=datetime.now().year,
        )

class Engine(object):
    """
    Braubuddy Engine.
    """

    def cycle(self):
        """
        Perform full thermostat cycle and return state.
        """

        units = cherrypy.config['units']
        retry_count = cherrypy.config['retry_count']
        retry_delay = cherrypy.config['retry_delay']
        envcontroller = cherrypy.config['envcontroller']
        thermometer = cherrypy.config['thermometer']
        thermostat = cherrypy.config['thermostat']
        # Environment input
        current_heat, current_cool = envcontroller.get_power_levels()
        # Temperature input
        for i in range(retry_count):
            try:
                current_temp = thermometer.get_temperature(units=units)
                break
            except braubuddy.thermometer.ReadError as err:
                cherrypy.log.error(err.message)
                time.sleep(retry_delay)
        else:
            cherrypy.request.app.log.error(
                'Unable to collect temperature after {0} '
                'tries'.format(retry_count))
            return False
        # Set power levels
        required_heat, required_cool = thermostat.get_required_state(
            current_temp, current_heat, current_cool, units=units)
        envcontroller.set_heater_level(required_heat)
        envcontroller.set_cooler_level(required_cool)
        # Output
        target = thermostat.target
        for name, output in cherrypy.request.app.config['outputs'].iteritems():
            try:
                output.publish_status(target, current_temp, current_heat,
                                      current_cool)
            except braubuddy.output.OutputError as err:
                cherrypy.log.error(err.message)
        return True


text:
<?php

namespace Frontend\Core\Engine;

/**
 * Twig token parser for form fields.
 */
class SeoFormTokenParser extends \Twig_TokenParser
{
    /**
     * @param \Twig_Token $token consumed token by the lexer.
     *
     * @return \Twig_Node
     * @throws \Twig_Error_Syntax
     */
    public function parse(\Twig_Token $token)
    {
        $stream = $this->parser->getStream();
        if ($stream->getCurrent()->getType() != \Twig_Token::BLOCK_END_TYPE) {
            $error = sprintf("'%s' does not require any arguments.", $this->getTag());
            throw new \Twig_Error_Syntax($error, $token->getLine(), $this->parser->getFilename());
        }
        $stream->expect(\Twig_Token::BLOCK_END_TYPE);

        if (FormState::$current === null) {
            throw new \Twig_Error_Syntax(
                sprintf('Cannot render seo outside a form element'),
                $token->getLine(),
                $this->parser->getFilename()
            );
        }

        return new SeoFormNode(FormState::$current, $token->getLine(), $this->getTag());
    }

    /**
     * @return string
     */
    public function getTag()
    {
        return 'seo';
    }
}


text:
"""
Benchmark scikit-learn's Ward implement compared to SciPy's
"""

import time

import numpy as np
from scipy.cluster import hierarchy
import matplotlib.pyplot as plt

from sklearn.cluster import AgglomerativeClustering

ward = AgglomerativeClustering(n_clusters=3, linkage='ward')

n_samples = np.logspace(.5, 3, 9)
n_features = np.logspace(1, 3.5, 7)
N_samples, N_features = np.meshgrid(n_samples,
                                    n_features)
scikits_time = np.zeros(N_samples.shape)
scipy_time = np.zeros(N_samples.shape)

for i, n in enumerate(n_samples):
    for j, p in enumerate(n_features):
        X = np.random.normal(size=(n, p))
        t0 = time.time()
        ward.fit(X)
        scikits_time[j, i] = time.time() - t0
        t0 = time.time()
        hierarchy.ward(X)
        scipy_time[j, i] = time.time() - t0

ratio = scikits_time / scipy_time

plt.figure("scikit-learn Ward's method benchmark results")
plt.imshow(np.log(ratio), aspect='auto', origin="lower")
plt.colorbar()
plt.contour(ratio, levels=[1, ], colors='k')
plt.yticks(range(len(n_features)), n_features.astype(int))
plt.ylabel('N features')
plt.xticks(range(len(n_samples)), n_samples.astype(int))
plt.xlabel('N samples')
plt.title("Scikit's time, in units of scipy time (log)")
plt.show()


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>net.jahhan</groupId>
		<artifactId>dependency</artifactId>
		<version>2.0.0-SNAPSHOT</version>
	</parent>
	<artifactId>package-frameworkx</artifactId>
	<packaging>pom</packaging>
	<name>${project.artifactId}</name>
	<description>The filter module of dubbo project</description>
	<modules>
		<module>package-frameworkx-base</module>
		<module>package-frameworkx-common</module>
	</modules>
</project>


text:
[Website](http://rubyworks.github.com/richunits) /
[Documentation](http://rubydoc.info/gems/richunits/frames) /
[Report Issue](http://github.com/rubyworks/richunits/issues) /
[Source Code](http://github.com/rubyworks/richunits)

[![Gem Version](https://badge.fury.io/rb/richunits.png)](http://badge.fury.io/rb/richunits)
[![Build Status](https://travis-ci.org/rubyworks/richunits.png)](https://travis-ci.org/rubyworks/richunits)
[![Flattr Me](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund)

## About

RichUnits is simple units system based on Rich Kilmer's original
time.rb script, in which different measures of time are represented
as seconds via extensions to the Numeric class. Later, Ruby on Rails'
ActiveSupport library adopted this script and expanded upon it.
RichUnits borrows from their work and a few other renditions this code
that have made the rounds to create a robust stand-alone version.

Unique to RichUnits' rendition is the Duration class (inspired by Matthew
Harris' version by the same name). Originally time measures were stored as
integers representing seconds. The Duration class instead stores the seconds
as an attribute and adds an optional segements property which can be used to
select exactly how to segment up the time period (years, week, days, etc.).

## Usage

You only need to require 'richunits' and all of RichUnit's functionality
becomes available.

    require 'richunits'

    2.hours  #=> 7200

See RDocs for complete API documentation.

## Development

RichUnits utilizes GitHub for development. You will find the git
repo under the rubyworks account.

    git://github.com/rubyworks/richunits.git

RichUnits utilizes the Syckle build system.

## Copyrights

* Copyright (c) 2008 Rubyworks
* Copyright (c) 2006 Matthew Harris
* Copyright (c) 2004 Rich Kilmer

If you have contributed to this code and feel you deserve mention
in the copyright notice, please let me know. Since this code has
been through a number of hands and other projects (Facets and
ActiveSupport among them) it is hard to identify exactly who is
responsible for what. Nonetheless, Rich Kilmer is the initiator
of the whole idea (AFAIK), so I figure much of the rights belong
to him.

RichUnits is distributed under the terms of the MIT license.

See LICENSE.txt file.


text:
package org.opensplice.common.model.table;

import java.util.ArrayList;

import org.opensplice.cm.Writer;
import org.opensplice.cm.data.State;
import org.opensplice.cm.data.UserData;
import org.opensplice.cmdataadapter.CmDataException;
import org.opensplice.cmdataadapter.TypeInfo;
import org.opensplice.common.CommonException;

public class CoherentSetUserDataTableModel extends CoherentSetAbstractTableModel<UserData> {

    private static final long serialVersionUID = 3044931973241694391L;

    public CoherentSetUserDataTableModel() {
        rows = new ArrayList<DataRowTuple<UserData>>();
    }

    /**
     * Adds the supplied data to the table. It is expected that the Writer has
     * already written the data at this point.
     *
     * @param data
     *            The UserData object that was constructed by a user data
     *            editor. The UserData is adapted, that is, the supplied data
     *            has not been passed through a call to
     *            {@link TypeInfo#adaptDataForWrite(org.opensplice.cmdataadapter.TypeInfo.TypeEvolution, UserData)}
     * @param writeState
     *            The State that the data was written as. State is expected to
     *            be one of WRITE, DISPOSE, REGISTER, UNREGISTER, or (WRITE |
     *            DISPOSE).
     * @param writer
     *            The Writer that was used to write the data.
     * @param typeInfo
     *            The TypeInfo object associated with the Writer's backing data
     *            type. It is used to acquire the type's keys.
     * @throws CommonException
     *             If there was an error while acquired the key fields from the
     *             typeInfo
     */
    public void addData(UserData data, State writeState, Writer writer, TypeInfo typeInfo) throws CommonException {
        rows.add(new DataRowTuple<UserData>(data, writeState, writer));
        if (!keyFieldMap.containsKey(writer)) {
            try {
                String[] keys = typeInfo.getKeys();
                for (int i = 0; i < keys.length; i++) {
                    if (keys[i].startsWith("userData.")) {
                        keys[i] = keys[i].substring(9);
                    }
                }
                keyFieldMap.put(writer, keys);
            } catch (CmDataException e) {
                throw new CommonException(e.getMessage());
            }
        }
        fireTableDataChanged();
    }

    public UserData getData(int rowIndex) {
        return rows.get(rowIndex).data;
    }

    @Override
    public String getColumnName(int index) {
        switch (index) {
        case 0:
            return "Instance";
        case 1:
            return "Write State";
        case 2:
            return "Source Writer";
        default:
            return "";
        }
    }

    @Override
    protected UserData getRowUserData(UserData tupleData) {
        return tupleData;
    }

    @Override
    protected String getStateString(State state) {
        String result = "";
        if (state.getValue() == State.WRITE) {
            result = "WRITE";
        } else if (state.getValue() == State.DISPOSED) {
            result = "DISPOSED";
        } else if (state.getValue() == (State.WRITE | State.DISPOSED)) {
            result = "WRITE DISPOSED";
        } else if (state.getValue() == State.REGISTER) {
            result = "REGISTERED";
        } else if (state.getValue() == State.UNREGISTER) {
            result = "UNREGISTERED";
        }
        return result;
    }
}


text:
@import me.lsbengine.components.html.footer
@import me.lsbengine.components.public.html.head
@()
<!DOCTYPE html>

    @head.render()

Ooops

The requested page does not seem to exist. You can go home. Or stay here, whatever, that's up to you... You do you, but really I would go home if I were you.

    @footer.render()


text:
using System;

namespace LionFire.Triggers
{
    public class Trigger
    {
        public object Condition { get; set; }
        public object Action { get; set; }
        public object Configuration { get; set; }
    }
}


text:
'use strict';

module.exports = {
  root: true,
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
    ecmaFeatures: {
      legacyDecorators: true,
    },
  },
  plugins: ['ember'],
  extends: ['plugin:prettier/recommended', 'eslint:recommended', 'plugin:ember/recommended'],
  env: {
    browser: true,
  },
  rules: {},
  overrides: [
    // node files
    {
      files: [
        '.eslintrc.js',
        '.template-lintrc.js',
        'ember-cli-build.js',
        'testem.js',
        'blueprints/*/index.js',
        'config/**/*.js',
        'lib/*/index.js',
        'server/**/*.js',
      ],
      parserOptions: {
        sourceType: 'script',
      },
      env: {
        browser: false,
        node: true,
      },
      plugins: ['node'],
      extends: ['plugin:node/recommended'],
      rules: {
        // this can be removed once the following is fixed
        // https://github.com/mysticatea/eslint-plugin-node/issues/77
        'node/no-unpublished-require': 'off',
      },
    },
  ],
};


text:
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace ExperimentalTools.Roslyn.Features.AccessModifier.Recipes
{
    internal abstract class TypeRecipe : ITypeRecipe
    {
        private readonly IEnumerable<ITypeActionProvider> actionProviders;

        public TypeRecipe(IEnumerable<ITypeActionProvider> actionProviders)
        {
            this.actionProviders = actionProviders;
        }

        public IEnumerable<CodeAction> Apply(Document document, SyntaxNode root, BaseTypeDeclarationSyntax typeDeclaration)
        {
            var actions = new List<CodeAction>();
            foreach (var provider in actionProviders)
            {
                var action = provider.CalculateAction(document, root, typeDeclaration);
                if (action != null)
                {
                    actions.Add(action);
                }
            }

            return actions;
        }

        public abstract bool CanHandle(BaseTypeDeclarationSyntax typeDeclaration);
    }
}


text:
<?php

namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

class AddConstraintValidatorsPass implements CompilerPassInterface {
	public function process(ContainerBuilder $container) {
		if (!$container->hasDefinition('validator.validator_factory')) {
			return;
		}

		$validators = array();
		foreach ($container->findTaggedServiceIds('validator.constraint_validator') as $id => $attributes) {
			if (isset($attributes[0]['alias'])) {
				$validators[$attributes[0]['alias']] = $id;
			}
		}

		$container->getDefinition('validator.validator_factory')->replaceArgument(1, $validators);
	}
}


text:
using System;
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.Compute.Models
{
    public partial class DiskCreationData : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("createOption");
            writer.WriteStringValue(CreateOption.ToString());
            if (Optional.IsDefined(StorageAccountId))
            {
                writer.WritePropertyName("storageAccountId");
                writer.WriteStringValue(StorageAccountId);
            }
            if (Optional.IsDefined(ImageReference))
            {
                writer.WritePropertyName("imageReference");
                writer.WriteObjectValue(ImageReference);
            }
            if (Optional.IsDefined(GalleryImageReference))
            {
                writer.WritePropertyName("galleryImageReference");
                writer.WriteObjectValue(GalleryImageReference);
            }
            if (Optional.IsDefined(SourceUri))
            {
                writer.WritePropertyName("sourceUri");
                writer.WriteStringValue(SourceUri.AbsoluteUri);
            }
            if (Optional.IsDefined(SourceResourceId))
            {
                writer.WritePropertyName("sourceResourceId");
                writer.WriteStringValue(SourceResourceId);
            }
            if (Optional.IsDefined(UploadSizeBytes))
            {
                writer.WritePropertyName("uploadSizeBytes");
                writer.WriteNumberValue(UploadSizeBytes.Value);
            }
            if (Optional.IsDefined(LogicalSectorSize))
            {
                writer.WritePropertyName("logicalSectorSize");
                writer.WriteNumberValue(LogicalSectorSize.Value);
            }
            if (Optional.IsDefined(SecurityDataUri))
            {
                writer.WritePropertyName("securityDataUri");
                writer.WriteStringValue(SecurityDataUri.AbsoluteUri);
            }
            writer.WriteEndObject();
        }

        internal static DiskCreationData DeserializeDiskCreationData(JsonElement element)
        {
            DiskCreateOption createOption = default;
            Optional<ResourceIdentifier> storageAccountId = default;
            Optional<ImageDiskReference> imageReference = default;
            Optional<ImageDiskReference> galleryImageReference = default;
            Optional<Uri> sourceUri = default;
            Optional<ResourceIdentifier> sourceResourceId = default;
            Optional<string> sourceUniqueId = default;
            Optional<long> uploadSizeBytes = default;
            Optional<int> logicalSectorSize = default;
            Optional<Uri> securityDataUri = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("createOption"))
                {
                    createOption = new DiskCreateOption(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("storageAccountId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageAccountId = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("imageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("galleryImageReference"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
                    continue;
                }
                if (property.NameEquals("sourceUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        sourceUri = null;
                        continue;
                    }
                    sourceUri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("sourceResourceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sourceResourceId = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("sourceUniqueId"))
                {
                    sourceUniqueId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uploadSizeBytes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    uploadSizeBytes = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("logicalSectorSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    logicalSectorSize = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("securityDataUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        securityDataUri = null;
                        continue;
                    }
                    securityDataUri = new Uri(property.Value.GetString());
                    continue;
                }
            }
            return new DiskCreationData(createOption, storageAccountId.Value, imageReference.Value, galleryImageReference.Value, sourceUri.Value, sourceResourceId.Value, sourceUniqueId.Value, Optional.ToNullable(uploadSizeBytes), Optional.ToNullable(logicalSectorSize), securityDataUri.Value);
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycologia 24: 138 (1932)

#### Original name
Puccinia baccharidis-sparteae H.S. Jacks. & Holw.

### Remarks
null


text:
layout: feature
title: 'Animacy'
shortdef: 'animacy'
---

In contrast to some other languages, the Slovenian tagset does not consider `Animacy` to be a lexical feature, as certain types of inanimate nouns, such as institutions, personified objects, brand names etc., often take on both semantic and grammatical features of animate nouns.

Animacy is thus only marked as an inflectional feature of [masculine](Gender) [nouns](NOUN) and [proper nouns](PROPN) to distinguish between animate and inanimate word forms in [accusative](Case) [singular](Number), e.g. _Odstrigla si je koder._ "She cut off a curl." (inanimate) vs. _Videla je kodra._ "She saw a poodle." (animate).

### `Anim`: animate

`Animate` value is attributed to masculine nouns in accusative singular usually ending in -a:

* _človeka_ "man", _delfina_ "dolphin", _Davida_ "David", _ministra_ "minister"

Note that grammatical animatness can also apply to semantically inanimate nouns, such as car names, personified objects, brand names, card names etc.

* _Renaulta_ "Renault", _pomivalca_ "washing machine", _bordojca_ "Bordeaux wine", _asa_ "ace" etc.

### `Inan`: inanimate

`Inanimate` value is attributed to all other masculine nouns in accusative singular:

* _avto_ "car", _fikus_ "ficus", _čevelj_ "shoe"

### Conversion from JOS

All nouns with Animate=yes are converted to `Animacy=Anim` and all nouns with Animate=no are converted to `Animacy=Inan`.


text:
#include <aws/mediaconvert/model/InsertableImage.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace MediaConvert
{
namespace Model
{

InsertableImage::InsertableImage() :
    m_duration(0),
    m_durationHasBeenSet(false),
    m_fadeIn(0),
    m_fadeInHasBeenSet(false),
    m_fadeOut(0),
    m_fadeOutHasBeenSet(false),
    m_height(0),
    m_heightHasBeenSet(false),
    m_imageInserterInputHasBeenSet(false),
    m_imageX(0),
    m_imageXHasBeenSet(false),
    m_imageY(0),
    m_imageYHasBeenSet(false),
    m_layer(0),
    m_layerHasBeenSet(false),
    m_opacity(0),
    m_opacityHasBeenSet(false),
    m_startTimeHasBeenSet(false),
    m_width(0),
    m_widthHasBeenSet(false)
{
}

InsertableImage::InsertableImage(JsonView jsonValue) :
    m_duration(0),
    m_durationHasBeenSet(false),
    m_fadeIn(0),
    m_fadeInHasBeenSet(false),
    m_fadeOut(0),
    m_fadeOutHasBeenSet(false),
    m_height(0),
    m_heightHasBeenSet(false),
    m_imageInserterInputHasBeenSet(false),
    m_imageX(0),
    m_imageXHasBeenSet(false),
    m_imageY(0),
    m_imageYHasBeenSet(false),
    m_layer(0),
    m_layerHasBeenSet(false),
    m_opacity(0),
    m_opacityHasBeenSet(false),
    m_startTimeHasBeenSet(false),
    m_width(0),
    m_widthHasBeenSet(false)
{
  *this = jsonValue;
}

InsertableImage& InsertableImage::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("duration"))
  {
    m_duration = jsonValue.GetInteger("duration");

    m_durationHasBeenSet = true;
  }

  if(jsonValue.ValueExists("fadeIn"))
  {
    m_fadeIn = jsonValue.GetInteger("fadeIn");

    m_fadeInHasBeenSet = true;
  }

  if(jsonValue.ValueExists("fadeOut"))
  {
    m_fadeOut = jsonValue.GetInteger("fadeOut");

    m_fadeOutHasBeenSet = true;
  }

  if(jsonValue.ValueExists("height"))
  {
    m_height = jsonValue.GetInteger("height");

    m_heightHasBeenSet = true;
  }

  if(jsonValue.ValueExists("imageInserterInput"))
  {
    m_imageInserterInput = jsonValue.GetString("imageInserterInput");

    m_imageInserterInputHasBeenSet = true;
  }

  if(jsonValue.ValueExists("imageX"))
  {
    m_imageX = jsonValue.GetInteger("imageX");

    m_imageXHasBeenSet = true;
  }

  if(jsonValue.ValueExists("imageY"))
  {
    m_imageY = jsonValue.GetInteger("imageY");

    m_imageYHasBeenSet = true;
  }

  if(jsonValue.ValueExists("layer"))
  {
    m_layer = jsonValue.GetInteger("layer");

    m_layerHasBeenSet = true;
  }

  if(jsonValue.ValueExists("opacity"))
  {
    m_opacity = jsonValue.GetInteger("opacity");

    m_opacityHasBeenSet = true;
  }

  if(jsonValue.ValueExists("startTime"))
  {
    m_startTime = jsonValue.GetString("startTime");

    m_startTimeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("width"))
  {
    m_width = jsonValue.GetInteger("width");

    m_widthHasBeenSet = true;
  }

  return *this;
}

JsonValue InsertableImage::Jsonize() const
{
  JsonValue payload;

  if(m_durationHasBeenSet)
  {
   payload.WithInteger("duration", m_duration);

  }

  if(m_fadeInHasBeenSet)
  {
   payload.WithInteger("fadeIn", m_fadeIn);

  }

  if(m_fadeOutHasBeenSet)
  {
   payload.WithInteger("fadeOut", m_fadeOut);

  }

  if(m_heightHasBeenSet)
  {
   payload.WithInteger("height", m_height);

  }

  if(m_imageInserterInputHasBeenSet)
  {
   payload.WithString("imageInserterInput", m_imageInserterInput);

  }

  if(m_imageXHasBeenSet)
  {
   payload.WithInteger("imageX", m_imageX);

  }

  if(m_imageYHasBeenSet)
  {
   payload.WithInteger("imageY", m_imageY);

  }

  if(m_layerHasBeenSet)
  {
   payload.WithInteger("layer", m_layer);

  }

  if(m_opacityHasBeenSet)
  {
   payload.WithInteger("opacity", m_opacity);

  }

  if(m_startTimeHasBeenSet)
  {
   payload.WithString("startTime", m_startTime);

  }

  if(m_widthHasBeenSet)
  {
   payload.WithInteger("width", m_width);

  }

  return payload;
}

} // namespace Model
} // namespace MediaConvert
} // namespace Aws


text:
// Copyright (c) 2012 Ecma International.  All rights reserved.
// Ecma International makes this code available under the terms and conditions set
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
// "Use Terms").   Any redistribution of this code must retain the above
// copyright and this notice and otherwise comply with the Use Terms.

/*---
es5id: 15.4.4.19-9-8
description: >
    Array.prototype.map - empty array to be returned if 'length' is 0
    (subclassed Array, length overridden to 0 (type conversion))
includes: [runTestCase.js]
---*/

function testcase() {

        var accessed = false;

        function callbackfn(val, idx, obj) {
            accessed = true;
            return val > 10;
        }

        var Foo = function () { };
        Foo.prototype = [1, 2, 3];
        var obj = new Foo();
        obj.length = 0;

        var testResult = Array.prototype.map.call(obj, callbackfn);
        return testResult.length === 0;

    }
runTestCase(testcase);


text:
//
//  SMS_SDK.h
//  SMS_SDKDemo
//
//  Created by 刘 靖煌 on 14-8-28.
//  Copyright (c) 2014年 掌淘科技. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "SMSSDKResultHanderDef.h"
#import "SMSSDKUserInfo.h"
#import <MessageUI/MessageUI.h>

/**
 * @brief 核心类(Core class)v1.2.0
 */
@interface SMSSDK : NSObject <MFMessageComposeViewControllerDelegate>

/**
 *  初始化应用,此方法在应用启动时在主线程中调用。(This method is called in the main thread in application:didFinishLaunchingWithOptions: method)
 *
 *  @param appKey    在Mob官网(http://mob.com/ )中注册的应用Key。(The appKey of mob Application. Log in to http://mob.com/ to register to be a Mob developer and create a application if you don't have one)
 *  @param appSecret 在Mob官网(http://mob.com/ )中注册的应用秘钥。(The appSecret of mob Application. Log in to http://mob.com/ to register to be a Mob developer and create a application if you don't have one)
 */
+(void)registerApp:(NSString*)appKey withSecret:(NSString*)appSecret;

#pragma mark - 支持获取验证码和提交验证码 (get the verification code and commit verifacation code)
/**
 *  @from                    v1.1.1
 *  @brief                   获取验证码(Get verification code by SMS)
 *
 *  @param method            获取验证码的方法(The method of getting verificationCode)
 *  @param phoneNumber       电话号码(The phone number)
 *  @param zone              区域号,不要加"+"号(Area code)
 *  @param customIdentifier  自定义短信模板标识 该标识需从官网http://www.mob.com上申请,审核通过后获得。(Custom model of SMS.  The identifier can get it  from http://www.mob.com  when the application had approved)
 *  @param result            请求结果回调(Results of the request)
 */
+(void)getVerificationCodeByMethod:(SMSGetCodeMethod)method
                       phoneNumber:(NSString *)phoneNumber
                              zone:(NSString *)zone
                  customIdentifier:(NSString *)customIdentifier
                            result:(SMSGetCodeResultHandler)result;

/**
 * @from               v1.1.1
 * @brief              提交验证码(Commit the verification code)
 *
 * @param code         验证码(Verification code)
 * @param phoneNumber  电话号码(The phone number)
 * @param zone         区域号,不要加"+"号(Area code)
 * @param result       请求结果回调(Results of the request)
 */
+(void)commitVerificationCode:(NSString *)code
                  phoneNumber:(NSString *)phoneNumber
                         zone:(NSString *)zone
                       result:(SMSCommitCodeResultHandler)result;

@end


text:
package roundaboutSimulator.ui;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.JFrame;
import javax.swing.Timer;

public class RenderWindow extends JFrame
{

	private static final long	serialVersionUID	= -203061943978917754L;

	private RenderLayout		grid;
	private Timer				timer;
	public static final int		FPS					= 20;
	private int					timeFactor			= 1;
	private int					loopCount			= 0;

	/**
	 * Default constructor
	 */
	public RenderWindow()
	{
		// Window properties
		setTitle("Roundabout Simulator");
		setMinimumSize(new Dimension(400, 400));
		setSize(new Dimension(600, 600));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLocationRelativeTo(null);

		grid = new RenderLayout(this);
		this.setLayout(grid);

		addComponentListener(new ComponentAdapter()
		{
			@Override
			public void componentResized(ComponentEvent e)
			{
				if (e.getID() == ComponentEvent.COMPONENT_RESIZED)
				{
					grid.pause(true);
				}
			}
		});

		timer = new Timer(1000 / timeFactor / FPS, new ActionListener()
		{
			@Override
			public void actionPerformed(ActionEvent e)
			{
				if (getLoopCount() % timeFactor == 0)
				{
					grid.refresh();
				}
				grid.calculate();
				loopCount++;
			}
		});

		setVisible(true);

	}// Constructor (default)

	/**
	 * Starts the timer
	 */
	public void start()
	{
		timer.start();
	}

	/**
	 * Stops the timer
	 */
	public void stop()
	{
		timer.stop();
	}

	/**
	 * Activate/Deactivate Super Speed
	 *
	 * @param true to activate SuperSpeed, false to deactivate
	 */
	public void setSuperSpeed(boolean arg)
	{
		if (arg)
			timeFactor = 10;
		else
			timeFactor = 1;
		timer.setDelay(1000 / timeFactor / FPS);
	}

	public int getLoopCount()
	{
		return loopCount;
	}

}// class RenderWindow


text:
;(function($n2){
	"use strict";
	var stringFromCharCode = String.fromCharCode;

	// Taken from https://mths.be/punycode
	function ucs2decode(string) {
		var output = [];
		var counter = 0;
		var length = string.length;
		var value;
		var extra;
		while (counter < length) {
			value = string.charCodeAt(counter++);
			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
				// high surrogate, and there is a next character
				extra = string.charCodeAt(counter++);
				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
				} else {
					// unmatched surrogate; only append this code unit, in case the next
					// code unit is the high surrogate of a surrogate pair
					output.push(value);
					counter--;
				}
			} else {
				output.push(value);
			}
		}
		return output;
	}

	function createByte(codePoint, shift) {
		return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
	}

	function encodeCodePoint(codePoint) {
		if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
			return stringFromCharCode(codePoint);
		}
		var symbol = '';
		if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
			symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
		}
		else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
			symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
			symbol += createByte(codePoint, 6);
		}
		else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
			symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
			symbol += createByte(codePoint, 12);
			symbol += createByte(codePoint, 6);
		}
		symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
		return symbol;
	}

	function utf8encode(string) {
		var codePoints = ucs2decode(string);
		var length = codePoints.length;
		var index = -1;
		var codePoint;
		var byteString = '';
		while (++index < length) {
			codePoint = codePoints[index];
			byteString += encodeCodePoint(codePoint);
		}
		return byteString;
	}

	/*--------------------------------------------------------------------------*/
	// Taken from https://mths.be/punycode

	/**
	* UTF-8 Decoder is not currently used anywhere in Nunaliit, but left in commented out in case of future need.
	*/

	//   function ucs2encode(array) {
	//         var length = array.length;
	//         var index = -1;
	//         var value;
	//         var output = '';
	//         while (++index < length) {
	//                 value = array[index];
	//                 if (value > 0xFFFF) {
	//                         value -= 0x10000;
	//                         output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
	//                         value = 0xDC00 | value & 0x3FF;
	//                 }
	//                 output += stringFromCharCode(value);
	//         }
	//         return output;
	// }

	//   function readContinuationByte() {
	//           if (byteIndex >= byteCount) {
	//                   throw Error('Invalid byte index');
	//           }

	//           var continuationByte = byteArray[byteIndex] & 0xFF;
	//           byteIndex++;

	//           if ((continuationByte & 0xC0) == 0x80) {
	//                   return continuationByte & 0x3F;
	//           }

	//           // If we end up here, it's not a continuation byte
	//           throw Error('Invalid continuation byte');
	//   }

	//   function decodeSymbol() {
	//           var byte1;
	//           var byte2;
	//           var byte3;
	//           var byte4;
	//           var codePoint;

	//           if (byteIndex > byteCount) {
	//                   throw Error('Invalid byte index');
	//           }

	//           if (byteIndex == byteCount) {
	//                   return false;
	//           }

	//           // Read first byte
	//           byte1 = byteArray[byteIndex] & 0xFF;
	//           byteIndex++;

	//           // 1-byte sequence (no continuation bytes)
	//           if ((byte1 & 0x80) == 0) {
	//                   return byte1;
	//           }

	//           // 2-byte sequence
	//           if ((byte1 & 0xE0) == 0xC0) {
	//                   var byte2 = readContinuationByte();
	//                   codePoint = ((byte1 & 0x1F) << 6) | byte2;
	//                   if (codePoint >= 0x80) {
	//                           return codePoint;
	//                   } else {
	//                           throw Error('Invalid continuation byte');
	//                   }
	//           }

	//           // 3-byte sequence (may include unpaired surrogates)
	//           if ((byte1 & 0xF0) == 0xE0) {
	//                   byte2 = readContinuationByte();
	//                   byte3 = readContinuationByte();
	//                   codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
	//                   if (codePoint >= 0x0800) {
	//                           return codePoint;
	//                   } else {
	//                           throw Error('Invalid continuation byte');
	//                   }
	//           }

	//           // 4-byte sequence
	//           if ((byte1 & 0xF8) == 0xF0) {
	//                   byte2 = readContinuationByte();
	//                   byte3 = readContinuationByte();
	//                   byte4 = readContinuationByte();
	//                   codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
	//                           (byte3 << 0x06) | byte4;
	//                   if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
	//                           return codePoint;
	//                   }
	//           }

	//           throw Error('Invalid UTF-8 detected');
	//   }

	//   var byteArray;
	//   var byteCount;
	//   var byteIndex;
	//   function utf8decode(byteString) {
	//           byteArray = ucs2decode(byteString);
	//           byteCount = byteArray.length;
	//           byteIndex = 0;
	//           var codePoints = [];
	//           var tmp;
	//           while ((tmp = decodeSymbol()) !== false) {
	//                   codePoints.push(tmp);
	//           }
	//           return ucs2encode(codePoints);
	//   }

	$n2.Base64 = {

		encodeMultibyte: function(input) {
			var utf8encodedInput = utf8encode(input);
			return btoa(utf8encodedInput);
		}
		//       Decoder is not currently used, but left in commented out in case of future need.
		//       ,decodeMultibyte : function(input) {
		//         var output = atob(input)
		//         var utf8decodedOutput = utf8decode(output);
		//         return utf8decodedOutput;
		//       }
		,encode: function(input) {
			return btoa(input);
		}

		,decode : function(input) {
			return atob(input);
		}
	};

})(nunaliit2);