text:
<?php

namespace reinvently\ondemand\core\modules\servicearea\migrations;

use yii\db\Migration;

/**
 * Class ServiceAreaTableMigration
 */
class ServiceAreaTableMigration extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->createTable('service_area', [
            'id' => $this->primaryKey(),
            'type' => $this->smallInteger()->unsigned(),
            'status' => $this->smallInteger()->unsigned(),
            'name' => $this->string(),
        ]);

    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        echo "ServiceAreaTableMigration cannot be reverted.\n";

        return false;
    }
}


text:
\hypertarget{_scroll_area_8cpp}{\section{/home/cecilia/\-Documents/\-Symptogen/src/menu/\-Scroll\-Area.cpp File Reference}
\label{_scroll_area_8cpp}\index{/home/cecilia/\-Documents/\-Symptogen/src/menu/\-Scroll\-Area.\-cpp@{/home/cecilia/\-Documents/\-Symptogen/src/menu/\-Scroll\-Area.\-cpp}}
}
{\ttfamily \#include \char`\"{}Scroll\-Area.\-h\char`\"{}}\\*
\subsection*{Namespaces}
\begin{DoxyCompactItemize}
\item
\hyperlink{namespace_symp}{Symp}
\end{DoxyCompactItemize}
\subsection*{Constant Groups}
\begin{DoxyCompactItemize}
\item
\hyperlink{namespace_symp}{Symp}
\end{DoxyCompactItemize}

redpajama_set_name: RedPajamaGithub


text:
package com.tectonica.jonix.onix3;

import com.tectonica.jonix.common.JPU;
import com.tectonica.jonix.common.OnixElement;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;
import com.tectonica.jonix.common.codelist.SupplyContactRoles;

import java.io.Serializable;

/*
 * NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
 */

/**
 *
Supply contact role

 *

 * An ONIX code which identifies the role played by the supply contact in relation to the product – for example
 * answering enquiries related to orders or to returns.
 *

 *

 *

 * Format
 * Fixed length, two digits
 *

 *

 * Codelist
 * List 239
 *

 *

 * Reference name
 * <tt><SupplyContactRole></tt>
 *

 *

 * Short tag
 * <tt><x537></tt>
 *

 *

 * Cardinality
 * 1
 *

 *

 * Example
 * <tt><SupplyContactRole>07</SupplyContactRole></tt> (Returns authorization contact)
 *

 *

 *

 * This tag may be included in the following composites:
 *

 *
<{@link SupplyContact}>

 *

 *

 * Possible placements within ONIX message:
 *

 *
{@link ONIXMessage} ⯈ {@link Product} ⯈ {@link ProductSupply} ⯈ {@link SupplyDetail} ⯈ {@link SupplyContact} ⯈
 * {@link SupplyContactRole}

 *

 *
 * @since Onix-3.04
 */
public class SupplyContactRole implements OnixElement<SupplyContactRoles>, Serializable {
    private static final long serialVersionUID = 1L;

    public static final String refname = "SupplyContactRole";
    public static final String shortname = "x537";

    /////////////////////////////////////////////////////////////////////////////////
    // ATTRIBUTES
    /////////////////////////////////////////////////////////////////////////////////

    /**
     * (type: dt.DateOrDateTime)
     */
    public String datestamp;

    /**
     * (type: dt.NonEmptyString)
     */
    public String sourcename;

    public RecordSourceTypes sourcetype;

    /////////////////////////////////////////////////////////////////////////////////
    // VALUE MEMBER
    /////////////////////////////////////////////////////////////////////////////////

    public SupplyContactRoles value;

    /**
     * Internal API, use the {@link #value()} method or the {@link #value} field instead
     */
    @Override
    public SupplyContactRoles _value() {
        return value;
    }

    /////////////////////////////////////////////////////////////////////////////////
    // SERVICES
    /////////////////////////////////////////////////////////////////////////////////

    private final boolean exists;
    public static final SupplyContactRole EMPTY = new SupplyContactRole();

    public SupplyContactRole() {
        exists = false;
    }

    public SupplyContactRole(org.w3c.dom.Element element) {
        exists = true;
        datestamp = JPU.getAttribute(element, "datestamp");
        sourcename = JPU.getAttribute(element, "sourcename");
        sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype"));

        value = SupplyContactRoles.byCode(JPU.getContentAsString(element));
    }

    /**
     * @return whether this tag (<SupplyContactRole> or <x537>) is explicitly provided in the ONIX XML
     */
    @Override
    public boolean exists() {
        return exists;
    }
}


text:
package org.apache.jackrabbit.oak.segment.data;

public class RecordIdData {

    public static final int BYTES = Short.BYTES + Integer.BYTES;

    private final int segmentReference;

    private final int recordNumber;

    RecordIdData(int segmentReference, int recordNumber) {
        this.segmentReference = segmentReference;
        this.recordNumber = recordNumber;
    }

    public int getSegmentReference() {
        return segmentReference;
    }

    public int getRecordNumber() {
        return recordNumber;
    }

}


text:
module Foortran
  class Lexer
    IDENTIFIER_REGEX = /\A(\*|[a-z]\w*)/
    STRING_REGEX     = /\A"(.*?)"/

    attr_accessor :source
    attr_reader   :tokens

    def self.tokenize(source)
      lexer = new(source)
      lexer.tokenize
    end

    def add_identifier_token(token)
      add_token(Token.identifier(token))
    end

    def add_keyword_token(token)
      add_token(Token.keyword(token))
    end

    def add_string_token(token)
      add_token(Token.string(token))
    end

    def add_token(token)
      tokens << token
    end

    def initialize(source)
      self.source = source
      @tokens     = []
    end

    def tokenize
      i = 0
      while i < source.size
        chunk = source[i..-1]

        if identifier = chunk[IDENTIFIER_REGEX, 1]
          if KEYWORDS.include?(identifier)
            add_keyword_token(identifier)
          else
            add_identifier_token(identifier)
          end
          i += identifier.size
        elsif string = chunk[STRING_REGEX, 1]
          add_string_token(string)
          i += string.size + 2 # for the quotes
        else
          i += 1
          next
        end
      end
      tokens
    end
  end
end


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>zlib::deflate_stream::prime</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Beast">
<link rel="up" href="../boost__beast__zlib__deflate_stream.html" title="zlib::deflate_stream">
<link rel="prev" href="pending.html" title="zlib::deflate_stream::pending">
<link rel="next" href="../boost__beast__http__empty_body.html" title="http::empty_body">

Home
Libraries
People
FAQ
More

zlib::deflate_stream::prime

          Insert bits into the compressed output stream.

          Synopsis

void
prime(
    int bits,
    int value,
    error_code& ec);

          Description

          This function inserts bits in the deflate output stream. The intent is
          that this function is used to start off the deflate output with the bits
          leftover from a previous deflate stream when appending to it. As such,
          this function can only be used for raw deflate, and must be used before
          the first write call after
          an initialization. bits
          must be less than or equal to 16, and that many of the least significant
          bits of value will be inserted
          in the output.

          Return
          Value

          error::need_buffers
          if there was not enough room in the internal buffer to insert the bits.

Copyright © 2016-2019 Vinnie
      Falco

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
require 'fog/openstack'

module DanarchySys
  module OpenStack
    # Load OpenStack compute requirements
    require_relative 'openstack/compute'
    require_relative 'openstack/networking'
  end
end


text: Coda Hale metrics-like micro-benchmarking for Python.


text:
package org.apache.struts2.portlet.example;

import com.opensymphony.xwork2.ActionSupport;

/**
 */
public class FormExampleWithValidation extends ActionSupport {
    private String firstName = null;
    private String lastName = null;

    public String input() {
        return SUCCESS;
    }

    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.jenkins-ci.plugins</groupId>
        <artifactId>plugin</artifactId>
        <version>3.4</version>
        <relativePath />
    </parent>

    <artifactId>zos-connector</artifactId>
    <version>2.4.1-SNAPSHOT</version>
    <packaging>hpi</packaging>
    <name>IBM z/OS Connector</name>
    <description>IBM z/OS FTP Connector - bunch of tools for integration with IBM z/OS</description>
    <url>https://github.com/jenkinsci/zos-connector-plugin</url>

    <properties>
        <jenkins.version>2.222.4</jenkins.version>
        <java.level>8</java.level>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.6</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.wagon</groupId>
                            <artifactId>wagon-http</artifactId>
                            <version>2.10</version>
                            <type>jar</type>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <tagNameFormat>@{project.artifactId}-@{project.version}</tagNameFormat>
                        <goals>deploy</goals>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <detectJavaApiLink>false</detectJavaApiLink>
                        <source>8</source>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jenkins-ci.tools</groupId>
                    <artifactId>maven-hpi-plugin</artifactId>
                    <extensions>true</extensions>
                    <configuration>
                        <compatibleSinceVersion>2.0.0</compatibleSinceVersion>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>CandidusLynx</id>
            <name>Alexander Shcherbakov</name>
            <email>candiduslynx@gmail.com</email>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:ssh://github.com/jenkinsci/zos-connector-plugin.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/jenkinsci/${project.artifactId}-plugin.git
        </developerConnection>
        <url>http://github.com/jenkinsci/${project.artifactId}-plugin</url>
        <tag>HEAD</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.8.0</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.26</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.26</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>1.7.26</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.26</version>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>credentials</artifactId>
            <version>2.6.1.1</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/public/</url>
        </pluginRepository>
    </pluginRepositories>
</project>


text:
import { combineReducers } from 'redux';
import search, * as fromSearch from './search';
import global, * as fromGlobal from './global';

/**
 * 根reducer
 */
const indexReducer = combineReducers({
  search,
  global,
});

export default indexReducer;

// index -> Selector
/**
 * search -> isFetching
 * @param {*} state
 */
export const getSearchIsFetching = state => fromSearch.getIsFetching(state.search);

/**
 * search -> errorMessagr
 * @param {*} state
 */
export const getSearchErrorMessage = state => fromSearch.getErrorMessage(state.search);

/**
 * search -> result
 * @param {*} state
 */
export const getSearchResult = state => fromSearch.getResult(state.search);

/**
 * global -> toastMessage
 * @param {*} state
 */
export const getGlobalToastMessage = state => fromGlobal.getToastMessage(state.global);

/**
 * global -> userDetail
 * @param {*} state
 */
export const getGlobalUserDetail = state => fromGlobal.getUserDetail(state.global);

/**
 * global -> navCollapse
 * @param {*} state
 */
export const getGlobalNavCollapse = state => fromGlobal.getNavCollapse(state.global);

/**
 * global -> userCircles
 * @param {*} state
 */
export const getGlobalUserCircles = state => fromGlobal.getUserCircles(state.global);


text:
class Test {
  String<caret> process(String s) {
    if (s == null) return null;
    s = s.trim();
    if (s.isEmpty()) return null;
    System.out.println(s);
    String result = s + s;
    return result;
  }
}


text:
module(..., package.seeall)

function new()
	local group = display.newGroup()

local function drawExplosion(i, j, explosionType)
	local xPosition = i*40-20
	local yPosition = j*40+138

	local explosionImage
	if explosionType == "verticalTopEnd" then
		explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)

	elseif explosionType == "verticalSegment" then
		explosionImage = display.newImageRect("images/explodeSegment.png", 40, 40)

	elseif explosionType == "verticalBottomEnd" then
		explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
		explosionImage.rotation = 180
		explosionImage.xScale = -1

	elseif explosionType == "horizontalLeftEnd" then
		explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
		explosionImage.rotation = -90

	elseif explosionType == "horizontalSegment" then
		explosionImage = display.newImageRect("images/explodeSegment.png", 40, 40)
		explosionImage.rotation = -90

	elseif explosionType == "horizontalRightEnd" then
		explosionImage = display.newImageRect("images/explodeEnd.png", 40, 40)
		explosionImage.rotation = 90
		explosionImage.xScale = -1

	end

	explosionImage.x = xPosition
	explosionImage.y = yPosition

	return explosionImage
end

local function drawVerticalExplosion(i)
	local imageGroup = display.newGroup()
	imageGroup:insert(drawExplosion(i,1, "verticalTopEnd"))

	for j=2,7,1 do
		imageGroup:insert(drawExplosion(i,j, "verticalSegment"))
	end
	imageGroup:insert(drawExplosion(i,8, "verticalBottomEnd"))

	return imageGroup
end

local function drawHorizontalExplosion(j)
	local imageGroup = display.newGroup()
	imageGroup:insert(drawExplosion(1,j, "horizontalLeftEnd"))
	for i=2,7,1 do
		imageGroup:insert(drawExplosion(i,j, "horizontalSegment"))
	end
	imageGroup:insert(drawExplosion(8,j, "horizontalRightEnd"))

	return imageGroup
end

local function drawCrossExplosioin(i,j)
	imageGroup = display.newGroup()

	local verticalImages = drawVerticalExplosion(i)
	imageGroup:insert(verticalImages)

	local horizontalImages = drawHorizontalExplosion(j)
	imageGroup:insert(horizontalImages)

	local centerImage = display.newImageRect("images/explodeCenter.png", 40, 40)
	centerImage.x = i * 40 - 17.5
	centerImage.y = j * 40 + 120
	imageGroup:insert(centerImage)

	return imageGroup
end

local function removeAllExplosionImages(images)
	return function()
	if images then
		for i=images.numChildren, 1, -1 do
			images[i]:removeSelf()
			images[i] = nil
		end
	end
	end
end

local function animateExplosion(images)
	for i=1,images.numChildren-1,1 do
		transition.to(images[i], {time=100, xScale=0.5})
		transition.to(images[i], {time=100, delay=100, xScale=1})

		transition.to(images[i], {time=100, delay=200, xScale=0.5})
		transition.to(images[i], {time=100, delay=300, xScale=1})

		transition.to(images[i], {time=100, delay=400, xScale=0.5})
		transition.to(images[i], {time=100, delay=500, xScale=1})
	end
	transition.to(images[images.numChildren], {time=100, xScale=-0.5})
	transition.to(images[images.numChildren], {time=100, delay=100, xScale=-1})

	transition.to(images[images.numChildren], {time=100, delay=200, xScale=-0.5})
	transition.to(images[images.numChildren], {time=100, delay=300, xScale=-1})

	transition.to(images[images.numChildren], {time=100, delay=400, xScale=-0.5})
	transition.to(images[images.numChildren], {time=100, delay=500, xScale=-1, onComplete=removeAllExplosionImages(images)})
end

--local temp = drawHorizontalExplosion(5)
--local temp1 = drawVerticalExplosion(5)
--animateExplosion(temp)
--animateExplosion(temp1)

function group:explosionAnimation(i,j,type)
	local imageGroup = display.newGroup()
	if type == "vertical" then
		local images = drawVerticalExplosion(i)
		imageGroup:insert(images)

	elseif type == "horizontal" then
		local images = drawHorizontalExplosion(j)
		imageGroup:insert(images)

	elseif type == "cross" then
		local verticalImages = drawVerticalExplosion(i)
		imageGroup:insert(verticalImages)

		local horizontalImages = drawHorizontalExplosion(j)
		imageGroup:insert(horizontalImages)

	elseif type == "area" then
		-- do something
		local function destroy(target)
			return function()
			if target then
				target:removeSelf()
				target = nil
			end
			end
		end
		local xPosition = i*40-20
		local yPosition = j*40+138
		local areaImages = display.newImage("images/explosion2.png")
		areaImages.x = xPosition
		areaImages.y = yPosition
		transition.to(areaImages, {time=500, xScale=4, yScale=4, onComplete=destroy(areaImages)})
		imageGroup:insert(areaImages)
		return imageGroup
	end

	for i=1, imageGroup.numChildren, 1 do
		animateExplosion(imageGroup[i])
	end

	return imageGroup
end

	return group
end


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Hello World!</title>

Hello World!

    We are using Node.js ,
    Chromium ,
    and Electron .


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>FindLibLZMA — CMake 3.8.1 Documentation</title>

    <link rel="stylesheet" href="../_static/cmake.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FindLibXml2" href="FindLibXml2.html" />
    <link rel="prev" title="FindLibArchive" href="FindLibArchive.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.8.1 Documentation »

cmake-modules(7) »

FindLibLZMA¶

Find LibLZMA

Find LibLZMA headers and library

LIBLZMA_FOUND             - True if liblzma is found.
LIBLZMA_INCLUDE_DIRS      - Directory where liblzma headers are located.
LIBLZMA_LIBRARIES         - Lzma libraries to link against.
LIBLZMA_HAS_AUTO_DECODER  - True if lzma_auto_decoder() is found (required).
LIBLZMA_HAS_EASY_ENCODER  - True if lzma_easy_encoder() is found (required).
LIBLZMA_HAS_LZMA_PRESET   - True if lzma_lzma_preset() is found (required).
LIBLZMA_VERSION_MAJOR     - The major version of lzma
LIBLZMA_VERSION_MINOR     - The minor version of lzma
LIBLZMA_VERSION_PATCH     - The patch version of lzma
LIBLZMA_VERSION_STRING    - version number as a string (ex: "5.0.3")

Previous topic

FindLibArchive

Next topic

FindLibXml2

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.8.1 Documentation »

cmake-modules(7) »

        © Copyright 2000-2017 Kitware, Inc. and Contributors.
      Created using Sphinx 1.5.2.


text:
"""Contains the ring road scenario class."""

from flow.scenarios.base_scenario import Scenario
from flow.core.params import InitialConfig
from flow.core.params import TrafficLightParams
from numpy import pi, sin, cos, linspace, ceil, sqrt

ADDITIONAL_NET_PARAMS = {
    # length of the ring road
    "length": 230,
    # number of lanes
    "lanes": 1,
    # speed limit for all edges
    "speed_limit": 30,
    # resolution of the curves on the ring
    "resolution": 40,
    # number of rings in the system
    "num_rings": 7
}

VEHICLE_LENGTH = 5  # length of vehicles in the network, in meters

class MultiLoopScenario(Scenario):
    """Ring road scenario.

    This network is similar to `LoopScenario`, but generates multiple separate
    ring roads in the same simulation.

    Requires from net_params:

    * **length** : length of the circle
    * **lanes** : number of lanes in the circle
    * **speed_limit** : max speed limit of the circle
    * **resolution** : number of nodes resolution
    * **num_ring** : number of rings in the system

    Usage
    -----
    >>> from flow.core.params import NetParams
    >>> from flow.core.params import VehicleParams
    >>> from flow.core.params import InitialConfig
    >>> from flow.scenarios import MultiLoopScenario
    >>>
    >>> scenario = MultiLoopScenario(
    >>>     name='multi_ring_road',
    >>>     vehicles=VehicleParams(),
    >>>     net_params=NetParams(
    >>>         additional_params={
    >>>             'length': 230,
    >>>             'lanes': 1,
    >>>             'speed_limit': 30,
    >>>             'resolution': 40,
    >>>             'num_rings': 7
    >>>         },
    >>>     )
    >>> )
    """

    def __init__(self,
                 name,
                 vehicles,
                 net_params,
                 initial_config=InitialConfig(),
                 traffic_lights=TrafficLightParams()):
        """Initialize a loop scenario."""
        for p in ADDITIONAL_NET_PARAMS.keys():
            if p not in net_params.additional_params:
                raise KeyError('Network parameter "{}" not supplied'.format(p))

        self.length = net_params.additional_params["length"]
        self.lanes = net_params.additional_params["lanes"]
        self.num_rings = net_params.additional_params["num_rings"]

        super().__init__(name, vehicles, net_params, initial_config,
                         traffic_lights)

    def specify_edge_starts(self):
        """See parent class."""
        edgelen = self.length / 4
        shift = 4 * edgelen

        edgestarts = []
        for i in range(self.num_rings):
            edgestarts += [("bottom_{}".format(i), 0 + i * shift),
                           ("right_{}".format(i), edgelen + i * shift),
                           ("top_{}".format(i), 2 * edgelen + i * shift),
                           ("left_{}".format(i), 3 * edgelen + i * shift)]

        return edgestarts

    @staticmethod
    def gen_custom_start_pos(cls, net_params, initial_config, num_vehicles):
        """Generate uniformly spaced starting positions on each ring.

        It is assumed that there are an equal number of vehicles per ring.
        If the perturbation term in initial_config is set to some positive
        value, then the start positions are perturbed from a uniformly spaced
        distribution by a gaussian whose std is equal to this perturbation
        term.
        """
        (x0, min_gap, bunching, lanes_distr, available_length,
         available_edges, initial_config) = \
            cls._get_start_pos_util(initial_config, num_vehicles)

        length = net_params.additional_params["length"]
        num_rings = net_params.additional_params["num_rings"]
        increment = available_length / num_vehicles
        vehs_per_ring = num_vehicles / num_rings

        x = x0
        car_count = 0
        startpositions, startlanes = [], []

        # generate uniform starting positions
        while car_count < num_vehicles:
            # collect the position and lane number of each new vehicle
            pos = cls.get_edge(x)

            # place vehicles side-by-side in all available lanes on this edge
            for lane in range(min(cls.num_lanes(pos[0]), lanes_distr)):
                car_count += 1
                startpositions.append(pos)
                edge, pos = startpositions[-1]
                startpositions[-1] = edge, pos % length
                startlanes.append(lane)

                if car_count == num_vehicles:
                    break

            # 1e-13 prevents an extra car from being added in wrong place
            x = (x + increment + VEHICLE_LENGTH + min_gap) + 1e-13
            if (car_count % vehs_per_ring) == 0:
                # if we have put in the right number of cars,
                # move onto the next ring
                ring_num = int(car_count / vehs_per_ring)
                x = length * ring_num + 1e-13

        # add a perturbation to each vehicle, while not letting the vehicle
        # leave its current edge
        # if initial_config.perturbation > 0:
        #     for i in range(num_vehicles):
        #         perturb = np.random.normal(0, initial_config.perturbation)
        #         edge, pos = startpositions[i]
        #         pos = max(0, min(self.edge_length(edge), pos + perturb))
        #         startpositions[i] = (edge, pos)

        return startpositions, startlanes

    def specify_nodes(self, net_params):
        """See parent class."""
        length = net_params.additional_params["length"]
        ring_num = net_params.additional_params["num_rings"]

        r = length / (2 * pi)
        ring_spacing = 4 * r
        num_rows = num_cols = int(ceil(sqrt(ring_num)))

        nodes = []
        i = 0
        for j in range(num_rows):
            for k in range(num_cols):
                nodes += [{
                    "id": "bottom_{}".format(i),
                    "x": 0 + j * ring_spacing,
                    "y": -r + k * ring_spacing
                }, {
                    "id": "right_{}".format(i),
                    "x": r + j * ring_spacing,
                    "y": 0 + k * ring_spacing
                }, {
                    "id": "top_{}".format(i),
                    "x": 0 + j * ring_spacing,
                    "y": r + k * ring_spacing
                }, {
                    "id": "left_{}".format(i),
                    "x": -r + j * ring_spacing,
                    "y": 0 + k * ring_spacing
                }]
                i += 1
                # FIXME this break if we don't have an exact square
                if i >= ring_num:
                    break
            if i >= ring_num:
                break

        return nodes

    def specify_edges(self, net_params):
        """See parent class."""
        length = net_params.additional_params["length"]
        resolution = net_params.additional_params["resolution"]
        ring_num = net_params.additional_params["num_rings"]
        num_rows = num_cols = int(ceil(sqrt(ring_num)))
        r = length / (2 * pi)
        ring_spacing = 4 * r
        edgelen = length / 4.
        edges = []

        i = 0

        for j in range(num_rows):
            for k in range(num_cols):
                edges += [{
                    "id":
                        "bottom_{}".format(i),
                    "type":
                        "edgeType",
                    "from":
                        "bottom_{}".format(i),
                    "to":
                        "right_{}".format(i),
                    "length":
                        edgelen,
                    "shape":
                        [
                            (r * cos(t) + j * ring_spacing,
                             r * sin(t) + k * ring_spacing)
                            for t in linspace(-pi / 2, 0, resolution)
                        ]
                }, {
                    "id":
                        "right_{}".format(i),
                    "type":
                        "edgeType",
                    "from":
                        "right_{}".format(i),
                    "to":
                        "top_{}".format(i),
                    "length":
                        edgelen,
                    "shape":
                        [
                            (r * cos(t) + j * ring_spacing,
                             r * sin(t) + k * ring_spacing)
                            for t in linspace(0, pi / 2, resolution)
                        ]
                }, {
                    "id":
                        "top_{}".format(i),
                    "type":
                        "edgeType",
                    "from":
                        "top_{}".format(i),
                    "to":
                        "left_{}".format(i),
                    "length":
                        edgelen,
                    "shape":
                        [
                            (r * cos(t) + j * ring_spacing,
                             r * sin(t) + k * ring_spacing)
                            for t in linspace(pi / 2, pi, resolution)
                        ]
                }, {
                    "id":
                        "left_{}".format(i),
                    "type":
                        "edgeType",
                    "from":
                        "left_{}".format(i),
                    "to":
                        "bottom_{}".format(i),
                    "length":
                        edgelen,
                    "shape":
                        [
                            (r * cos(t) + j * ring_spacing,
                             r * sin(t) + k * ring_spacing)
                            for t in linspace(pi, 3 * pi / 2, resolution)
                        ]
                }]
                i += 1
                if i >= ring_num:
                    break
            if i >= ring_num:
                break

        return edges

    def specify_types(self, net_params):
        """See parent class."""
        lanes = net_params.additional_params["lanes"]
        speed_limit = net_params.additional_params["speed_limit"]

        types = [{
            "id": "edgeType",
            "numLanes": lanes,
            "speed": speed_limit
        }]

        return types

    def specify_routes(self, net_params):
        """See parent class."""
        ring_num = net_params.additional_params["num_rings"]
        rts = {}
        for i in range(ring_num):
            rts.update({
                "top_{}".format(i):
                    ["top_{}".format(i),
                     "left_{}".format(i),
                     "bottom_{}".format(i),
                     "right_{}".format(i)],
                "left_{}".format(i): ["left_{}".format(i),
                                      "bottom_{}".format(i),
                                      "right_{}".format(i),
                                      "top_{}".format(i)],
                "bottom_{}".format(i): ["bottom_{}".format(i),
                                        "right_{}".format(i),
                                        "top_{}".format(i),
                                        "left_{}".format(i)],
                "right_{}".format(i): ["right_{}".format(i),
                                       "top_{}".format(i),
                                       "left_{}".format(i),
                                       "bottom_{}".format(i)]
            })

        return rts


text: Isomorphic/universal React code for Frontend Bucharest presentation


text:
*The Enhanced Ember Application Blueprint*

This addon is the Quick Start guide to the best tools the Ember community has to offer! Ember-CLI-Opinionated takes on
common decisions you need to make to get the most out of your app and gives you an answer. The following questions
are all answered by this addon:

1. *SCSS* vs LESS vs CSS?
2. How can we get code coverage?
3. How do we put styles in our pods?
4. How can we track app performance?
5. What's the best way to do date parsing in Ember?
6. How can we implement feature flags?

...and more!

All you have to do is sit back, relax, and let Ember-CLI-Opinionated do all the hard work for you. When we're done,
your app will be even better than a barebones Ember app (which is already pretty sweet!); it'll be a lean, mean,
code-generating machine. Watch your productivity increase and your architecture meetings decrease, all at the same time!

## Installation

The following command will install this addon and run the included blueprint to give you maximum awesomeness:

`ember install ember-cli-opinionated`

Subsequent updates to this addon can be pulled in by updating the version of this package and running the following:

`ember g ember-cli-opinionated`

This will execute the included blueprint, setting up your app for the win! If you want to enhance your app configuration
with some additional awesomeness, simply say yes to the first question to fill out a short questionnaire that will
allow us to improve your app even more.

Once you have installed this package, you will need to go through some minor setup to begin utilizing the included
addons. Your app should be fully operational in the meantime, but the addons won't be usable until setup is completed.
Please refer to the sections below and the individual READMEs for information on each addon's setup (where applicable).

## Compatibility

Ember-CLI-Opinionated's blueprint relies on `addAddonsToProject`, a
[new feature](https://github.com/ember-cli/ember-cli/pull/4839) to Ember-CLI. For older Ember-CLI versions (<=1.13.8),
a polyfill has been provided by chaining `addAddonToProject`. However, there are some slight problems with
how that works, and some packages may not be properly saved to your `package.json` and `bower.json`.
So feel free to use this addon regardless, but check to make sure the dependencies are saved.

Each of the included addons has its own compatibility with different versions of Ember, Ember-CLI, and so on. We
recommend checking the individual repositories for more information to make sure your app is compatible with the latest
versions of each project. The intent of this addon is to enhance a brand-new app generated with Ember-CLI, but
that doesn't mean you can't juice up your existing application, either!

As of now, Ember 1.13+ should be supported without issues. Earlier versions of Ember may also be supported,
but have not been explicitly tested. If you are on 1.12-, please test and let us know if there are issues.

_Note: A [bug in Ember-CLI](https://github.com/ember-cli/ember-cli/issues/4876) causes npm to attempt
installing `ember-cli-sass` twice. This will throw a large number of concerning-looking errors to your console
but should not cause any real problems with installation._

## What's Inside The Box?

Ember-CLI-Opinionated packs a number of essential addons to use in your Ember application. Below you will find each
dependency listed along with a short description and a link to the main repositories. Any further dependencies
installed by the addons' blueprints will be listed below the section header. Optional dependencies that are included
by our Enhanced Setup will be labeled as **Enhanced** with the name of their associated config. Some of these additional
projects may be WIP, alpha, or otherwise experimental, but you should be able to begin using them right away for
new app development, as long as you are cognizant of this fact.

The amount of additional setup needed to begin using the addon is judged for you. Our rating system is as follows:

_No Setup_ - You can begin using this addon immediately without any additional configuration necessary.
_Trivial Setup_ - You may have to add 1-2 easy lines of code to complete setup.
_Minor Setup_ - A bit of configuration is required (usually in `config/environment.js`), but the process is
straightforward and explained well in their README.
_Major Setup_ - A significant amount of work is needed to begin using this addon. Our goal is not to include
any projects that would receive this rating, as it is counter-intuitive to the quick-start nature of this project.

### [ember-cli-blanket](http://jhawk.co/ember-cli-blanket)
_Minor Setup_

_Additional Install: [`blanket`](http://jhawk.co/blanket-js)_

Wraps Blanket.js to provide code coverage for Ember apps. Easy integration with
[`ember-cli-pretender`](http://jhawk.co/ember-cli-pretender) or [`ember-cli-mirage`](http://jhawk.co/ember-cli-mirage).
The [README](https://github.com/sglanzer/ember-cli-blanket/blob/master/README.md) has details on configuration of the addon.

### [ember-cli-sass-pods](http://jhawk.co/ember-cli-sass-pods)
_Trivial Setup_

_Additional Install: [`ember-cli-sass`](http://jhawk.co/ember-cli-sass)_

Enables usage of SCSS styles in pod directories. Also includes generators for these files!

### [ember-cpm](http://jhawk.co/ember-cpm)
_No Setup_

_Additional Install: N/A_

Provides Computed Property Macros, including
[Composable Macros](https://github.com/cibernox/ember-cpm/blob/master/README.md#composable-computed-property-macros)!

### [ember-e3](http://jhawk.co/ember-e3)
**Enhanced: Analytics**

_No Setup_

_Additional Install: N/A_

An Ember-first data visualization library that combines d3-like math with Ember's "data down/actions up" data binding
paradigm. Supports rendering to both Canvas _and_ SVG!

_Note: This is a beta product that is still a WIP, with many more features on the way. Additionally, it only supports
Ember 1.13+, sorry!_

### [ember-feature-flags](http://jhawk.co/ember-feature-flags)
_Minor Setup_

_Additional Install: N/A_

Provides an injected `features` property to your routes, controllers, and components.

The [README](https://github.com/kategengler/ember-feature-flags/blob/master/README.md) details the easy ENV config.

### [ember-gestures](http://jhawk.co/ember-gestures)
**Enhanced: Mobile-Friendly**

_Trivial Setup_

_Additional Install: [`hammer.js`](http://jhawk.co/hammer-js-repo) & [`hammer-time`](http://jhawk.co/hammer-time-js)_

Provides gesture and mobile support for Ember applications.

_Note: `ember-gestures` relies on the yet-to-be-released 2.1.x version of `hammer.js`. In order for this package to work
properly, you must install the latest `develop` branch from their repository:_

`bower install --save runspired/hammer.js#develop`

### [ember-metrics](http://jhawk.co/ember-metrics)
_Minor Setup_

_Additional Install: N/A_

Allows you to send data to multiple analytics integrations without re-implementing new API.

Check out the [README](https://github.com/poteto/ember-metrics/blob/develop/README.md) for information on how to
set up the instrumentation to your favorite analytics reporting tool.

### [ember-moment](http://jhawk.co/ember-moment)
_No Setup_

_Additional Install: [`ember-cli-moment-shim`](http://jhawk.co/ember-cli-moment-shim),
[`moment`](http://jhawk.co/moment-js), & [`moment-timezone`](http://jhawk.co/moment-timezone)_

Provides template helpers and computed property macros for date parsing, as well as
including `moment.js` as an ES6 module import.

### [ember-paper](http://jhawk.co/ember-paper)
**Enhanced: Material Design**

_Trivial Setup_

_Additional Install: [`ember-cli-sass`](http://jhawk.co/ember-cli-sass), [`hammerjs`](http://jhawk.co/hammer-js-repo)
 & [`matchMedia`](http://jhawk.co/match-media-polyfill)

An Ember-first implementation of Google's [Material Design](http://jhawk.co/google-md) spec. This is an ambitious
project that does not yet fully support every part of the spec, but feel free to check out their
[demo](http://jhawk.co/ember-paper-demo) to see how incredibly far they've gotten!

### [ember-responsive](http://jhawk.co/ember-responsive)
_No Setup_

_Additional Install: N/A_

Uses responsive media queries to inject screen layout information throughout Ember applications.
Needs Polyfill for [compatibility](http://caniuse.com/#feat=matchmedia) with IE 8/9 or Opera Mini.

### [ember-suave](http://jhawk.co/ember-suave)
_No Setup_

_Additional Install: N/A_

Enforce code styles using [`JSCS`](http://jhawk.co/js-cs). Defaults to the
DockYard [JavaScript](https://github.com/dockyard/styleguides/blob/master/javascript.md) and
[Ember](https://github.com/dockyard/styleguides/blob/master/ember.md) Style Guides, but rules are configurable.

## Contributing

[CONTRIBUTING.md](https://github.com/elwayman02/ember-cli-opinionated/blob/master/CONTRIBUTING.md) details how to contribute to this project.

### Installation

* `git clone` this repository
* `npm install`
* `bower install`

### Running

* `ember s` or `ember server`
* Visit your app at http://localhost:4200.

### Running Tests

* `npm test`


text:
GoPlus - The Go+ language for data science
========

[![LICENSE](https://img.shields.io/github/license/qiniu/goplus.svg)](https://github.com/qiniu/goplus/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/qiniu/goplus.png?branch=master)](https://travis-ci.org/qiniu/goplus)
[![Go Report Card](https://goreportcard.com/badge/github.com/qiniu/goplus)](https://goreportcard.com/report/github.com/qiniu/goplus)
[![GitHub release](https://img.shields.io/github/v/tag/qiniu/goplus.svg?label=release)](https://github.com/qiniu/goplus/releases)
[![Coverage Status](https://codecov.io/gh/qiniu/goplus/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/goplus)
[![GoDoc](https://img.shields.io/badge/Godoc-reference-blue.svg)](https://godoc.org/github.com/qiniu/goplus)

## Summary about Go+

What are mainly impressions about Go+?

- A static typed language.
- Fully compatible with [the Go language](https://github.com/golang/go).
- Script-like style, and more readable code for data science than Go.

For example, the following is a legal Go+ source code:

```go
a := [1, 2, 3.4]
println(a)
```

How do we do this in the Go language?

```go
package main

func main() {
    a := []float64{1, 2, 3.4}
    println(a)
}
```

Of course, we don't only do less-typing things.

For example, we  support `list comprehension`, which make data processing easier.

```go
a := [1, 3, 5, 7, 11]
b := [x*x for x <- a, x > 3]
println(b) // output: [25 49 121]

mapData := {"Hi": 1, "Hello": 2, "Go+": 3}
reversedMap := {v: k for k, v <- mapData}
println(reversedMap) // output: map[1:Hi 2:Hello 3:Go+]
```

We will keep Go+ simple. This is why we call it Go+, not Go++.

Less is exponentially more.

It's for Go, and it's also for Go+.

## Compatibility with Go

All Go features (not including `cgo`) will be supported.

* See [supported the Go language features](https://github.com/qiniu/goplus/wiki/Supported-Go-features).

**All Go packages (even these packages use `cgo`) can be imported by Go+.**

```go
import (
    "fmt"
    "strings"
)

x := strings.NewReplacer("?", "!").Replace("hello, world???")
fmt.Println("x:", x)
```

Be interested in how it works? See [Dive into Go+](https://github.com/qiniu/goplus/wiki/Dive-into-Goplus).

**Also, all Go+ packages can be converted into Go packages, and then be imported by Go.**

First, let's make a directory named `tutorial/14-Using-goplus-in-Go`.

Then write a Go+ package named `foo` in it:

```go
package foo

func ReverseMap(m map[string]int) map[int]string {
    return {v: k for k, v <- m}
}
```

Then use it in a Go package:

```go
package main

import (
	"fmt"

	"github.com/qiniu/goplus/tutorial/14-Using-goplus-in-Go/foo"
)

func main() {
	rmap := foo.ReverseMap(map[string]int{"Hi": 1, "Hello": 2})
	fmt.Println(rmap)
}
```

How to compile this exmaple?

```bash
gop go tutorial/ # Convert all Go+ packages in tutorial/ into Go packages
go install ./...
```

Or:

```bash
gop install ./... # Convert Go+ packages and go install ./...
```

Go [tutorial/14-Using-goplus-in-Go](https://github.com/qiniu/goplus/tree/master/tutorial/14-Using-goplus-in-Go) to get the source code.

## Tutorials

* https://github.com/qiniu/goplus/tree/master/tutorial

## Go+ features

### Bytecode vs. Go code

Go+ suppports bytecode backend or generating Go code.

When we use `gop go` or `gop install` command, it generates Go code to covert Go+ package into Go packages.

When we use `gop run` command, it doesn't call `go run` command. It generates bytecode to execute.

### Commands

```bash
gop go <gopSrcDir> # Convert all Go+ packages under <gopSrcDir> into Go packages, recursively
gop run <gopSrcDir> # Running <gopSrcDir> as a Go+ main package
gop run <gopSrcFile> # Running <gopSrcFile> as a Go+ script
gop install ./... # Convert all Go+ packages under ./ and go install ./...
```

The `gop` command isn't provided currently (in alpha stage). Instead, we provide the following commands:

```bash
qrun <gopSrcDir> # gop run <gopSrcDir>
qrun -asm <gopSrcDir> # generates `asm` code of Go+ bytecode backend
qrun -quiet <gopSrcDir> # don't generate any compiling stage log
qrun -debug <gopSrcDir> # print debug information
qrun -prof <gopSrcDir> # do profile and generate profile report
qgo <gopSrcDir> # gop go <gopSrcDir>
qgo -test <gopSrcDir>
```

Note:

* `qgo -test <gopSrcDir>` converts Go+ packages into Go packages, and for every package, it call `go run <gopPkgDir>/gop_autogen.go` and `qrun -quiet <gopPkgDir>` to compare their outputs. If their outputs aren't equal, the test case fails.

### Map literal

```go
x := {"Hello": 1, "xsw": 3.4} // map[string]float64
y := {"Hello": 1, "xsw": "Go+"} // map[string]interface{}
z := {"Hello": 1, "xsw": 3} // map[string]int
empty := {} // map[string]interface{}
```

### Slice literal

```go
x := [1, 3.4] // []float64
y := [1] // []int
z := [1+2i, "xsw"] // []interface{}
a := [1, 3.4, 3+4i] // []complex128
b := [5+6i] // []complex128
c := ["xsw", 3] // []interface{}
empty := [] // []interface{}
```

### List/Map comprehension

```go
a := [x*x for x <- [1, 3, 5, 7, 11]]
b := [x*x for x <- [1, 3, 5, 7, 11], x > 3]
c := [i+v for i, v <- [1, 3, 5, 7, 11], i%2 == 1]
d := [k+","+s for k, s <- {"Hello": "xsw", "Hi": "Go+"}]

arr := [1, 2, 3, 4, 5, 6]
e := [[a, b] for a <- arr, a < b for b <- arr, b > 2]

x := {x: i for i, x <- [1, 3, 5, 7, 11]}
y := {x: i for i, x <- [1, 3, 5, 7, 11], i%2 == 1}
z := {v: k for k, v <- {1: "Hello", 3: "Hi", 5: "xsw", 7: "Go+"}, k > 3}
```

### For loop

```go
sum := 0
for x <- [1, 3, 5, 7, 11, 13, 17], x > 3 {
    sum += x
}
```

### Error handling

We reinvent error handling specification in Go+. We call them `ErrWrap expressions`:

```go
expr! // panic if err
expr? // return if err
expr?:defval // use defval if err
```

How to use them? Here is an example:

```go
import (
	"strconv"
)

func add(x, y string) (int, error) {
	return strconv.Atoi(x)? + strconv.Atoi(y)?, nil
}

func addSafe(x, y string) int {
	return strconv.Atoi(x)?:0 + strconv.Atoi(y)?:0
}

println(`add("100", "23"):`, add("100", "23")!)

sum, err := add("10", "abc")
println(`add("10", "abc"):`, sum, err)

println(`addSafe("10", "abc"):`, addSafe("10", "abc"))
```

The output of this example is:

```
add("100", "23"): 123
add("10", "abc"): 0 strconv.Atoi: parsing "abc": invalid syntax

===> errors stack:
main.add("10", "abc")
	/Users/xsw/goplus/tutorial/15-ErrWrap/err_wrap.gop:6 strconv.Atoi(y)?

addSafe("10", "abc"): 10
```

Compared to corresponding Go code, It is clear and more readable.

And the most interesting thing is, the return error contains the full error stack. When we got an error, it is very easy to position what the root cause is.

How these `ErrWrap expressions` work? See [Error Handling](https://github.com/qiniu/goplus/wiki/Error-Handling) for more information.

### Go features

All Go features (not including `cgo`) will be supported.

* See [supported the Go language features](https://github.com/qiniu/goplus/wiki/Supported-Go-features).


text:
package com.goeuro.sync4j.sync;

import com.goeuro.sync4j.fs.*;
import com.goeuro.sync4j.sync.Synchronizer.ProgressListener;
import org.echocat.unittest.utils.rules.TestDirectory;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.function.Function;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import static com.goeuro.sync4j.fs.Detail.Kind.file;
import static com.goeuro.sync4j.fs.Directory.directory;
import static com.goeuro.sync4j.fs.Local.localOf;
import static com.goeuro.sync4j.fs.LocalFileSystem.defaultLocalFileSystem;
import static com.goeuro.sync4j.fs.Path.path;
import static com.goeuro.sync4j.fs.Paths.*;
import static com.goeuro.sync4j.sync.ElementFilter.Action.*;
import static com.goeuro.sync4j.sync.SynchronizeTask.task;
import static com.goeuro.sync4j.utils.IOStreams.copy;
import static java.nio.file.Files.*;
import static org.echocat.unittest.utils.matchers.HasSameSizeAs.hasSameSizeAs;
import static org.echocat.unittest.utils.matchers.IsEqualTo.isEqualTo;
import static org.echocat.unittest.utils.matchers.IsEqualTo.isTrue;
import static org.echocat.unittest.utils.matchers.IsNull.isNotNull;
import static org.echocat.unittest.utils.matchers.OptionalMatchers.whereContentMatches;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;

@RunWith(Parameterized.class)
public class SynchronizerScenarioUnitTest {

    @Parameters(name = "{0}")
    public static Collection<Object[]> data() {
        return Arrays.asList(
            new Object[]{"singleFileTargetMissing", "singleFileTargetMissing1", null, null},
            new Object[]{"singleFileOrphanedTarget", "singleFileOrphanedTarget1", null, null},
            new Object[]{"targetEmpty", "targetEmpty1", null, null},
            new Object[]{"targetEqual", "targetEqual1", null, null},
            new Object[]{"targetHasMoreFiles", "targetHasMoreFiles1", null, null},
            new Object[]{"justOneFileDifferent", "justOneFileDifferent1", null, null},
            new Object[]{"relativeToPath", "targetHasMoreFiles1", null, (TF) SynchronizerScenarioUnitTest::makeToRelative},
            new Object[]{"targetHasFilesThatAreIgnoredLeft", "targetHasFilesThatAreIgnoredLeft1", (ElementFilter<Local>) (path, relativePath) -> "dir1/ignored".equals(relativePath) ? ignore : include, null},
            new Object[]{"sourceWithSomeExcludes", "sourceWithSomeExcludes1", (ElementFilter<Local>) (path, relativePath) -> "dir1/excluded".equals(relativePath) ? exclude : include, null}
        );
    }

    @Nonnull
    private static SynchronizeTask<Local, Local> makeToRelative(@Nonnull SynchronizeTask<Local, Local> input) {
        final java.nio.file.Path plainTo = input.to().loose().delegate().resolve("anyOther/..");
        final Path<Local> to = input.to().fileSystem().resolve(plainTo.toUri());
        return task(input.from(), to)
            .filteredBy(input.filter())
            .build();
    }

    @Nonnull
    private final String name;
    @Nonnull
    private final String scenario;
    @Nullable
    private final ElementFilter<Local> filter;
    @Nullable
    private final Function<SynchronizeTask<Local, Local>, SynchronizeTask<Local, Local>> patchTask;
    @Rule
    public final TestDirectory root = new TestDirectory(this::prepareScenario);

    public SynchronizerScenarioUnitTest(
        @Nonnull String name,
        @Nonnull String scenario,
        @Nullable ElementFilter<Local> filter,
        @Nullable Function<SynchronizeTask<Local, Local>, SynchronizeTask<Local, Local>> patchTask) {
        this.name = name;
        this.scenario = scenario;
        this.filter = filter;
        this.patchTask = patchTask;
    }

    @Test
    public void execute() throws Exception {
        final SynchronizeTask<Local, Local> task = givenTask();
        final Synchronizer instance = givenInstance();

        instance.execute(task);

        final Map<String, Detail<Local>> actualContents = actualContents();
        final Map<String, Detail<Local>> expectedContents = expectedContents();

        assertThat(actualContents, hasSameSizeAs(expectedContents));
        for (final Entry<String, Detail<Local>> relativeAndExpected : expectedContents.entrySet()) {
            final Detail<Local> expected = relativeAndExpected.getValue();
            final Detail<Local> actual = actualContents.get(relativeAndExpected.getKey());
            assertThat(expected + " could not found in " + actualContents.values(), actual, isNotNull());
            assertThat(expected + " does not have the same kind as " + actual, actual.kind(), isEqualTo(expected.kind()));
            if (expected.kind() == file) {
                assertThat(expected + " does not have the same content as " + actual, hasSameContent(actual, expected), whereContentMatches(isTrue()));
            }
        }
    }

    @Nonnull
    private Path<Local> targetPath() {
        return pathOf("target");
    }

    @Nonnull
    private Path<Local> expectedPath() {
        return pathOf("expected");
    }

    @Nonnull
    private Path<Local> pathOf(@Nonnull String name) {
        final LocalFileSystem fileSystem = givenFileSystem();
        return path(fileSystem, localOf(root.resolve(name)))
            .build();
    }

    @Nonnull
    private Map<String, Detail<Local>> actualContents() {
        return contentsOf(targetPath());
    }

    @Nonnull
    private Map<String, Detail<Local>> expectedContents() {
        return contentsOf(expectedPath());
    }

    @Nonnull
    private Map<String, Detail<Local>> contentsOf(@Nonnull Path<Local> path) {
        final Map<String, Detail<Local>> result = new TreeMap<>();
        try (final Stream<Detail<Local>> stream = listAll(path)) {
            stream.forEach(candidate -> {
                final String relativized = relativize(path, candidate);
                result.put(relativized, candidate);
            });
        }
        return result;
    }

    private void prepareScenario(@Nonnull java.nio.file.Path base) throws Exception {
        try (final InputStream is = scenarioInputStream()) {
            try (final ZipInputStream zis = new ZipInputStream(is)) {
                ZipEntry entry = zis.getNextEntry();
                while (entry != null) {
                    final java.nio.file.Path target = base.resolve(entry.getName());
                    if (entry.isDirectory()) {
                        createDirectories(target);
                    } else {
                        createDirectories(target.getParent());
                        try (final OutputStream os = newOutputStream(target)) {
                            copy(zis, os);
                        }
                    }
                    entry = zis.getNextEntry();
                }
            }
        }
        if (!scenario.startsWith("singleFile")) {
            assertThat(isDirectory(base.resolve("expected")), isTrue());
            assertThat(isDirectory(base.resolve("source")), isTrue());
            assertThat(isDirectory(base.resolve("target")), isTrue());
        }
    }

    @Nonnull
    private InputStream scenarioInputStream() {
        final String name = "scenario/" + scenario + ".zip";
        final InputStream result = getClass().getResourceAsStream(name);
        assertThat(result, isNotNull());
        return result;
    }

    @Nonnull
    protected static LocalFileSystem givenFileSystem() {
        return defaultLocalFileSystem();
    }

    @Nonnull
    protected static Synchronizer givenInstance() {
        final ProgressListener progressListener = givenProgressListener();
        return new Synchronizer(progressListener);
    }

    @Nonnull
    protected static ProgressListener givenProgressListener() {
        return mock(ProgressListener.class);
    }

    @Nonnull
    private SynchronizeTask<Local, Local> givenTask() {
        SynchronizeTask<Local, Local> result = givenTask(pathOf("source"), pathOf("target"));
        if (patchTask != null) {
            result = patchTask.apply(result);
        }
        return result;
    }

    @Nonnull
    private SynchronizeTask<Local, Local> givenTask(@Nonnull Path<Local> from, @Nonnull Path<Local> to) {
        final LocalFileSystem fs = givenFileSystem();
        return givenTask(
            directory(fs, from.loose()).build(),
            directory(fs, to.loose()).build()
        );
    }

    @Nonnull
    private SynchronizeTask<Local, Local> givenTask(@Nonnull Directory<Local> from, @Nonnull Directory<Local> to) {
        return task(from, to)
            .filteredBy(filter)
            .build();
    }

    @FunctionalInterface
    private interface TF extends Function<SynchronizeTask<Local, Local>, SynchronizeTask<Local, Local>> {}

}


text:
""" Utility functions and classes for the protocol api """
from collections import UserDict
import functools
import logging
from dataclasses import dataclass, field, astuple
from typing import (Any, Callable, Dict, Optional,
                    TYPE_CHECKING, Union, List, Set)

from opentrons import types as top_types
from opentrons.protocols.types import APIVersion
from opentrons.hardware_control import (types, SynchronousAdapter, API,
                                        HardwareAPILike, ThreadManager)
if TYPE_CHECKING:
    from opentrons.protocol_api.contexts import InstrumentContext
    from opentrons.protocol_api.labware import Well, Labware
    from opentrons.protocols.geometry.deck import Deck
    from opentrons.hardware_control.dev_types import HasLoop # noqa (F501)

MODULE_LOG = logging.getLogger(__name__)

class APIVersionError(Exception):
    """
    Error raised when a protocol attempts to access behavior not implemented
    """
    pass

def _assert_gzero(val: Any, message: str) -> float:
    try:
        new_val = float(val)
        assert new_val > 0.0
        return new_val
    except (TypeError, ValueError, AssertionError):
        raise AssertionError(message)

@dataclass
class EdgeList:
    right: Optional[top_types.Point] = field(default_factory=top_types.Point)
    left: Optional[top_types.Point] = field(default_factory=top_types.Point)
    center: Optional[top_types.Point] = field(default_factory=top_types.Point)
    up: top_types.Point = field(default_factory=top_types.Point)
    down: top_types.Point = field(default_factory=top_types.Point)

def determine_edge_path(
        where: 'Well', mount: top_types.Mount,
        default_edges: EdgeList, deck: 'Deck') -> EdgeList:
    left_path = EdgeList(
        left=default_edges.left,
        right=None,
        center=default_edges.center,
        up=default_edges.up,
        down=default_edges.down)
    right_path = EdgeList(
        left=None,
        right=default_edges.right,
        center=default_edges.center,
        up=default_edges.up,
        down=default_edges.down
    )
    labware = where.parent

    r_mount = top_types.Mount.RIGHT
    l_mount = top_types.Mount.LEFT
    l_col = labware.columns()[0]
    r_col = labware.columns()[-1]
    right_pip_criteria = mount is r_mount and where in l_col
    left_pip_criteria = mount is l_mount and where in r_col

    next_to_mod = deck.is_edge_move_unsafe(mount, labware)
    if labware.parent in ['3', '6', '9'] and left_pip_criteria:
        return left_path
    elif left_pip_criteria and next_to_mod:
        return left_path
    elif right_pip_criteria and next_to_mod:
        return right_path
    return default_edges

def build_edges(
        where: 'Well', offset: float, mount: top_types.Mount,
        deck: 'Deck', radius: float = 1.0,
        version: APIVersion = APIVersion(2, 7)) -> List[top_types.Point]:
    # Determine the touch_tip edges/points
    offset_pt = top_types.Point(0, 0, offset)
    edge_list = EdgeList(
        right=where._from_center_cartesian(x=radius, y=0, z=1) + offset_pt,
        left=where._from_center_cartesian(x=-radius, y=0, z=1) + offset_pt,
        center=where._from_center_cartesian(x=0, y=0, z=1) + offset_pt,
        up=where._from_center_cartesian(x=0, y=radius, z=1) + offset_pt,
        down=where._from_center_cartesian(x=0, y=-radius, z=1) + offset_pt
    )

    if version < APIVersion(2, 4):
        edge_list.center = None
        # Add the center value before switching axes
        return [edge for edge in astuple(edge_list) if edge]
    new_edges = determine_edge_path(where, mount, edge_list, deck)
    return [edge for edge in astuple(new_edges) if edge]

def labware_column_shift(
        initial_well: 'Well', tiprack: 'Labware',
        well_spacing: int = 4,
        modulo_value: int = 8) -> 'Well':
    unshifted_index = tiprack.wells().index(initial_well)
    unshifted_column = unshifted_index // modulo_value
    shifted_column = unshifted_column + well_spacing
    shifted_well = unshifted_index % modulo_value
    return tiprack.columns()[shifted_column][shifted_well]

def first_parent(loc: top_types.LocationLabware) -> Optional[str]:
    """ Return the topmost parent of this location. It should be
    either a string naming a slot or a None if the location isn't
    associated with a slot """

    # cycle-detecting recursive climbing
    seen: Set[top_types.LocationLabware] = set()

    # internal function to have the cycle detector different per call
    def _fp_recurse(location: top_types.LocationLabware):
        if location in seen:
            raise RuntimeError('Cycle in labware parent')
        seen.add(location)
        if location is None or isinstance(location, str):
            return location
        else:
            return first_parent(location.parent)

    return _fp_recurse(loc)

class FlowRates:
    """ Utility class for rich setters/getters for flow rates """
    def __init__(self,
                 instr: 'InstrumentContext') -> None:
        self._instr = instr

    def set_defaults(self, api_level: APIVersion):
        self.aspirate = _find_value_for_api_version(
            api_level, self._instr.hw_pipette['default_aspirate_flow_rates'])
        self.dispense = _find_value_for_api_version(
            api_level, self._instr.hw_pipette['default_dispense_flow_rates'])
        self.blow_out = _find_value_for_api_version(
            api_level, self._instr.hw_pipette['default_blow_out_flow_rates'])

    @property
    def aspirate(self) -> float:
        return self._instr.hw_pipette['aspirate_flow_rate']

    @aspirate.setter
    def aspirate(self, new_val: float):
        self._instr._hw_manager.hardware.set_flow_rate(
            mount=self._instr._mount,
            aspirate=_assert_gzero(
                new_val, 'flow rate should be a numerical value in ul/s'))

    @property
    def dispense(self) -> float:
        return self._instr.hw_pipette['dispense_flow_rate']

    @dispense.setter
    def dispense(self, new_val: float):
        self._instr._hw_manager.hardware.set_flow_rate(
            mount=self._instr._mount,
            dispense=_assert_gzero(
                new_val, 'flow rate should be a numerical value in ul/s'))

    @property
    def blow_out(self) -> float:
        return self._instr.hw_pipette['blow_out_flow_rate']

    @blow_out.setter
    def blow_out(self, new_val: float):
        self._instr._hw_manager.hardware.set_flow_rate(
            mount=self._instr._mount,
            blow_out=_assert_gzero(
                new_val, 'flow rate should be a numerical value in ul/s'))

def _find_value_for_api_version(for_version: APIVersion,
                                values: Dict[str, float]) -> float:
    """
    Parse a dict that looks like
    {"2.0": 5,
    "2.5": 4}
    (aka the flow rate values from pipette config) and return the value for
    the highest api level that is at or underneath ``for_version``
    """
    sorted_versions = sorted({APIVersion.from_string(k): v
                              for k, v in values.items()})
    last = values[str(sorted_versions[0])]
    for version in sorted_versions:
        if version > for_version:
            break
        last = values[str(version)]
    return last

class PlungerSpeeds:
    """ Utility class for rich setters/getters for speeds """
    def __init__(self,
                 instr: 'InstrumentContext') -> None:
        self._instr = instr

    @property
    def aspirate(self) -> float:
        return self._instr.hw_pipette['aspirate_speed']

    @aspirate.setter
    def aspirate(self, new_val: float):
        self._instr._hw_manager.hardware.set_pipette_speed(
            mount=self._instr._mount,
            aspirate=_assert_gzero(
                new_val, 'speed should be a numerical value in mm/s'))

    @property
    def dispense(self) -> float:
        return self._instr.hw_pipette['dispense_speed']

    @dispense.setter
    def dispense(self, new_val: float):
        self._instr._hw_manager.hardware.set_pipette_speed(
            mount=self._instr._mount,
            dispense=_assert_gzero(
                new_val, 'speed should be a numerical value in mm/s'))

    @property
    def blow_out(self) -> float:
        return self._instr.hw_pipette['blow_out_speed']

    @blow_out.setter
    def blow_out(self, new_val: float):
        self._instr._hw_manager.hardware.set_pipette_speed(
            mount=self._instr._mount,
            blow_out=_assert_gzero(
                new_val, 'speed should be a numerical value in mm/s'))

class Clearances:
    def __init__(self,
                 default_aspirate: float,
                 default_dispense: float) -> None:
        self._aspirate = default_aspirate
        self._dispense = default_dispense

    @property
    def aspirate(self) -> float:
        return self._aspirate

    @aspirate.setter
    def aspirate(self, new_val: float):
        self._aspirate = float(new_val)

    @property
    def dispense(self) -> float:
        return self._dispense

    @dispense.setter
    def dispense(self, new_val: float):
        self._dispense = float(new_val)

class AxisMaxSpeeds(UserDict):
    """ Special mapping allowing internal storage by Mount enums and
    user access by string
    """

    def __getitem__(self, key: Union[str, types.Axis]):
        checked_key = AxisMaxSpeeds._verify_key(key)
        return self.data[checked_key]

    @staticmethod
    def _verify_key(key: Any) -> types.Axis:
        if isinstance(key, types.Axis):
            checked_key: Optional[types.Axis] = key
        elif isinstance(key, str):
            checked_key = types.Axis[key.upper()]
        else:
            checked_key = None
        if checked_key not in types.Axis.gantry_axes():
            raise KeyError(key)
        return checked_key

    def __setitem__(self, key: Any, value: Any):
        if value is None:
            del self[key]
            return

        checked_key = AxisMaxSpeeds._verify_key(key)
        checked_val = _assert_gzero(
            value, 'max speeds should be numerical values in mm/s')

        self.data[checked_key] = checked_val

    def __delitem__(self, key: Union[str, types.Axis]):
        checked_key = AxisMaxSpeeds._verify_key(key)
        del self.data[checked_key]

    def __iter__(self):
        """ keys() and dict iteration return string keys """
        return (k.name for k in self.data.keys())

    def keys(self):
        return (k.name for k in self.data.keys())

    def items(self):
        return ((k.name, v) for k, v in self.data.items())

HardwareToManage = Union[ThreadManager,
                         SynchronousAdapter,
                         'HasLoop']

# TODO: BC 2020-03-02 This class's utility as a utility class is drying up.
# It's only job is to ensure that the hardware a given
# ProtocolContext references, is synchronously callable.
# All internal calls to ProtocolContext __init__
# or build_using, either pass a ThreadManaged API instance
# or pass None and expect HardwareManager to create one
# for them. It seems as though we could replace this
# with a single if else that covers just those two cases.
# If that were the case, perhaps it would be clearer to move
# this logic back into the ProtocolContext definition
# and hold onto a sync hardware api directly instead of
# through the ._hw_manager.hardware indirection.
class HardwareManager:
    def __init__(self, hardware: Optional[HardwareToManage]):
        if hardware is None:
            self._current = ThreadManager(API.build_hardware_simulator).sync
        elif isinstance(hardware, SynchronousAdapter):
            self._current = hardware
        elif isinstance(hardware, ThreadManager):
            self._current = hardware.sync
        else:
            self._current = SynchronousAdapter(hardware)

    @property
    def hardware(self):
        return self._current

    def set_hw(self, hardware):
        if isinstance(hardware, SynchronousAdapter):
            self._current = hardware
        elif isinstance(hardware, ThreadManager):
            self._current = hardware.sync
        elif isinstance(hardware, HardwareAPILike):
            self._current = SynchronousAdapter(hardware)
        else:
            raise TypeError(
                "hardware should be API or synch adapter but is {}"
                .format(hardware))
        return self._current

    def reset_hw(self):
        self._current = ThreadManager(API.build_hardware_simulator).sync
        return self._current

def clamp_value(
        input_value: float, max_value: float, min_value: float,
        log_tag: str = '') -> float:
    if input_value > max_value:
        MODULE_LOG.info(
            f'{log_tag} clamped input {input_value} to {max_value}')
        return max_value
    if input_value < min_value:
        MODULE_LOG.info(
            f'{log_tag} clamped input {input_value} to {min_value}')
        return min_value
    return input_value

def requires_version(
        major: int, minor: int) -> Callable[[Callable], Callable]:
    """ Decorator. Apply to Protocol API methods or attributes to indicate
    the first version in which the method or attribute was present.
    """
    def _set_version(decorated_obj: Callable) -> Callable:
        added_version = APIVersion(major, minor)
        setattr(decorated_obj, '__opentrons_version_added',
                added_version)
        if hasattr(decorated_obj, '__doc__'):
            # Add the versionadded stanza to everything decorated if we can
            docstr = decorated_obj.__doc__ or ''
            # this newline and initial space has to be there for sphinx to
            # parse this correctly and not add it into for instance a
            # previous code-block
            docstr += f'\n\n        .. versionadded:: {added_version}\n\n'
            decorated_obj.__doc__ = docstr

        @functools.wraps(decorated_obj)
        def _check_version_wrapper(*args, **kwargs):
            slf = args[0]
            added_in = decorated_obj.__opentrons_version_added  # type: ignore
            current_version = slf._api_version
            if current_version >= APIVersion(2, 0)\
               and current_version < added_in:
                raise APIVersionError(
                    f'{decorated_obj} was added in {added_in}, but your '
                    f'protocol requested version {current_version}. You '
                    f'must increase your API version to {added_in} to '
                    'use this functionality.')
            return decorated_obj(*args, **kwargs)

        return _check_version_wrapper

    return _set_version

class ModifiedList(list):
    def __contains__(self, item):
        for name in self:
            if name == item.replace("-", "_").lower():
                return True
        return False

def convert_door_state_to_bool(door_state: types.DoorState):
    return True if door_state == types.DoorState.CLOSED else False


text:
#include <cetty/handler/timeout/ReadTimeoutException.h>

namespace cetty {
namespace handler {
namespace timeout {

CETTY_IMPLEMENT_EXCEPTION(ReadTimeoutException, TimeoutException, "no data was read within a certain period of time")

}
}
}


text:
package au.com.agic.deploymentsync.core.deployment;

/**
 * Represents application's deployment artifact
 */
public interface Deployment {

	byte[] getSha1();

	String getLocalPath();

	void setLocalPath(String localPath);

	String getName();

	Boolean getForceFlag();

	void setForceFlag(Boolean forceFlag);

	Long getEnabledTime();

	void setEnabledTime(Long enabledTime);

	boolean equals(Object object);

	int hashCode();
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="ExDoc v0.18.3">
    <title>Annon.Factories.Configuration – annon_api v0.16.2</title>
    <link rel="stylesheet" href="dist/app-091c05798a.css" />

<button class="sidebar-button sidebar-toggle">

  Toggle Sidebar
</button>
<button class="sidebar-button night-mode-toggle">

  Toggle Theme
</button>

        annon_api

        v0.16.2

  <form class="sidebar-search" action="search.html">
    <button type="submit" class="search-button">

    </button>
    <input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
  </form>

Pages

Modules

        annon_api v0.16.2
        Annon.Factories.Configuration

This module lists Configuration-related factories, a mean suitable
for tests that involve preparation of DB data.

              Link to this section

            Summary

      Functions

    acl_plugin_factory()

    api_factory()

    api_request_factory()

    auth_plugin_with_jwt_factory()

    auth_plugin_with_oauth_factory()

    build(factory_name, attrs \\ %{})

    build_list(number_of_records, factory_name, attrs \\ %{})

    build_pair(factory_name, attrs \\ %{})

    cors_plugin_factory()

    create(_)

    create(_, _)

    create_list(_, _, _)

    create_pair(_, _)

    factory(factory_name)

Raises a helpful error if no factory is defined

    fields_for(factory_name, attrs \\ %{})

    idempotency_plugin_factory()

    insert(already_built_record)

    insert(factory_name, attrs \\ %{})

    insert_list(number_of_records, factory_name, attrs \\ %{})

    insert_pair(factory_name, attrs \\ %{})

    ip_restriction_plugin_factory()

    params_for(factory_name, attrs \\ %{})

    params_with_assocs(factory_name, attrs \\ %{})

    proxy_plugin_factory()

    proxy_plugin_upstream_factory()

    string_params_for(factory_name, attrs \\ %{})

    string_params_with_assocs(factory_name, attrs \\ %{})

    ua_restriction_plugin_factory()

    validator_plugin_factory()

              Link to this section

            Functions

      Link to this function

    acl_plugin_factory()

      Link to this function

    api_factory()

      Link to this function

    api_request_factory()

      Link to this function

    auth_plugin_with_jwt_factory()

      Link to this function

    auth_plugin_with_oauth_factory()

      Link to this function

    build(factory_name, attrs \\ %{})

      Link to this function

    build_list(number_of_records, factory_name, attrs \\ %{})

      Link to this function

    build_pair(factory_name, attrs \\ %{})

      Link to this function

    cors_plugin_factory()

      Link to this function

    create(_)

create(any()) :: no_return()

      Link to this function

    create(_, _)

create(any(), any()) :: no_return()

      Link to this function

    create_list(_, _, _)

create_list(any(), any(), any()) :: no_return()

      Link to this function

    create_pair(_, _)

create_pair(any(), any()) :: no_return()

      Link to this function

    factory(factory_name)

factory(any()) :: no_return()

Raises a helpful error if no factory is defined.

      Link to this function

    fields_for(factory_name, attrs \\ %{})

      Link to this function

    idempotency_plugin_factory()

      Link to this function

    insert(already_built_record)

      Link to this function

    insert(factory_name, attrs \\ %{})

      Link to this function

    insert_list(number_of_records, factory_name, attrs \\ %{})

      Link to this function

    insert_pair(factory_name, attrs \\ %{})

      Link to this function

    ip_restriction_plugin_factory()

      Link to this function

    params_for(factory_name, attrs \\ %{})

      Link to this function

    params_with_assocs(factory_name, attrs \\ %{})

      Link to this function

    proxy_plugin_factory()

      Link to this function

    proxy_plugin_upstream_factory()

      Link to this function

    string_params_for(factory_name, attrs \\ %{})

      Link to this function

    string_params_with_assocs(factory_name, attrs \\ %{})

      Link to this function

    ua_restriction_plugin_factory()

      Link to this function

    validator_plugin_factory()

            Built using
            ExDoc (v0.18.3),

            designed by
            Friedel Ziegelmayer.


text:
package com.crittertap;

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

public class World {

	private static final float TICK_INITIAL = 0.5f;

	//private static final float TICK_DECREMENT = 0.05f;
	private float tickTime;
	private float tick;

	public boolean gameOver;
	public int score;

	public List<Creature> creaturesArray = new ArrayList<Creature>();

	public World() {
		Setup();
	}

	public void Setup() {
		tickTime = 0.0f;
		tick = TICK_INITIAL;
		gameOver = false;
		score = 0;

		for(int i=0; i <=8; i++) {

			if(i <= 2){
				Creature tempCreature = new Creature((96 * i) + 19, 86 );
				creaturesArray.add(tempCreature);
			}
			if(i >= 3 && i <= 5){
				Creature tempCreature = new Creature((96 * (i-3)) + 19, 180);
				creaturesArray.add(tempCreature);
			}
			if(i >= 6 && i <= 8){
				Creature tempCreature = new Creature((96 * (i-6)) + 19, 276);
				creaturesArray.add(tempCreature);
			}

		}
	}

	public void update(float deltaTime) {
		if(gameOver) {
			return;
		}
		tickTime += deltaTime;

		while(tickTime > tick) {
			tickTime -= tick;
		}
	}
}


text:
<!DOCTYPE HTML>
<html>
<head>
<title>Testcase for resizing elements that depend on containing block height</title>
<style type="text/css">
html, body { height: 100%; }
iframe { width: 100%; }
</style>
</head>
<body>
<iframe style="height: 750px" src="163504-1-inner.html"></iframe>
</body>
</html>


text:
///////////////////////////////////////////////////////////////////////////////
// Name:        wx/wxcrtvararg.h
// Purpose:     Type-safe ANSI and Unicode builds compatible wrappers for
//              printf(), scanf() and related CRT functions
// Author:      Joel Farley, Ove Kåven
// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
// Created:     2007-02-19
// RCS-ID:      $Id$
// Copyright:   (c) 2007 REA Elektronik GmbH
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

#ifndef _WX_WXCRTVARARG_H_
#define _WX_WXCRTVARARG_H_

// NB: User code should include wx/crt.h instead of including this
//     header directly.

#include "wx/wxcrt.h"
#include "wx/strvararg.h"

#include "wx/string.h"

// ----------------------------------------------------------------------------
// CRT functions aliases
// ----------------------------------------------------------------------------

/* Required for wxPrintf() etc */
#include <stdarg.h>

/* printf() family saga */

/*
   For many old Unix systems [v]snprintf()/vsscanf() exists in the system
   libraries but not in the headers, so we need to declare it ourselves to be
   able to use it.
 */
#ifdef __UNIX__

#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
#ifdef __cplusplus
    extern "C"
#else
    extern
#endif
    int vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif /* !HAVE_VSNPRINTF_DECL */

#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
#ifdef __cplusplus
    extern "C"
#else
    extern
#endif
    int snprintf(char *str, size_t size, const char *format, ...);
#endif /* !HAVE_SNPRINTF_DECL */

#if defined(HAVE_VSSCANF) && !defined(HAVE_VSSCANF_DECL)
#ifdef __cplusplus
    extern "C"
#else
    extern
#endif
    int vsscanf(const char *str, const char *format, va_list ap);
#endif /* !HAVE_VSSCANF_DECL */

/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
 * same isn't done for snprintf below, the builtin wxSnprintf_ is used
 * instead since it's already a simple wrapper */
#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
    inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
    {
        return vsnprintf(str, size, (char*)format, ap);
    }
#endif

#endif /* __UNIX__ */

/*
   mingw32 normally uses MSVCRT which has non-standard vswprintf() and so
   normally _vsnwprintf() is used instead, the only exception is when mingw32
   is used with STLPort which does have a standard vswprintf() starting from
   version 5.1 which we can use.
 */
#ifdef __MINGW32__
    #if defined(_STLPORT_VERSION) && _STLPORT_VERSION >= 0x510
        #ifndef HAVE_VSWPRINTF
            #define HAVE_VSWPRINTF
        #endif
    #elif defined(HAVE_VSWPRINTF)
        /* can't use non-standard vswprintf() */
        #undef HAVE_VSWPRINTF
    #endif
#endif /* __MINGW32__ */

#if defined(__WATCOMC__)
    #define HAVE_VSWPRINTF 1
#endif

#if wxUSE_PRINTF_POS_PARAMS
    /*
        The systems where vsnprintf() supports positional parameters should
        define the HAVE_UNIX98_PRINTF symbol.

        On systems which don't (e.g. Windows) we are forced to use
        our wxVsnprintf() implementation.
    */
    #if defined(HAVE_UNIX98_PRINTF)
        #ifdef HAVE_VSWPRINTF
            #define wxCRT_VsnprintfW   vswprintf
        #endif
        #ifdef HAVE_BROKEN_VSNPRINTF_DECL
            #define wxCRT_VsnprintfA    wx_fixed_vsnprintf
        #else
            #define wxCRT_VsnprintfA    vsnprintf
        #endif
    #else /* !HAVE_UNIX98_PRINTF */
        /*
            The only compiler with positional parameters support under Windows
            is VC++ 8.0 which provides a new xxprintf_p() functions family.
            The 2003 PSDK includes a slightly earlier version of VC8 than the
            main release and does not have the printf_p functions.
         */
        #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
            #define wxCRT_VsnprintfA    _vsprintf_p
            #define wxCRT_VsnprintfW    _vswprintf_p
        #endif
    #endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
#else /* !wxUSE_PRINTF_POS_PARAMS */
    /*
       We always want to define safe snprintf() function to be used instead of
       sprintf(). Some compilers already have it (or rather vsnprintf() which
       we really need...), otherwise we implement it using our own printf()
       code.

       We define function with a trailing underscore here because the real one
       is a wrapper around it as explained below
     */

    #if defined(__VISUALC__) || \
            (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
        #define wxCRT_VsnprintfA    _vsnprintf
        #define wxCRT_VsnprintfW    _vsnwprintf
    #else
        #if defined(HAVE__VSNWPRINTF)
            #define wxCRT_VsnprintfW    _vsnwprintf
        #elif defined(HAVE_VSWPRINTF)
            #define wxCRT_VsnprintfW     vswprintf
        #elif defined(__WATCOMC__)
            #define wxCRT_VsnprintfW    _vsnwprintf
        #endif

        /*
           All versions of CodeWarrior supported by wxWidgets apparently
           have both snprintf() and vsnprintf()
         */
        #if defined(HAVE_VSNPRINTF) \
            || defined(__MWERKS__) || defined(__WATCOMC__)
            #ifdef HAVE_BROKEN_VSNPRINTF_DECL
                #define wxCRT_VsnprintfA    wx_fixed_vsnprintf
            #else
                #define wxCRT_VsnprintfA    vsnprintf
            #endif
        #endif
    #endif
#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */

#ifndef wxCRT_VsnprintfW
    /* no (suitable) vsnprintf(), cook our own */
    WXDLLIMPEXP_BASE int
    wxCRT_VsnprintfW(wchar_t *buf, size_t len, const wchar_t *format, va_list argptr);
    #define wxUSE_WXVSNPRINTFW 1
#else
    #define wxUSE_WXVSNPRINTFW 0
#endif

#ifndef wxCRT_VsnprintfA
        /* no (suitable) vsnprintf(), cook our own */
        WXDLLIMPEXP_BASE int
        wxCRT_VsnprintfA(char *buf, size_t len, const char *format, va_list argptr);
        #define wxUSE_WXVSNPRINTFA 1
#else
        #define wxUSE_WXVSNPRINTFA 0
#endif

// for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx
// implementation is used no matter what (in UTF-8 build, either *A or *W
// version may be called):
#if !wxUSE_UNICODE
    #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
#elif wxUSE_UNICODE_WCHAR
    #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW
#elif wxUSE_UTF8_LOCALE_ONLY
    #define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
#else // UTF-8 under any locale
    #define wxUSE_WXVSNPRINTF (wxUSE_WXVSNPRINTFA && wxUSE_WXVSNPRINTFW)
#endif

#define wxCRT_FprintfA       fprintf
#define wxCRT_PrintfA        printf
#define wxCRT_VfprintfA      vfprintf
#define wxCRT_VprintfA       vprintf
#define wxCRT_VsprintfA      vsprintf

/*
   In Unicode mode we need to have all standard functions such as wprintf() and
   so on but not all systems have them so use our own implementations in this
   case.
 */
#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
    #define wxNEED_WPRINTF
#endif
#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF)
    #define wxNEED_VSWSCANF
#endif

#if defined(wxNEED_WPRINTF)
    /*
        we need to implement all wide character printf functions either because
        we don't have them at all or because they don't have the semantics we
        need
     */
    int wxCRT_PrintfW( const wchar_t *format, ... );
    int wxCRT_FprintfW( FILE *stream, const wchar_t *format, ... );
    int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list ap );
    int wxCRT_VprintfW( const wchar_t *format, va_list ap );
    int wxCRT_VsprintfW( wchar_t *str, const wchar_t *format, va_list ap );
#else /* !wxNEED_WPRINTF */
    #define wxCRT_FprintfW      fwprintf
    #define wxCRT_PrintfW       wprintf
    #define wxCRT_VfprintfW     vfwprintf
    #define wxCRT_VprintfW      vwprintf

    #if defined(__WINDOWS__) && !defined(HAVE_VSWPRINTF)
        // only non-standard vswprintf() without buffer size argument can be used here
        #define  wxCRT_VsprintfW     vswprintf
    #endif
#endif /* wxNEED_WPRINTF */

/* Required for wxScanf() etc. */
#define wxCRT_ScanfA     scanf
#define wxCRT_SscanfA    sscanf
#define wxCRT_FscanfA    fscanf
#define wxCRT_VsscanfA   vsscanf

#if defined(wxNEED_WPRINTF)
    int wxCRT_ScanfW(const wchar_t *format, ...);
    int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...);
    int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...);
#else
    #define wxCRT_ScanfW     wxVMS_USE_STD wscanf
    #define wxCRT_SscanfW    wxVMS_USE_STD swscanf
    #define wxCRT_FscanfW    wxVMS_USE_STD fwscanf
#endif
#ifdef wxNEED_VSWSCANF
    int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap);
#else
    #define wxCRT_VsscanfW   wxVMS_USE_STD vswscanf
#endif

// ----------------------------------------------------------------------------
// user-friendly wrappers to CRT functions
// ----------------------------------------------------------------------------

#ifdef __WATCOMC__
    // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
    #define wxPrintf    wxPrintf_Impl
    #define wxFprintf   wxFprintf_Impl
    #define wxSprintf   wxSprintf_Impl
    #define wxSnprintf  wxSnprintf_Impl
#endif

    // FIXME-UTF8: remove this
#if wxUSE_UNICODE
    #define wxCRT_PrintfNative wxCRT_PrintfW
    #define wxCRT_FprintfNative wxCRT_FprintfW
#else
    #define wxCRT_PrintfNative wxCRT_PrintfA
    #define wxCRT_FprintfNative wxCRT_FprintfA
#endif

WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxPrintf, 1, (const wxFormatString&),
                              wxCRT_PrintfNative, wxCRT_PrintfA)
inline int wxPrintf(const wxFormatString& s)
{
    return wxPrintf("%s", s.InputAsString());
}

WX_DEFINE_VARARG_FUNC_SANS_N0(int, wxFprintf, 2, (FILE*, const wxFormatString&),
                              wxCRT_FprintfNative, wxCRT_FprintfA)
inline int wxFprintf(FILE *f, const wxFormatString& s)
{
    return wxFprintf(f, "%s", s.InputAsString());
}

// va_list versions of printf functions simply forward to the respective
// CRT function; note that they assume that va_list was created using
// wxArgNormalizer<T>!
#if wxUSE_UNICODE_UTF8
    #if wxUSE_UTF8_LOCALE_ONLY
        #define WX_VARARG_VFOO_IMPL(args, implW, implA)              \
            return implA args
    #else
        #define WX_VARARG_VFOO_IMPL(args, implW, implA)              \
            if ( wxLocaleIsUtf8 ) return implA args;                 \
            else return implW args
    #endif
#elif wxUSE_UNICODE_WCHAR
    #define WX_VARARG_VFOO_IMPL(args, implW, implA)                  \
        return implW args
#else // ANSI
    #define WX_VARARG_VFOO_IMPL(args, implW, implA)                  \
        return implA args
#endif

inline int
wxVprintf(const wxString& format, va_list ap)
{
    WX_VARARG_VFOO_IMPL((wxFormatString(format), ap),
                        wxCRT_VprintfW, wxCRT_VprintfA);
}

inline int
wxVfprintf(FILE *f, const wxString& format, va_list ap)
{
    WX_VARARG_VFOO_IMPL((f, wxFormatString(format), ap),
                        wxCRT_VfprintfW, wxCRT_VfprintfA);
}

#undef WX_VARARG_VFOO_IMPL

// wxSprintf() and friends have to be implemented in two forms, one for
// writing to char* buffer and one for writing to wchar_t*:

#if !wxUSE_UTF8_LOCALE_ONLY
int WXDLLIMPEXP_BASE wxDoSprintfWchar(char *str, const wxChar *format, ...);
#endif
#if wxUSE_UNICODE_UTF8
int WXDLLIMPEXP_BASE wxDoSprintfUtf8(char *str, const char *format, ...);
#endif
WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (char*, const wxFormatString&),
                      wxDoSprintfWchar, wxDoSprintfUtf8)

int WXDLLIMPEXP_BASE
wxVsprintf(char *str, const wxString& format, va_list argptr);

#if !wxUSE_UTF8_LOCALE_ONLY
int WXDLLIMPEXP_BASE wxDoSnprintfWchar(char *str, size_t size, const wxChar *format, ...);
#endif
#if wxUSE_UNICODE_UTF8
int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(char *str, size_t size, const char *format, ...);
#endif
WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&),
                      wxDoSnprintfWchar, wxDoSnprintfUtf8)

int WXDLLIMPEXP_BASE
wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr);

#if wxUSE_UNICODE

#if !wxUSE_UTF8_LOCALE_ONLY
int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...);
#endif
#if wxUSE_UNICODE_UTF8
int WXDLLIMPEXP_BASE wxDoSprintfUtf8(wchar_t *str, const char *format, ...);
#endif
WX_DEFINE_VARARG_FUNC(int, wxSprintf, 2, (wchar_t*, const wxFormatString&),
                      wxDoSprintfWchar, wxDoSprintfUtf8)

int WXDLLIMPEXP_BASE
wxVsprintf(wchar_t *str, const wxString& format, va_list argptr);

#if !wxUSE_UTF8_LOCALE_ONLY
int WXDLLIMPEXP_BASE wxDoSnprintfWchar(wchar_t *str, size_t size, const wxChar *format, ...);
#endif
#if wxUSE_UNICODE_UTF8
int WXDLLIMPEXP_BASE wxDoSnprintfUtf8(wchar_t *str, size_t size, const char *format, ...);
#endif
WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatString&),
                      wxDoSnprintfWchar, wxDoSnprintfUtf8)

int WXDLLIMPEXP_BASE
wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr);

#endif // wxUSE_UNICODE

#ifdef __WATCOMC__
    // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
    //
    // fortunately, OpenWatcom implements __VA_ARGS__, so we can provide macros
    // that cast the format argument to wxString:
    #undef wxPrintf
    #undef wxFprintf
    #undef wxSprintf
    #undef wxSnprintf

    #define wxPrintf(fmt, ...) \
            wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__)
    #define wxFprintf(f, fmt, ...) \
            wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__)
    #define wxSprintf(s, fmt, ...) \
            wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__)
    #define wxSnprintf(s, n, fmt, ...) \
            wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__)
#endif // __WATCOMC__

// We can't use wxArgNormalizer<T> for variadic arguments to wxScanf() etc.
// because they are writable, so instead of providing friendly template
// vararg-like functions, we just provide both char* and wchar_t* variants
// of these functions. The type of output variadic arguments for %s must match
// the type of 'str' and 'format' arguments.
//
// For compatibility with earlier wx versions, we also provide wxSscanf()
// version with the first argument (input string) wxString; for this version,
// the type of output string values is determined by the type of format string
// only.

#define _WX_SCANFUNC_EXTRACT_ARGS_1(x)   x
#define _WX_SCANFUNC_EXTRACT_ARGS_2(x,y) x, y
#define _WX_SCANFUNC_EXTRACT_ARGS(N, args) _WX_SCANFUNC_EXTRACT_ARGS_##N args

#define _WX_VARARG_PASS_WRITABLE(i) a##i

#define _WX_DEFINE_SCANFUNC(N, dummy1, name, impl, passfixed, numfixed, fixed)\
    template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)>                            \
    int name(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, fixed),                      \
             _WX_VARARG_JOIN(N, _WX_VARARG_ARG))                              \
    {                                                                         \
        return  impl(_WX_SCANFUNC_EXTRACT_ARGS(numfixed, passfixed),          \
                     _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WRITABLE));           \
    }

#define WX_DEFINE_SCANFUNC(name, numfixed, fixed, impl, passfixed)            \
    _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS,                                      \
                    _WX_DEFINE_SCANFUNC,                                      \
                    dummy1, name, impl, passfixed, numfixed, fixed)

// this is needed to normalize the format string, see src/common/strvararg.cpp
// for more details
#ifdef __WINDOWS__
    #define wxScanfConvertFormatW(fmt) fmt
#else
    const wxScopedWCharBuffer
    WXDLLIMPEXP_BASE wxScanfConvertFormatW(const wchar_t *format);
#endif

WX_DEFINE_SCANFUNC(wxScanf, 1, (const char *format),
                   wxCRT_ScanfA, (format))
WX_DEFINE_SCANFUNC(wxScanf, 1, (const wchar_t *format),
                   wxCRT_ScanfW, (wxScanfConvertFormatW(format)))

WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const char *format),
                   wxCRT_FscanfA, (stream, format))
WX_DEFINE_SCANFUNC(wxFscanf, 2, (FILE *stream, const wchar_t *format),
                   wxCRT_FscanfW, (stream, wxScanfConvertFormatW(format)))

WX_DEFINE_SCANFUNC(wxSscanf, 2, (const char *str, const char *format),
                   wxCRT_SscanfA, (str, format))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wchar_t *str, const wchar_t *format),
                   wxCRT_SscanfW, (str, wxScanfConvertFormatW(format)))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedCharBuffer& str, const char *format),
                   wxCRT_SscanfA, (str.data(), format))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxScopedWCharBuffer& str, const wchar_t *format),
                   wxCRT_SscanfW, (str.data(), wxScanfConvertFormatW(format)))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const char *format),
                   wxCRT_SscanfA, (str.mb_str(), format))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxString& str, const wchar_t *format),
                   wxCRT_SscanfW, (str.wc_str(), wxScanfConvertFormatW(format)))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const char *format),
                   wxCRT_SscanfA, (str.AsCharBuf(), format))
WX_DEFINE_SCANFUNC(wxSscanf, 2, (const wxCStrData& str, const wchar_t *format),
                   wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))

// Visual C++ doesn't provide vsscanf()
#ifndef __VISUALC___
int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedCharBuffer& str, const char *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wxScopedWCharBuffer& str, const wchar_t *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const char *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wxString& str, const wchar_t *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const char *format, va_list ap);
int WXDLLIMPEXP_BASE wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap);
#endif // !__VISUALC__

#endif /* _WX_WXCRTVARARG_H_ */