text:
/**
 * @fileoverview Tests for no-dupe-keys rule.
 * @author Ian Christian Myers
 */

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

var vows = require("vows"),
    assert = require("assert"),
    eslint = require("../../../lib/eslint");

//------------------------------------------------------------------------------
// Constants
//------------------------------------------------------------------------------

var RULE_ID = "no-dupe-keys";

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

vows.describe(RULE_ID).addBatch({

    "when evaluating 'var x = { y: 1, y: 2 };'": {

        topic: "var x = { y: 1, y: 2 };",

        "should report a violation": function(topic) {
            var config = { rules: {} };
            config.rules[RULE_ID] = 1;

            var messages = eslint.verify(topic, config);

            assert.equal(messages.length, 1);
            assert.equal(messages[0].ruleId, RULE_ID);
            assert.equal(messages[0].message, "Duplicate key 'y'.");
            assert.include(messages[0].node.type, "ObjectExpression");
        }
    },

    "when evaluating 'var foo = { 0x1: 1, 1: 2};'": {

        topic: "var foo = { 0x1: 1, 1: 2};",

        "should report a violation": function(topic) {
            var config = { rules: {} };
            config.rules[RULE_ID] = 1;

            var messages = eslint.verify(topic, config);

            assert.equal(messages.length, 1);
            assert.equal(messages[0].ruleId, RULE_ID);
            assert.equal(messages[0].message, "Duplicate key '1'.");
            assert.include(messages[0].node.type, "ObjectExpression");
        }
    },

    "when evaluating 'var foo = { __proto__: 1, two: 2};'": {

        topic: "var foo = { __proto__: 1, two: 2};",

        "should report a violation": function(topic) {
            var config = { rules: {} };
            config.rules[RULE_ID] = 1;

            var messages = eslint.verify(topic, config);

            assert.equal(messages.length, 0);
        }
    },

    "when evaluating 'var x = { \"z\": 1, z: 2 };'": {

        topic: "var x = { \"z\": 1, z: 2 };",

        "should report a violation": function(topic) {
            var config = { rules: {} };
            config.rules[RULE_ID] = 1;

            var messages = eslint.verify(topic, config);

            assert.equal(messages.length, 1);
            assert.equal(messages[0].ruleId, RULE_ID);
            assert.equal(messages[0].message, "Duplicate key 'z'.");
            assert.include(messages[0].node.type, "ObjectExpression");
        }
    },

    "when evaluating 'var x = { foo: 1, bar: 2 };'": {

        topic: "var x = { foo: 1, bar: 2 };",

        "should not report a violation": function(topic) {
            var config = { rules: {} };
            config.rules[RULE_ID] = 1;

            var messages = eslint.verify(topic, config);

            assert.equal(messages.length, 0);
        }
    }

}).export(module);


text:
<?php
if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

return array(
	'name' => 'WP ' . esc_html__( 'Pages' ),
	'base' => 'vc_wp_pages',
	'icon' => 'icon-wpb-wp',
	'category' => esc_html__( 'WordPress Widgets', 'js_composer' ),
	'class' => 'wpb_vc_wp_widget',
	'weight' => - 50,
	'description' => esc_html__( 'Your sites WordPress Pages', 'js_composer' ),
	'params' => array(
		array(
			'type' => 'textfield',
			'heading' => esc_html__( 'Widget title', 'js_composer' ),
			'param_name' => 'title',
			'description' => esc_html__( 'What text use as a widget title. Leave blank to use default widget title.', 'js_composer' ),
			'value' => esc_html__( 'Pages' ),
		),
		array(
			'type' => 'dropdown',
			'heading' => esc_html__( 'Order by', 'js_composer' ),
			'param_name' => 'sortby',
			'value' => array(
				esc_html__( 'Page title', 'js_composer' ) => 'post_title',
				esc_html__( 'Page order', 'js_composer' ) => 'menu_order',
				esc_html__( 'Page ID', 'js_composer' ) => 'ID',
			),
			'description' => esc_html__( 'Select how to sort pages.', 'js_composer' ),
			'admin_label' => true,
		),
		array(
			'type' => 'textfield',
			'heading' => esc_html__( 'Exclude', 'js_composer' ),
			'param_name' => 'exclude',
			'description' => esc_html__( 'Enter page IDs to be excluded (Note: separate values by commas (,)).', 'js_composer' ),
			'admin_label' => true,
		),
		array(
			'type' => 'el_id',
			'heading' => esc_html__( 'Element ID', 'js_composer' ),
			'param_name' => 'el_id',
			'description' => sprintf( esc_html__( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'js_composer' ), '', '' ),
		),
		array(
			'type' => 'textfield',
			'heading' => esc_html__( 'Extra class name', 'js_composer' ),
			'param_name' => 'el_class',
			'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
		),
	),
);

redpajama_set_name: RedPajamaGithub


text:
@interface BouncingView : FCBBouncingView

@property (nonatomic, strong) UIImage *image;

@end


text:
using JustLogic.Core;
using System.Collections.Generic;
using UnityEngine;

[UnitMenu("Vectors/Get/Get Down (Vector3)")]
[UnitFriendlyName("Get Down")]
[UnitUsage(typeof(Vector3), HideExpressionInActionsList = true)]
public class JLVector3GetDown : JLExpression
{
    public override object GetAnyResult(IExecutionContext context)
    {
        return Vector3.down;
    }
}


text:
require 'digest/md5'
require 'digest/sha1'
require 'ostruct'

DEFAULT_ADAPTER = RUBY_PLATFORM == 'java' ? 'rjgit_adapter' : 'rugged_adapter'

if defined?(Gollum::GIT_ADAPTER)
  require "#{Gollum::GIT_ADAPTER.downcase}_adapter"
else
  require DEFAULT_ADAPTER
end

# external
require 'github/markup'
require 'sanitize'

# internal
require File.expand_path('../gollum-lib/git_access', __FILE__)
require File.expand_path('../gollum-lib/hook', __FILE__)
require File.expand_path('../gollum-lib/committer', __FILE__)
require File.expand_path('../gollum-lib/pagination', __FILE__)
require File.expand_path('../gollum-lib/blob_entry', __FILE__)
require File.expand_path('../gollum-lib/wiki', __FILE__)
require File.expand_path('../gollum-lib/page', __FILE__)
require File.expand_path('../gollum-lib/macro', __FILE__)
require File.expand_path('../gollum-lib/file', __FILE__)
require File.expand_path('../gollum-lib/file_view', __FILE__)
require File.expand_path('../gollum-lib/markup', __FILE__)
require File.expand_path('../gollum-lib/markups', __FILE__)
require File.expand_path('../gollum-lib/sanitization', __FILE__)
require File.expand_path('../gollum-lib/filter', __FILE__)

# Set ruby to UTF-8 mode
# This is required for Ruby 1.8.7 which gollum still supports.
$KCODE = 'U' if RUBY_VERSION[0, 3] == '1.8'

module Gollum

  def self.assets_path
    ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
  end

  class Error < StandardError; end

  class DuplicatePageError < Error
    attr_accessor :dir
    attr_accessor :existing_path
    attr_accessor :attempted_path

    def initialize(dir, existing, attempted, message = nil)
      @dir            = dir
      @existing_path  = existing
      @attempted_path = attempted
      super(message || "Cannot write #{@dir}/#{@attempted_path}, found #{@dir}/#{@existing_path}.")
    end
  end

  class InvalidGitRepositoryError < StandardError; end
  class NoSuchPathError < StandardError; end

end


text:
/* This file is part of execve-v strace test. */
#define VERBOSE 1
#include "execve.c"


text:
package org.apache.ode.bpel.extensions.comm.messages.engineIn;

import javax.xml.namespace.QName;

public class Fault_To_Scope extends IncomingMessageBase {

	private static final long serialVersionUID = 4774771L;

	private Long processID;

	private Long scopeID;

	private QName faultName;

	private QName elementType;

	private QName messageType;

	private String faultMsg;

	public Fault_To_Scope() {
		super();
	}

	public Long getProcessID() {
		return processID;
	}

	public Long getScopeID() {
		return scopeID;
	}

	public QName getFaultName() {
		return faultName;
	}

	public QName getElementType() {
		return elementType;
	}

	public QName getMessageType() {
		return messageType;
	}

	public String getFaultMsg() {
		return faultMsg;
	}

	public void setProcessID(Long processID) {
		this.processID = processID;
	}

	public void setScopeID(Long scopeID) {
		this.scopeID = scopeID;
	}

	public void setFaultName(QName faultName) {
		this.faultName = faultName;
	}

	public void setElementType(QName elementType) {
		this.elementType = elementType;
	}

	public void setMessageType(QName messageType) {
		this.messageType = messageType;
	}

	public void setFaultMsg(String faultMsg) {
		this.faultMsg = faultMsg;
	}

}


text:
def set_nodes(nodes):
def restore_nodes():
class QemuWinDriver(driver.ComputeDriver):
    __init__:
    init_host: => Not Implemented
    list_instances: => Test with multiple instances, Test after removing instances, Test with no instances
    plug_vifs:=> Not Implemented
    unplug_vifs:=> Not Implemented
    disk_cachemode:=>Test if it calls "_supports_direct_io(CONF.instances_path)"
    _supports_direct_io:=>Test with empty dirpath, Test with confusing dirpaths(aka: paths that can also be interpreted as commands. Test different system responses
    getEl:=>Test if it calls "dom.getElementsByTagName", Test a empty list at return
    getEls:=>Test if it calls "dom.getElementsByTagName"
    getText:=>Test if it calls "dom.getElementsByTagName", Test a empty list at return
    qemuCommandNew:=>Check the return for both  CONF.qemu_home == None and CONF.qemu_home != None
    qemuCommandAddArg:=>Check if the appends are called
    qemuCommandStr:=>Test for Empty string
    _create_qemu_machine:=>Are we sure we have permission to write on the instances directory? If not, test that. Does entry.ChildNodes is guaranteed to always have at least one member? If not test when it is empty
    _start_metadata_proxy:=> Can we be sure that  the correct version of Python will be avaliable to the driver with a simple "python" command| the user has set the python_path on configuration? If not, test it
     -Add a comment about the nova_metadata_shared_secret on the installation page
    _create_instance_metadata_file:=>Test writing permission on the instances dir, Test with a non-existing dir.
    _check_machine_started:
    start_qemu_instance:
    _next_vnc_display:
    spawn:=> Test if create image is being called, test if to_xml is being called, check the contents of socket_locks after the opperation, check if start_qemu_instance is called, see if _wait_for_qmp is called
    _wait_for_qmp:=> mock different numbers of tries until the return of a power_state.RUNNING result
    _get_console_log_path:=> check if libvirt_utils.get_instance_path is called with the correct parameter, test the return
     _get_disk_config_path:=>  check if libvirt_utils.get_instance_path is called with the correct parameter, test the return
     _chown_console_log_for_instance:=> Test with no permission to the instance dir
     _chown_disk_config_for_instance:=> Test with no permission to the instance dir
    _create_local:=> Test with and without a fs_format. See if the correct methods are called
    _create_ephemeral:=> See if create_local and disk.mkfs are called with the correct parameters Max_size parameter seems dead
    _get_host_state:=> Test no permission to the instance path, check return vallues (maybe mock json return)
    _create_host_state_file:=> Test no permission on the instance path
    _get_host_arch: see if platform.architecture is correctly called, check return for both architectures
    _create_host_uuid: Test return value
    get_host_capabilities(self): Test how it handles exceptions from it's called methods
    There's a TODO there, is it still relevant? Do We want to set the host CPU as always appearing as a Intel? There is some way to find out the host-model on windows? Or does this information is irrelevant?
    get_host_uuid: Test if get_host_capabilities is called
    get_host_cpu_for_guest: Check how it handles exception from it's called methods Is any of the information faked on the drive relevant? (CPU vendor, host-model and guestcpu.match)
    get_guest_cpu_config:=> Test for all valid and some invalid modes and models
    get_hypervisor_type:=> Check return type.
    get_hypervisor_version:=> Check return type
    set_cache_mode: =>check if the correct value of the variable is set
    get_guest_disk_config: => Check if  libvirt_info is called with the correct parameters
    get_guest_storage_config: =>Check if get_guest_disk_configuration is called with the correct parameters, check the return content
    get_guest_config_sysinfo:=>Check the return content
    get_guest_pci_device:=> Check if the parse_address is called with the correct parameters, check the contents of the return for a "real" usage
    get_guest_config:=> Check if instance_type_get is getting called with the correct parameters, check if inst_path is correct, check no permission to access the instance directory, Check return content.
    Can't this method be refactored? It's 175 lines long.
    get_guest_pci_device:=> Check return content
    to_xml:=> Check no permission on the instances directory, check file content against the return
    _create_image:=> Test for writing permission on image directory,
    basepath:=>
    image:=> test if image_backend.image is correctly called
    raw:=> check content of return
    live_snapshot:=>Check both a existing and an inexisting instance, check task state after the function has been called.
    snapshot:=> Check both a existing and an inexisting instance, check task state after the function has been called.
    Is there any difference between this function and the one above? They have the same parameter and code
    _get_ephemeral_port: => Check if _get_available_port is correctly called
    _get_available_port:=>   Simulate no avaliable ports on that range
    _get_qmp_connection:=> test for presence or ausence of sockets in the list, test for a busy qmp port
    _read_qmp_output:=> Check the different types the return message can be (including or not 'event' and 'return')
    _recv_qmp_output:=> test data bigger and smaller than 8192 bytes, and no data.
    _negotiate_qmp_caps:=> test for no connection and busy socket
    _run_qmp_command:=> test losing the connection during a transaction
    _get_qmp_instance_status(self, instance):=> Check the diferent combination of Expected and current statuses
    reboot: => see if it calls _run_qmp_command with the correct parameters
    get_host_ip_addr:=> check response if this attribute is not present on conf
    set_admin_password: Pass
    inject_file: Pass
    resume_state_on_host_boot: Pass
    rescue: Pass
    unrescue: Pass
    poll_rebooting_instances: Pass
    migrate_disk_and_power_off: Pass
    finish_revert_migration: Pass
    post_live_migration_at_destination: Pass
    power_off:=> Test for sucessful and unsucessful power off
    power_on:=> check if popen is being correctly called, check the content of the metata variable
    soft_delete: Pass
    restore: Pass
    pause:=> Check if run_qmp_command uses the correct parameters
    unpause:=> Check if run_qmp_command uses the correct parameters
    suspend:=> Check if run_qmp_command uses the correct parameters
    resume:=> Check if run_qmp_command uses the correct parameters
    _get_instance_metadata:=> Check no access to instances dir, nonexisting metadata file
    destroy:=> check if the _kill method is called the correct number of times and with the correct parameters, check no permission on instance dir
    _kill:=> check the parameters of the subproccess call
    _execute_iscsi_command:=> check the parameters of the subproccess call, find ways in which popen may fail.
    _list_targets:=> check different return for the iscsi command call, and check against the final value of target_list
    _add_target_portal:=> Check if _execute_iscsi_command is being called with the correct parameters
    Why there's an attribution on this method? Is some python iscsi exclusive thing?
    _login_target:=>Check if _execute_iscsi_command is being called with the correct parameters
    Why there's an attribution on this method? Is some python iscsi exclusive thing?
    _logout_targe:=>Check if _execute_iscsi_command is being called with the correct parameters
    Why there's an attribution on this method? Is some python iscsi exclusive thing?
    _connected_targets:=> Empty return on _execute_iscsi_command, test various combinations of connected targets
    _get_physical_drive:=> Empty return on _execute_iscsi_command, check valid and invalid target names and device types
    _get_iscsi_session_id:=> Check if _execute_iscsi_command is being called with the correct parameters, check empty return on _execute_iscsi_command
    _get_initiator_name:=> Check if _execute_iscsi_command is being called with the correct parameters, test both possible returns
    _run_qmp_human_monitor_command:=> Check if _run_qmp_command is being called with the correct parameters
    _attach_volume:=> Test connection_info defective, test different responses for
get_physical_drive, test what happens once _get_instance_metadata fails, test what are the parameters which whom  _run_qmp_human_monitor_command is being called, test for both a valid and a invalid result in _check_qmp_result, check for failures in _create_instance_metadata_file
    _check_qmp_result:=>
    attach_volume:=>Why is this necessary?
    detach_volume:=> Empty Metadata, metadata not containing "iscsi_devices", no members on "iscsi_devices", connection_info lacking information, check if, with correct information run qmp command is called, and if with incorrrect information it is not called
    swap_volume:=> test for sucessful and failed calls of atach and detach
    attach_interface:=>Pass
    detach_interface:=>Pass
    _get_power_state:=> Test for a empty return on _get_qmp_instance_status, test for each possible return and for a faked non-existing return
    _instance_exists:=> test for and empty list_of_instances
    get_info:=> test for a not existing instance, test failure at get_instance_metadata, test for empty metadata, test for empty result_cpus
    _get_value:=> test for an empty entry
    get_diagnostics:=> Test for non-existing instances, test for empty result on qmp command call, test return for a mocked response on run qmp human monitor command
    get_all_bw_counters:=> The information here is so faked i'm not sure why we bothered with it
    interface_stats: Same as above
    _get_xml_desc:=> Test for unexisting file, test for no permission on dir
    get_console_output: =>Test for and non-existing file-path, test for no permission on the dir, check content of return
    get_vnc_console: => test for empty metadata, no vnc_proxyclient_address on configuration
    get_spice_console:=> Returns faked information
    get_console_pool_info:=> Returns faked information
    refresh_security_group_rules: => Returns faked information
    refresh_security_group_members:=> Returns faked information
    refresh_instance_security_rules:=> Returns faked information
    refresh_provider_fw_rules:=>Pass
    _get_host_disk_space:=> Test if GetDiskFreeSpaceExw is called with the correct arguments
    _get_host_disk_total:=> see if the return of _get_host_disk_space can be nulled, and if it is, test that
    _get_host_disk_free:=> see if the return of _get_host_disk_space can be nulled, and if it is, test that
    _get_host_disk_used:=> see if the return of _get_host_disk_space can be nulled, and if it is, test that
    _get_host_ram:=> Test if GlobalMemoryStatus is called with the correct arguments
    _get_host_free_ram: Rename the variable used on the for, => check if Win32_OperatingSystem is called
    _get_host_total_ram: Rename the variable used on the for, => check if Win32_OperatingSystem is called
    _get_host_used_ram: See if it can return a negative number
    get_available_resource: test return for some mocked information
    ensure_filtering_rules_for_instance:=> Returns None
    get_instance_disk_info:=> Returns None
    live_migration:=> Returns None, check if post_method is called with the correct parameters
    check_can_live_migrate_destination_cleanup:=> Returns None
    check_can_live_migrate_destination:=> Returns faked information
    check_can_live_migrate_source:=> Returns None
    finish_migration:=> Returns None
    confirm_migration:=> Returns None
    pre_live_migration:=> Returns None
    unfilter_instance:=> Returns None
    get_host_stats:=> Test for no Nodes, test for some nodes, test for empty host status Correct the error message (no node => no nodes)
    host_power_action:=> Does Nothing
    host_maintenance_mode:=> Test for mode==None and a mocked mode
    set_host_enabled:=> Test for enable==True and enable==False
    get_disk_available_least:=>Test for no instances, test for no permission on the instances dir, test returned information
    add_to_aggregate:=> Pass
    remove_from_aggregate:=> Pass
    get_volume_connector:=> Test for no information on ip or host on CONF, test for empty initiator name, test return content
    get_available_nodes:=> Check returned info
    instance_on_disk:=> Test for permission on the instance dir
    list_instance_uuids:=> Check content of return


text:
namespace Cartogram
{
    public class Experience
    {
        public int Level { get; set; }
        public int Percentage { get; set; }
        public long CurrentExperience { get; set; }
        public long NextLevelExperience { get; set; }
    }
}


text:
namespace PokerTests
{
    using System;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Poker;

    [TestClass]
    public class TestCard
    {
        [TestMethod]
        public void TestCreatingNormalCardFace()
        {
            var card = new Card(CardFace.Ace, CardSuit.Diamonds);

            Assert.AreEqual(true, card.Face == CardFace.Ace, "Card face is not setting right");
        }

        [TestMethod]
        public void TestCreatingNormalCardSuit()
        {
            var card = new Card(CardFace.Ace, CardSuit.Diamonds);

            Assert.AreEqual(true, card.Suit == CardSuit.Diamonds, "Card suit is not setting right");
        }

        [TestMethod]
        public void TestToStringMethod()
        {
            var card = new Card(CardFace.Ace, CardSuit.Spades);

            var expected = "A" + '\x06'; //♠

            Assert.AreEqual(0, String.Compare(card.ToString(), expected), "Card to string is not setting right");
        }

        [TestMethod]
        public void TestToStringMethod2()
        {
            var card = new Card(CardFace.Ace, CardSuit.Clubs);

            var expected = "A" + '\x05'; //♣

            Assert.AreEqual(0, String.Compare(card.ToString(), expected), "Card to string is not setting right");
        }

        [TestMethod]
        public void TestToStringMethod3()
        {
            var card = new Card(CardFace.Ace, CardSuit.Diamonds);

            var expected = "A" + '\x04'; //♦

            Assert.AreEqual(0, String.Compare(card.ToString(), expected), "Card to string is not setting right");
        }

        [TestMethod]
        public void TestNotEqualsCast()
        {
            var card = new Card(CardFace.Ace, CardSuit.Diamonds);

            Assert.IsFalse(card.Equals(new int[2]), "Card equals not correct");
        }
    }
}


text:
package org.sitenv.vocabularies.test.other;
import org.sitenv.vocabularies.configuration.ConfiguredValidator;
import org.sitenv.vocabularies.validation.NodeValidation;
import org.sitenv.vocabularies.validation.services.VocabularyValidationService;

public class TestableVocabularyValidationService extends VocabularyValidationService {

	@Override
	public NodeValidation selectVocabularyValidator(ConfiguredValidator configuredValidator) {
		NodeValidation vocabularyValidator = null;
		final String packagePath = "org.sitenv.vocabularies.validation.validators.nodetypes.";
		try {
			vocabularyValidator = (NodeValidation) Class.forName(packagePath + configuredValidator.getName())
					.newInstance();
		} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
			e.printStackTrace();
		}
		return vocabularyValidator;
	}

}


text:
@interface MOBProjectionEPSG2864 : MOBProjection

@end


text:
<?php
namespace D4rk4ng3l\Oxid\Module;

use D4rk4ng3l\Oxid\AdvancedModule\Metadata;
use D4rk4ng3l\Oxid\CodeGenerator\Php\Code;
use D4rk4ng3l\Oxid\CodeGenerator\Php\Method;
use D4rk4ng3l\Oxid\CodeGenerator\Php\PhpClass;
use D4rk4ng3l\Oxid\CodeGenerator\Php\PhpFile;
use D4rk4ng3l\Oxid\CodeGenerator\Php\PhpUse;
use D4rk4ng3l\Oxid\CodeGenerator\Php\Property;
use D4rk4ng3l\Oxid\AdvancedModule\Annotations;

/**
 * Class Generator
 *
 * @package D4rk4ng3l\Oxid\Module
 */
class Generator
{

    /**
     * @var array
     */
    private $classesToLoad = array();

    /**
     * @var array
     */
    private $mappings = array();

    /**
     * @var array
     */
    private $metadata = array();

    /**
     * @var string
     */
    private $oxidPath;

    /**
     * @var string
     */
    private $modulePath;

    /**
     * @var string
     */
    private $vendorPath;

    /**
     * @param string $oxidPath
     * @param string $modulePath
     * @param string $appPath
     */
    public function __construct($oxidPath, $modulePath, $appPath)
    {
        $this->oxidPath = $oxidPath;
        $this->modulePath = $modulePath;
        $this->vendorPath = $appPath . '/vendor';
    }

    /**
     * @param Mapping[] $mappings
     *
     * @return $this
     */
    public function addMappings($mappings)
    {
        foreach ($mappings as $mapping) {
            $this->addMapping($mapping);
        }

        return $this;
    }

    /**
     * @param Mapping $mapping
     *
     * @return $this
     */
    public function addMapping(Mapping $mapping)
    {
        $oxidClass   = $mapping->getOxidClass();
        $oxidMethod  = $mapping->getOxidMethod();
        $moduleClass = $mapping->getModuleClass();
        $moduleFile  = $mapping->getModuleFile();

        if (!isset($this->mappings[$oxidClass])) {
            $this->mappings[$oxidClass] = array();
        }

        $needNewProxy = true;
        foreach ($this->mappings[$oxidClass] as $proxyClass => $classMethods) {
            if (!isset($classMethods[$oxidMethod])) {
                $this->setMapping($oxidClass, $proxyClass, $oxidMethod, $moduleFile, $moduleClass, $mapping);
                $needNewProxy = false;
                break;
            }
        }

        if ($needNewProxy) {
            $proxyClass = (count($this->mappings[$oxidClass]) + 1);
            $this->setMapping($oxidClass, $proxyClass, $oxidMethod, $moduleFile, $moduleClass, $mapping);
        }

        return $this;
    }

    /**
     * @param $metadataClassName
     */
    public function generate($metadataClassName)
    {
        $oxidPath = $this->oxidPath;
        $this->metadata = array();
        foreach ($this->mappings as $oxidClass => $proxies) {
            foreach ($proxies as $proxyName => $mappings) {
                $phpFile = new PhpFile();
                $phpUse = new PhpUse();
                $moduleId = "aom{$proxyName}";
                $proxyClassName = "{$moduleId}_{$oxidClass}";
                $phpClass = new PhpClass($proxyClassName, $phpUse);
                $phpClass->setExtension("{$proxyClassName}_parent");

                foreach ($this->classesToLoad[$oxidClass][$proxyName] as $moduleClassName => $moduleFile) {
                    $methodName = $this->sanatizeModuleClass($moduleClassName);

                    $instanceProperty = lcfirst($methodName);
                    $property = new Property($instanceProperty);
                    $property->setVisibility(Property::VISIBILITY_PRIVATE);
                    $phpClass->addProperty($property);

                    $method = new Method("get{$methodName}");
                    $method->setVisibility(Method::VISIBILITY_PRIVATE);
                    $body = "if (!class_exists('{$moduleClassName}', false)) {\n";
                    $body .= "include '{$moduleFile}';\n";
                    $body .= "}\n";
                    $body .= "if (null === \$this->{$instanceProperty}) {\n";
                    $body .= "\$this->{$instanceProperty} = new \\{$moduleClassName}();\n";
                    $body .= "}\n";
                    $body .= "return \$this->{$instanceProperty};\n";
                    $method->setBody($body);
                    $phpClass->addMethod($method);
                }

                /** @var Mapping $mapping */
                foreach ($mappings as $mapping) {
                    $body = "\$class = \$this->get" . $this->sanatizeModuleClass($mapping->getModuleClass());
                    $body .= "();\n";
                    $body .= "\$args = func_get_args();\n";
                    $resultVarAssign = "";
                    $resultVarReturn = "";
                    if ($mapping->hasReturn()) {
                        $resultVar = "\$result";
                        $resultVarAssign = "$resultVar = ";
                        $resultVarReturn = "return {$resultVar};\n";
                    }

                    if (Annotations\Method::EXECUTE_BEFORE === $mapping->getParentExecution()) {
                        $body .= "{$resultVarAssign}call_user_func_array(array('parent', __FUNCTION__), \$args);\n";
                    }

                    $body .= "{$resultVarAssign}call_user_func_array(array(\$class, '{$mapping->getModuleMethod()}'), \$args);\n";

                    if (Annotations\Method::EXECUTE_AFTER === $mapping->getParentExecution()) {
                        $body .= "{$resultVarAssign}call_user_func_array(array('parent', __FUNCTION__), \$args);\n";
                    }

                    $body .= $resultVarReturn;

                    $methodReflection = new \ReflectionMethod($mapping->getOxidClass(), $mapping->getOxidMethod());
                    $method = new Method($mapping->getOxidMethod(), array(), $body);
                    foreach ($methodReflection->getParameters() as $parameter) {
                        $method->addParameter(
                            new Method\Parameter(
                                $parameter->getName(),
                                $parameter->getDefaultValue(),
                                !$parameter->isOptional()
                            )
                        );
                    }

                    switch (true) {
                        case $methodReflection->isPublic():
                            $method->setVisibility(Method::VISIBILITY_PUBLIC);
                            break;
                        case $methodReflection->isProtected():
                            $method->setVisibility(Method::VISIBILITY_PROTECTED);
                            break;
                        case $methodReflection->isPrivate():
                            $method->setVisibility(Method::VISIBILITY_PRIVATE);
                            break;
                    }

                    $method->setFinal($methodReflection->isFinal());
                    $method->setAbstract($methodReflection->isAbstract());

                    $phpClass->addMethod($method);
                }

                $vendorPath = $this->modulePath;
                do {
                    $vendorPath = dirname($vendorPath) . '/vendor';
                    if ('/' === $vendorPath || ':' == substr($vendorPath, 1, 1)) {
                        throw new \RuntimeException('Can not locate the vendor directory!');
                    }
                } while (!file_exists($vendorPath));

                $phpAutoloader = new Code("include_once '{$this->vendorPath}/autoload.php';\n");

                $phpFile->addBlock($phpAutoloader);
                $phpFile->addBlock($phpUse);
                $phpFile->addBlock($phpClass);

                $proxyClassExtend = str_replace('_', '/', $proxyClassName) . "/{$proxyClassName}";
                $proxyClassFile = "{$oxidPath}/modules/{$proxyClassExtend}.php";

                if (!file_exists(dirname($proxyClassFile))) {
                    mkdir(dirname($proxyClassFile), 0777, true);
                }

                file_put_contents($proxyClassFile, $phpFile->generate());

                /** @var Metadata $metadataClass */
                $metadataClass = $this->getMetadata($proxyName, $metadataClassName, $moduleId);
                $metadataClass->getExtensions()->addExtension($oxidClass, $proxyClassExtend);

                file_put_contents("{$oxidPath}/modules/{$moduleId}/metadata.php", $metadataClass->generate());
            }
        }
    }

    /**
     * @param $proxyName
     * @param $metadataClassName
     * @param $moduleId
     *
     * @return mixed
     */
    private function getMetadata($proxyName, $metadataClassName, $moduleId)
    {
        if (!isset($this->metadata[$proxyName])) {
            $this->metadata[$proxyName] = new $metadataClassName($moduleId, true);
        }

        return $this->metadata[$proxyName];
    }

    /**
     * @param         $oxidClass
     * @param         $proxyClass
     * @param         $oxidMethod
     * @param         $moduleFile
     * @param         $moduleClass
     * @param Mapping $mapping
     */
    private function setMapping($oxidClass, $proxyClass, $oxidMethod, $moduleFile, $moduleClass, Mapping $mapping)
    {
        $this->mappings[$oxidClass][$proxyClass][$oxidMethod]       = $mapping;
        $this->classesToLoad[$oxidClass][$proxyClass][$moduleClass] = $moduleFile;
    }

    /**
     * @param $moduleClassName
     *
     * @return mixed|string
     */
    private function sanatizeModuleClass($moduleClassName)
    {
        $methodName = str_replace('\\', ' ', $moduleClassName);
        $methodName = ucwords($methodName);
        $methodName = str_replace(' ', '', $methodName);

        return $methodName;
    }
}


text:
const express = require('express');
const app = express();
const path = require('path');
const cons = require('consolidate');

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

app.use(function (req, res) {
  res.sendFile(__dirname + '/app/index.html');
});

app.listen(8081, function () {
  console.log('App sendo executada em: http://localhost:8081');
});


text:
using System;
using System.Diagnostics.CodeAnalysis;

namespace Cometary
{
    /// <summary>
    ///
    /// </summary>
    [SuppressMessage("Compiler", "CS0702", Justification = "That constraint is annoying.")]
    internal sealed class Pipeline<TDelegate> where TDelegate : Delegate
    {
        private readonly LightList<PipelineComponent<TDelegate>> Components;

        public Pipeline()
        {
            Components = new LightList<PipelineComponent<TDelegate>>();
        }

        public TDelegate MakeDelegate(TDelegate @default)
        {
            var components = Components.UnderlyingArray;
            var next = @default;

            for (int i = components.Length - 1; i >= 0; i--)
            {
                next = components[i](next);
            }

            return next;
        }

        public void Add(PipelineComponent<TDelegate> component)
        {
            Components.Add(component);
        }

        public void Remove(PipelineComponent<TDelegate> component)
        {
            Components.Remove(component);
        }
    }
}


text:
/******************************************************************************
 *
 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
 *
 *****************************************************************************/

/*
 * Copyright (C) 2000 - 2007, R. Byron Moore
 * All rights reserved.
 *
 * 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,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
 */

#ifndef __ACINTERP_H__
#define __ACINTERP_H__

#define ACPI_WALK_OPERANDS          (&(walk_state->operands [walk_state->num_operands -1]))

/* Macros for tables used for debug output */

#define ACPI_EXD_OFFSET(f)          (u8) ACPI_OFFSET (union acpi_operand_object,f)
#define ACPI_EXD_NSOFFSET(f)        (u8) ACPI_OFFSET (struct acpi_namespace_node,f)
#define ACPI_EXD_TABLE_SIZE(name)   (sizeof(name) / sizeof (struct acpi_exdump_info))

/*
 * If possible, pack the following structures to byte alignment, since we
 * don't care about performance for debug output. Two cases where we cannot
 * pack the structures:
 *
 * 1) Hardware does not support misaligned memory transfers
 * 2) Compiler does not support pointers within packed structures
 */
#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
#pragma pack(1)
#endif

typedef const struct acpi_exdump_info {
	u8 opcode;
	u8 offset;
	char *name;

} acpi_exdump_info;

/* Values for the Opcode field above */

#define ACPI_EXD_INIT                   0
#define ACPI_EXD_TYPE                   1
#define ACPI_EXD_UINT8                  2
#define ACPI_EXD_UINT16                 3
#define ACPI_EXD_UINT32                 4
#define ACPI_EXD_UINT64                 5
#define ACPI_EXD_LITERAL                6
#define ACPI_EXD_POINTER                7
#define ACPI_EXD_ADDRESS                8
#define ACPI_EXD_STRING                 9
#define ACPI_EXD_BUFFER                 10
#define ACPI_EXD_PACKAGE                11
#define ACPI_EXD_FIELD                  12
#define ACPI_EXD_REFERENCE              13

/* restore default alignment */

#pragma pack()

/*
 * exconvrt - object conversion
 */
acpi_status
acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
			   union acpi_operand_object **result_desc, u32 flags);

acpi_status
acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
			  union acpi_operand_object **result_desc);

acpi_status
acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
			  union acpi_operand_object **result_desc, u32 type);

/* Types for ->String conversion */

#define ACPI_EXPLICIT_BYTE_COPY         0x00000000
#define ACPI_EXPLICIT_CONVERT_HEX       0x00000001
#define ACPI_IMPLICIT_CONVERT_HEX       0x00000002
#define ACPI_EXPLICIT_CONVERT_DECIMAL   0x00000003

acpi_status
acpi_ex_convert_to_target_type(acpi_object_type destination_type,
			       union acpi_operand_object *source_desc,
			       union acpi_operand_object **result_desc,
			       struct acpi_walk_state *walk_state);

/*
 * exfield - ACPI AML (p-code) execution - field manipulation
 */
acpi_status
acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
			    u32 buffer_length, u32 * datum_count);

acpi_status
acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
			       acpi_integer mask,
			       acpi_integer field_value,
			       u32 field_datum_byte_offset);

void
acpi_ex_get_buffer_datum(acpi_integer * datum,
			 void *buffer,
			 u32 buffer_length,
			 u32 byte_granularity, u32 buffer_offset);

void
acpi_ex_set_buffer_datum(acpi_integer merged_datum,
			 void *buffer,
			 u32 buffer_length,
			 u32 byte_granularity, u32 buffer_offset);

acpi_status
acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
			     union acpi_operand_object *obj_desc,
			     union acpi_operand_object **ret_buffer_desc);

acpi_status
acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
			    union acpi_operand_object *obj_desc,
			    union acpi_operand_object **result_desc);

/*
 * exfldio - low level field I/O
 */
acpi_status
acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
			   void *buffer, u32 buffer_length);

acpi_status
acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
			  void *buffer, u32 buffer_length);

acpi_status
acpi_ex_access_region(union acpi_operand_object *obj_desc,
		      u32 field_datum_byte_offset,
		      acpi_integer * value, u32 read_write);

/*
 * exmisc - misc support routines
 */
acpi_status
acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
			     union acpi_operand_object **return_desc,
			     struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_concat_template(union acpi_operand_object *obj_desc,
			union acpi_operand_object *obj_desc2,
			union acpi_operand_object **actual_return_desc,
			struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
		       union acpi_operand_object *obj_desc2,
		       union acpi_operand_object **actual_return_desc,
		       struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_do_logical_numeric_op(u16 opcode,
			      acpi_integer integer0,
			      acpi_integer integer1, u8 * logical_result);

acpi_status
acpi_ex_do_logical_op(u16 opcode,
		      union acpi_operand_object *operand0,
		      union acpi_operand_object *operand1, u8 * logical_result);

acpi_integer
acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);

acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_create_region(u8 * aml_start,
		      u32 aml_length,
		      u8 region_space, struct acpi_walk_state *walk_state);

acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_create_method(u8 * aml_start,
		      u32 aml_length, struct acpi_walk_state *walk_state);

/*
 * exconfig - dynamic table load/unload
 */
acpi_status
acpi_ex_load_op(union acpi_operand_object *obj_desc,
		union acpi_operand_object *target,
		struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
		      union acpi_operand_object **return_desc);

acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);

/*
 * exmutex - mutex support
 */
acpi_status
acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
		      union acpi_operand_object *obj_desc,
		      struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
		      struct acpi_walk_state *walk_state);

void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);

void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);

/*
 * exprep - ACPI AML execution - prep utilities
 */
acpi_status
acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
				 u8 field_flags,
				 u8 field_attribute,
				 u32 field_bit_position, u32 field_bit_length);

acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);

/*
 * exsystem - Interface to OS services
 */
acpi_status
acpi_ex_system_do_notify_op(union acpi_operand_object *value,
			    union acpi_operand_object *obj_desc);

acpi_status acpi_ex_system_do_suspend(acpi_integer time);

acpi_status acpi_ex_system_do_stall(u32 time);

acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);

acpi_status
acpi_ex_system_wait_event(union acpi_operand_object *time,
			  union acpi_operand_object *obj_desc);

acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);

acpi_status
acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout);

acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout);

/*
 * exoparg1 - ACPI AML execution, 1 operand
 */
acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);

/*
 * exoparg2 - ACPI AML execution, 2 operands
 */
acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);

/*
 * exoparg3 - ACPI AML execution, 3 operands
 */
acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);

acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);

/*
 * exoparg6 - ACPI AML execution, 6 operands
 */
acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);

/*
 * exresolv - Object resolution and get value functions
 */
acpi_status
acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
			 struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
			 union acpi_operand_object *operand,
			 acpi_object_type * return_type,
			 union acpi_operand_object **return_desc);

/*
 * exresnte - resolve namespace node
 */
acpi_status
acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
			      struct acpi_walk_state *walk_state);

/*
 * exresop - resolve operand to value
 */
acpi_status
acpi_ex_resolve_operands(u16 opcode,
			 union acpi_operand_object **stack_ptr,
			 struct acpi_walk_state *walk_state);

/*
 * exdump - Interpreter debug output routines
 */
void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);

void
acpi_ex_dump_operands(union acpi_operand_object **operands,
		      acpi_interpreter_mode interpreter_mode,
		      char *ident,
		      u32 num_levels,
		      char *note, char *module_name, u32 line_number);

#ifdef	ACPI_FUTURE_USAGE
void
acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);

void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
#endif				/* ACPI_FUTURE_USAGE */

/*
 * exnames - AML namestring support
 */
acpi_status
acpi_ex_get_name_string(acpi_object_type data_type,
			u8 * in_aml_address,
			char **out_name_string, u32 * out_name_length);

/*
 * exstore - Object store support
 */
acpi_status
acpi_ex_store(union acpi_operand_object *val_desc,
	      union acpi_operand_object *dest_desc,
	      struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
			     struct acpi_namespace_node *node,
			     struct acpi_walk_state *walk_state,
			     u8 implicit_conversion);

#define ACPI_IMPLICIT_CONVERSION        TRUE
#define ACPI_NO_IMPLICIT_CONVERSION     FALSE

/*
 * exstoren - resolve/store object
 */
acpi_status
acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
		       acpi_object_type target_type,
		       struct acpi_walk_state *walk_state);

acpi_status
acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
			       union acpi_operand_object *dest_desc,
			       union acpi_operand_object **new_desc,
			       struct acpi_walk_state *walk_state);

/*
 * exstorob - store object - buffer/string
 */
acpi_status
acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
			       union acpi_operand_object *target_desc);

acpi_status
acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
			       union acpi_operand_object *target_desc);

/*
 * excopy - object copy
 */
acpi_status
acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
				    union acpi_operand_object *target_desc);

acpi_status
acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
				   union acpi_operand_object *target_desc);

acpi_status
acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
				 struct acpi_namespace_node *node);

acpi_status
acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
				     union acpi_operand_object *target_desc);

/*
 * exutils - interpreter/scanner utilities
 */
void acpi_ex_enter_interpreter(void);

void acpi_ex_exit_interpreter(void);

void acpi_ex_reacquire_interpreter(void);

void acpi_ex_relinquish_interpreter(void);

void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);

u8 acpi_ex_acquire_global_lock(u32 rule);

void acpi_ex_release_global_lock(u8 locked);

void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string);

void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string);

/*
 * exregion - default op_region handlers
 */
acpi_status
acpi_ex_system_memory_space_handler(u32 function,
				    acpi_physical_address address,
				    u32 bit_width,
				    acpi_integer * value,
				    void *handler_context,
				    void *region_context);

acpi_status
acpi_ex_system_io_space_handler(u32 function,
				acpi_physical_address address,
				u32 bit_width,
				acpi_integer * value,
				void *handler_context, void *region_context);

acpi_status
acpi_ex_pci_config_space_handler(u32 function,
				 acpi_physical_address address,
				 u32 bit_width,
				 acpi_integer * value,
				 void *handler_context, void *region_context);

acpi_status
acpi_ex_cmos_space_handler(u32 function,
			   acpi_physical_address address,
			   u32 bit_width,
			   acpi_integer * value,
			   void *handler_context, void *region_context);

acpi_status
acpi_ex_pci_bar_space_handler(u32 function,
			      acpi_physical_address address,
			      u32 bit_width,
			      acpi_integer * value,
			      void *handler_context, void *region_context);

acpi_status
acpi_ex_embedded_controller_space_handler(u32 function,
					  acpi_physical_address address,
					  u32 bit_width,
					  acpi_integer * value,
					  void *handler_context,
					  void *region_context);

acpi_status
acpi_ex_sm_bus_space_handler(u32 function,
			     acpi_physical_address address,
			     u32 bit_width,
			     acpi_integer * value,
			     void *handler_context, void *region_context);

acpi_status
acpi_ex_data_table_space_handler(u32 function,
				 acpi_physical_address address,
				 u32 bit_width,
				 acpi_integer * value,
				 void *handler_context, void *region_context);

#endif				/* __INTERP_H__ */


text:
#ifndef __BLACKFIN_CPUTIME_H
#define __BLACKFIN_CPUTIME_H

#include <asm-generic/cputime.h>

#endif				/* __BLACKFIN_CPUTIME_H */


text:
.class interface abstract Landroid/support/v4/view/AccessibilityDelegateCompat$AccessibilityDelegateImpl;
.super Ljava/lang/Object;
.source "AccessibilityDelegateCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/view/AccessibilityDelegateCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x608
    name = "AccessibilityDelegateImpl"
.end annotation

# virtual methods
.method public abstract dispatchPopulateAccessibilityEvent(Ljava/lang/Object;Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)Z
.end method

.method public abstract getAccessibilityNodeProvider(Ljava/lang/Object;Landroid/view/View;)Landroid/support/v4/view/accessibility/AccessibilityNodeProviderCompat;
.end method

.method public abstract newAccessiblityDelegateBridge(Landroid/support/v4/view/AccessibilityDelegateCompat;)Ljava/lang/Object;
.end method

.method public abstract newAccessiblityDelegateDefaultImpl()Ljava/lang/Object;
.end method

.method public abstract onInitializeAccessibilityEvent(Ljava/lang/Object;Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)V
.end method

.method public abstract onInitializeAccessibilityNodeInfo(Ljava/lang/Object;Landroid/view/View;Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;)V
.end method

.method public abstract onPopulateAccessibilityEvent(Ljava/lang/Object;Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)V
.end method

.method public abstract onRequestSendAccessibilityEvent(Ljava/lang/Object;Landroid/view/ViewGroup;Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)Z
.end method

.method public abstract performAccessibilityAction(Ljava/lang/Object;Landroid/view/View;ILandroid/os/Bundle;)Z
.end method

.method public abstract sendAccessibilityEvent(Ljava/lang/Object;Landroid/view/View;I)V
.end method

.method public abstract sendAccessibilityEventUnchecked(Ljava/lang/Object;Landroid/view/View;Landroid/view/accessibility/AccessibilityEvent;)V
.end method


text:
// from https://github.com/TypeStrong/atom-typescript/blob/master/lib/typings/atompromise.d.ts
// Ripped from lib.es6.d.ts with addtions for atom

/**
 * Represents the completion of an asynchronous operation
 */
interface Promise<T> {
    /**
    * Attaches callbacks for the resolution and/or rejection of the Promise.
    * @param onfulfilled The callback to execute when the Promise is resolved.
    * @param onrejected The callback to execute when the Promise is rejected.
    * @returns A Promise for the completion of which ever callback is executed.
    */
    then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;

    /**
     * Attaches a callback for only the rejection of the Promise.
     * @param onrejected The callback to execute when the Promise is rejected.
     * @returns A Promise for the completion of the callback.
     */
    catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
}

interface PromiseConstructor {
    /**
      * A reference to the prototype.
      */
    prototype: Promise<any>;

    /**
     * Creates a new Promise.
     * @param init A callback used to initialize the promise. This callback is passed two arguments:
     * a resolve callback used resolve the promise with a value or the result of another promise,
     * and a reject callback used to reject the promise with a provided reason or error.
     */
    new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;

    <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;

    /**
     * Creates a Promise that is resolved with an array of results when all of the provided Promises
     * resolve, or rejected when any Promise is rejected.
     * @param values An array of Promises.
     * @returns A new Promise.
     */
    all<T>(values: (T | Promise<T>)[]): Promise<T[]>;

    /**
     * Creates a Promise that is resolved with an array of results when all of the provided Promises
     * resolve, or rejected when any Promise is rejected.
     * @param values An array of values.
     * @returns A new Promise.
     */
    all(values: Promise<void>[]): Promise<void>;

    /**
     * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
     * or rejected.
     * @param values An array of Promises.
     * @returns A new Promise.
     */
    race<T>(values: (T | Promise<T>)[]): Promise<T>;

    /**
     * Creates a new rejected promise for the provided reason.
     * @param reason The reason the promise was rejected.
     * @returns A new rejected Promise.
     */
    reject(reason: any): Promise<void>;

    /**
     * Creates a new rejected promise for the provided reason.
     * @param reason The reason the promise was rejected.
     * @returns A new rejected Promise.
     */
    reject<T>(reason: any): Promise<T>;

    /**
      * Creates a new resolved promise for the provided value.
      * @param value A promise.
      * @returns A promise whose internal state matches the provided promise.
      */
    resolve<T>(value: T | Promise<T>): Promise<T>;

    /**
     * Creates a new resolved promise .
     * @returns A resolved promise.
     */
    resolve(): Promise<void>;

    /// BAS ADDITIONS AFTER INSPECTION INTO ATOM
    defer<T>(): PromiseDeferred<T>;
}

interface PromiseDeferred<T> {
    promise: Promise<T>; resolve(value: T): any; reject(error: T): any;
}

declare var Promise: PromiseConstructor;

declare module 'pinkie-promise'{
    export = Promise;
}


text:
package net.skoumal.joogar.shared.cursor;

import net.skoumal.joogar.shared.Joogar;
import net.skoumal.joogar.shared.JoogarDatabaseResult;
import net.skoumal.joogar.shared.JoogarRecord;
import net.skoumal.joogar.shared.util.ReflectionUtils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 */
public class JoogarCursorImpl<T> implements JoogarCursor<T>, Iterator<T> {

    private Class<T> type;
    private JoogarDatabaseResult result;

    private boolean isClosed = false;

    private JoogarRecord.Prefetch[] prefetches = null;

    ReflectionUtils reflectionUtils;

    public JoogarCursorImpl(Class<T> gType, JoogarDatabaseResult gResult) {
        this(gType, gResult, null);
    }

    public JoogarCursorImpl(Class<T> gType, JoogarDatabaseResult gResult, JoogarRecord.Prefetch[] gPrefetches) {
        type = gType;
        result = gResult;
        prefetches = gPrefetches;

        reflectionUtils = Joogar.getInstance().getReflectionUtils();
    }

    /**
     * Returns the numbers of rows in joogar cursor.
     *
     * @return the number of rows in the cursor
     */
    public int getCount() {
        return size();
    }

    public int size() {
        return result.count();
    }

    /**
     * Returns the current position of the cursor in the row set.
     * The value is zero-based. Initially the cursor is at position -1,
     * which is before the first row. After the
     * last row is returned another call to next() will leave the cursor past
     * the last entry, at a position of count().
     *
     * @return the current cursor position.
     */
    public int getPosition() {
        return result.getPosition();
    }

    /**
     * Moves the cursor to given position. Allowed values are from 0 to count.
     *
     * @param position the zero-based position to move to
     */
    public void setPosition(int position) {
        result.setPosition(position);
    }

    @Override
    public boolean hasNext() {
        return result.getPosition() < (result.count() - 1);
    }

    /**
     * Move the cursor to the next item.
     * <p/>
     * Returns true if step forward is possible.
     *
     * @return true for successful move, false otherwise
     */
    public T next() {
        if (result.next()) {
            return getItem();
        } else {
            return null;
        }
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("Remove is not supported for joogar cursor iterator.");
    }

    /**
     * Closes the Cursor, releasing all of its underlining resources.
     */
    public void close() {
        isClosed = true;
        result.close();
    }

    /**
     * Return true when cursor is close.
     *
     * @return true if {@link #close()} method was called
     */
    public boolean isClosed() {
        return isClosed;
    }

    /**
     * Returns row as item object.
     *
     * @return data object
     */
    public T getItem() {
        return current();
    }

    public T current() {
        try {
            T entity = type.getDeclaredConstructor().newInstance();
            if (prefetches == null) {
                reflectionUtils.inflate(result, entity, -1);
            } else {
                int index = reflectionUtils.inflate(result, entity, 0);
                inflatePrefetches(type, entity, result, prefetches, index);
            }
            return entity;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public List<T> toList() {
        List<T> list = new ArrayList<>();
        setPosition(-1);
        T item;
        while ((item = next()) != null) {
            list.add(item);
        }
        return list;
    }

    @Override
    public List<T> toListAndClose() {
        List<T> list = toList();
        close();
        return list;
    }

    private <T> void inflatePrefetches(Class<?> type, Object entity, JoogarDatabaseResult result, JoogarRecord.Prefetch[] prefetches, int index) throws InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, NoSuchMethodException {
        for (JoogarRecord.Prefetch p : prefetches) {
            if (p instanceof JoogarRecord.OneToOnePrefetch) {
                JoogarRecord.OneToOnePrefetch otop = (JoogarRecord.OneToOnePrefetch) p;
                Field field = reflectionUtils.getDeepField(otop.getField(), type);
                Class<?> fieldType = field.getType();

                Object prefetchedEntity = fieldType.getDeclaredConstructor().newInstance();
                index = reflectionUtils.inflate(result, prefetchedEntity, index);
                reflectionUtils.setFieldValueNative(entity, field, prefetchedEntity);

                inflatePrefetches(fieldType, prefetchedEntity, result, otop.getChildPrefetch(), index);
            }
        }
    }

    @Override
    public Iterator<T> iterator() {
        setPosition(-1); // reset position pointer
        return this;
    }
}


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

<TITLE>
Uses of Class javax.microedition.midlet.MIDletStateChangeException (2013 FRC Java API)
</TITLE>

<META NAME="date" CONTENT="2014-01-01">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

"
2013 FRC Java API
"

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
javax.microedition.midlet.MIDletStateChangeException

Packages that use MIDletStateChangeException

com.sun.midp.midlet

edu.wpi.first.wpilibj
The WPI Robotics library (WPILibJ) is a set of Java classes that interfaces to the hardware in the FRC
control system and your robot.

javax.microedition.midlet
The MIDlet package defines Mobile Information
    Device Profile applications and the interactions between the
    application and the environment in which the application runs.

Uses of MIDletStateChangeException in com.sun.midp.midlet

Methods in com.sun.midp.midlet that throw MIDletStateChangeException

 void
MIDletTunnel.callDestroyApp(MIDlet m,
               boolean unconditional)

          Calls the destroyApp method on the midlet instance.

 void
MIDletTunnel.callStartApp(MIDlet m)

          Calls the startApp method on the midlet instance.

Uses of MIDletStateChangeException in edu.wpi.first.wpilibj

Methods in edu.wpi.first.wpilibj that throw MIDletStateChangeException

protected  void
RobotBase.destroyApp(boolean unconditional)

          Called if the MIDlet is terminated by the system.

protected  void
RobotBase.startApp()

          Starting point for the applications.

Uses of MIDletStateChangeException in javax.microedition.midlet

Methods in javax.microedition.midlet that throw MIDletStateChangeException

protected abstract  void
MIDlet.destroyApp(boolean unconditional)

          Signals the MIDlet to terminate and enter the
 Destroyed state.

protected abstract  void
MIDlet.startApp()

          Signals the MIDlet that it has entered the
 Active state.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

"
2013 FRC Java API
"

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

"For updated information see the Java FRC site"


text:
<?php

namespace Clue\React\Zenity\Zen;

use Clue\React\Zenity\Zen\BaseZen;

class ColorSelectionZen extends BaseZen
{
    /**
     * Parses the color string returned from the dialog into a #rrggbb string
     *
     * @internal
     * @see parent::parseValue()
     * @return string
     * @link https://answers.launchpad.net/ubuntu/+source/zenity/+question/204096
     */
    public function parseValue($value)
    {
        // convert zenity's #rrrrggggbbbb to #rrggbb by skipping duplicate info
        return '#' . substr($value, 1, 2) . substr($value, 5, 2) . substr($value, 9, 2);
    }
}


text:
/*  Title:      Pure/Tools/build.scala
    Author:     Makarius
    Options:    :folding=explicit:

Build and manage Isabelle sessions.
*/

package isabelle

import scala.collection.SortedSet
import scala.annotation.tailrec

object Build
{
  /** auxiliary **/

  /* persistent build info */

  sealed case class Session_Info(
    sources: String,
    input_heaps: List[String],
    output_heap: Option[String],
    return_code: Int)
  {
    def ok: Boolean = return_code == 0
  }

  /* queue with scheduling information */

  private object Queue
  {
    type Timings = (List[Properties.T], Double)

    def load_timings(progress: Progress, store: Sessions.Store, name: String): Timings =
    {
      val no_timings: Timings = (Nil, 0.0)

      store.access_database(name) match {
        case None => no_timings
        case Some(db) =>
          def ignore_error(msg: String) =
          {
            progress.echo_warning("Ignoring bad database " + db + (if (msg == "") "" else "\n" + msg))
            no_timings
          }
          try {
            val command_timings = store.read_command_timings(db, name)
            val session_timing =
              store.read_session_timing(db, name) match {
                case Markup.Elapsed(t) => t
                case _ => 0.0
              }
            (command_timings, session_timing)
          }
          catch {
            case ERROR(msg) => ignore_error(msg)
            case exn: java.lang.Error => ignore_error(Exn.message(exn))
            case _: XML.Error => ignore_error("")
          }
          finally { db.close }
      }
    }

    def make_session_timing(sessions_structure: Sessions.Structure, timing: Map[String, Double])
      : Map[String, Double] =
    {
      val maximals = sessions_structure.build_graph.maximals.toSet
      def desc_timing(name: String): Double =
      {
        if (maximals.contains(name)) timing(name)
        else {
          val descendants = sessions_structure.build_descendants(List(name)).toSet
          val g = sessions_structure.build_graph.restrict(descendants)
          (0.0 :: g.maximals.flatMap(desc => {
            val ps = g.all_preds(List(desc))
            if (ps.exists(p => timing.get(p).isEmpty)) None
            else Some(ps.map(timing(_)).sum)
          })).max
        }
      }
      timing.keySet.iterator.map(name => (name -> desc_timing(name))).toMap.withDefaultValue(0.0)
    }

    def apply(progress: Progress, sessions_structure: Sessions.Structure, store: Sessions.Store)
      : Queue =
    {
      val graph = sessions_structure.build_graph
      val names = graph.keys

      val timings = names.map(name => (name, load_timings(progress, store, name)))
      val command_timings =
        timings.map({ case (name, (ts, _)) => (name, ts) }).toMap.withDefaultValue(Nil)
      val session_timing =
        make_session_timing(sessions_structure,
          timings.map({ case (name, (_, t)) => (name, t) }).toMap)

      object Ordering extends scala.math.Ordering[String]
      {
        def compare_timing(name1: String, name2: String): Int =
        {
          val t1 = session_timing(name1)
          val t2 = session_timing(name2)
          if (t1 == 0.0 || t2 == 0.0) 0
          else t1 compare t2
        }

        def compare(name1: String, name2: String): Int =
          compare_timing(name2, name1) match {
            case 0 =>
              sessions_structure(name2).timeout compare sessions_structure(name1).timeout match {
                case 0 => name1 compare name2
                case ord => ord
              }
            case ord => ord
          }
      }

      new Queue(graph, SortedSet(names: _*)(Ordering), command_timings)
    }
  }

  private class Queue(
    graph: Graph[String, Sessions.Info],
    order: SortedSet[String],
    val command_timings: String => List[Properties.T])
  {
    def is_inner(name: String): Boolean = !graph.is_maximal(name)

    def is_empty: Boolean = graph.is_empty

    def - (name: String): Queue =
      new Queue(graph.del_node(name),
        order - name,  // FIXME scala-2.10.0 .. 2.12.4 TreeSet problem!?
        command_timings)

    def dequeue(skip: String => Boolean): Option[(String, Sessions.Info)] =
    {
      val it = order.iterator.dropWhile(name =>
        skip(name)
          || !graph.defined(name)  // FIXME scala-2.10.0 .. 2.12.4 TreeSet problem!?
          || !graph.is_minimal(name))
      if (it.hasNext) { val name = it.next; Some((name, graph.get_node(name))) }
      else None
    }
  }

  /* PIDE protocol handler */

  class Handler(progress: Progress, session: Session, session_name: String)
    extends Session.Protocol_Handler
  {
    val result_error: Promise[String] = Future.promise

    override def exit() { result_error.cancel }

    private def build_session_finished(msg: Prover.Protocol_Output): Boolean =
    {
      val error_message =
        try { Pretty.string_of(Symbol.decode_yxml(msg.text)) }
        catch { case ERROR(msg) => msg }
      result_error.fulfill(error_message)
      session.send_stop()
      true
    }

    private def loading_theory(msg: Prover.Protocol_Output): Boolean =
      msg.properties match {
        case Markup.Loading_Theory(name) =>
          progress.theory(session_name, name)
          true
        case _ => false
      }

    val functions =
      List(
        Markup.BUILD_SESSION_FINISHED -> build_session_finished _,
        Markup.LOADING_THEORY -> loading_theory _)
  }

  /* job: running prover process */

  private class Job(progress: Progress,
    name: String,
    val info: Sessions.Info,
    deps: Sessions.Deps,
    store: Sessions.Store,
    do_output: Boolean,
    verbose: Boolean,
    pide: Boolean,
    val numa_node: Option[Int],
    command_timings: List[Properties.T])
  {
    val options =
      numa_node match {
        case None => info.options
        case Some(n) => info.options.string("ML_process_policy") = NUMA.policy(n)
      }

    private val graph_file = Isabelle_System.tmp_file("session_graph", "pdf")
    //isabelle.graphview.Graph_File.write(options, graph_file, deps(name).session_graph_display)

    private val export_tmp_dir = Isabelle_System.tmp_dir("export")
    private val export_consumer =
      Export.consumer(store.open_database(name, output = true), cache = store.xz_cache)

    private val future_result: Future[Process_Result] =
      Future.thread("build") {
        val parent = info.parent.getOrElse("")
        val base = deps(name)
        val args_yxml =
          YXML.string_of_body(
            {
              import XML.Encode._
              pair(list(pair(string, int)), pair(list(properties), pair(bool, pair(bool,
                pair(Path.encode, pair(list(pair(Path.encode, Path.encode)), pair(string,
                pair(string, pair(string, pair(string, pair(Path.encode,
                pair(list(pair(Options.encode, list(pair(string, properties)))),
                pair(list(pair(string, properties)), pair(list(string),
                pair(list(pair(string, string)),
                pair(list(string), pair(list(pair(string, string)), list(string))))))))))))))))))(
              (Symbol.codes, (command_timings, (do_output, (verbose,
                (store.browser_info, (info.document_files, (File.standard_path(graph_file),
                (parent, (info.chapter, (name, (Path.current,
                (info.theories, (base.known.sessions.toList, (base.doc_names,
                (base.global_theories.toList, (base.loaded_theories.keys, (base.dest_known_theories,
                info.bibtex_entries.map(_.info)))))))))))))))))))
            })

        val env =
          Isabelle_System.settings() +
            ("ISABELLE_EXPORT_TMP" -> File.standard_path(export_tmp_dir)) +
            ("ISABELLE_ML_DEBUGGER" -> options.bool("ML_debugger").toString)

        def save_heap: String =
          (if (info.theories.isEmpty) "" else "ML_Heap.share_common_data (); ") +
            "ML_Heap.save_child " +
            ML_Syntax.print_string_bytes(File.platform_path(store.output_heap(name)))

        if (pide && !Sessions.is_pure(name)) {
          val resources = new Resources(deps(parent))
          val session = new Session(options, resources)
          val handler = new Handler(progress, session, name)
          session.init_protocol_handler(handler)

          val session_result = Future.promise[Process_Result]

          Isabelle_Process.start(session, options, logic = parent, cwd = info.dir.file, env = env,
            sessions_structure = Some(deps.sessions_structure), store = Some(store),
            phase_changed =
            {
              case Session.Ready => session.protocol_command("build_session", args_yxml)
              case Session.Terminated(result) => session_result.fulfill(result)
              case _ =>
            })

          val result = session_result.join
          handler.result_error.join match {
            case "" => result
            case msg =>
              result.copy(
                rc = result.rc max 1,
                out_lines = result.out_lines ::: split_lines(Output.error_message_text(msg)))
          }
        }
        else {
          val args_file = Isabelle_System.tmp_file("build")
          File.write(args_file, args_yxml)

          val eval =
            "Command_Line.tool0 (fn () => (" +
            "Build.build " + ML_Syntax.print_string_bytes(File.standard_path(args_file)) +
            (if (Sessions.is_pure(name)) "; Theory.install_pure (Thy_Info.get_theory Context.PureN)"
             else "") + (if (do_output) "; " + save_heap else "") + "));"

          val process =
            if (Sessions.is_pure(name)) {
              ML_Process(options, raw_ml_system = true, cwd = info.dir.file,
                args =
                  (for ((root, _) <- Thy_Header.ml_roots) yield List("--use", root)).flatten :::
                  List("--eval", eval),
                env = env, sessions_structure = Some(deps.sessions_structure), store = Some(store),
                cleanup = () => args_file.delete)
            }
            else {
              ML_Process(options, parent, List("--eval", eval), cwd = info.dir.file,
                env = env, sessions_structure = Some(deps.sessions_structure), store = Some(store),
                cleanup = () => args_file.delete)
            }

          process.result(
            progress_stdout = (line: String) =>
              Library.try_unprefix("\floading_theory = ", line) match {
                case Some(theory) => progress.theory(name, theory)
                case None =>
                  for {
                    text <- Library.try_unprefix("\fexport = ", line)
                    (args, path) <-
                      Markup.Export.dest_inline(XML.Decode.properties(YXML.parse_body(text)))
                  } {
                    val body = Bytes.read(path)
                    path.file.delete
                    export_consumer(name, args, body)
                  }
              },
            progress_limit =
              options.int("process_output_limit") match {
                case 0 => None
                case m => Some(m * 1000000L)
              },
            strict = false)
        }
      }

    def terminate: Unit = future_result.cancel
    def is_finished: Boolean = future_result.is_finished

    private val timeout_request: Option[Event_Timer.Request] =
    {
      if (info.timeout > Time.zero)
        Some(Event_Timer.request(Time.now() + info.timeout) { terminate })
      else None
    }

    def join: (Process_Result, Option[String]) =
    {
      val result0 = future_result.join
      val result1 =
        export_consumer.shutdown(close = true).map(Output.error_message_text(_)) match {
          case Nil => result0
          case errs if result0.ok => result0.copy(rc = 1).errors(errs)
          case errs => result0.errors(errs)
        }

      Isabelle_System.rm_tree(export_tmp_dir)

      if (result1.ok) {
        for ((dir, pats) <- info.export_files) {
          Export.export_files(store, name, info.dir + dir,
            progress = if (verbose) progress else No_Progress,
            export_patterns = pats,
            export_prefix = name + ": ")
        }
        Present.finish(progress, store.browser_info, graph_file, info, name)
      }

      graph_file.delete

      val was_timeout =
        timeout_request match {
          case None => false
          case Some(request) => !request.cancel
        }

      val result2 =
        if (result1.interrupted) {
          if (was_timeout) result1.error(Output.error_message_text("Timeout")).was_timeout
          else result1.error(Output.error_message_text("Interrupt"))
        }
        else result1

      val heap_digest =
        if (result2.ok && do_output && store.output_heap(name).is_file)
          Some(Sessions.write_heap_digest(store.output_heap(name)))
        else None

      (result2, heap_digest)
    }
  }

  /** build with results **/

  class Results private[Build](results: Map[String, (Option[Process_Result], Sessions.Info)])
  {
    def sessions: Set[String] = results.keySet
    def cancelled(name: String): Boolean = results(name)._1.isEmpty
    def apply(name: String): Process_Result = results(name)._1.getOrElse(Process_Result(1))
    def info(name: String): Sessions.Info = results(name)._2
    val rc =
      (0 /: results.iterator.map(
        { case (_, (Some(r), _)) => r.rc case (_, (None, _)) => 1 }))(_ max _)
    def ok: Boolean = rc == 0

    override def toString: String = rc.toString
  }

  def build(
    options: Options,
    progress: Progress = No_Progress,
    check_unknown_files: Boolean = false,
    build_heap: Boolean = false,
    clean_build: Boolean = false,
    dirs: List[Path] = Nil,
    select_dirs: List[Path] = Nil,
    infos: List[Sessions.Info] = Nil,
    numa_shuffling: Boolean = false,
    max_jobs: Int = 1,
    list_files: Boolean = false,
    check_keywords: Set[String] = Set.empty,
    fresh_build: Boolean = false,
    no_build: Boolean = false,
    soft_build: Boolean = false,
    system_mode: Boolean = false,
    verbose: Boolean = false,
    pide: Boolean = false,
    requirements: Boolean = false,
    all_sessions: Boolean = false,
    base_sessions: List[String] = Nil,
    exclude_session_groups: List[String] = Nil,
    exclude_sessions: List[String] = Nil,
    session_groups: List[String] = Nil,
    sessions: List[String] = Nil,
    selection: Sessions.Selection = Sessions.Selection.empty): Results =
  {
    val build_options = options.int.update("completion_limit", 0).bool.update("ML_statistics", true)

    val store = Sessions.store(build_options, system_mode)

    /* session selection and dependencies */

    val full_sessions =
      Sessions.load_structure(build_options, dirs = dirs, select_dirs = select_dirs, infos = infos)

    def sources_stamp(deps: Sessions.Deps, name: String): String =
    {
      val digests =
        full_sessions(name).meta_digest :: deps.sources(name) ::: deps.imported_sources(name)
      SHA1.digest(cat_lines(digests.map(_.toString).sorted)).toString
    }

    val selection1 =
      Sessions.Selection(requirements, all_sessions, base_sessions, exclude_session_groups,
        exclude_sessions, session_groups, sessions) ++ selection

    val deps =
    {
      val deps0 =
        Sessions.deps(full_sessions.selection(selection1), full_sessions.global_theories,
          progress = progress, inlined_files = true, verbose = verbose,
          list_files = list_files, check_keywords = check_keywords).check_errors

      if (soft_build && !fresh_build) {
        val outdated =
          deps0.sessions_structure.build_topological_order.flatMap(name =>
            store.access_database(name) match {
              case Some(db) =>
                using(db)(store.read_build(_, name)) match {
                  case Some(build)
                  if build.ok && build.sources == sources_stamp(deps0, name) => None
                  case _ => Some(name)
                }
              case None => Some(name)
            })

        Sessions.deps(full_sessions.selection(Sessions.Selection(sessions = outdated)),
          full_sessions.global_theories, progress = progress, inlined_files = true).check_errors
      }
      else deps0
    }

    /* check unknown files */

    if (check_unknown_files) {
      val source_files =
        (for {
          (_, base) <- deps.session_bases.iterator
          (path, _) <- base.sources.iterator
        } yield path).toList
      val exclude_files = List(Path.explode("$POLYML_EXE")).map(_.canonical_file)
      val unknown_files =
        Mercurial.check_files(source_files)._2.
          filterNot(path => exclude_files.contains(path.canonical_file))
      if (unknown_files.nonEmpty) {
        progress.echo_warning("Unknown files (not part of the underlying Mercurial repository):" +
          unknown_files.map(path => path.expand.implode).sorted.mkString("\n  ", "\n  ", ""))
      }
    }

    /* main build process */

    val queue = Queue(progress, deps.sessions_structure, store)

    store.prepare_output_dir()

    if (clean_build) {
      for (name <- full_sessions.imports_descendants(full_sessions.imports_selection(selection1))) {
        val (relevant, ok) = store.clean_output(name)
        if (relevant) {
          if (ok) progress.echo("Cleaned " + name)
          else progress.echo(name + " FAILED to clean")
        }
      }
    }

    // scheduler loop
    case class Result(
      current: Boolean,
      heap_digest: Option[String],
      process: Option[Process_Result],
      info: Sessions.Info)
    {
      def ok: Boolean =
        process match {
          case None => false
          case Some(res) => res.rc == 0
        }
    }

    def sleep()
    {
      try { Thread.sleep(500) }
      catch { case Exn.Interrupt() => Exn.Interrupt.impose() }
    }

    val numa_nodes = new NUMA.Nodes(numa_shuffling)

    @tailrec def loop(
      pending: Queue,
      running: Map[String, (List[String], Job)],
      results: Map[String, Result]): Map[String, Result] =
    {
      def used_node(i: Int): Boolean =
        running.iterator.exists(
          { case (_, (_, job)) => job.numa_node.isDefined && job.numa_node.get == i })

      if (pending.is_empty) results
      else {
        if (progress.stopped)
          for ((_, (_, job)) <- running) job.terminate

        running.find({ case (_, (_, job)) => job.is_finished }) match {
          case Some((name, (input_heaps, job))) =>
            //{{{ finish job

            val (process_result, heap_digest) = job.join

            val log_lines = process_result.out_lines.filterNot(_.startsWith("\f"))
            val process_result_tail =
            {
              val tail = job.info.options.int("process_output_tail")
              process_result.copy(
                out_lines =
                  "(see also " + store.output_log(name).file.toString + ")" ::
                  (if (tail == 0) log_lines else log_lines.drop(log_lines.length - tail max 0)))
            }

            // write log file
            if (process_result.ok) {
              File.write_gzip(store.output_log_gz(name), terminate_lines(log_lines))
            }
            else File.write(store.output_log(name), terminate_lines(log_lines))

            // write database
            {
              val build_log =
                Build_Log.Log_File(name, process_result.out_lines).
                  parse_session_info(
                    command_timings = true,
                    theory_timings = true,
                    ml_statistics = true,
                    task_statistics = true)

              using(store.open_database(name, output = true))(db =>
                store.write_session_info(db, name,
                  build_log =
                    if (process_result.timeout) build_log.error("Timeout") else build_log,
                  build =
                    Session_Info(sources_stamp(deps, name), input_heaps, heap_digest,
                      process_result.rc)))
            }

            // messages
            process_result.err_lines.foreach(progress.echo(_))

            if (process_result.ok)
              progress.echo("Finished " + name + " (" + process_result.timing.message_resources + ")")
            else {
              progress.echo(name + " FAILED")
              if (!process_result.interrupted) progress.echo(process_result_tail.out)
            }

            loop(pending - name, running - name,
              results + (name -> Result(false, heap_digest, Some(process_result_tail), job.info)))
            //}}}
          case None if running.size < (max_jobs max 1) =>
            //{{{ check/start next job
            pending.dequeue(running.isDefinedAt(_)) match {
              case Some((name, info)) =>
                val ancestor_results =
                  deps.sessions_structure.build_requirements(List(name)).filterNot(_ == name).
                    map(results(_))
                val ancestor_heaps = ancestor_results.flatMap(_.heap_digest)

                val do_output = build_heap || Sessions.is_pure(name) || queue.is_inner(name)

                val (current, heap_digest) =
                {
                  store.access_database(name) match {
                    case Some(db) =>
                      using(db)(store.read_build(_, name)) match {
                        case Some(build) =>
                          val heap_digest = store.find_heap_digest(name)
                          val current =
                            !fresh_build &&
                            build.ok &&
                            build.sources == sources_stamp(deps, name) &&
                            build.input_heaps == ancestor_heaps &&
                            build.output_heap == heap_digest &&
                            !(do_output && heap_digest.isEmpty)
                          (current, heap_digest)
                        case None => (false, None)
                      }
                    case None => (false, None)
                  }
                }
                val all_current = current && ancestor_results.forall(_.current)

                if (all_current)
                  loop(pending - name, running,
                    results + (name -> Result(true, heap_digest, Some(Process_Result(0)), info)))
                else if (no_build) {
                  if (verbose) progress.echo("Skipping " + name + " ...")
                  loop(pending - name, running,
                    results + (name -> Result(false, heap_digest, Some(Process_Result(1)), info)))
                }
                else if (ancestor_results.forall(_.ok) && !progress.stopped) {
                  progress.echo((if (do_output) "Building " else "Running ") + name + " ...")

                  store.clean_output(name)
                  using(store.open_database(name, output = true))(store.init_session_info(_, name))

                  val numa_node = numa_nodes.next(used_node(_))
                  val job =
                    new Job(progress, name, info, deps, store, do_output,
                      verbose, pide, numa_node, queue.command_timings(name))
                  loop(pending, running + (name -> (ancestor_heaps, job)), results)
                }
                else {
                  progress.echo(name + " CANCELLED")
                  loop(pending - name, running,
                    results + (name -> Result(false, heap_digest, None, info)))
                }
              case None => sleep(); loop(pending, running, results)
            }
            ///}}}
          case None => sleep(); loop(pending, running, results)
        }
      }
    }

    /* build results */

    val results0 =
      if (deps.is_empty) {
        progress.echo_warning("Nothing to build")
        Map.empty[String, Result]
      }
      else loop(queue, Map.empty, Map.empty)

    val results =
      new Results(
        (for ((name, result) <- results0.iterator)
          yield (name, (result.process, result.info))).toMap)

    if (results.rc != 0 && (verbose || !no_build)) {
      val unfinished =
        (for {
          name <- results.sessions.iterator
          if !results(name).ok
         } yield name).toList.sorted
      progress.echo("Unfinished session(s): " + commas(unfinished))
    }

    /* global browser info */

    if (!no_build) {
      val browser_chapters =
        (for {
          (name, result) <- results0.iterator
          if result.ok
          info = full_sessions(name)
          if info.options.bool("browser_info")
        } yield (info.chapter, (name, info.description))).toList.groupBy(_._1).
            map({ case (chapter, es) => (chapter, es.map(_._2)) }).filterNot(_._2.isEmpty)

      for ((chapter, entries) <- browser_chapters)
        Present.update_chapter_index(store.browser_info, chapter, entries)

      if (browser_chapters.nonEmpty) Present.make_global_index(store.browser_info)
    }

    results
  }

  /* Isabelle tool wrapper */

  val isabelle_tool = Isabelle_Tool("build", "build and manage Isabelle sessions", args =>
  {
    val build_options = Word.explode(Isabelle_System.getenv("ISABELLE_BUILD_OPTIONS"))

    var base_sessions: List[String] = Nil
    var select_dirs: List[Path] = Nil
    var numa_shuffling = false
    var pide = false
    var requirements = false
    var soft_build = false
    var exclude_session_groups: List[String] = Nil
    var all_sessions = false
    var build_heap = false
    var clean_build = false
    var dirs: List[Path] = Nil
    var fresh_build = false
    var session_groups: List[String] = Nil
    var max_jobs = 1
    var check_keywords: Set[String] = Set.empty
    var list_files = false
    var no_build = false
    var options = Options.init(opts = build_options)
    var system_mode = false
    var verbose = false
    var exclude_sessions: List[String] = Nil

    val getopts = Getopts("""
Usage: isabelle build [OPTIONS] [SESSIONS ...]

  Options are:
    -B NAME      include session NAME and all descendants
    -D DIR       include session directory and select its sessions
    -N           cyclic shuffling of NUMA CPU nodes (performance tuning)
    -P           build via PIDE protocol
    -R           operate on requirements of selected sessions
    -S           soft build: only observe changes of sources, not heap images
    -X NAME      exclude sessions from group NAME and all descendants
    -a           select all sessions
    -b           build heap images
    -c           clean build
    -d DIR       include session directory
    -f           fresh build
    -g NAME      select session group NAME
    -j INT       maximum number of parallel jobs (default 1)
    -k KEYWORD   check theory sources for conflicts with proposed keywords
    -l           list session source files
    -n           no build -- test dependencies only
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
    -s           system build mode: produce output in ISABELLE_HOME
    -v           verbose
    -x NAME      exclude session NAME and all descendants

  Build and manage Isabelle sessions, depending on implicit settings:

""" + Library.prefix_lines("  ", Build_Log.Settings.show()) + "\n",
      "B:" -> (arg => base_sessions = base_sessions ::: List(arg)),
      "D:" -> (arg => select_dirs = select_dirs ::: List(Path.explode(arg))),
      "N" -> (_ => numa_shuffling = true),
      "P" -> (_ => pide = true),
      "R" -> (_ => requirements = true),
      "S" -> (_ => soft_build = true),
      "X:" -> (arg => exclude_session_groups = exclude_session_groups ::: List(arg)),
      "a" -> (_ => all_sessions = true),
      "b" -> (_ => build_heap = true),
      "c" -> (_ => clean_build = true),
      "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
      "f" -> (_ => fresh_build = true),
      "g:" -> (arg => session_groups = session_groups ::: List(arg)),
      "j:" -> (arg => max_jobs = Value.Int.parse(arg)),
      "k:" -> (arg => check_keywords = check_keywords + arg),
      "l" -> (_ => list_files = true),
      "n" -> (_ => no_build = true),
      "o:" -> (arg => options = options + arg),
      "s" -> (_ => system_mode = true),
      "v" -> (_ => verbose = true),
      "x:" -> (arg => exclude_sessions = exclude_sessions ::: List(arg)))

    val sessions = getopts(args)

    val progress = new Console_Progress(verbose = verbose)

    val start_date = Date.now()

    if (verbose) {
      progress.echo(
        "Started at " + Build_Log.print_date(start_date) +
          " (" + Isabelle_System.getenv("ML_IDENTIFIER") + " on " + Isabelle_System.hostname() +")")
      progress.echo(Build_Log.Settings.show() + "\n")
    }

    val results =
      progress.interrupt_handler {
        build(options,
          progress = progress,
          check_unknown_files = Mercurial.is_repository(Path.explode("~~")),
          build_heap = build_heap,
          clean_build = clean_build,
          dirs = dirs,
          select_dirs = select_dirs,
          numa_shuffling = NUMA.enabled_warning(progress, numa_shuffling),
          max_jobs = max_jobs,
          list_files = list_files,
          check_keywords = check_keywords,
          fresh_build = fresh_build,
          no_build = no_build,
          soft_build = soft_build,
          system_mode = system_mode,
          verbose = verbose,
          pide = pide,
          requirements = requirements,
          all_sessions = all_sessions,
          base_sessions = base_sessions,
          exclude_session_groups = exclude_session_groups,
          exclude_sessions = exclude_sessions,
          session_groups = session_groups,
          sessions = sessions)
      }
    val end_date = Date.now()
    val elapsed_time = end_date.time - start_date.time

    if (verbose) {
      progress.echo("\nFinished at " + Build_Log.print_date(end_date))
    }

    val total_timing =
      (Timing.zero /: results.sessions.iterator.map(a => results(a).timing))(_ + _).
        copy(elapsed = elapsed_time)
    progress.echo(total_timing.message_resources)

    sys.exit(results.rc)
  })

  /* build logic image */

  def build_logic(options: Options, logic: String,
    progress: Progress = No_Progress,
    build_heap: Boolean = false,
    dirs: List[Path] = Nil,
    system_mode: Boolean = false): Int =
  {
    if (build(options, build_heap = build_heap, no_build = true, dirs = dirs,
        system_mode = system_mode, sessions = List(logic)).ok) 0
    else {
      progress.echo("Build started for Isabelle/" + logic + " ...")
      Build.build(options, progress = progress, build_heap = build_heap, dirs = dirs,
        system_mode = system_mode, sessions = List(logic)).rc
    }
  }
}


text:
package org.wso2.carbon.policy.mgt.core.cache;

public class PolicyCacheException extends Exception {

    private static final long serialVersionUID = -4234546127441192907L;

    private String errorMessage;

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public PolicyCacheException(String msg, Exception nestedEx) {
        super(msg, nestedEx);
        setErrorMessage(msg);
    }

    public PolicyCacheException(String message, Throwable cause) {
        super(message, cause);
        setErrorMessage(message);
    }

    public PolicyCacheException(String msg) {
        super(msg);
        setErrorMessage(msg);
    }

    public PolicyCacheException() {
        super();
    }

    public PolicyCacheException(Throwable cause) {
        super(cause);
    }

}


text:
<?php

namespace DVL\Struct\Expressions;

use DVL\Struct\Context;

class BooleanUnaryExpression extends BaseBooleanExpression {

    const WRONG_TYPE_EXCEPTION_MESSAGE = "Unknown unary boolean expression type %d";

    const TYPE_NOT = 1;

    private $type;
    private $operand;

    function __construct($type, BaseExpression $operand) {
        $this->type = $type;
        $this->operand = $operand;
    }

    private function getValue(Context $context) {
        return $this->operand->calculate($context);
    }

    public function calculateRaw(Context $context) {
        switch ($this->type) {
            case static::TYPE_NOT:
                return !$this->getValue($context)->getBooleanWithTypeException();
            default:
                throw new ValidatorBinaryStructureException(
                        sprintf(static::WRONG_TYPE_EXCEPTION_MESSAGE, $this->type)
                    );
        }
    }

}


text:
class CBatchedLogger
{
private:
    bool accept;
    std::string header;
    std::string msg;
public:
    CBatchedLogger(uint64_t _category, const std::string& _header);
    virtual ~CBatchedLogger();

    template<typename... Args>
    void Batch(const std::string& fmt, const Args&... args)
    {
        if (!accept) {
            return;
        }
        msg += "    " + strprintf(fmt, args...) + "\n";
    }

    void Flush();
};

#endif//DASH_BATCHEDLOGGER_H