text:
namespace crypto {
namespace tink {

///////////////////////////////////////////////////////////////////////////////
// Static methods for registering with the Registry
// all instances of experimental signature key types supported in a particular
// release of Tink, i.e. key types that correspond to primitives
// PublicKeySign and PublicKeyVerify.
//
// To register all experiemntal signature key types from the current Tink
// release one calls PqSignatureConfigRegister().
//

// Registers PublicKeySign and PublicKeyVerify primitive wrappers, and key
// managers for all experimental implementations of PublicKeySign and
// PublicKeyVerify from the current Tink release.
crypto::tink::util::Status PqSignatureConfigRegister();

}  // namespace tink
}  // namespace crypto

#endif  // TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SIGNATURE_CONFIG_H_


text:
R3-CEV

R3 CEV

Distributed ledger technology has the potential to change financial services as profoundly as
  the Internet changed media and entertainment

History

LR3 (R3CEV LLC) is a blockchain technology company. It leads a consortium of 45
   financial companies in research and development of blockchain usage in the financial system.
   It is headquartered in New York City. It was founded circa 2014

January, 2016. An 11-bank trial which used Ethereum hosted on Microsoft Azure.

On March 3, 2016, R3 announced that it had completed a trial involving 40 banks
  held in the last two weeks of February, testing the use of blockchain solutions
  offered by Eris Industries, IBM, Intel and Chain to facilitate the trading of debt instruments.

CORDA

Announced in April 2016. R3 Corda is A Distributed Ledger Designed for Financial Services

[ Corda Announce ]
[ new-distributed-ledger-tech ]

    Home Page

    News

     [ R3 ]

     [ newsroom ]

     [ CriptoNews ]

[ Previous ] NXT [ Next ]

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Quak\ShopsReportBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Quak\ShopsCoreBundle\Entity\ShopReport;
use Quak\ShopsReportBundle\Form\Type\ReportType;

/**
 * Reports controller
 */
class ReportController extends Controller
{
    /**
     * Index action
     *
     * @return Response
     */
    public function indexAction()
    {
        $user = $this->getUser();

        return $this->render(
            'QuakShopsReportBundle:Report:index.html.twig',
            array(
                'user' => $user
            )
        );
    }

    /**
     * New report action
     *
     * @return Response
     */
    public function newAction()
    {
        $user = $this->getUser();

        if (!$user->getCurrentReport()) {
            $entityManager = $this->getDoctrine()->getManager();

            $currentReport = new ShopReport;
            $user->setCurrentReport($currentReport);
            $currentReport->setUser($user);

            $entityManager->persist($currentReport);
            $entityManager->flush();
        }

        $currentReport = $user->getCurrentReport();

        return $this->redirect(
            $this->generateUrl('quak_shops_report_form', array(
                'reportId' => $currentReport->getId()
            ))
        );
    }

    /**
     * Report form action
     *
     * @param Request $request
     *
     * @return Response
     */
    public function reportAction(Request $request)
    {
        $user = $this->getUser();
        $currentReport = $user->getCurrentReport();

        if (!$currentReport) {
            return $this->redirect(
                $this->generateUrl('quak_shops_report_index')
            );
        }

        $reportValues = $this->get('report.values.factory');
        $statusReport = $this->get('model.shopReport')
            ->getCurrentStatusReport($user);
        $savedData = $reportValues->createArrayFromReport(
            $currentReport, $statusReport
        );
        $legend = $this->get('repository.registryKey')->getLegend();
        $fields = $this->get('repository.formField')->fetchAllSortedByOrdering();

        $form = $this->createForm($this->get('form.report'), $savedData);

        $form->handleRequest($request);

        if ($form->isValid()) {
            $data = $form->getData();

            $reportValues->createValuesFromArray($currentReport, $data);
        }

        return $this->render(
            'QuakShopsReportBundle:Report:reportForm.html.twig',
            array(
                'form' => $form->createView(),
                'user' => $user,
                'valid' => $form->isValid(),
                'legend' => $legend,
                'fields' => $fields
            )
        );
    }
}


text:
package com.activiti.extension.api;

import java.util.List;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.interceptor.CommandExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.alfresco.model.DynamicSubProcessModel;

import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.pvm.delegate.ActivityExecution;
import org.activiti.engine.runtime.Execution;

@RestController
public class DynamicSubProcess {

	@Autowired
	protected RuntimeService runtimeService;

	@Autowired
	ProcessEngineConfigurationImpl processEngineConfiguration;

	ProcessEngine pe;

	@RequestMapping(value = "/enterprise/dynamicsubprocess", method = RequestMethod.POST, produces = "application/json")
	@ResponseStatus(value = HttpStatus.OK)
	public void injectNewSubProcess(@RequestBody DynamicSubProcessModel request) throws Exception {
		CallActivityBehavior call = new CallActivityBehavior(request.getProcessDefinitionKey(), null);
		Execution execution = null;
		if (request.getExecutionId() != null && !request.getExecutionId().equals("")) {
			execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(request.getExecutionId())
					.singleResult();
		} else {
			List<Execution> execList = runtimeService.createExecutionQuery()
					.processInstanceId(request.getProcessInstanceId()).list();
			for (Execution currentExecution : execList) {
				if (currentExecution.getParentId() != null && currentExecution.getParentId().equals(request.getProcessInstanceId())
						&& currentExecution.getActivityId() != null
						&& currentExecution.getActivityId().equals(request.getActivityId())) {
					execution = currentExecution;
					break;
				}
			}
		}
		ExecutionEntity executionEntity = (ExecutionEntity) execution;

		CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
		commandExecutor.execute(new Command<ExecutionEntity>() {
			public ExecutionEntity execute(CommandContext commandContext) {
				String executionId = executionEntity.getId();
				int instanceCount = (int) runtimeService.getVariable(executionId, "nrOfInstances");
				runtimeService.setVariable(executionId, "nrOfActiveInstances",
						(int) runtimeService.getVariable(executionId, "nrOfActiveInstances") + 1);
				runtimeService.setVariable(executionId, "nrOfInstances", instanceCount + 1);

				ActivityExecution activityExecution = executionEntity.createExecution();
				activityExecution.setActive(true);
				activityExecution.setConcurrent(true);
				activityExecution.setScope(false);
				runtimeService.setVariableLocal(activityExecution.getId(), "loopCounter", instanceCount);

				try {
					call.execute(activityExecution);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				return executionEntity;
			}
		});
	}

}


text:
package org.apache.geode.cache.util;

import static java.util.Objects.isNull;

import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import org.apache.geode.cache.CacheEvent;
import org.apache.geode.cache.EntryEvent;
import org.apache.geode.cache.Operation;

/**
 * Utility class for getting Transaction events for create, invalidate, put, destroy operations.
 */
public class TxEventTestUtil {

  /**
   * Selects entry create events from a list of cache events.
   *
   * @param cacheEvents the cache events from which to select create events
   * @return list of entry create events from the given cache events
   */
  public static List<EntryEvent<?, ?>> getCreateEvents(List<CacheEvent<?, ?>> cacheEvents) {
    return getEntryEventsWithOperation(cacheEvents, Operation::isCreate);
  }

  /**
   * Selects the entry update events from a list of cache events.
   *
   * @param cacheEvents the cache events from which to select update events
   * @return list of entry update events from the given cache events
   */
  public static List<EntryEvent<?, ?>> getPutEvents(List<CacheEvent<?, ?>> cacheEvents) {
    return getEntryEventsWithOperation(cacheEvents, Operation::isUpdate);
  }

  /**
   * Selects the entry invalidate events from a list of cache events.
   *
   * @param cacheEvents the cache events from which to select invalidate events
   * @return list of entry invalidate events from the given cache events
   */
  public static List<EntryEvent<?, ?>> getInvalidateEvents(
      List<CacheEvent<?, ?>> cacheEvents) {
    return getEntryEventsWithOperation(cacheEvents, Operation::isInvalidate);
  }

  /**
   * Selects the entry destroy events from a list of cache events.
   *
   * @param cacheEvents the cache events from which to select destroy events
   * @return list of entry destroy events from the given cache events
   */
  public static List<EntryEvent<?, ?>> getDestroyEvents(List<CacheEvent<?, ?>> cacheEvents) {
    return getEntryEventsWithOperation(cacheEvents, Operation::isDestroy);
  }

  /**
   * Selects the entry events whose operation matches the given predicate.
   *
   * @param cacheEvents the cache events from which to select entry events
   * @param operationPredicate tests each event's operation to determine whether to include the
   *        event
   * @return list of entry events whose operations match the given predicate
   * @throws ClassCastException if the predicate matches the operation of an event that is not an
   *         {@code EntryEvent}
   */
  public static List<EntryEvent<?, ?>> getEntryEventsWithOperation(
      List<CacheEvent<?, ?>> cacheEvents,
      Predicate<Operation> operationPredicate) {
    return getEntryEventsMatching(cacheEvents, e -> operationPredicate.test(e.getOperation()));
  }

  /**
   * Selects the entry events that match the given predicate.
   *
   * @param cacheEvents the cache events from which to select entry events
   * @param predicate tests whether to include each event
   * @return list of entry events that match the predicate
   * @throws ClassCastException if the predicate matches an event that is not an {@code EntryEvent}
   */
  public static List<EntryEvent<?, ?>> getEntryEventsMatching(
      List<CacheEvent<?, ?>> cacheEvents,
      Predicate<? super EntryEvent<?, ?>> predicate) {
    if (isNull(cacheEvents)) {
      return Collections.emptyList();
    }
    return cacheEvents.stream()
        .filter(EntryEvent.class::isInstance)
        .map(cacheEvent -> (EntryEvent<?, ?>) cacheEvent)
        .filter(predicate)
        .collect(Collectors.toList());
  }
}


text:
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.GCodeVisualizer;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
using MatterHackers.VectorMath;
using NUnit.Framework;

namespace MatterControl.Tests.MatterControl
{
	[TestFixture]
	public class LevelingTests
	{
		[Test, Category("Leveling")]
		public void Leveling7PointsNeverGetsTooHigh()
		{
			StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
			MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));

			var levelingData = new PrintLevelingData(ActiveSliceSettings.Instance);

			double radius = 100;
			levelingData.SampledPositions = new List<Vector3>();
			levelingData.SampledPositions.Add(new Vector3(130.00, 0.00, 0));
			levelingData.SampledPositions.Add(new Vector3(65.00, 112.58, 10));
			levelingData.SampledPositions.Add(new Vector3(-65.00, 112.58, 0));
			levelingData.SampledPositions.Add(new Vector3(-130.00, 0.00, 10));
			levelingData.SampledPositions.Add(new Vector3(-65.00, -112.58, 0));
			levelingData.SampledPositions.Add(new Vector3(65.00, -112.58, 10));

			levelingData.SampledPositions.Add(new Vector3(0, 0, 0));

			levelingData.SampledPositions.Add(new Vector3(0, 0, 6));

			Vector2 bedCenter = Vector2.Zero;

			RadialLevlingFunctions levelingFunctions7Point = new RadialLevlingFunctions(6, levelingData, bedCenter);
			int totalPoints = 2000;
			for (int curPoint = 0; curPoint < totalPoints; curPoint++)
			{
				Vector2 currentTestPoint = new Vector2(radius, 0);
				currentTestPoint.Rotate(MathHelper.Tau / totalPoints * curPoint);
				Vector3 destPosition = new Vector3(currentTestPoint, 0);

				Vector3 outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);
				Assert.IsTrue(outPosition.z <= 10);

				string outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Absolute);
				double outZ = 0;
				Assert.IsTrue(GCodeFile.GetFirstNumberAfter("Z", outPositionString, ref outZ));
				Assert.IsTrue(outZ <= 10);
			}
		}

		[Test, Category("Leveling")]
		public void Leveling7PointsCorectInterpolation()
		{
			StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
			MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));

			var levelingData = new PrintLevelingData(ActiveSliceSettings.Instance);

			double radius = 100;
			levelingData.SampledPositions = new List<Vector3>();
			Vector2 currentEdgePoint = new Vector2(radius, 0);
			for (int i = 0; i < 6; i++)
			{
				levelingData.SampledPositions.Add(new Vector3(currentEdgePoint, i));
				currentEdgePoint.Rotate(MathHelper.Tau / 6);
			}

			levelingData.SampledPositions.Add(new Vector3(0, 0, 6));

			Vector2 bedCenter = Vector2.Zero;

			RadialLevlingFunctions levelingFunctions7Point = new RadialLevlingFunctions(6, levelingData, bedCenter);
			for (int curPoint = 0; curPoint < 6; curPoint++)
			{
				int nextPoint = curPoint < 5 ? curPoint + 1 : 0;

				// test actual sample position
				Vector2 currentTestPoint = new Vector2(radius, 0);
				currentTestPoint.Rotate(MathHelper.Tau / 6 * curPoint);
				Vector3 destPosition = new Vector3(currentTestPoint, 0);
				Vector3 outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);
				Assert.AreEqual(outPosition.z, levelingData.SampledPositions[curPoint].z, .001);
				string outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Absolute);
				Assert.AreEqual(GetGCodeString(outPosition), outPositionString);

				// test mid point between samples
				Vector3 midPoint = (levelingData.SampledPositions[curPoint] + levelingData.SampledPositions[nextPoint]) / 2;
				currentTestPoint = new Vector2(midPoint.x, midPoint.y);
				destPosition = new Vector3(currentTestPoint, 0);
				outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);
				Assert.AreEqual(outPosition.z, midPoint.z, .001);
				outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Absolute);
				Assert.AreEqual(GetGCodeString(outPosition), outPositionString);

				// test mid point between samples with offset
				Vector3 midPointWithOffset = (levelingData.SampledPositions[curPoint] + levelingData.SampledPositions[nextPoint]) / 2 + new Vector3(0, 0, 3);
				currentTestPoint = new Vector2(midPointWithOffset.x, midPointWithOffset.y);
				destPosition = new Vector3(currentTestPoint, 3);
				outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);
				Assert.AreEqual(outPosition.z, midPointWithOffset.z, .001);
				outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Absolute);
				Assert.AreEqual(GetGCodeString(outPosition), outPositionString);

				// test 1/2 angles (mid way between samples on radius)
				currentTestPoint = new Vector2(radius, 0);
				currentTestPoint.Rotate(MathHelper.Tau / 6 * (curPoint + .5));
				destPosition = new Vector3(currentTestPoint, 0);
				outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);
				// the center is the higest point so the point on the radius has to be less than the mid point of the sample points (it is lower)
				Assert.IsTrue(outPosition.z < (levelingData.SampledPositions[curPoint].z + levelingData.SampledPositions[nextPoint].z) / 2 - .001);
				outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Absolute);
				Assert.AreEqual(GetGCodeString(outPosition), outPositionString);

				// test 1/2 to center
				currentTestPoint = new Vector2(radius / 2, 0);
				currentTestPoint.Rotate(MathHelper.Tau / 6 * curPoint);
				destPosition = new Vector3(currentTestPoint, 0);
				outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);
				Assert.AreEqual(outPosition.z, (levelingData.SampledPositions[curPoint].z + levelingData.SampledPositions[6].z) / 2, .001);
				outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Absolute);
				Assert.AreEqual(GetGCodeString(outPosition), outPositionString);
			}

			// prove that relative offsets work
			{
				Vector2 prevTestPoint = new Vector2(radius, 0);
				Vector3 prevDestPosition = new Vector3(prevTestPoint, 0);
				Vector3 prevOutPosition = levelingFunctions7Point.GetPositionWithZOffset(prevDestPosition);
				string prevOutPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(prevDestPosition), prevDestPosition, PrinterMachineInstruction.MovementTypes.Absolute);

				for (int curPoint = 1; curPoint < 6; curPoint++)
				{
					// test actual sample position
					Vector2 currentTestPoint = new Vector2(radius, 0);
					currentTestPoint.Rotate(MathHelper.Tau / 6 * curPoint);
					Vector3 destPosition = new Vector3(currentTestPoint, 0);
					Vector3 outPosition = levelingFunctions7Point.GetPositionWithZOffset(destPosition);

					string outPositionString = levelingFunctions7Point.DoApplyLeveling(GetGCodeString(destPosition), destPosition, PrinterMachineInstruction.MovementTypes.Relative);
					Vector3 delatFromPrevToCurrent = outPosition - prevOutPosition;
					Assert.AreEqual(GetGCodeString(delatFromPrevToCurrent), outPositionString);

					prevTestPoint = currentTestPoint;
					prevDestPosition = destPosition;
					prevOutPosition = outPosition;
				}
			}

			Vector3 outPosition2 = levelingFunctions7Point.GetPositionWithZOffset(Vector3.Zero);
			Assert.AreEqual(outPosition2.z, levelingData.SampledPositions[6].z, .001);
		}

		private string GetGCodeString(Vector3 destPosition)
		{
			return "G1 X{0:0.##} Y{1:0.##} Z{2:0.###}".FormatWith(destPosition.x, destPosition.y, destPosition.z);
		}

		// TODO: do all the same tests for 13 point leveling.
	}
}


text:
package com.web.dao;

import com.web.bean.base.VUser;
import com.web.bean.base.VUserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface VUserMapper {
    int countByExample(VUserExample example);

    int deleteByExample(VUserExample example);

    int insert(VUser record);

    int insertSelective(VUser record);

    List<VUser> selectByExample(VUserExample example);

    int updateByExampleSelective(@Param("record") VUser record, @Param("example") VUserExample example);

    int updateByExample(@Param("record") VUser record, @Param("example") VUserExample example);
}


text:
// @ts-check
const cp = require("child_process");
const log = require("fancy-log"); // was `require("gulp-util").log (see https://github.com/gulpjs/gulp-util)
const isWin = /^win/.test(process.platform);
const chalk = require("./chalk");
const { CancellationToken, CancelError } = require("prex");

module.exports = exec;

/**
 * Executes the provided command once with the supplied arguments.
 * @param {string} cmd
 * @param {string[]} args
 * @param {ExecOptions} [options]
 *
 * @typedef ExecOptions
 * @property {boolean} [ignoreExitCode]
 * @property {import("prex").CancellationToken} [cancelToken]
 */
function exec(cmd, args, options = {}) {
    return /**@type {Promise<{exitCode: number}>}*/(new Promise((resolve, reject) => {
        const { ignoreExitCode, cancelToken = CancellationToken.none } = options;
        cancelToken.throwIfCancellationRequested();

        // TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
        const subshellFlag = isWin ? "/c" : "-c";
        const command = isWin ? [possiblyQuote(cmd), ...args] : [`${cmd} ${args.join(" ")}`];

        log(`> ${chalk.green(cmd)} ${args.join(" ")}`);
        const proc = cp.spawn(isWin ? "cmd" : "/bin/sh", [subshellFlag, ...command], { stdio: "inherit", windowsVerbatimArguments: true });
        const registration = cancelToken.register(() => {
            log(`${chalk.red("killing")} '${chalk.green(cmd)} ${args.join(" ")}'...`);
            proc.kill("SIGINT");
            proc.kill("SIGTERM");
            reject(new CancelError());
        });
        proc.on("exit", exitCode => {
            registration.unregister();
            if (exitCode === 0 || ignoreExitCode) {
                resolve({ exitCode });
            }
            else {
                reject(new Error(`Process exited with code: ${exitCode}`));
            }
        });
        proc.on("error", error => {
            registration.unregister();
            reject(error);
        });
    }));
}

/**
 * @param {string} cmd
 */
function possiblyQuote(cmd) {
    return cmd.indexOf(" ") >= 0 ? `"${cmd}"` : cmd;
}


text:
	Lua State Machine Library
----=================================================]]
module("luafsm", package.seeall)

VERSION = "2.3.2"

SUCCEEDED = 1 -- the event transitioned successfully from one state to another
NOTRANSITION = 2 -- the event was successfull but no state transition was necessary
CANCELLED = 3 -- the event was cancelled by the caller in a beforeEvent callback
PENDING = 4 -- the event is asynchronous and the caller is in control of when the transition occurs

INVALID_TRANSITION_ERROR = 'INVALID_TRANSITION_ERROR' -- caller tried to fire an event that was innapropriate in the current state
PENDING_TRANSITION_ERROR = 'PENDING_TRANSITION_ERROR' -- caller tried to fire an event while an async transition was still pending
INVALID_CALLBACK_ERROR = 'INVALID_CALLBACK_ERROR' -- caller provided callback function threw an exception

WILDCARD = '*'
ASYNC = 'async'

local function do_callback(fsm, func, event, params)
	if type(func) == 'function' then
		local success, ret = pcall(func, unpack(params))
		if not success then
			local err = ret
			fsm:error(event, INVALID_CALLBACK_ERROR, err)
		end
		return ret
	end
end

local function before_any_event(fsm, event, params)
	return do_callback(fsm, fsm.onbeforeevent, event, params)
end

local function after_any_event(fsm, event, params)
	return do_callback(fsm, fsm.onafterevent or fsm.onevent, event, params)
end

local function leave_any_state(fsm, event, params)
	return do_callback(fsm, fsm.onleavestate, event, params)
end

local function enter_any_state(fsm, event, params)
	return do_callback(fsm, fsm.onenterstate or fsm.onstate, event, params)
end

local function change_state(fsm, event, params)
	return do_callback(fsm, fsm.onchangestate, event, params)
end

local function before_this_event(fsm, event, params)
	return do_callback(fsm, fsm['onbefore' .. event.name], event, params)
end

local function after_this_event(fsm, event, params)
	return do_callback(fsm, fsm['onafter' .. event.name] or fsm['on' .. event.name], event, params)
end

local function leave_this_state(fsm, event, params)
	return do_callback(fsm, fsm['onleave' .. event.from], event, params)
end

local function enter_this_state(fsm, event, params)
	return do_callback(fsm, fsm['onenter' .. event.to] or fsm['on' .. event.to], event, params)
end

local function before_event(fsm, event, params)
	if before_this_event(fsm, event, params) == false or before_any_event(fsm, event, params) == false then
		return false
	end
end

local function after_event(fsm, event, params)
	after_this_event(fsm, event, params)
	after_any_event(fsm, event, params)
end

local function leave_state(fsm, event, params)
	local specific = leave_this_state(fsm, event, params)
	local general = leave_any_state(fsm, event, params)
	if specific == false or general == false then
		return false
	elseif specific == ASYNC or general == ASYNC then
		return ASYNC
	end
end

local function enter_state(fsm, event, params)
	enter_this_state(fsm, event, params)
	enter_any_state(fsm, event, params)
end

local function build_event(name, entry)
	return function(self, ...)
		local from = self.current
		local to = entry[from] or entry[WILDCARD] or from
		local event = {
			name = name,
			from = from,
			to = to,
		}
		local params = {self, event, ...}

		if self.transition then
			return self:error(event, PENDING_TRANSITION_ERROR, ('event %s inappropriate because previous transition did not complete'):format(name))
		end

		if self:cannot(name) then
			return self:error(event, INVALID_TRANSITION_ERROR, ('event %s inappropriate in current state %s'):format(name, self.current))
		end

		if before_event(self, event, params) == false then
			return CANCELLED
		end

		if from == to then
			after_event(self, event, params)
			return NOTRANSITION
		end

		-- prepare a transition method for use EITHER lower down,
		-- or by caller if they want an async transition (indicated by an ASYNC return value from leaveState)
		local fsm = self
		self.transition = {
			-- provide a way for caller to cancel async transition if desired
			cancel = function()
				fsm.transition = nil
				after_event(fsm, event, params)
			end
		}
		setmetatable(self.transition, {
			__call = function()
				fsm.transition = nil -- this method should only ever be called once
				fsm.current = to
				enter_state(fsm, event, params)
				change_state(fsm, event, params)
				after_event(fsm, event, params)
				return SUCCEEDED
			end
		})

		local leave = leave_state(fsm, event, params)
		if leave == false then
			self.transition = nil
			return CANCELLED
		elseif leave == ASYNC then
			return PENDING
		else
			if self.transition then -- need to check in case user manually called transition() but forgot to return ASYNC
				return self.transition()
			end
		end
	end
end

function create(cfg, target)
	assert(type(cfg) == 'table', 'cfg must be a table')

	-- allow for a simple string, or an object with { state: = 'foo', event = 'setup', defer = true|false }
	local initial = type(cfg.initial) == 'string' and { state = cfg.initial } or cfg.initial
	local terminal = cfg.terminal or cfg.final
	local fsm = target or cfg.target or {}
	local events = cfg.events or {}
	local callbacks = cfg.callbacks or {}
	local map = {}

	local function add(e)
		-- allow 'wildcard' transition if 'from' is not specified
		local from = type(e.from) == 'table' and e.from or (e.from and {e.from} or {WILDCARD})
		local entry = map[e.name] or {}
		map[e.name] = entry
		for _, v in ipairs(from) do
			entry[v] = e.to or v -- allow no-op transition if 'to' is not specified
		end
	end

	if initial then
		initial.event = initial.event or 'startup'
		add { name = initial.event, from = 'none', to = initial.state }
	end

	for _, e in ipairs(events) do
		add(e)
	end

	for k, v in pairs(map) do
		fsm[k] = build_event(k, v)
	end

	for k, v in pairs(callbacks) do
		fsm[k] = v
	end

	fsm.current = 'none'
	fsm.is = function(self, state)
		if type(state) == 'table' then
			for _, s in ipairs(state) do
				if s == self.current then
					return true
				end
			end
			return false
		else
			return self.current == state
		end
	end
	fsm.can = function(self, event)
		if (not self.transition) and map[event] and
			(map[event][self.current] or map[event][WILDCARD]) then
			return true
		else
			return false
		end
	end
	fsm.cannot = function(self, event) return not self:can(event) end
	-- default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired
	fsm.error = cfg.error or function(self, event, error_code, err) error(error_code .. " " .. err) end
	fsm.is_finished = function(self) return self:is(terminal) end

	if initial and not initial.defer then
		fsm[initial.event](fsm)
	end

	return fsm
end

return _M


text:
<!DOCTYPE html>

<meta name="robots" content="noindex">
  <meta name="project_path" value="/web/tools/workbox/_project.yaml" />
  <meta name="book_path" value="/web/tools/workbox/_book.yaml" />
  <meta name="gtm_var" data-key="docType" data-value="reference">
  <title>Source: workbox-broadcast-cache-update/src/lib/constants.js</title>
  <link href="jsdoc.css" rel="stylesheet">

Source: workbox-broadcast-cache-update/src/lib/constants.js

/**
 * This is a static variable for the cache updated message type. Useful for
 * comparing to the messages `type` parameter to identify the kind of message.
 *
 * @type {string}
 *
 * @example
 * // Prints 'CACHE_UPDATED'
 * console.log(workbox.broadcastCacheUpdate.cacheUpdatedMessageType);
 *
 * @memberof module:workbox-broadcast-cache-update
 */
const cacheUpdatedMessageType = 'CACHE_UPDATED';

/**
 * The default headers to compare when determining whether two `Response`
 * objects are different.
 *
 * @private
 * @type {Array&lt;string>}
 *
 * @memberof module:workbox-broadcast-cache-update
 */
const defaultHeadersToCheck = [
  'content-length',
  'etag',
  'last-modified',
];

/**
 * The value `'workbox-broadcast-cache-update'`, used as the `meta` field of the
 * update message.
 *
 * @private
 * @type {string}
 *
 * @memberof module:workbox-broadcast-cache-update
 */
const defaultSource = 'workbox-broadcast-cache-update';

export {
  cacheUpdatedMessageType,
  defaultHeadersToCheck,
  defaultSource,
};


text:
@implementation ATLPresenceStatusView

CGFloat const ATLMStartAngle = 0.0;
CGFloat const ATLMEndAngle = M_PI*2;

# pragma mark - Initialize

-(instancetype)initWithFrame:(CGRect)rect statusColor:(UIColor *)statusColor mode:(ATLMPresenceStatusViewMode)mode
{
    self = [self initWithFrame:rect];
    if (self) {
        _statusColor = statusColor;
        _mode = mode;
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];

        _statusColor = [UIColor lightGrayColor];
        _statusBackgroundColor = [UIColor whiteColor];
        _mode = ATLMPresenceStatusViewModeFill;
    }
    return self;
}

# pragma mark - Setters

- (void)setMode:(ATLMPresenceStatusViewMode)mode
{
    _mode = mode;
    [self setNeedsDisplay];
}

- (void)setStatusColor:(UIColor *)statusColor
{
    _statusColor = statusColor;
    [self setNeedsDisplay];
}

- (void)setStatusBackgroundColor:(UIColor *)statusBackgroundColor
{
    _statusBackgroundColor = statusBackgroundColor;
    [self setNeedsDisplay];
}

# pragma mark - Drawing
// Draw a circle in the center of the view using the color and mode of this ATLPresenceStatusView
- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);

    CGPoint center = CGPointMake(CGRectGetWidth(self.bounds) * 0.5, CGRectGetHeight(self.bounds) * 0.5);

    // We are drawing a circle to fit the bounds, so we need the smallest side
    CGFloat diameter = MIN(CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds));
    CGFloat radius = diameter * 0.5;

    // Draw background first
    CGContextSetFillColorWithColor(context, _statusBackgroundColor.CGColor);
    CGContextAddArc(context, center.x, center.y, radius, ATLMStartAngle, ATLMEndAngle, YES);
    CGContextFillPath(context);
    CGContextSaveGState(context);

    CGFloat borderWidth = diameter / 6.0;

    switch (_mode) {
        case ATLMPresenceStatusViewModeFill:
        {
            // Fill the circle
            CGContextSetFillColorWithColor(context, _statusColor.CGColor);
            CGContextAddArc(context, center.x, center.y, radius - (borderWidth * 0.5), ATLMStartAngle, ATLMEndAngle, YES);
            CGContextFillPath(context);
            break;
        }
        case ATLMPresenceStatusViewModeBordered:
        {
            // Inset the radius
            CGContextAddArc(context, center.x, center.y, radius - borderWidth, ATLMStartAngle, ATLMEndAngle, YES);

            CGContextSetLineWidth(context, borderWidth);
            CGContextSetStrokeColorWithColor(context, _statusColor.CGColor);
            CGContextStrokePath(context);
            break;
        }
    }

}

@end


text:
class TokyoMetro::Required::All::Api::StationFacility::Info::BarrierFree::Facility::MetaClass < TokyoMetro::Required

  def self.other_files
    LinkForMobilityScootersAndStairLift.files
  end

end


text:
<?php

namespace Catalog\Model\Entity;

class OptionValue {

    public $option_id;
    public $name;
    public $image;
    public $sort_order;

    public function __construct(Array $data = array())
    {
        $this->exchangeArray($data);
    }

    public function exchangeArray($data)
    {

        $attributes = array_keys($this->getArrayCopy());

        foreach ($attributes as $attr) {
            if (isset($data[$attr])) {
                $this->{$attr} = $data[$attr];
            }
        }
    }

    public function getArrayCopy() {
        return get_object_vars($this);
    }

}


text:
<?php

$migration->setNamespace($namespace)->latest();


text:
package org.scm4j.vcs.api.workingcopy;

public enum VCSLockedWorkingCopyState {
	/**
	 * NOT_INITIALIZED state of the Locked Working Copy is internal state which
	 * exists only during constructor executing. It means the
	 * {@link VCSLockedWorkingCopy} is not initialized and does not corresponds
	 * to a Working copy folder
	 */
	NOT_INITIALIZED,

	/**
	 * LOCKED state is normal state of a {@link VCSLockedWorkingCopy} instance.
	 * It means that current {@link VCSLockedWorkingCopy} instance corresponds
	 * to a locked folder.
	 */
	LOCKED,

	/**
	 * OBSOLETE state means that {@link IVCSLockedWorkingCopy#close()}
	 * had been called and current instance does not corresponds to a locked
	 * folder anymore. Instance of {@link VCSLockedWorkingCopy} with this state
	 * should not be used anymore.
	 */
	OBSOLETE
}


text:
require 'test_helper'

class FieldTest < ActionView::TestCase
  test "render a simple_form field" do
    with_form_for(@user) do |form|
      form.field(:name) {|f| f.input :name}
      form.field(:description) {|f| f.input :description}
    end

    assert_select 'input.string#user_name'
    assert_select 'textarea.text#user_description'
  end

  test "render a custom field" do
    with_form_for(@user) do |form|
      form.field(:something) {|f| 'Something'.html_safe}
    end

    assert_select 'span#foo', "Something"
  end

  test "render a verbatim field" do
    with_form_for(@user) do |form|
      form.field :something, 'Something'.html_safe
    end

    assert_select 'span#foo', "Something"
  end

  test "escape unsafe output" do
    with_form_for(@user) do |form|
      form.field(:something) {|f| 'Something'}
    end

    assert_no_select 'span#foo'
    assert_select 'form', /<span id="foo">Something<\/span>/
  end

  test "allow the usage of view helpers" do
    with_form_for(@user) do |form|
      form.field(:something) {|f| content_tag(:span){"Something"}}
    end

    assert_select 'span', "Something"
  end

  test "allow appending elements" do
    with_form_for(@user) do |form|
      form.field(:name) {|f| f.input :name}
      form.field(:description) {|f| f.input :description}

      form.field_after(:name, :credit_card) {|f| f.input :credit_card}
      form.field_last(:active) {|f| f.input :active}
    end

    # the first div in a form contains some hidden fields
    assert_select 'form > div:nth-of-type(2) > input.string#user_name'
    assert_select 'form > div:nth-of-type(3) > input.string#user_credit_card'
    assert_select 'form > div:nth-of-type(4) > textarea.text#user_description'
    assert_select 'form > div:nth-of-type(5) > input.boolean#user_active'
  end

  test "allow prepending elements" do
    with_form_for(@user) do |form|
      form.field(:name) {|f| f.input :name}
      form.field(:description) {|f| f.input :description}

      form.field_first(:active) {|f| f.input :active}
      form.field_before(:description, :credit_card) {|f| f.input :credit_card}
    end

    # the first div in a form contains some hidden fields
    assert_select 'form > div:nth-of-type(2) > input.boolean#user_active'
    assert_select 'form > div:nth-of-type(3) > input.string#user_name'
    assert_select 'form > div:nth-of-type(4) > input.string#user_credit_card'
    assert_select 'form > div:nth-of-type(5) > textarea.text#user_description'
  end

  test "check existence of elements when inserting" do
    assert_raise ArgumentError do
      with_form_for(@user) do |form|
        form.field(:name) {|f| f.input :name}
        form.field_before(:description, :credit_card) {|f| f.input :credit_card}
      end
    end

    assert_raise ArgumentError do
      with_form_for(@user) do |form|
        form.field(:name) {|f| f.input :name}
        form.field_after(:description, :credit_card) {|f| f.input :credit_card}
      end
    end
  end

  test "delete field" do
    with_form_for(@user) do |form|
      form.field(:name) {|f| f.input :name}
      form.field(:description) {|f| f.input :description}

      form.delete(:description)
    end

    assert_select 'input.string#user_name'
    assert_no_select 'textarea.text#user_description'
  end

  test "replace a field's generator" do
    with_form_for(@user) do |form|
      form.field(:name) {|f| f.input :name}

      form.field(:name).generator {|f| f.input :description}
    end

    assert_no_select 'input.string#user_name'
    assert_select 'textarea.text#user_description'
  end
end


text:
<resources>
    <string name="app_name">CardCounter</string>
</resources>


text:
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>
    loadout.ink - Stat Calculator + Gear Planner for Splatoon 2
  </title>
  <meta name="description" content="Gear planner and stat calculator for Splatoon 2. Create gear configurations and see the effects on your stats.">
  <meta name="robots" content="index, follow">

    <link rel="stylesheet" href="/common/style/splash.css">

          English

          日本語

            Français

            Español

          (próximamente)

            Italiano

          (prossimamente)

            中文

          (快来了)


text:
using System;
using System.Linq;
using System.Threading.Tasks;
using AllReady.Features.Notifications;
using AllReady.Models;
using MediatR;
using Microsoft.EntityFrameworkCore;

namespace AllReady.Areas.Admin.Features.Tasks
{
    public class TaskStatusChangeHandler : IAsyncRequestHandler<TaskStatusChangeCommand, TaskChangeResult>
    {
        public Func<DateTime> DateTimeUtcNow = () => DateTime.UtcNow;

        private AllReadyContext _context;
        private IMediator _mediator;

        public TaskStatusChangeHandler(AllReadyContext context, IMediator mediator)
        {
            _context = context;
            _mediator = mediator;
        }

        public async Task<TaskChangeResult> Handle(TaskStatusChangeCommand message)
        {
            var task = await GetTask(message);

            if (task == null)
                throw new InvalidOperationException($"Task {message.TaskId} does not exist");

            var taskSignup = task.AssignedVolunteers.SingleOrDefault(c => c.User.Id == message.UserId);
            if (taskSignup == null)
                throw new InvalidOperationException($"Sign-up for user {message.UserId} does not exist");

            TaskStatus currentStatus;
            if (!Enum.TryParse(taskSignup.Status, out currentStatus))
                currentStatus = TaskStatus.Assigned;

            switch (message.TaskStatus)
            {
                case TaskStatus.Assigned:
                    break;
                case TaskStatus.Accepted:
                    if (currentStatus != TaskStatus.Assigned && currentStatus != TaskStatus.CanNotComplete && currentStatus != TaskStatus.Completed)
                        throw new ArgumentException("Task must be assigned before being accepted or undoing CanNotComplete or Completed");
                    break;
                case TaskStatus.Rejected:
                    if (currentStatus != TaskStatus.Assigned)
                        throw new ArgumentException("Task must be assigned before being rejected");
                    break;
                case TaskStatus.Completed:
                    if (currentStatus != TaskStatus.Accepted && currentStatus != TaskStatus.Assigned)
                        throw new ArgumentException("Task must be accepted before being completed");
                    break;
                case TaskStatus.CanNotComplete:
                    if (currentStatus != TaskStatus.Accepted && currentStatus != TaskStatus.Assigned)
                        throw new ArgumentException($"Task must be assigned or accepted before it can be marked as {message.TaskStatus}");
                    break;
                default:
                    throw new ArgumentException($"Invalid sign-up status value: {message.TaskStatus}");
            }

            taskSignup.Status = message.TaskStatus.ToString();
            //taskSignup.StatusDateTimeUtc = DateTime.UtcNow;
            taskSignup.StatusDateTimeUtc = DateTimeUtcNow();
            taskSignup.StatusDescription = message.TaskStatusDescription;

            await _context.SaveChangesAsync();

            var notification = new TaskSignupStatusChanged { SignupId = taskSignup.Id };
            await _mediator.PublishAsync(notification);

            return new TaskChangeResult { Status = "success", Task = task };
        }

        private async Task<AllReadyTask> GetTask(TaskStatusChangeCommand message)
        {
            return await _context.Tasks
                .Include(t => t.AssignedVolunteers).ThenInclude(ts => ts.User)
                .Include(t => t.RequiredSkills).ThenInclude(s => s.Skill)
                .SingleOrDefaultAsync(c => c.Id == message.TaskId);
        }
    }

    public class TaskChangeResult
    {
        public string Status { get; set; }
        public AllReadyTask Task { get; set; }
    }
}


text:
package org.objenesis.tck.search;

import org.objenesis.instantiator.ObjectInstantiator;
import org.objenesis.strategy.PlatformDescription;
import org.objenesis.tck.candidates.SerializableNoConstructor;

import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.*;

/**
 * This class will try every available instantiator on the platform to see which works.
 *
 * @author Henri Tremblay
 */
public class SearchWorkingInstantiator implements Serializable { // implements Serializable just for the test

    private SearchWorkingInstantiatorListener listener;

    public static void main(String[] args) throws Exception {
        System.out.println();
        System.out.println(PlatformDescription.describePlatform());
        System.out.println();

        SearchWorkingInstantiator searchWorkingInstantiator = new SearchWorkingInstantiator(new SystemOutListener());
        searchWorkingInstantiator.searchForInstantiator(SerializableNoConstructor.class);
    }

    public SearchWorkingInstantiator(SearchWorkingInstantiatorListener listener) {
        this.listener = listener;
    }

    public void searchForInstantiator(Class<?> toInstantiate) {
        SortedSet<Class<?>> classes = ClassEnumerator.getClassesForPackage(ObjectInstantiator.class.getPackage());

        for (Iterator<Class<?>> it = classes.iterator(); it.hasNext();) {
            Class<?> c = it.next();
            if(c.isInterface() || !ObjectInstantiator.class.isAssignableFrom(c)) {
                continue;
            }

            Constructor<?> constructor;
            try {
                constructor = c.getConstructor(Class.class);
            } catch (NoSuchMethodException e) {
                throw new RuntimeException(e);
            }

            try {
                ObjectInstantiator<?> instantiator =
                        (ObjectInstantiator<?>) constructor.newInstance(toInstantiate);
                instantiator.newInstance();
                listener.instantiatorSupported(c);
            }
            catch(Exception e) {
                Throwable t = (e instanceof InvocationTargetException) ? e.getCause() : e;
                listener.instantiatorUnsupported(c, t);
            }
        }
    }
}


text:
/**
 * Get the current location host.
 */
var getHost = function () {
	return location.host;
};

/**
 * Get the base of the current URL.
 */
var getBaseUrl = function () {
	return location.protocol + '//' + getHost();
};

/**
 * Get the query parameters from a URL.
 */
var getQueryParams = function (url) {
	url = url || location.href;
	var query = url.substr(url.indexOf('?') + 1).split('#')[0];
	var pairs = query.split('&');
	query = {};
	forEach(pairs, function (pair) {
		var eqPos = pair.indexOf('=');
		var name = pair.substr(0, eqPos);
		var value = pair.substr(eqPos + 1);
		query[name] = value;
	});
	return query;
};

/**
 * Get the query parameters from the hash of a URL.
 */
var getHashParams = function (hash) {
	hash = (hash || location.hash).replace(/^#/, '');
	return hash ? getQueryParams(hash) : {};
};


text:
This module is used to clean database records that have become invalid since data validation rules have changed within the app.

## Rake tasks

This module adds two rake tasks, one for finding invalid records, and one for fixing them.

### Usage

Find invalid records.

#### Warning:

This will iterate over every record on your database. It could easily take over an hour to run.

``` bash
$ rake data_cleanup:find_invalid_records
```

Find invalid records for a given list of models.

``` bash
$ rake data_cleanup:find_invalid_records INCLUDE=Note,User
```

...or...

``` bash
$ rake data_cleanup:find_invalid_records EXCLUDE=Annotation
```

---

Fix invalid records based on the rules defined in `lib/data_cleanup/rules`.

#### Warning:

This will update the records on your database, often using `update_all`. Make sure you:

- **have a backup of your database**
- **you are comfortable you understand what each of these rules are doing to your data**

``` bash
$ rake data_cleanup:clean_invalid_records
```

Or to clean a given table...

``` bash
$ rake data_cleanup:clean_invalid_records INCLUDE=Question
```

To avoid a given table...

``` bash
$ rake data_cleanup:clean_invalid_records EXAMPLE=Plan
```

## Rules

Each type of data error is fixed separately.

These are defined in `lib/data_cleanup/rules`.

### Creating a new rule

You can create a new rule by running the following genrator:

``` bash
$ rails g data_cleanup_rule user/fix_missing_emails
```

This will create a file `lib/data_cleanup/rules/user/fix_missing_emails.rb` which contains the rules for updating users with missing emails.

Feel free to add your own rules where neccesary to fix your own data.

## Logging output

Output from the Rake tasks will be logged to `log/validations.log`.


text:
<?php

namespace GoogleAPI\Exception;

/**
 * Exception class used by the Google_api library.
 *
 * @author  Yorick Peterse, Isset Internet Professionals
 * @link    http://yorickpeterse.com/ Website of Yorick Peterse
 * @link    http://isset.nl/ Website of Isset Internet Professionals
 * @license https://github.com/isset/codeigniter-google-apis/blob/master/license.txt The MIT license
 * @version 0.1
 */
class GoogleAPIException extends \Exception {}


text:
package com.bazaarvoice.jolt.common.reference;

import com.bazaarvoice.jolt.exception.SpecException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class PathAndGroupReferenceTest {

    @DataProvider
    public Object[][] getValidReferenceTests() {
        return new Object[][] {
            {     "", 0, 0, "(0,0)" },
            {    "3", 3, 0, "(3,0)" },
            {  "(3)", 3, 0, "(3,0)" },
            {"(1,2)", 1, 2, "(1,2)" }
        };
    }

    @Test( dataProvider = "getValidReferenceTests" )
    public void validAmpReferencePatternTest(String key, int pathIndex, int keyGroup, String canonicalForm) {

        PathAndGroupReference amp = new AmpReference( "&" + key );
        Assert.assertEquals( pathIndex, amp.getPathIndex() );
        Assert.assertEquals( keyGroup, amp.getKeyGroup() );
        Assert.assertEquals( "&" + canonicalForm, amp.getCanonicalForm() );
    }

    @Test( dataProvider = "getValidReferenceTests" )
    public void validDollarReferencePatternTest(String key, int pathIndex, int keyGroup, String canonicalForm) {

        PathAndGroupReference amp = new DollarReference( "$" + key );
        Assert.assertEquals( pathIndex, amp.getPathIndex() );
        Assert.assertEquals( keyGroup, amp.getKeyGroup() );
        Assert.assertEquals( "$" + canonicalForm, amp.getCanonicalForm() );
    }

    @DataProvider
    public Object[][] getFailReferenceTests() {
        return new Object[][] {
            { "pants" },
            { "-1" },
            { "(-1,2)" },
            { "(1,-2)" },
        };
    }

    @Test( dataProvider = "getFailReferenceTests", expectedExceptions = SpecException.class  )
    public void failAmpReferencePatternTest(String key ) {
        new AmpReference( "&" + key );
    }

    @Test( dataProvider = "getFailReferenceTests", expectedExceptions = SpecException.class )
    public void failDollarReferencePatternTest(String key ) {
        new DollarReference( "$" + key );
    }
}