text:
<?php
/**
 * Marks the response type.
 *
 * PHP version 5
 *
 * @category Kolab
 * @package  Kolab_Filter
 * @author   Gunnar Wrobel <wrobel@pardus.de>
 * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
 * @link     http://pear.horde.org/index.php?package=Kolab_Server
 */

/**
 * Marks the response type.
 *
 * Copyright 2010 Klarälvdalens Datakonsult AB
 *
 * See the enclosed file COPYING for license information (LGPL). If you did not
 * receive this file, see
 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 *
 * @category Kolab
 * @package  Kolab_Filter
 * @author   Gunnar Wrobel <wrobel@pardus.de>
 * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
 * @link     http://pear.horde.org/index.php?package=Kolab_Server
 */
interface Horde_Kolab_Resource_Itip_Response_Type
{
    /**
     * Return the status of the response.
     *
     * @return string The status.
     */
    public function getStatus();

    /**
     * Return the abbreviated subject of the response.
     *
     * @return string The short subject.
     */
    public function getShortSubject();

    /**
     * Return the subject of the response.
     *
     * @param string $comment An optional comment that should appear in the
     *                        response subject.
     *
     * @return string The subject.
     */
    public function getSubject($comment = null);

    /**
     * Return an additional message for the response.
     *
     * @param boolean $is_update Indicates if the request was an update.
     * @param string  $comment   An optional comment that should appear in the
     *                           response message.
     *
     * @return string The message.
     */
    public function getMessage($is_update = false, $comment = null);
}


text:
@interface FLEXColorExplorerViewController ()
@property (nonatomic, readonly) UIColor *colorObject;
@end

@implementation FLEXColorExplorerViewController

- (UIColor *)colorObject
{
    return (UIColor *)self.object;
}

- (NSString *)displayedObjectDescription
{
    CGFloat h, s, l;
    CGFloat r, g, b, a;
    [self.colorObject getRed:&r green:&g blue:&b alpha:&a];
    [self.colorObject getHue:&h saturation:&s brightness:&l alpha:nil];

    return [NSString stringWithFormat:@"HSL: (%.3f, %.3f, %.3f)\nRGB: (%.3f, %.3f, %.3f)\nAlpha: %.3f", h, s, l, r, g, b, a];
}

- (NSString *)customSectionTitle
{
    return @"Color";
}

- (NSArray *)customSectionRowCookies
{
    return @[@0];
}

- (UIView *)customViewForRowCookie:(id)rowCookie
{
    if ([rowCookie isKindOfClass:[NSNumber class]]) {
        CGFloat width = UIScreen.mainScreen.bounds.size.width;
        switch ([rowCookie integerValue]) {
            case 0: {
                UIView *square = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 44)];
                square.backgroundColor = (UIColor *)self.object;
                return square;
            }
        }
    }

    return [super customViewForRowCookie:rowCookie];
}

- (BOOL)customSectionCanDrillIntoRowWithCookie:(id)rowCookie
{
    if ([@0 isEqual:rowCookie]) {
        return NO;
    }

    return [super customSectionCanDrillIntoRowWithCookie:rowCookie];
}

@end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<Policy xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
        PolicyId="a07478e8-3642-42ff-980e-911e26ec3f47"
        RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides">
   <Description>
				This is a reference policy for
				consent2share@outlook.com</Description>
   <Target/>
   <Rule Effect="Permit" RuleId="primary-group-rule">
      <Target>
         <Resources>
            <Resource>
               <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-regexp-match">
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">25a0d3f0-5b5d-11e3-9cbc-00155d466c30</AttributeValue>
                  <ResourceAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                                               DataType="http://www.w3.org/2001/XMLSchema#string"/>
               </ResourceMatch>
            </Resource>
         </Resources>
         <Actions>
            <Action>
               <ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">write</AttributeValue>
                  <ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
                                             DataType="http://www.w3.org/2001/XMLSchema#string"/>
               </ActionMatch>
            </Action>
         </Actions>
      </Target>
      <Condition>
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1083949036</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1568797520</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1902131865</AttributeValue>
               </Apply>
            </Apply>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1346575297</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1285969170</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1174858088</AttributeValue>
               </Apply>
            </Apply>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="gov.samhsa.consent2share.purpose-of-use-code"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ETREAT</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="gov.samhsa.consent2share.purpose-of-use-code"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TREAT</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="gov.samhsa.consent2share.purpose-of-use-code"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">HRESCH</AttributeValue>
               </Apply>
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                  <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
                     <SubjectAttributeDesignator MustBePresent="false"
                                                 AttributeId="gov.samhsa.consent2share.purpose-of-use-code"
                                                 DataType="http://www.w3.org/2001/XMLSchema#string"/>
                  </Apply>
                  <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PWATRNY</AttributeValue>
               </Apply>
            </Apply>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:dateTime-greater-than-or-equal">
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:dateTime-one-and-only">
                  <EnvironmentAttributeDesignator MustBePresent="false"
                                                  AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-dateTime"
                                                  DataType="http://www.w3.org/2001/XMLSchema#dateTime"/>
               </Apply>
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#dateTime">2013-06-12T00:00:00-04:00</AttributeValue>
            </Apply>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:dateTime-less-than-or-equal">
               <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:dateTime-one-and-only">
                  <EnvironmentAttributeDesignator MustBePresent="false"
                                                  AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-dateTime"
                                                  DataType="http://www.w3.org/2001/XMLSchema#dateTime"/>
               </Apply>
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#dateTime">2020-07-18T00:00:00-04:00</AttributeValue>
            </Apply>
         </Apply>
      </Condition>
   </Rule>
   <Rule Effect="Deny" RuleId="deny-others"/>
   <Obligations>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">51848-0</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">121181</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">47420-5</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">46240-8</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">ETH</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">GDIS</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">PSY</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">SEX</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">18748-4</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">11504-8</AttributeAssignment>
      </Obligation>
      <Obligation ObligationId="urn:samhsa:names:tc:consent2share:1.0:obligation:redact-document-section-code"
                  FulfillOn="Permit">
         <AttributeAssignment AttributeId="urn:oasis:names:tc:xacml:3.0:example:attribute:text"
                              DataType="http://www.w3.org/2001/XMLSchema#string">34117-2</AttributeAssignment>
      </Obligation>
   </Obligations>
</Policy>


text:
package com.pxhero.coolweather.util;

/**
 * Created by pengxianheng on 2016/9/27.
 */
public interface ProcessDataCallbackListener {
    void OnFinish();
    void OnError();
}


text:
/**
 * Notifier interface.
 * All notifier scripts have to follow this interface.
 */
interface INotifier {
  /**
   * Get the name of the notifier.
   * @returns {string} Name.
   */
  getName(): string;
  /**
   * Get the notifier version.
   * @returns {string} Version.
   */
  getVersion(): string;
  /**
   * Send error message to notifier.
   * @param {string} error Error message.
   * @param {function} done Callback to fire on done: function(void) => void.
   */
  sendError(error: string, done: () => void): void;
  /**
   * Send success message to notifier.
   * @param {string} message Message to pass to notifier.
   * @param {number} time Time the task took.
   * @param {function} done Callback to fire on done: function(void) => void.
   */
  sendSuccess(message: string, time: number, done: () => void): void;
  /**
   * Send message to notifier.
   * @param {string} message Message to send.
   * @param {function} done Callback to fire on done: function(void) => void.
   */
  sendMessage(message: string, done: () => void): void;
}

export = INotifier;


text:
<?php

namespace GoldenPlanet\WebpackBundle\Webpack\Config;

use GoldenPlanet\WebpackBundle\ErrorHandler\ErrorHandlerInterface;
use GoldenPlanet\WebpackBundle\Exception\AssetNotFoundException;
use GoldenPlanet\WebpackBundle\Exception\NoEntryPointsException;
use GoldenPlanet\WebpackBundle\Model\WebpackConfigModel;
use GoldenPlanet\WebpackBundle\Provider\AliasProvider;
use GoldenPlanet\WebpackBundle\Service\AssetCollector;
use GoldenPlanet\WebpackBundle\Service\AssetNameGenerator;
use GoldenPlanet\WebpackBundle\Service\AssetResolver;

class WebpackConfigManager
{
	const DEFAULT_GROUP_NAME = 'default';

	private $aliasProvider;
	private $assetCollector;
	private $configDumper;
	private $configPath;
	private $assetResolver;
	private $assetNameGenerator;
	private $errorHandler;

	public function __construct(
		AliasProvider $aliasProvider,
		AssetCollector $assetCollector,
		WebpackConfigDumper $configDumper,
		$configPath,
		AssetResolver $assetResolver,
		AssetNameGenerator $assetNameGenerator,
		ErrorHandlerInterface $errorHandler
	) {
		$this->aliasProvider = $aliasProvider;
		$this->assetCollector = $assetCollector;
		$this->configDumper = $configDumper;
		$this->configPath = $configPath;
		$this->assetResolver = $assetResolver;
		$this->assetNameGenerator = $assetNameGenerator;
		$this->errorHandler = $errorHandler;
	}

	/**
	 * Generate main `webpack.config.js`
	 * which requires the `webpack.symfony.config.js`
	 *
	 * Collects all data for the webpack config's `options` object:
	 * - Aliases
	 * - Entry points
	 * - Commons chunk groups
	 *
	 * @param WebpackConfigModel $previousConfig Provided when called in a loop
	 *                                           in watch mode (when watching TWIG files for changes)
	 *
	 * @return WebpackConfigModel
	 */
	public function collectAndDump(WebpackConfigModel $previousConfig = null)
	{
		$aliases = $this->aliasProvider->getAliases();

		$assetCollection = $this->assetCollector
			->getAssets(
				$previousConfig !== null ? $previousConfig->getCacheContext() : null
			);

		$entryPoints = [];
		$assetGroups = [];

		// Collect entry points
		foreach ($assetCollection->getAssets() as $asset) {

			$assetPath = $asset->getResource();
			$assetName = $this->assetNameGenerator->generateName($assetPath);

			try {
				$entryPoints[$assetName] = $this->assetResolver->resolveAsset($assetPath);
			} catch (AssetNotFoundException $exception) {
				$this->errorHandler->processException($exception);
			}

			$groupName = $asset->getGroup() !== null ? $asset->getGroup() : self::DEFAULT_GROUP_NAME;
			$assetGroups[$groupName][] = $assetName;
		}

		if (count($entryPoints) === 0) {
			throw new NoEntryPointsException();
		}

		$config = new WebpackConfigModel();
		$config->setAliases($aliases);
		$config->setAssetGroups($assetGroups);
		$config->setEntryPoints($entryPoints);
		$config->setCacheContext($assetCollection->getContext());

		if (
			$previousConfig === null
			|| $aliases !== $previousConfig->getAliases()
			|| $assetGroups !== $previousConfig->getAssetGroups()
			|| $entryPoints !== $previousConfig->getEntryPoints()
			|| !file_exists($previousConfig->getConfigPath())
		) {
			$this->configDumper->dump($config);
			$config->setConfigPath($this->configPath);
			$config->setFileDumped(true);
		} else {
			$config->setConfigPath($previousConfig->getConfigPath());
		}

		return $config;
	}
}


text:
var SelectButton = require('./buttonFilters').SelectButton;
var DownloadButton = require('./buttonFilters').DownloadButton;
var ConditionalSelectButton = require('./buttonFilters').ConditionalSelectButton;
var ApiButton = require('./buttonFilters').ApiButton;
var SliderInput = require('./slider').SliderInput;
var DynamicSearch = require('./dynamicSearch').DynamicSearch;

var FilterFactory = function(type) {

    if (typeof FilterFactory[type] != 'function'){
        throw new Error(type + ' is not a valid filter.');
    }

    return FilterFactory[type];
};

FilterFactory.SliderInput = SliderInput;
FilterFactory.SelectButton = SelectButton;
FilterFactory.ConditionalSelectButton = ConditionalSelectButton;
FilterFactory.ApiButton = ApiButton;
FilterFactory.DownloadButton = DownloadButton;
FilterFactory.DynamicSearch = DynamicSearch;

const Filter = React.createClass({
    getDefaultProps: function() {
        return {
            type: React.PropTypes.string.isRequired,
            options: React.PropTypes.object,
            dynamic: false,
            onChange: React.PropTypes.func
        };
    },
    render: function(){
        var Z = FilterFactory(this.props.type);
        return (
            <Z ref={"filter"}
                dynamic={this.props.dynamic}
                onChange={this.props.onChange}
                options={this.props.options} />
        );
    }
});

module.exports.Filter = Filter;


text:
This Agent check only collects metrics for message offsets. If you want to collect metrics about the Kafka brokers themselves, see the kafka check.

This check fetches the highwater offsets from the Kafka brokers, consumer offsets for old-style consumers that store their offsets in zookeeper, and the calculated consumer lag (which is the difference between those two metrics).

This check does NOT support Kafka versions > 0.8—it can't collect consumer offsets for new-style consumer groups which store their offsets in Kafka. If run such a version of Kafka, track [this issue on GitHub](https://github.com/DataDog/integrations-core/issues/457).

## Setup
### Installation

The Agent's Kafka consumer check is packaged with the Agent, so simply [install the Agent](https://app.datadoghq.com/account/settings#agent) on your Kafka nodes. If you need the newest version of the check, install the `dd-check-kafka-consumer` package.

### Configuration

Create a `kafka_consumer.yaml` file using [this sample conf file](https://github.com/DataDog/integrations-core/blob/master/kafka_consumer/conf.yaml.example) as an example. Then restart the Datadog Agent to start sending metrics to Datadog.

### Validation

Run the Agent's `info` subcommand and look for `kafka_consumer` under the Checks section:

```
  Checks
  ======
    [...]

    kafka_consumer
    -------
      - instance #0 [OK]
      - Collected 26 metrics, 0 events & 1 service check

    [...]
```

## Compatibility

The kafka_consumer check is compatible with all major platforms.

## Data Collected
### Metrics
See [metadata.csv](https://github.com/DataDog/integrations-core/blob/master/kafka_consumer/metadata.csv) for a list of metrics provided by this check.

### Events
The Kafka-consumer check does not include any event at this time.

### Service Checks
The Kafka-consumer check does not include any service check at this time.

## Troubleshooting
### Specifying a non existent partition in your kafka_Consumer.yaml file
If you get this error in your info.log:
```
instance - #0 [Error]: ''
```

Specify the specific partition of your environment for your topic in your kafka_Consumer.yaml file:
```
#my_topic [0, 1, 4, 12]
```

## Further Reading

## Further Reading

* [Monitoring Kafka performance metrics](https://www.datadoghq.com/blog/monitoring-kafka-performance-metrics/)
* [Collecting Kafka performance metrics](https://www.datadoghq.com/blog/collecting-kafka-performance-metrics/)
* [Monitoring Kafka with Datadog](https://www.datadoghq.com/blog/monitor-kafka-with-datadog/)


text:
var fs = require('fs');

var queue = {
    start: 1,
    'undefined': 2,
    end: 3
};

module.exports = {
    updateBowerVersion: function() {
        var pack = require('../package.json');
        var bower = require('../bower.json');
        if(pack.version !== bower.version) {
            bower.version = pack.version;
            fs.writeFileSync('../bower.json', JSON.stringify(bower, null, '  '));
        }
    },
    buildTitles: function() {
        var txt = fs.readFileSync('dist/typograf.titles.json');
        fs.writeFileSync('dist/typograf.titles.js', 'Typograf.titles = ' + txt + ';\n');
    },
    buildGroups: function() {
        var txt = fs.readFileSync('dist/typograf.groups.json');
        fs.writeFileSync('dist/typograf.groups.js', 'Typograf.groups = ' + txt + ';\n');
    },
    makeMdRules: function() {
        var Typograf = require('../dist/typograf.js'),
            titles = require('../dist/typograf.titles.json'),
            rules = Typograf.prototype._rules,
            getRow = function(rule, i, lang) {
                var title = titles[rule.name][lang] || titles[rule.name].common;
                return '| ' + i + '. | [' +
                    rule.name + '](../src/rules/' + rule.name + '.js) | ' +
                    title + ' | ' +
                    rule.sortIndex + ' | ' +
                    (rule.queue || '') + ' | ' +
                    (rule.enabled === false || rule.disabled === true ? '' : '✓') + ' |\n';
            },
            processTemplate = function(file, templateFile, text) {
                var template = fs.readFileSync(templateFile).toString();
                fs.writeFileSync(file, template.replace(/{{content}}/, text));
            },
            buildDoc = function() {
                Typograf._langs.forEach(function(lang) {
                    var text = '';

                    rules.forEach(function(rule, i) {
                        text += getRow(rule, i + 1, lang);
                    });

                    processTemplate('docs/RULES.' + lang + '.md', 'gulp/templates/RULES.' + lang + '.md', text);
                });
            };

        rules.sort(function(a, b) {
            if(a.name > b.name) {
                return 1;
            } else {
                return -1;
            }
        });

        buildDoc();

        rules.sort(function(a, b) {
            var queueA = queue[a.queue],
                queueB = queue[b.queue];
            if(queueA === queueB) {
                if(a.sortIndex > b.sortIndex) {
                    return 1;
                } else if(a.sortIndex < b.sortIndex) {
                    return -1;
                } else {
                    return 0;
                }
            } else if(queueA > queueB) {
                return 1;
            } else {
                return -1;
            }
        });

        buildDoc();
    }
};


text:
// This file implements logic for translating mixed IR to buffer form.

#include "mlir/Transforms/Bufferize.h"  // from @llvm-project

#include "mlir/Dialect/MemRef/IR/MemRef.h"  // from @llvm-project
#include "mlir/Dialect/SCF/SCF.h"  // from @llvm-project
#include "mlir/Dialect/StandardOps/IR/Ops.h"  // from @llvm-project
#include "mlir/IR/Attributes.h"  // from @llvm-project
#include "mlir/IR/BlockAndValueMapping.h"  // from @llvm-project
#include "mlir/IR/BuiltinTypes.h"  // from @llvm-project
#include "mlir/IR/ImplicitLocOpBuilder.h"  // from @llvm-project
#include "mlir/Transforms/DialectConversion.h"  // from @llvm-project
#include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h"
#include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/rewriters.h"

namespace mlir {
namespace kernel_gen {
namespace transforms {
namespace {

class BufferizeConstantOp : public OpConversionPattern<ConstantOp> {
 public:
  using OpConversionPattern<ConstantOp>::OpConversionPattern;

  LogicalResult matchAndRewrite(
      ConstantOp op, ArrayRef<Value> operands,
      ConversionPatternRewriter &rewriter) const final {
    // We only need to bufferize tensor constants.
    Location loc = op.getLoc();
    auto result_type = op.getType().dyn_cast<RankedTensorType>();
    int64_t result_rank = result_type.getRank();
    if (!result_type || !result_type.hasStaticShape() || result_rank > 1)
      return failure();

    auto memref_type =
        MemRefType::get(result_type.getShape(), result_type.getElementType());
    auto elements_attr = op.value().cast<DenseElementsAttr>();

    if (result_rank == 0) {
      Value buffer = rewriter.create<memref::AllocOp>(loc, memref_type);
      Value constant =
          rewriter.create<ConstantOp>(loc, elements_attr.getValue({}));
      rewriter.create<memref::StoreOp>(loc, constant, buffer);
      rewriter.replaceOp(op, {buffer});
      return success();
    }

    Value buffer = rewriter.create<memref::AllocaOp>(loc, memref_type);

    bool all_same_elems = elements_attr.isSplat();
    Value value;
    if (all_same_elems)
      value = rewriter.create<ConstantOp>(loc, elements_attr.getSplatValue());
    for (auto en : llvm::enumerate(elements_attr.getAttributeValues())) {
      if (!all_same_elems) value = rewriter.create<ConstantOp>(loc, en.value());
      Value index = rewriter.create<ConstantIndexOp>(loc, en.index());
      rewriter.create<memref::StoreOp>(loc, value, buffer, index);
    }
    rewriter.replaceOp(op, {buffer});
    return success();
  }
};

class BufferizeDimOp : public OpConversionPattern<memref::DimOp> {
 public:
  using OpConversionPattern::OpConversionPattern;
  LogicalResult matchAndRewrite(
      memref::DimOp op, ArrayRef<Value> operands,
      ConversionPatternRewriter &rewriter) const override {
    memref::DimOp::Adaptor adaptor(operands);
    rewriter.replaceOpWithNewOp<memref::DimOp>(op, adaptor.memrefOrTensor(),
                                               adaptor.index());
    return success();
  }
};

class BufferizeAndConvertMinimumBroadcastShapesOp
    : public OpConversionPattern<chlo::MinimumBroadcastShapesOp> {
 public:
  using OpConversionPattern<
      chlo::MinimumBroadcastShapesOp>::OpConversionPattern;

  LogicalResult matchAndRewrite(
      chlo::MinimumBroadcastShapesOp broadcast_shapes_op,
      ArrayRef<Value> operands,
      ConversionPatternRewriter &rewriter) const override {
    chlo::MinimumBroadcastShapesOp::Adaptor adaptor(operands);
    auto loc = broadcast_shapes_op.getLoc();
    ImplicitLocOpBuilder lb(loc, rewriter);
    Value zero = lb.create<ConstantIndexOp>(0);
    SmallVector<Value> shapes = adaptor.shapes();
    size_t k = shapes.size();
    SmallVector<Value> ranks;
    ranks.reserve(k);
    SmallVector<Value> real_ranks;
    real_ranks.reserve(k);
    SmallVector<Value> leading_ones;
    leading_ones.reserve(k);

    // Determine the "real" rank of each operand shape by counting leading 1's.
    for (size_t i = 0; i < k; ++i) {
      Value rank = lb.create<memref::DimOp>(loc, shapes[i], zero);
      ranks.push_back(rank);
      leading_ones.push_back(CountLeadingOnes(lb, shapes[i], rank));
      Value real_rank = lb.create<SubIOp>(rank, leading_ones[i]);
      real_ranks.push_back(real_rank);
    }

    // Determine the maximum real rank of the operands.
    Value max_rank = real_ranks[0];
    for (size_t i = 1; i < k; ++i) {
      Value rank_is_greater =
          lb.create<CmpIOp>(CmpIPredicate::ugt, real_ranks[i], max_rank);
      max_rank = lb.create<SelectOp>(rank_is_greater, real_ranks[i], max_rank);
    }

    // Allocate buffers for the return values and initialize them with 1's.
    SmallVector<Value> result_shapes;
    result_shapes.reserve(k);
    auto result_type =
        MemRefType::get({ShapedType::kDynamicSize}, lb.getIndexType());
    Value one = lb.create<ConstantIndexOp>(1);
    for (size_t i = 0; i < k; ++i) {
      // We assume the buffer will be small, so we allocate it on the stack.
      // TODO(b/181654096): Replace AllocaOp with AllocOp.
      auto result = lb.create<memref::AllocaOp>(result_type, real_ranks[i]);
      lb.create<scf::ForOp>(zero, real_ranks[i], one, llvm::None,
                            [&one, &result](OpBuilder &b, Location l, Value idx,
                                            ValueRange /*vr*/) {
                              b.create<memref::StoreOp>(l, one, result, idx);
                              b.create<scf::YieldOp>(l, llvm::None);
                            });
      result_shapes.push_back(result);
    }

    // Iterate through the dimensions and determine which adjacent dimensions
    // can be combined. Keep a running product of the dimensions that can be
    // combined as iteration variable (initialized to 1), and the current
    // dimension offset in the result shapes. We iterate through the shapes
    // backward, because the broadcasting semantics mean that the last
    // dimensions of each shape (the least significant ones) are matched
    // together.
    Value two = lb.create<ConstantIndexOp>(2);
    Value max_rank_plus_two = lb.create<AddIOp>(loc, max_rank, two);
    Value constant_false =
        lb.create<ConstantOp>(lb.getI1Type(), lb.getBoolAttr(false));
    SmallVector<Value> init_values;
    init_values.reserve(k + 3);
    // Initially, all values are marked as not broadcasted.
    for (int i = 0; i < k; ++i) {
      init_values.push_back(constant_false);
    }
    // The running product is initially 1.
    init_values.push_back(one);
    // The current dimension offset is initially 0.
    init_values.push_back(zero);
    // Whether the broadcasting is invalid.
    init_values.push_back(constant_false);

    // Iterate from 1 to max_rank + 1 (inclusive). This iteration variable is
    // used as an offset from the end of each shape vector. We iterate until
    // max_rank + 1 to handle the case that we have a running_product > 1 left
    // when we have processed all dimensions of the largest shape.
    auto main_loop = lb.create<scf::ForOp>(
        one, max_rank_plus_two, one, init_values,
        [&](OpBuilder &b, Location l, Value v, ValueRange vr) {
          // 'same_size' should track what the size of the dimension is to which
          // the 1-sized dimensions are broadcasted. If all of the dimensions
          // are 1, it will stay 1.
          Value same_size = one;
          // 'result_dimensions' stores the current dimension with an offset of
          // 'leading_ones' to make it easier to check whether we are in-bounds
          // with respect to the "real" shape with leading 1's removed.
          SmallVector<Value> result_dimensions;
          result_dimensions.reserve(k);
          // 'no_broadcasting' stores boolean flags that encode whether the
          // corresponding shape does not need broadcasting at the current
          // position.
          SmallVector<Value> no_broadcasting;
          no_broadcasting.reserve(k + 3);
          // The first k loop carried values are the previous broadcasting
          // state.
          auto prev_no_broadcasting = vr.take_front(k);

          // This loop checks which shapes need broadcasting at the current
          // dimension. A shape needs broadcasting if it is indexed out of
          // bounds, or its current dimension size is 1.
          Value current_dimension_has_invalid_broadcast = constant_false;
          for (size_t i = 0; i < k; ++i) {
            // Determine the size of the current dimension. If the dimension is
            // out of bounds, we choose the value 'one'.
            Value is_out_of_bounds =
                b.create<CmpIOp>(l, CmpIPredicate::ult, real_ranks[i], v);
            Value dimension = b.create<SubIOp>(l, ranks[i], v);
            Value result_dimension =
                b.create<SubIOp>(l, dimension, leading_ones[i]);
            result_dimensions.push_back(result_dimension);
            Value current_size =
                b.create<scf::IfOp>(
                     l, TypeRange{b.getIndexType()}, is_out_of_bounds,
                     [&](OpBuilder &b, Location l) {
                       b.create<scf::YieldOp>(l, one);
                     },
                     [&](OpBuilder &b, Location l) {
                       // Using IfOp instead of SelectOp makes sure that we
                       // don't try to load if the dimension is out of bounds.
                       Value size =
                           b.create<memref::LoadOp>(l, shapes[i], dimension);
                       b.create<scf::YieldOp>(l, size);
                     })
                    .getResult(0);
            // Compute whether the current dimension does require broadcasting.
            Value current_size_is_not_one =
                b.create<CmpIOp>(l, CmpIPredicate::ne, current_size, one);
            no_broadcasting.push_back(current_size_is_not_one);
            Value new_same_size = b.create<SelectOp>(l, current_size_is_not_one,
                                                     current_size, same_size);
            Value same_size_was_not_one =
                b.create<CmpIOp>(l, CmpIPredicate::ne, same_size, one);
            Value is_different_size = b.create<CmpIOp>(
                l, CmpIPredicate::ne, same_size, new_same_size);
            // The broadcast is invalid if the size of the current dimension
            // is not equal to the expected size, unless the expected size was
            // still the initial value 1.
            Value is_invalid =
                b.create<AndOp>(l, same_size_was_not_one, is_different_size);
            current_dimension_has_invalid_broadcast = b.create<OrOp>(
                l, current_dimension_has_invalid_broadcast, is_invalid);
            same_size = new_same_size;
          }

          // Check whether we have at least one shape that has a different
          // status regarding whether it needs broadcasting at the current
          // dimension versus whether it needs broadcasting at the previous
          // dimension.
          Value same_size_is_one =
              b.create<CmpIOp>(l, CmpIPredicate::eq, same_size, one);
          Value different_broadcasting_set = constant_false;
          for (size_t i = 0; i < k; ++i) {
            // If all dimensions are 1, we preserve the status whether a shape
            // needs broadcasting or not, because in that case the dimension can
            // just be ignored.
            no_broadcasting[i] =
                b.create<SelectOp>(l, same_size_is_one, prev_no_broadcasting[i],
                                   no_broadcasting[i]);
            // Compare whether the current shape changes its status regarding
            // whether it needs broadcasting at the current dimension.
            Value broadcasting_is_different =
                b.create<CmpIOp>(l, CmpIPredicate::ne, prev_no_broadcasting[i],
                                 no_broadcasting[i]);
            different_broadcasting_set = b.create<OrOp>(
                l, different_broadcasting_set, broadcasting_is_different);
          }
          Value running_product = vr[k];
          Value current_dimension_offset = vr[k + 1];

          // We need to stop combining dimensions if the set of shapes which
          // need broadcasting at the current dimension changes compared to the
          // set of shapes needing broadcasting at the previous dimension.
          Value is_last_iteration =
              b.create<CmpIOp>(l, CmpIPredicate::sgt, v, max_rank);
          Value stop_combining_dimensions =
              b.create<OrOp>(l, is_last_iteration, different_broadcasting_set);
          auto if_stop_combining_dimensions = b.create<scf::IfOp>(
              l, TypeRange{b.getIndexType(), b.getIndexType()},
              stop_combining_dimensions,
              [&](OpBuilder &b, Location l) {
                // If the running product is not 1, add one dimension of size
                // 'running_product' to each shape that didn't need
                // broadcasting, otherwise add a 1 dimension if it was
                // previously indexed in-bounds.
                Value running_product_not_one = b.create<CmpIOp>(
                    l, CmpIPredicate::ne, running_product, one);
                Value new_dimension_offset =
                    b.create<scf::IfOp>(
                         l, TypeRange{b.getIndexType()},
                         running_product_not_one,
                         [&](OpBuilder &b, Location l) {
                           Value new_dimension_offset = b.create<AddIOp>(
                               l, current_dimension_offset, one);
                           Value minus_one = lb.create<ConstantIndexOp>(-1);
                           for (size_t i = 0; i < k; ++i) {
                             Value was_in_bounds = b.create<CmpIOp>(
                                 l, CmpIPredicate::sge, result_dimensions[i],
                                 minus_one);
                             Value should_store_dimension = b.create<OrOp>(
                                 l, was_in_bounds, prev_no_broadcasting[i]);
                             b.create<scf::IfOp>(
                                 l, should_store_dimension,
                                 [&](OpBuilder &b, Location l) {
                                   Value output_dimension = b.create<SubIOp>(
                                       l, real_ranks[i], new_dimension_offset);
                                   // If the shape needed broadcasting at the
                                   // previous dimension, we set the output size
                                   // to 1, otherwise to 'running_product'.
                                   Value output_size = b.create<SelectOp>(
                                       l, prev_no_broadcasting[i],
                                       running_product, one);
                                   b.create<memref::StoreOp>(l, output_size,
                                                             result_shapes[i],
                                                             output_dimension);
                                   b.create<scf::YieldOp>(l, llvm::None);
                                 });
                           }
                           b.create<scf::YieldOp>(l, new_dimension_offset);
                         },
                         [&](OpBuilder &b, Location l) {
                           b.create<scf::YieldOp>(l, current_dimension_offset);
                         })
                        .getResult(0);
                b.create<scf::YieldOp>(
                    l, ValueRange{same_size, new_dimension_offset});
              },
              [&](OpBuilder &b, Location l) {
                Value new_running_product =
                    b.create<MulIOp>(l, running_product, same_size);
                b.create<scf::YieldOp>(l, ValueRange{new_running_product,
                                                     current_dimension_offset});
              });
          // Add the remaining results.
          no_broadcasting.push_back(if_stop_combining_dimensions.getResult(0));
          no_broadcasting.push_back(if_stop_combining_dimensions.getResult(1));
          Value is_invalid = vr.back();
          is_invalid = b.create<OrOp>(l, is_invalid,
                                      current_dimension_has_invalid_broadcast);
          no_broadcasting.push_back(is_invalid);
          b.create<scf::YieldOp>(l, no_broadcasting);
        });
    Value is_invalid = main_loop.getResults().back();
    for (size_t i = 0; i < k; ++i) {
      result_shapes[i] =
          RemoveLeadingOnesFrom1DMemref(lb, result_shapes[i], real_ranks[i]);
      result_shapes[i] =
          lb.create<SelectOp>(is_invalid, shapes[i], result_shapes[i]);
    }
    rewriter.replaceOp(broadcast_shapes_op, result_shapes);
    return success();
  }

 private:
  Value CountLeadingOnes(ImplicitLocOpBuilder &lb, Value extent_memref,
                         Value rank) const {
    // Count leading 1's. Use two iteration variables for that: one with a
    // boolean flag for whether every size so far was 1, one with the number of
    // leading 1's.
    Value constant_true =
        lb.create<ConstantOp>(lb.getI1Type(), lb.getBoolAttr(true));
    Value zero = lb.create<ConstantIndexOp>(0);
    Value one = lb.create<ConstantIndexOp>(1);
    auto leading_ones_loop = lb.create<scf::ForOp>(
        zero, rank, one, ValueRange{constant_true, zero},
        [&](OpBuilder &b, Location l, Value idx, ValueRange vr) {
          auto size = b.create<memref::LoadOp>(l, extent_memref, idx);
          auto is_equal_to_one =
              b.create<CmpIOp>(l, CmpIPredicate::eq, size, one);
          auto all_ones = b.create<AndOp>(l, vr.front(), is_equal_to_one);
          auto increased_value = b.create<AddIOp>(l, vr.back(), one);
          auto number_of_leading_ones =
              b.create<SelectOp>(l, all_ones, increased_value, vr.back());
          b.create<scf::YieldOp>(l,
                                 ValueRange{all_ones, number_of_leading_ones});
        });
    return leading_ones_loop.results()[1];
  }

  Value RemoveLeadingOnesFrom1DMemref(ImplicitLocOpBuilder &lb,
                                      Value extent_memref, Value rank) const {
    Value leading_ones = CountLeadingOnes(lb, extent_memref, rank);
    Value new_rank = lb.create<SubIOp>(rank, leading_ones);
    auto result_type =
        MemRefType::get({ShapedType::kDynamicSize}, lb.getIndexType());
    // Ideally we would use SubView here to return a MemRef with 'leading_ones'
    // as offset, but several things related to MemRef with offsets are
    // currently broken, so instead we just allocate another buffer of the
    // desired size and copy the elements over. We assume the buffer will be
    // small, so we allocate it on the stack.
    // TODO(b/181654096): Replace AllocaOp with AllocOp.
    Value result = lb.create<memref::AllocaOp>(result_type, new_rank);
    Value zero = lb.create<ConstantIndexOp>(0);
    Value one = lb.create<ConstantIndexOp>(1);
    lb.create<scf::ForOp>(
        zero, new_rank, one, llvm::None,
        [&](OpBuilder &b, Location l, Value idx, ValueRange /*vr*/) {
          Value idx_with_offset = b.create<AddIOp>(l, idx, leading_ones);
          auto size =
              b.create<memref::LoadOp>(l, extent_memref, idx_with_offset);
          b.create<memref::StoreOp>(l, size, result, idx);
          b.create<scf::YieldOp>(l, llvm::None);
        });
    return result;
  }
};

class BufferizeRankOp : public OpConversionPattern<RankOp> {
 public:
  using OpConversionPattern::OpConversionPattern;
  LogicalResult matchAndRewrite(
      RankOp op, ArrayRef<Value> operands,
      ConversionPatternRewriter &rewriter) const override {
    RankOp::Adaptor adaptor(operands);
    rewriter.replaceOpWithNewOp<RankOp>(op, adaptor.memrefOrTensor());
    return success();
  }
};
}  // namespace

void populateExtraStdBufferizePattern(MLIRContext *context,
                                      BufferizeTypeConverter *converter,
                                      OwningRewritePatternList *patterns) {
  patterns
      ->insert<BufferizeConstantOp, BufferizeDimOp,
               BufferizeAndConvertMinimumBroadcastShapesOp, BufferizeRankOp>(
          *converter, context);
}

}  // namespace transforms
}  // namespace kernel_gen
}  // namespace mlir


text:
.. _overview:

Overview
========

The Ras Executable Model (REM) is a model of the signaling pathway of the Ras
family proteins (K-RAS, N-RAS, H-RAS), including their regulators and
effectors, at a biochemical level of detail. It is a `rule-based
model <http://www.nature.com/nmeth/journal/v8/n2/full/nmeth0211-130.html>`_
written in `PySB. <http://www.pysb.org>`_

REM consists of three interlinked levels. :ref:`Model components <components>` consist of PySB modules that implement pathway mechanisms.
A :ref:`model scenario <scenarios>` corresponds to a specific use case and imports one or more model components in a fit-to-purpose manner to instantiate an executable model.
Each model scenario can have a set of corresponding :ref:`model analysis <analysis>` scripts.

|rem-archi|

REM is built via a combination of automated assembly using `INDRA (Integrated Network and Dynamical Reasonging Assembler) <https://github.com/sorgerlab/indra>`_, and manual development by a team of modelers.

The Ras Executable Model is being developed as part of `DARPA's Big Mechanism
program <http://www.darpa.mil/Our_Work/I2O/Programs/Big_Mechanism.aspx>`_ by the
`Sorger Lab <http://sorrger.med.harvard.edu>`_ at Harvard Medical School and
collaborators within the Big Mechanism program. In the context of the
program's overall effort to automate the construction of models from
the scientific literature, the development of the Ras model has the
following motivations:

1. Systems biology resource.
2. Opportunity to engage biological domain experts.
3. Investigation of the combination of manual and automated reading and modeling process.
4. Resource for improving reading algorithms.
5. Reference standard for evaluating reading algorithms.

A "literate" model
------------------

To better understand the relationship between scientific texts and executable
models, in REM the documentation and evidence supporting the various
biochemical reactions is a primary, rather than a supporting feature. As a
means of more fully integrating textual evidence with executable modeling code
we have adopted a `"literate" style of programming.
<http://en.wikipedia.org/wiki/Literate_Programming>`_  As first described by
computer scientist Donald Knuth, in literate programming,

    Instead of imagining that our main task is to instruct a computer what to
    do, let us concentrate rather on explaining to human beings what we want a
    computer to do.

Our goal for REM is for a human reader with biological and/or modeling
expertise to read it, much like a scientific paper or review, and evaluate
whether the implementation of the model's various mechanistic assertions are
adequately supported by the textual evidence.

To do this, we exploit the fact that in PySB, biological models are implemented
as Python programs, which allows tools and conventions for computer programming
to be applied to the organization and documentation of models. In REM, we embed
the PySB modeling code within the documentation itself, which is written in
`reStructuredText. <http://docutils.sourceforge.net/rst.html>`_ The
documentation is processed and formatted using the Python documentation
generator, `Sphinx, <http://sphinx-doc.org>`_ while the remainder of the build
process extracts the model code from the documentation, and executes it to
generate various outputs: exports of the model in several formats (BNGL, Kappa,
SBML), visualizations, and simulation results.

Ty Thomson's `Yeast Pheromone Model <http://yeastpheromonemodel.org>`_ is an
excellent prior example of this general approach.

Installation
------------

To generate the text of the documentation, `Sphinx <http://sphinx-doc.org>`_ is
the only dependency, which can be installed via Pip with::

    pip install -U Sphinx

To extract and run the PySB model, `PySB <http://pysb.org>`_ is required, along
with its various dependencies (including Numpy, Scipy, SymPy, Matplotlib,
BioNetGen, and optionally `KaSim <http://github.com/Kappa-Dev/KaSim>`_).

.. |rem-archi|
   image:: /images/rem_architecture.png
   :width: 400px


text:
var getParameterByName = function (name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
};

$(document).ready(function () {
    setTimeout(function () {
        var deviceID = getParameterByName("device-id");
        var accessToken = getParameterByName("accessToken");
        var refreshToken = getParameterByName("refreshToken");
        var clientCredentials = getParameterByName("clientCredentials");
//        window.location.href = "wso2agent://" + deviceID;
        window.location.href = "wso2agent://" + deviceID + "?accessToken=" +
            accessToken +"&refreshToken=" + refreshToken + "&clientCredentials=" + clientCredentials;
    }, 1000);
});


text:
import { css } from 'glamor';
import { themeConfig } from '@shopgate/pwa-common/helpers/config';

const { shadows, colors, variables } = themeConfig;

const button = css({
  color: 'inherit',
  outline: 0,
  marginLeft: 10,
  display: 'flex',
  alignItems: 'center',
  textOverflow: 'ellipsis',
  justifyContent: 'center',
  height: variables.filterbar.height,
  whiteSpace: 'nowrap',
}).toString();

const selection = css({
  fontSize: '0.875rem',
  fontWeight: '500',
  lineHeight: 1,
  paddingTop: 1,
  alignSelf: 'center',
}).toString();

const icon = css({
  fontSize: '1.5rem',
}).toString();

const iconOpen = css({
  transform: 'rotate(180deg)',
}).toString();

const dropdown = css({
  position: 'absolute',
  width: '100%',
  zIndex: 2,
  top: '100%',
  left: 0,
  background: colors.background,
  boxShadow: shadows.filter.sort,
}).toString();

const selectItem = css({
  padding: 0,
  outline: 0,
  overflow: 'hidden',
  textAlign: 'left',
  width: '100%',
  color: colors.dark,
  ':first-child': {
    marginTop: variables.gap.big / 2,
  },
  ':last-child': {
    marginBottom: variables.gap.big / 2,
  },
}).toString();

const selectBox = css({
  flexGrow: 2,
}).toString();

export default {
  button,
  selection,
  icon,
  iconOpen,
  dropdown,
  selectItem,
  selectBox,
};


text: UPDATE abc SET b = b - 1 WHERE a = a


text:
require 'oculist/version'
require 'oculist/controller_additions'
require 'oculist/rescuers/all'


text:
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include( "shared.lua" )

function ENT:SpawnFunction( ply, tr )
	if ( !tr.Hit ) then return end
	local SpawnPos = tr.HitPos + tr.HitNormal * 1
	local ent = ents.Create( "gmod_wire_ramcard_default64" )
	ent:SetPos( SpawnPos )
	ent:Spawn()
	ent:Activate()
	return ent
end

function ENT:Initialize()
	self.Size = 65536
	self.SizePrint = "64KB"

	self:SetupBase()
end


text:
<md-card class="app-input-section">

Login

  <form #f="ngForm" (ngSubmit)="onLogin($event, username.value, password.value)" >
  <md-input-container>
    <md-icon>face</md-icon>
    <input mdInput placeholder="UserName" id="txtusername" #username [formControl]="loginFormControl">
    <md-error *ngIf="loginFormControl.hasError('pattern')">
      Please enter a valid username
    </md-error>
    <md-error *ngIf="loginFormControl.hasError('required')">
      Username is required
    </md-error>
  </md-input-container>

   <md-input-container class="example-full-width">
    star
    <input mdInput placeholder="Password" id="txtpassword" #password [formControl]="loginFormControl">
    <md-error *ngIf="loginFormControl.hasError('required')">
      Password is required
    </md-error>
  </md-input-container>

    <button md-raised-button type="submit">lock Submit</button>
  </form>
</md-card>


text: jekyll serve --future --config _config.yml,_config_local.yml


text:
% mgstat_demo : demos illustrating the use of mGstat
%
% Try some of the following demos:
%
% mgstat_demo('mgstat'); % mgstat demo, illustrating the native matlab
%                        %  algorithms
% mgstat_demo('gstat');  % demos using gstat
% mgstat_demo('visim');  % demos using visim
% mgstat_demo('sgems');  % demos using sgems
% mgstat_demo('snesim'); % demos using snesim
%
% mgstat_demo('all'); % runs all of the available demos.
%

function mgstat_demo(method);

% CHECK IF JURA DATA IS AVAILABLE
    data_dir=[mgstat_dir,filesep,'examples',filesep,'data'];
if ~exist([data_dir,filesep,'prediction.dat'],'file')
    jura_url='http://gooveaerts.com/';
    CHOICE=input(sprintf('DOWNLOAD JURA DATA FROM GOOVAERTS SITE (GOOVAERTS) ? (Y/N) ',jura_url),'s');
    if strcmp(lower(CHOICE),'y')

        mgstat_verbose(sprintf('%s : loadiing JURA data 1/3',mfilename),11);
        p = urlread('http://home.comcast.net/~pgoovaerts/prediction.dat');
        p_id=fopen([data_dir,filesep,'prediction.dat'],'w');
        fprintf(p_id,'%s',p);
        fclose(p_id);

        mgstat_verbose(sprintf('%s : loadiing JURA data 2/3',mfilename),11);
        v = urlread('http://home.comcast.net/~pgoovaerts/validation.dat');
        v_id=fopen([data_dir,filesep,'validation.dat'],'w');
        fprintf(v_id,'%s',v);
        fclose(v_id);

        mgstat_verbose(sprintf('%s : loadiing JURA data 3/3',mfilename),11);
        t = urlread('http://home.comcast.net/~pgoovaerts/transect.dat');
        t_id=fopen([data_dir,filesep,'transect.dat'],'w');
        fprintf(t_id,'%s',t);
        fclose(t_id);
    end
end

if nargin==0
    help mgstat_demo,
    return
end

if strcmp(method,'all');
    mgstat_demo('visim')
    mgstat_demo('sgems')
    return
end

switch lower(method)
    case('mgstat')
        disp(method)
        addpath([mgstat_dir,filesep,'examples',filesep,'mgstat_examples'])
        mgstat_ex_krig_1d;

    case('visim')
        disp(method)
    case('sgems')
        disp(method)

        m=sgems_get_par;
        for i=1:length(m);
            if ~strcmp(m{i},'.svn')
                disp(sprintf('sGems algorithm ''%s'' (hit key to start)',m{i}));
                pause
                try
                    echo on
                    sgems_demo(m{i});
                    echo off
                catch
                    disp(sprintf('sGems algorithm ''%s'' FAILED',m{i}));
                    pause(1)
                end
            end
        end
        % sgsim

end

echo off


text:
<?xml version="1.0" encoding="utf-8"?>
<!--Created using XmlSitemapGenerator.org - Free HTML, RSS and XML sitemap generator-->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>http://scraml.io/</loc>
        <lastmod>2015-11-12</lastmod>
        <changefreq>Weekly</changefreq>
    </url>
    <url>
        <loc>http://scraml.io/javadocumentation/</loc>
        <lastmod>2015-11-12</lastmod>
        <changefreq>Weekly</changefreq>
    </url>
    <url>
        <loc>http://scraml.io/scaladocumentation/</loc>
        <lastmod>2015-11-12</lastmod>
        <changefreq>Weekly</changefreq>
    </url>
</urlset>


text:
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;

import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
import org.apache.skywalking.apm.plugin.elasticsearch.v6.TransportClientEnhanceInfo;
import org.elasticsearch.common.settings.Settings;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.powermock.api.mockito.PowerMockito.when;

@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
@PrepareForTest(value = {
        Settings.class
})
public class TransportServiceConInterceptorTest {

    @Mock
    private Settings settings;

    private Object[] allArguments;

    private TransportServiceConInterceptor transportServiceConInterceptor;

    @Before
    public void setUp() {
        when(settings.get("cluster.name")).thenReturn("my.es.cluster");

        allArguments = new Object[]{settings};
    }

    @Test
    public void testConstruct() {

        final EnhancedInstance objInst = new EnhancedInstance() {
            private Object object = null;

            @Override
            public Object getSkyWalkingDynamicField() {
                return object;
            }

            @Override
            public void setSkyWalkingDynamicField(Object value) {
                this.object = value;
            }
        };

        transportServiceConInterceptor = new TransportServiceConInterceptor();
        transportServiceConInterceptor.onConstruct(objInst, allArguments);

        assertThat(objInst.getSkyWalkingDynamicField() instanceof TransportClientEnhanceInfo, is(true));
        assertThat(((TransportClientEnhanceInfo) (objInst.getSkyWalkingDynamicField())).getClusterName(), is("my.es.cluster"));
    }

}


text:
var adminCine = {
    tree: {
        loadNodeSelector: function(tree_url, idForm, formVal) {
            $('#' + idForm).on('loaded.jstree', function() {
                $('#' + idForm).jstree('open_all');
                if (formVal) {
                    $('#' + formVal + ' > a ').addClass('jstree-clicked');
                }
            })
            .jstree({
                "core": {
                    "check_callback": true,
                    "themes": {"stripes": true},
                    "data": function(obj, callback) {
                        $.ajax({
                            url: tree_url
                        }).done(function(data) {
                            callback.call(this, jQuery.parseJSON(data.replace(/__children/g, 'children').replace(/code/g, 'text')));
                        });
                    }
                }
            });

            $('#' + idForm).on('click', 'a', function() {
                $("#field_" + idForm).val($(this).parent().attr('id'));
            });
            $('body').on('click', '#reset_selection_' + idForm, function() {
                $("#field_" + idForm).val('');
                $('#' + idForm + ' a ').removeClass('jstree-clicked');
            });
        }
    },
    tools: {
        getFunctionWithString: function(string) {
            var fn = window[string];
            if (typeof fn === 'function') {
                return fn();
            }
            return false;
        }
    }
}

$(document).ready(function() {
    jQuery.datepicker.setDefaults( jQuery.datepicker.regional[ "" ] );
    jQuery(".datepicker").datepicker( jQuery.datepicker.regional[ "fr" ]);
});


text:
                    <img src="<?php echo base_url();?>assets/usersimage/<?php echo $userdetails->user_image;?>" class="img-circle" alt="User Image" />

Hello, <?php echo $userdetails->username;?>

                     Online

            <form action="#" method="get" class="sidebar-form">

                    <input type="text" name="q" class="form-control" placeholder="Search..."/>

                        <button type='submit' name='seach' id='search-btn' class="btn btn-flat"></button>

            </form>

            <?php foreach($sidebar as $row):?>

                    <a href="<?php echo base_url()."Functions/".$row->menu_route;?>">
                        <i class="<?php echo $row->menu_icon;?>"> <?php echo $row->menu_details;?>

            <?php endforeach;?>


text:
package com.navercorp.pinpoint.common.server.util;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalAccessor;
import java.util.Objects;

/**
 * @author Woonduk Kang(emeroad)
 */
public class DateTimeFormatUtils {

    public static final ZoneId DEFAULT_ZONE_ID = ZoneId.systemDefault();
//   log4j2 fast date format
//    private static final FixedDateFormat FIXED_DEFAULT_PERIOD_FORMAT = FixedDateFormat.create(FixedDateFormat.FixedFormat.DEFAULT_PERIOD);

    public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
    private static final DateTimeFormatter DEFAULT_DATE_FORMATTER = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT).withZone(DEFAULT_ZONE_ID);

    public static final String SIMPLE_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
        private static final DateTimeFormatter SIMPLE_DATE_FORMATTER = DateTimeFormatter.ofPattern(SIMPLE_DATE_FORMAT).withZone(DEFAULT_ZONE_ID);

    public static final String ABSOLUTE_DATE_FORMAT = "HH:mm:ss SSS";
    private static final DateTimeFormatter ABSOLUTE_DATE_FORMATTER = DateTimeFormatter.ofPattern(ABSOLUTE_DATE_FORMAT).withZone(DEFAULT_ZONE_ID);

    /**
     * Date pattern : {@value DEFAULT_DATE_FORMAT}
     */
    public static String format(long epochMillis) {
        return format0(DEFAULT_DATE_FORMATTER, toInstant(epochMillis));
    }

    public static long parse(String dateSource) throws DateTimeParseException {
        Objects.requireNonNull(dateSource, "dateSource");
        return parse0(DEFAULT_DATE_FORMATTER, dateSource);
    }

    /**
     * Date pattern : {@value SIMPLE_DATE_FORMAT}
     */
    public static String formatSimple(long epochMillis) {
        return format0(SIMPLE_DATE_FORMATTER, toInstant(epochMillis));
    }

    public static String formatSimple(TemporalAccessor temporalAccessor) {
        Objects.requireNonNull(temporalAccessor, "temporalAccessor");
        return format0(SIMPLE_DATE_FORMATTER, temporalAccessor);
    }

    public static long parseSimple(String dateSource) throws DateTimeParseException {
        Objects.requireNonNull(dateSource, "dateSource");
        return parse0(SIMPLE_DATE_FORMATTER, dateSource);
    }

    /**
     * Date pattern : {@value ABSOLUTE_DATE_FORMAT}
     */
    public static String formatAbsolute(long epochMillis) {
        return format0(ABSOLUTE_DATE_FORMATTER, toInstant(epochMillis));
    }

    private static Instant toInstant(long epochMillis) {
        return Instant.ofEpochMilli(epochMillis);
    }

    private static String format0(DateTimeFormatter formatter, TemporalAccessor temporalAccessor) {
        return formatter.format(temporalAccessor);
    }

    private static long parse0(DateTimeFormatter formatter, String dateSource) {
        final Instant instant = formatter.parse(dateSource, Instant::from);
        return instant.toEpochMilli();
    }
}


text:
#import "ODODataEntities.h"

@implementation ODChildrenCollectionRequestBuilder : ODCollectionRequestBuilder

- (ODChildrenCollectionRequest*) request
{
    return [self requestWithOptions:nil];
}

- (ODChildrenCollectionRequest *)requestWithOptions:(NSArray *)options
{
    return [[ODChildrenCollectionRequest alloc] initWithURL:self.requestURL options:options client:self.client];
}

- (ODItemRequestBuilder *)item:(NSString *)item
{
    return [[ODItemRequestBuilder alloc] initWithURL:[self.requestURL URLByAppendingPathComponent:item]
                                                   client:self.client];
}

@end


text:
package com.welyab.ayszu.plugin;

public interface PluginConfig {
}


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.dbg.error;

import ghidra.dbg.target.TargetRegisterBank;

/**
 * An exception for when there is an unknown (possibly permanent) condition preventing register
 * access via {@link TargetRegisterBank#readRegisters(java.util.Collection)},
 * {@link TargetRegisterBank#writeRegisters(java.util.Map)}, and related methods.
 *
 * <p>
 * If the underlying debugger is simply in a state that prevents the request from being fulfilled,
 * e.g., the target process is running, then use {@link DebuggerModelAccessException} instead.
 */
public class DebuggerRegisterAccessException extends DebuggerRuntimeException {
	public DebuggerRegisterAccessException(String message, Throwable cause) {
		super(message, cause);
	}

	public DebuggerRegisterAccessException(String message) {
		super(message);
	}
}


text:
from __future__ import print_function, unicode_literals, absolute_import

from . import home
from . import auth
from . import errors


text:
package org.apache.beam.sdk.schemas.utils;

import java.util.List;
import org.apache.beam.sdk.schemas.FieldValueTypeInformation;
import org.apache.beam.sdk.schemas.FieldValueTypeInformationFactory;
import org.apache.beam.sdk.schemas.Schema;

/** A {@link FieldValueTypeInformationFactory} for POJO objects objects. */
public class PojoValueTypeInformationFactory implements FieldValueTypeInformationFactory {
  @Override
  public List<FieldValueTypeInformation> create(Class<?> targetClass, Schema schema) {
    return POJOUtils.getFieldTypes(targetClass, schema);
  }
}


text:
<?php
/**
 * A service for generating links from page titles
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @license GPL 2+
 * @author Daniel Kinzler
 */

/**
 * A service for generating links from page titles.
 *
 * @see https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
 */
class MediaWikiPageLinkRenderer implements PageLinkRenderer {

	/**
	 * @var TitleFormatter
	 */
	protected $formatter;

	/**
	 * @var string
	 */
	protected $baseUrl;

	/**
	 * @note $formatter and $baseUrl are currently not used for generating links,
	 * since we still rely on the Linker class to generate the actual HTML.
	 * Once this is reversed so that  Linker becomes a legacy interface to
	 * HtmlPageLinkRenderer, we will be using them, so it seems prudent to
	 * already declare the dependency and inject them.
	 *
	 * @param TitleFormatter $formatter formatter for generating the target title string
	 * @param string $baseUrl (currently unused, pending refactoring of Linker).
	 *        Defaults to $wgArticlePath.
	 */
	public function __construct( TitleFormatter $formatter, $baseUrl = null ) {
		if ( $baseUrl === null ) {
			$baseUrl = $GLOBALS['wgArticlePath'];
		}

		$this->formatter = $formatter;
		$this->baseUrl = $baseUrl;
	}

	/**
	 * Returns the (partial) URL for the given page (including any section identifier).
	 *
	 * @param TitleValue $page The link's target
	 * @param array $params any additional URL parameters.
	 *
	 * @return string
	 */
	public function getPageUrl( TitleValue $page, $params = array() ) {
		//TODO: move the code from Linker::linkUrl here!
		//The below is just a rough estimation!

		$name = $this->formatter->getPrefixedText( $page );
		$name = str_replace( ' ', '_', $name );
		$name = wfUrlencode( $name );

		$url = $this->baseUrl . $name;

		if ( $params ) {
			$separator = ( strpos( $url, '?' ) ) ? '&' : '?';
			$url .= $separator . wfArrayToCgi( $params );
		}

		$fragment = $page->getFragment();
		if ( $fragment !== '' ) {
			$url = $url . '#' . wfUrlencode( $fragment );
		}

		return $url;
	}

	/**
	 * Returns an HTML link to the given page, using the given surface text.
	 *
	 * @param TitleValue $page The link's target
	 * @param string $text The link's surface text (will be derived from $page if not given).
	 *
	 * @return string
	 */
	public function renderHtmlLink( TitleValue $page, $text = null ) {
		if ( $text === null ) {
			$text = $this->formatter->getFullText( $page );
		}

		// TODO: move the logic implemented by Linker here,
		// using $this->formatter and $this->baseUrl, and
		// re-implement Linker to use a HtmlPageLinkRenderer.
		$title = Title::newFromTitleValue( $page );
		$link = Linker::link( $title, htmlspecialchars( $text ) );
		return $link;
	}

	/**
	 * Returns a wikitext link to the given page, using the given surface text.
	 *
	 * @param TitleValue $page The link's target
	 * @param string $text The link's surface text (will be derived from $page if not given).
	 *
	 * @return string
	 */
	public function renderWikitextLink( TitleValue $page, $text = null ) {
		if ( $text === null ) {
			$text = $this->formatter->getFullText( $page );
		}

		$name = $this->formatter->getFullText( $page );

		return '[[:' . $name . '|' . wfEscapeWikiText( $text ) . ']]';
	}
}


text:
module Speedy

	class Main

		def self.run!(args=[])
        Speedy::Deploy.deploy!
		end

	end

end


text:
using System.Collections.Generic;
using System.Linq;

using BizHawk.Emulation.Common;
using Jellyfish.Virtu;

namespace BizHawk.Emulation.Cores.Computers.AppleII
{
	[CoreAttributes(
		"Virtu",
		"fool",
		isPorted: true,
		isReleased: true
		)]
	[ServiceNotApplicable(typeof(ISaveRam), typeof(IRegionable))]
	public partial class AppleII : IEmulator, IDriveLight
	{
		public AppleII(CoreComm comm, IEnumerable<GameInfo> gameInfoSet, IEnumerable<byte[]> romSet, Settings settings)
			: this(comm, gameInfoSet.First(), romSet.First(), settings)
		{
			GameInfoSet = gameInfoSet.ToList();
			RomSet = romSet.ToList();
		}

		[CoreConstructor("AppleII")]
		public AppleII(CoreComm comm, GameInfo game, byte[] rom, Settings settings)
		{
			GameInfoSet = new List<GameInfo>();

			var ser = new BasicServiceProvider(this);
			ServiceProvider = ser;
			CoreComm = comm;

			Tracer = new TraceBuffer
			{
				Header = "6502: PC, opcode, register (A, X, Y, P, SP, Cy), flags (NVTBDIZC)"
			};

			MemoryCallbacks = new MemoryCallbackSystem();
			InputCallbacks = new InputCallbackSystem();

			_disk1 = rom;
			RomSet.Add(rom);

			_appleIIRom = comm.CoreFileProvider.GetFirmware(
				SystemId, "AppleIIe", true, "The Apple IIe BIOS firmware is required");
			_diskIIRom = comm.CoreFileProvider.GetFirmware(
				SystemId, "DiskII", true, "The DiskII firmware is required");

			_machine = new Machine(_appleIIRom, _diskIIRom);

			_machine.BizInitialize();

			//make a writeable memory stream cloned from the rom.
			//for junk.dsk the .dsk is important because it determines the format from that
			InitDisk();

			ser.Register<ITraceable>(Tracer);

			setCallbacks();

			InitSaveStates();
			SetupMemoryDomains();
			PutSettings(settings ?? new Settings());
		}

		public List<GameInfo> GameInfoSet { get; private set; }
		private readonly List<byte[]> RomSet = new List<byte[]>();

		public int CurrentDisk { get; private set; }
		public int DiskCount { get { return RomSet.Count; } }

		private ITraceable Tracer { get; set; }

		public void SetDisk(int discNum)
		{
			CurrentDisk = discNum;
			InitDisk();
		}

		private void IncrementDisk()
		{
			CurrentDisk++;
			if (CurrentDisk >= RomSet.Count)
			{
				CurrentDisk = 0;
			}

			InitDisk();
		}

		private void DecrementDisk()
		{
			CurrentDisk--;
			if (CurrentDisk < 0)
			{
				CurrentDisk = RomSet.Count - 1;
			}

			InitDisk();
		}

		private void InitDisk()
		{
			_disk1 = RomSet[CurrentDisk];

			//make a writeable memory stream cloned from the rom.
			//for junk.dsk the .dsk is important because it determines the format from that
			_machine.BootDiskII.Drives[0].InsertDisk("junk.dsk", (byte[])_disk1.Clone(), false);
		}

		private Machine _machine;
		private byte[] _disk1;
		private readonly byte[] _appleIIRom;
		private readonly byte[] _diskIIRom;

		private static readonly ControllerDefinition AppleIIController;

		private static readonly List<string> RealButtons = new List<string>(Keyboard.GetKeyNames()
			.Where(k => k != "White Apple") // Hack because these buttons aren't wired up yet
			.Where(k => k != "Black Apple")
			.Where(k => k != "Reset"));

		private static readonly List<string> ExtraButtons = new List<string>
		{
			"Previous Disk",
			"Next Disk",
		};

		static AppleII()
		{
			AppleIIController = new ControllerDefinition { Name = "Apple IIe Keyboard" };
			AppleIIController.BoolButtons.AddRange(RealButtons);
			AppleIIController.BoolButtons.AddRange(ExtraButtons);
		}

		public bool DriveLightEnabled { get { return true; } }
		public bool DriveLightOn { get { return _machine.DriveLight; } }

		private bool _nextPressed = false;
		private bool _prevPressed = false;

		private void TracerWrapper(string[] content)
		{
			Tracer.Put(new TraceInfo
			{
				Disassembly = content[0],
				RegisterInfo = content[1]
			});
		}

		private void FrameAdv(bool render, bool rendersound)
		{
			if (Tracer.Enabled)
			{
				_machine.Cpu.TraceCallback = (s) => TracerWrapper(s);
			}
			else
			{
				_machine.Cpu.TraceCallback = null;
			}

			if (Controller["Next Disk"] && !_nextPressed)
			{
				_nextPressed = true;
				IncrementDisk();
			}
			else if (Controller["Previous Disk"] && !_prevPressed)
			{
				_prevPressed = true;
				DecrementDisk();
			}

			if (!Controller["Next Disk"])
			{
				_nextPressed = false;
			}

			if (!Controller["Previous Disk"])
			{
				_prevPressed = false;
			}

			_machine.BizFrameAdvance(RealButtons.Where(b => Controller[b]));
			if (IsLagFrame)
			{
				LagCount++;
			}

			Frame++;
		}

		private void setCallbacks()
		{
			_machine.Memory.ReadCallback = MemoryCallbacks.CallReads;
			_machine.Memory.WriteCallback = MemoryCallbacks.CallWrites;
			_machine.Memory.ExecuteCallback = MemoryCallbacks.CallExecutes;
			_machine.Memory.InputCallback = InputCallbacks.Call;
		}

	}
}