text:
#pragma once
#include <aws/route53resolver/Route53Resolver_EXPORTS.h>
#include <aws/route53resolver/Route53ResolverRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/route53resolver/model/Tag.h>
#include <utility>
#include <aws/core/utils/UUID.h>

namespace Aws
{
namespace Route53Resolver
{
namespace Model
{

  /**
   */
  class AWS_ROUTE53RESOLVER_API CreateResolverQueryLogConfigRequest : public Route53ResolverRequest
  {
  public:
    CreateResolverQueryLogConfigRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "CreateResolverQueryLogConfig"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline const Aws::String& GetName() const{ return m_name; }

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& WithName(const Aws::String& value) { SetName(value); return *this;}

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}

    /**
     *
The name that you want to give the query logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& WithName(const char* value) { SetName(value); return *this;}

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline const Aws::String& GetDestinationArn() const{ return m_destinationArn; }

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline bool DestinationArnHasBeenSet() const { return m_destinationArnHasBeenSet; }

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline void SetDestinationArn(const Aws::String& value) { m_destinationArnHasBeenSet = true; m_destinationArn = value; }

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline void SetDestinationArn(Aws::String&& value) { m_destinationArnHasBeenSet = true; m_destinationArn = std::move(value); }

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline void SetDestinationArn(const char* value) { m_destinationArnHasBeenSet = true; m_destinationArn.assign(value); }

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline CreateResolverQueryLogConfigRequest& WithDestinationArn(const Aws::String& value) { SetDestinationArn(value); return *this;}

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline CreateResolverQueryLogConfigRequest& WithDestinationArn(Aws::String&& value) { SetDestinationArn(std::move(value)); return *this;}

    /**
     *
The ARN of the resource that you want Resolver to send query logs. You can
     * send query logs to an S3 bucket, a CloudWatch Logs log group, or a Kinesis Data
     * Firehose delivery stream. Examples of valid values include the following:

     *

 S3 bucket:

 arn:aws:s3:::examplebucket
     *

You can optionally append a file prefix to the end of the ARN.

     * arn:aws:s3:::examplebucket/development/

     * CloudWatch Logs log group:

     * arn:aws:logs:us-west-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*
     *

 Kinesis Data Firehose delivery stream:

     * arn:aws:kinesis:us-east-2:0123456789:stream/my_stream_name

     *

     */
    inline CreateResolverQueryLogConfigRequest& WithDestinationArn(const char* value) { SetDestinationArn(value); return *this;}

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline const Aws::String& GetCreatorRequestId() const{ return m_creatorRequestId; }

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline bool CreatorRequestIdHasBeenSet() const { return m_creatorRequestIdHasBeenSet; }

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline void SetCreatorRequestId(const Aws::String& value) { m_creatorRequestIdHasBeenSet = true; m_creatorRequestId = value; }

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline void SetCreatorRequestId(Aws::String&& value) { m_creatorRequestIdHasBeenSet = true; m_creatorRequestId = std::move(value); }

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline void SetCreatorRequestId(const char* value) { m_creatorRequestIdHasBeenSet = true; m_creatorRequestId.assign(value); }

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline CreateResolverQueryLogConfigRequest& WithCreatorRequestId(const Aws::String& value) { SetCreatorRequestId(value); return *this;}

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline CreateResolverQueryLogConfigRequest& WithCreatorRequestId(Aws::String&& value) { SetCreatorRequestId(std::move(value)); return *this;}

    /**
     *
A unique string that identifies the request and that allows failed requests
     * to be retried without the risk of running the operation twice.
     * CreatorRequestId can be any unique string, for example, a date/time
     * stamp.

     */
    inline CreateResolverQueryLogConfigRequest& WithCreatorRequestId(const char* value) { SetCreatorRequestId(value); return *this;}

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline const Aws::Vector<Tag>& GetTags() const{ return m_tags; }

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; }

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline void SetTags(const Aws::Vector<Tag>& value) { m_tagsHasBeenSet = true; m_tags = value; }

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline void SetTags(Aws::Vector<Tag>&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); }

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& WithTags(const Aws::Vector<Tag>& value) { SetTags(value); return *this;}

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& WithTags(Aws::Vector<Tag>&& value) { SetTags(std::move(value)); return *this;}

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; }

    /**
     *
A list of the tag keys and values that you want to associate with the query
     * logging configuration.

     */
    inline CreateResolverQueryLogConfigRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; }

  private:

    Aws::String m_name;
    bool m_nameHasBeenSet = false;

    Aws::String m_destinationArn;
    bool m_destinationArnHasBeenSet = false;

    Aws::String m_creatorRequestId;
    bool m_creatorRequestIdHasBeenSet = false;

    Aws::Vector<Tag> m_tags;
    bool m_tagsHasBeenSet = false;
  };

} // namespace Model
} // namespace Route53Resolver
} // namespace Aws


text:
'use strict';

const Command = require('../../Command.js');
const ConclaveChallengeEmbed = require('../../embeds/ConclaveChallengeEmbed.js');

const values = ['all', 'day', 'week'];

/**
 * Displays the currently active Invasions
 */
class ConclaveChallenges extends Command {
  /**
   * Constructs a callable command
   * @param {Genesis} bot  The bot object
   */
  constructor(bot) {
    super(bot, 'warframe.worldstate.conclaveChallenges', 'conclave', 'Gets the current conclave challenges for a category of challenge, or all.');
    this.regex = new RegExp(`^${this.call}(?:\\s+(${values.join('|')}))?(?:\\s+on\\s+([pcsxb14]{2,3}))?$`, 'i');

    this.usages = [
      {
        description: 'Display conclave challenges for a challenge type.',
        parameters: ['conclave category'],
      },
    ];
  }

  async run(message) {
    const matches = message.strippedContent.match(this.regex);
    const param1 = (matches[1] || '').toLowerCase();
    const param2 = (matches[2] || '').toLowerCase();
    const category = values.indexOf(param1) > -1 ? param1 : 'all';
    let platformParam;
    if (this.platforms.indexOf(param2) > -1) {
      platformParam = param2;
    } else if (this.platforms.indexOf(param1) > -1) {
      platformParam = param1;
    }
    const platform = platformParam || await this.bot.settings.getChannelSetting(message.channel, 'platform');
    const ws = await this.bot.worldStates[platform].getData();
    const conclaveChallenges = ws.conclaveChallenges;
    const embed = new ConclaveChallengeEmbed(this.bot, conclaveChallenges, category, platform);
    await this.messageManager.embed(message, embed, true, false);
    return this.messageManager.statuses.SUCCESS;
  }
}

module.exports = ConclaveChallenges;

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.Rest;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace ClientRuntime.Tests.Common.Fakes
{
    public class FakeServiceClientWithCredentials : ServiceClient<FakeServiceClientWithCredentials>
    {
        private Uri _baseUri;
        private ServiceClientCredentials _credentials;

        /// <summary>
        /// Initializes a new instance of the FakeServiceClientWithCredentials class.
        /// </summary>
        private FakeServiceClientWithCredentials() : base()
        {
        }

        /// <summary>
        /// Initializes a new instance of the FakeServiceClientWithCredentials class.
        /// </summary>
        public FakeServiceClientWithCredentials(ServiceClientCredentials credentials, Uri baseUri,
            params DelegatingHandler[] handlers)
            : base(handlers)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException("credentials");
            }
            if (baseUri == null)
            {
                throw new ArgumentNullException("baseUri");
            }

            InitializeClient(credentials, baseUri);
        }

        public FakeServiceClientWithCredentials(ServiceClientCredentials credentials, Uri baseUri,
            HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException("credentials");
            }
            if (baseUri == null)
            {
                throw new ArgumentNullException("baseUri");
            }

            InitializeClient(credentials, baseUri);
        }

        /// <summary>
        /// Initializes a new instance of the FakeServiceClientWithCredentials class.
        /// </summary>
        public FakeServiceClientWithCredentials(ServiceClientCredentials credentials,
            params DelegatingHandler[] handlers)
            : base(handlers)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException("credentials");
            }

            InitializeClient(credentials, new Uri("https://TBD"));
        }

        public FakeServiceClientWithCredentials(ServiceClientCredentials credentials, HttpClientHandler rootHandler,
            params DelegatingHandler[] handlers)
            : base(rootHandler, handlers)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException("credentials");
            }

            InitializeClient(credentials, new Uri("https://TBD"));
        }

        public Uri BaseUri
        {
            get { return _baseUri; }
        }

        public ServiceClientCredentials Credentials
        {
            get { return _credentials; }
        }

        public async Task<HttpResponseMessage> DoStuff()
        {
            // Construct URL
            string url = "http://www.microsoft.com";

            // Create HTTP transport objects
            HttpRequestMessage httpRequest = null;

            httpRequest = new HttpRequestMessage();
            httpRequest.Method = HttpMethod.Get;
            httpRequest.RequestUri = new Uri(url);

            await this.Credentials.ProcessHttpRequestAsync(httpRequest, new CancellationToken());

            // Set Headers
            httpRequest.Headers.Add("x-ms-version", "2013-11-01");

            // Set Credentials
            var cancellationToken = new CancellationToken();
            cancellationToken.ThrowIfCancellationRequested();
            return await HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
        }

        protected void InitializeClient(ServiceClientCredentials credentials, Uri baseUri)
        {
            this._credentials = credentials;
            this._baseUri = baseUri;
            this.Credentials.InitializeServiceClient(this);
            HttpClient.Timeout = TimeSpan.FromSeconds(300);
        }
    }
}


text:
package club.zhcs.titans.nutz.interceptor;

import org.nutz.aop.InterceptorChain;
import org.nutz.aop.MethodInterceptor;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.Mvcs;

import eu.bitwalker.useragentutils.UserAgent;

/**
 *
 * @author Kerbores(kerbores@gmail.com)
 *
 * @project Utils
 *
 * @file UaInterceptor.java
 *
 * @description useragent拦截
 *
 * @time 2016年3月8日 上午10:51:26
 *
 */
@IocBean(name = "uaDebug")
public class UserAgentInterceptor implements MethodInterceptor {
	Log log = Logs.getLog(UserAgentInterceptor.class);

	/*
	 * (non-Javadoc)
	 *
	 * @see org.nutz.aop.MethodInterceptor#filter(org.nutz.aop.InterceptorChain)
	 */
	@Override
	public void filter(InterceptorChain chain) throws Throwable {
		UserAgent ua = new UserAgent(Mvcs.getReq().getHeader("user-agent"));
		String uaInfo = "ip地址: " + Mvcs.getReq().getRemoteAddr() + " userAgent信息:" + Json.toJson(ua);
		log.debug(uaInfo);
		chain.doChain();
	}

}


text:
This is source for vincentvandaal.nl as it is used currently on digitalocean.com

Basically the data in cloud-init is used for spinning up the instance (select data and copy-paste).
The rest of automated thanks to this repo.

What the cloud-init does:
 * Sets SSH port to 9001
 * Disables root login
 * Creates a user named controlusr
 * Enables sshkey login only for controlusr
 * Install linux packages python-pip, nginx, bc
 * Install pip packages pelican markdown typogrify
 * Clones letsencrypt and this GIT

Feel free to re-use this repo and change it to your liking.
This is distributed under the MIT license (see LICENSE)

-Vincent van Daal


text:
<?php

namespace Cercanias\Tests\Entity;

use Cercanias\Entity\Train;
use Cercanias\Entity\Trip;
use PHPUnit\Framework\TestCase;

/**
 * @author Rober Martín H <rmh.dev@gmail.com>
 */
class TripTest extends TestCase
{

    public function testGetDepartureTrain()
    {
        $train = $this->createSimpleTrain();
        $trip = new Trip($train);
        $this->assertEquals($train, $trip->getDepartureTrain());
    }

    protected function createSimpleTrain()
    {
        return new Train("c1", new \DateTime("2014-01-20 12:00:00"), new \DateTime("2014-01-20 12:55:00"));
    }

    public function testSimpleTripHasNoTransfer()
    {
        $trip = new Trip($this->createSimpleTrain());
        $this->assertFalse($trip->hasTransfer());
    }

    public function testGetDepartureTime()
    {
        $train = $this->createSimpleTrain();
        $trip = new Trip($train);
        $this->assertEquals($train->getDepartureTime(), $trip->getDepartureTime());
    }

    public function testCompareWith()
    {
        $trip = new Trip($this->createSimpleTrain());
        $trip2 = new Trip($this->createSimpleTrain());
        $this->assertEquals(0, $trip->compareWith($trip2));
    }

    public function testGetTransferTrainsInTripWithNoTransfers()
    {
        $trip = new Trip($this->createSimpleTrain());
        $this->assertEquals(new \ArrayIterator(), $trip->getTransferTrains());
    }

    public function testGetTransferTrainsInTripWithOneTransfer()
    {
        $train = $this->createSimpleTrain();
        $expectedTransferTrain = $this->createTransferTrain($train);
        $trip = new Trip($train, $expectedTransferTrain);
        $this->assertEquals(1, $trip->getTransferTrains()->count());
        $this->assertEquals($expectedTransferTrain, $trip->getTransferTrains()->offsetGet(0));
    }

    protected function createTransferTrain(Train $train)
    {
        $departureTransferDateTime = clone $train->getArrivalTime();
        $departureTransferDateTime = $departureTransferDateTime->add(new \DateInterval("PT10M"));
        $arrivalTransferDateTime = clone $departureTransferDateTime;
        $arrivalTransferDateTime = $arrivalTransferDateTime->add(new \DateInterval("PT55M"));

        return new Train($train->getLine(), $departureTransferDateTime, $arrivalTransferDateTime);
    }

    public function testGetTransferTrainsInTripWithMultipleTransfers()
    {
        $departureTrain = $this->createSimpleTrain();
        $transfer1 = $this->createTransferTrain($departureTrain);
        $transfer2 = $this->createTransferTrain($transfer1);
        $transfers = array($transfer1, $transfer2);
        $trip = new Trip($departureTrain, $transfers);
        $this->assertEquals(2, $trip->getTransferTrains()->count());
    }

    /**
     * @expectedException \Cercanias\Exception\OutOfBoundsException
     */
    public function testTransferTrainOutOfBounds()
    {
        $departureTrain = $this->createSimpleTrain();
        $transferDepartureTime = clone $departureTrain->getArrivalTime();
        $transferDepartureTime = $transferDepartureTime->sub(new \DateInterval("PT10M"));
        $transferArrivalTime = clone $transferDepartureTime;
        $transferArrivalTime = $transferArrivalTime->add(new \DateInterval("PT55M"));
        $transferTrain = new Train($departureTrain->getLine(), $transferDepartureTime, $transferArrivalTime);
        $trip = new Trip($departureTrain, $transferTrain);
    }
}


text:
import os

from threadpool import ThreadPool
from block import Block, Connection
from blockinfo import block_infos
from core.returnvalue import *
from symbol import except_clause

class CompositionManager:

    """\brief Manages a blockmon composition
    """

    def __init__(self, comp_id, blockmon, bm_logger):
        """\brief Initializes class
        \param comp_id   (\c string)         The composition id
        \param blockmon  (\c module)         The blockmon executable module
        \param bm_logger (\c logging.logger) The logger
        """
        self.__logger = bm_logger
        self.__comp_id = str(comp_id)
        self.__blocks = {}         # dict block id -> Block
        self.__thread_pools = {}   # dict pool id  -> ThreadPool
        self.__blockmon = blockmon
        self.__blockmon.add_composition(self.__comp_id)

    def install(self, xmlnode):
        """\brief Installs a blockmon composition
        \param xmlnode (\c xml.dom.Node) The blockmon composition
        """

        generalXML = xmlnode.getElementsByTagName("general")
        if not generalXML:
            print "error, composition has no 'general' tag"
            os._exit(1)
        self.__process_general(generalXML[0])

        for n in xmlnode.getElementsByTagName("threadpool"):
            self.__create_pool(n)

        for n in xmlnode.getElementsByTagName("block"):
            self.__create_block(n)

        for n in xmlnode.getElementsByTagName("connection"):
            self.__create_connection(n)

        self.__blockmon.init_composition(self.__comp_id)

        self.__logger.info(self.__comp_id + ' : installed')

    def reconfigure(self, xmlnodes):
        """\brief Reconfigures a blockmon composition
        \param xmlnodes (\c xml.dom.Node) The blockmon composition
        """
        for xmlnode in xmlnodes.getElementsByTagName("delete"):
            for n in xmlnode.getElementsByTagName("connection"):
                self.__delete_connection(n)

            for n in xmlnode.getElementsByTagName("block"):
                self.__delete_block(n)

            for n in xmlnode.getElementsByTagName("threadpool"):
                self.__delete_pool(n)

        for xmlnode in xmlnodes.getElementsByTagName("add"):
            for n in xmlnode.getElementsByTagName("threadpool"):
                self.__create_pool(n)

            for n in xmlnode.getElementsByTagName("block"):
                self.__create_block(n)

            for n in xmlnode.getElementsByTagName("connection"):
                self.__create_connection(n)

        for xmlnode in xmlnodes.getElementsByTagName("reconf"):

            for n in xmlnode.getElementsByTagName("block"):
                self.__update_block(n)

        self.__logger.info(self.__comp_id + ' : updated')

    def remove(self):
        """\brief Removes the currently installed blockmon composition
        """
        for i in self.__blocks.values():
            i.remove()

        for t in self.__thread_pools.values():
            self.__blockmon.remove_thread_pool(t.name)

        self.__blockmon.delete_composition(self.__comp_id)

    def read_block_var(self, var_info):
        """\brief Reads a block variable's value
        \param var_info  (\c VariableInfo) The variable to read
        \return         (\c ReturnValue)  The result of the operation
        """
        blockname = var_info.get_block_name()
        varname = var_info.get_name()
        if not self.__blocks.has_key(blockname):
            return ReturnValue(ReturnValue.CODE_FAILURE, "block id " + blockname + " does not exist", None)
        block = self.__blocks[blockname]
#        if not block_infos.has_key(block.block_type):
#            return ReturnValue(ReturnValue.CODE_FAILURE, "no block of type "+block.block_type+" exists", None)
#        if not block_infos[block.block_type].has_variable(varname, "read"):
#            return ReturnValue(ReturnValue.CODE_FAILURE, "block has no read variable " + varname, None)
        try:
            value = block.read_var(varname)
        except RuntimeError, e:
            return ReturnValue(ReturnValue.CODE_FAILURE, "An exception occurred: '" + str(e)+"'", None)

        var_info.set_value(value)
        return ReturnValue(ReturnValue.CODE_SUCCESS, "", var_info)

    def write_block_var(self, var_info):
        """\brief Writes a value to a block variable
        \param var_info  (\c VariableInfo) The variable to write to
        \return         (\c ReturnValue)  The result of the operation
        """
        blockname = var_info.get_block_name()
        varname = var_info.get_name()
        value = var_info.get_value()
        if not self.__blocks.has_key(blockname):
            return ReturnValue(ReturnValue.CODE_FAILURE, "block id " + blockname + " does not exist", None)
        block = self.__blocks[blockname]
#        if not block_infos.has_key(block.block_type):
#            return ReturnValue(ReturnValue.CODE_FAILURE, "no block of that type exists", None)
#        if not block_infos[block.block_type].has_variable(varname, "write"):
#            return ReturnValue(ReturnValue.CODE_FAILURE, "block has no write variable " + varname, None)
        try:
            if self.__blocks[blockname].write_var(varname, value):
                return ReturnValue(ReturnValue.CODE_SUCCESS, "", None)
        except RuntimeError, e:
            return ReturnValue(ReturnValue.CODE_FAILURE, "An exception occurred: '" + str(e)+"'", None)

        return ReturnValue(ReturnValue.CODE_FAILURE, "error while writing to variable", None)

    def __process_general(self, xmlnode):
        """\brief Processes parameters under the 'general' tag
        \param xmlnode (\c xml.dom.Node) The XML for the general tag
        """
        clockXML = xmlnode.getElementsByTagName("clock")
        clock_type = "WALL"
        if (clockXML and len(clockXML) > 0):
            clock_type = clockXML[0].attributes['type'].value
        self.__select_clock(str(clock_type))

    def __select_clock(self, clock_type):
        """\brief Sets the clock type (PACKET or WALL, case insensitive)
        \param clock_type (\c string)      The clock type
        \return           (\c ReturnValue) The result of the operation
        """
        clock_type = clock_type.upper()
        if clock_type == "WALL" or clock_type == "PACKET":
            self.__blockmon.select_clock(clock_type)
            return ReturnValue(ReturnValue.CODE_SUCCESS, "", None)
        return ReturnValue(ReturnValue.CODE_FAILURE, "invalid value for clock type", None)

    def __create_block(self, blocknode):
        """\brief Creates a block
        \param blocknode (\c xml.dom.Node) The block in xml form
        """
        block_name = blocknode.attributes['id'].value
        block_type = blocknode.attributes['type'].value

        invocation = "direct"
        tpool_id = ""
        tpool = None

#        params = blocknode.getElementsByTagName('params')
        #params = params[0].toxml()

        if blocknode.attributes.has_key('invocation'):
            invocation = blocknode.attributes['invocation'].value

        if invocation == "indirect" or invocation == "async":
            tpool_id = blocknode.attributes['threadpool'].value
            tpool = self.__thread_pools[str(tpool_id)]

        self.__blocks[block_name] = Block(block_name,\
                                          block_type,\
                                          self.__comp_id,\
                                          invocation,\
                                          blocknode.toxml(),\
                                          tpool_id,\
                                          tpool,\
                                          self.__blockmon,\
                                          self.__logger)

    def __delete_block(self, blocknode):
        """\brief Deletes a block
        \param blocknode (\c xml.dom.Node) The block in xml form
        """
        block_name = blocknode.attributes['id'].value
        self.__blocks[block_name].remove()
        del self.__blocks[block_name]

    def __update_block(self, blocknode):
        """\brief Updates a block
        \param blocknode (\c xml.dom.Node) The block in xml form
        """
        block_name = blocknode.attributes['id'].value

        params = blocknode.getElementsByTagName('params')
        params = str(params[0].toxml())

        invocation = "direct"
        tpool_id = ""
        tpool = None
        #active = False

        if blocknode.attributes.has_key('invocation'):
            invocation = blocknode.attributes['invocation'].value

        if invocation == "indirect" or invocation == "async":
            tpool_id = blocknode.attributes['threadpool'].value
            tpool = self.__thread_pools[str(tpool_id)]

        self.__blocks[block_name].update(invocation, params, tpool_id, tpool)
#        if blocknode.attributes.has_key('sched_type'):
#            active = True if (blocknode.attributes['sched_type'].value == 'active') else False
#            tpool_id = blocknode.attributes['threadpool'].value
#
#        if (active):
#            tpool = self.__thread_pools[str(tpool_id)]
#        self.__blocks[block_name].update(active, params, tpool_id, tpool)

    def __create_pool(self, poolnode):
        """\brief Creates a thread pool
        \param poolnode (\c xml.dom.Node) The thread pool in xml form
        """
        self.__thread_pools[poolnode.attributes['id'].value] = ThreadPool(poolnode,\
                                                                          self.__blockmon)
    def __delete_pool(self, poolnode):
        """\brief Deletes a thread pool
        \param poolnode (\c xml.dom.Node) The thread pool in xml form
        """
        del self.__thread_pools[poolnode.attributes['id'].value]

    def __create_connection(self, connection_node):
        """\brief Creates a connection between two blocks
        \param connection_node (\c xml.dom.Node) The connection in xml form
        """
        bsource = str(connection_node.attributes['src_block'].value)
        gsource = str(connection_node.attributes['src_gate'].value)
        bdst = str(connection_node.attributes['dst_block'].value)
        gdst = str(connection_node.attributes['dst_gate'].value)
        self.__connect_blocks(self.__blocks[bsource], gsource, self.__blocks[bdst], gdst)

    def __delete_connection(self, connection_node):
        """\brief Deletes a connection between two blocks
        \param connection_node (\c xml.dom.Node) The connection in xml form
        """
        bsource = str(connection_node.attributes['src_block'].value)
        gsource = str(connection_node.attributes['src_gate'].value)
        bdst = str(connection_node.attributes['dst_block'].value)
        gdst = str(connection_node.attributes['dst_gate'].value)
        self.__disconnect_blocks(self.__blocks[bsource], gsource, self.__blocks[bdst], gdst)

    def __connect_blocks(self, b1, g1, b2, g2):
        """\brief Connects two blocks
        \param b1  (\c Block)  The source block
        \param g1  (\c string) The source gate
        \param b2  (\c Block)  The destination block
        \param g2  (\c string) The destination gate
        """
        self.__blockmon.create_connection(b1.comp_id,\
                                          b1.name,\
                                          g1,\
                                          b2.comp_id,\
                                          b2.name,\
                                          g2)
        b1.add_connection(g1, b2, g2, 'out')
        b2.add_connection(g2, b1, g1, 'in')
        b1.connections.append(Connection(g1, b2, g2))
        b2.connections.append(Connection(g2, b1, g1))

    def __disconnect_blocks(self, b1, g1, b2, g2):
        """\brief Disconnects two blocks
        \param b1  (\c Block)  The source block
        \param g1  (\c string) The source gate
        \param b2  (\c Block)  The destination block
        \param g2  (\c string) The destination gate
        """
        self.__blockmon.delete_connection(b1.comp_id, \
                                          b1.name, \
                                          g1, \
                                          b2.comp_id, \
                                          b2.name, \
                                          g2)
        b1.remove_connection(g1, b2, g2, 'out')
        b2.remove_connection(g2, b1, g1, 'in')

    def get_blocks(self):
        return self.__blocks


text:
package de.bps.ims.qti.fileresource;

import java.io.File;

import org.olat.ims.qti.fileresource.SurveyFileResourceValidator;

import de.bps.onyx.plugin.OnyxModule;

/**
 * Description:

 * TODO: patrickb Class Description for SurveyFileResourceValidator
 *

 * Initial Date: 25.06.2010

 *
 * @author patrickb
 */
public class SurveyFileResourceValidatorOnyx extends SurveyFileResourceValidator {

	/**
	 * @see org.olat.ims.qti.fileresource.QTIFileResourceValidator#validate(java.io.File)
	 */
	@Override
	public boolean validate(final File unzippedDir) {
		if (OnyxModule.isOnyxTest(unzippedDir)) {
			return true;
		} else {
			return super.validate(unzippedDir);
		}
	}

}


text:
<?php

namespace backend\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Adv;

/**
 * AdvSearch represents the model behind the search form about `common\models\Adv`.
 */
class AdvSearch extends Adv
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'show'], 'integer'],
            [['link', 'image'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Adv::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'show' => $this->show,
        ]);

        $query->andFilterWhere(['like', 'link', $this->link])
            ->andFilterWhere(['like', 'image', $this->image]);

        return $dataProvider;
    }
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('articles', '0061_auto_20150928_1913'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='endnote',
            name='article',
        ),
        migrations.DeleteModel(
            name='EndNote',
        ),
    ]


text:
'use strict';

angular.module('organizations').directive('ordersTable', [
	function() {
		return {
			templateUrl: './modules/organizations/views/orders.table.directive.client.view.html',
			restrict: 'E',
      transclude: true
		};
	}
]);


text:
require 'spec_helper'

describe CF::String do

  describe 'from_string' do
    it 'should return a CF::String' do
      CF::String.from_string('A CF string').should be_a(CF::String)
    end

    # The intent is to force feed CF::String with an invalid utf-8 string
    # but jruby doesn't seem to allow this to be constructed
    unless defined? RUBY_ENGINE and RUBY_ENGINE == 'jruby'
      context 'with invalid data' do
        it 'returns nil' do
          if CF::String::HAS_ENCODING
            CF::String.from_string("\xff\xff\xff".force_encoding('UTF-8')).should be_nil
          else
            CF::String.from_string("\xff\xff\xff").should be_nil
          end
        end
      end
    end
  end

  describe '#to_s' do
    it 'should return a utf ruby string' do
      ruby_string = CF::String.from_string('A CF string').to_s
      ruby_string.should == 'A CF string'
      if CF::String::HAS_ENCODING
        ruby_string.encoding.should == Encoding::UTF_8
      else
      end
    end
  end

  describe 'to_ruby' do
    it 'should behave like to_s' do
      CF::String.from_string('A CF string').to_ruby.should == 'A CF string'
      if CF::String::HAS_ENCODING
        CF::String.from_string('A CF string').to_ruby.encoding.should == Encoding::UTF_8
      end
    end
  end

  it 'should be comparable' do
    CF::String.from_string('aaa').should  <= CF::String.from_string('zzz')
  end
end


text:
/**
 * @author Hana Lee
 * @since 2016-05-16 16:44
 */

import router from './base.router';
import controller from './base.controller';

let baseModule = angular.module('PIGDATA.base', [])
  .config(router)
  .controller('base.controller', controller);

export default baseModule;


text:
/* ****************************************************************************
 *                           _______________________
 *                           \| RP6  ROBOT SYSTEM |/
 *                            \_-_-_-_-_-_-_-_-_-_/             >>> RP6 CONTROL
 * ----------------------------------------------------------------------------
 * ------------------- [c]2006 / 2007 - AREXX ENGINEERING ---------------------
 * -------------------------- http://www.arexx.com/ ---------------------------
 * --------------------------- All rights reserved ----------------------------
 * ****************************************************************************
 * File: RP6Control.h
 * Version: 1.0
 * Target: RP6 CONTROL - ATMEGA32 @16.00MHz
 * Author(s): Dominik S. Herwald
 * ****************************************************************************
 * Description:
 * The RP6 CONTROL M32 header file with general definitions. If you don't want
 * to include the complete RP6ControlLib because it is too large - then at least
 * include this file! It is already included in the RP6ControlLib, but can be
 * used without it!
 *
 * This file contains helpful definitions that simplify reading the sourcecode.
 * Most important are the default settings for Port and Direction registers!
 * Hint: You should better leave all this as it is, but it is a good idea to
 * read the comments, it will help you to understand C programming for AVR
 * better!
 * ****************************************************************************
 * CHANGELOG AND LICENSING INFORMATION CAN BE FOUND AT THE END OF THIS FILE!
 * ****************************************************************************
 */

#ifndef RP6CONTROL_H
#define RP6CONTROL_H

/*****************************************************************************/
// Useful definition for common routines that are used on several
// different devices (you can switch register settings to match the target!):

#define DEVICE_RP6CONTROL

/*****************************************************************************/
// CPU Clock:

#ifndef F_CPU
#define F_CPU 16000000 //Expansion: 16.00MHz  - DO NOT CHANGE!
#endif

/*****************************************************************************/
// Includes:

#include <stdint.h>			// Standard Integer definitions
#include <avr/io.h>			// I/O Port definitions
#include <avr/interrupt.h>	// Signal and other Interrupt macros

/*****************************************************************************/
// I/O PORT pin definitions
// These definitions simplify reading and understanding the source code.
//
// ATTENTION: Initial value of port and direction registers should not
// be changed, if you do not exactly know what you are doing!
//
// Hints for DDRx and PORTx Registers:
// DDRxy = 0 and PORTxy = 0 ==> Input without internal Pullup
// DDRxy = 0 and PORTxy = 1 ==> Input with internal Pullup
// DDRxy = 1 and PORTxy = 0 ==> Output low
// DDRxy = 1 and PORTxy = 1 ==> Output high
// "=1" indicates that the appropriate bit is set.
//
// Example:
// #define INIT_DDRA 0b00010000
// #define INIT_PRTA 0b00000000
//
// This means that ALL ports on PortA are inputs without internal pullups
// except for PortA4, which is an output (E_INT1 signal in this case) and
// initial value is low.
//
// Binary value explanation:
// 0b00010000     = 16 in decimal system
//   ^      ^
// MSB      LSB      (MSB = Most Significant Bit, LSB = Least Significant Bit)
//
// The program should always call the macro "portInit();" FIRST! You can find
// it a bit below. Correct port initialisation is the most important step
// after a hardware reset!

// ---------------------------------------------------
// PORTA

#define ADC7 		(1 << PINA7) // ADC7 (Input)
#define ADC6		(1 << PINA6) // ADC6 (Input)
#define ADC5 		(1 << PINA5) // ADC5 (Input)
#define ADC4 		(1 << PINA4) // ADC4 (Input)
#define ADC3 		(1 << PINA3) // ADC3 (Input)
#define ADC2 		(1 << PINA2) // ADC2 (Input)
#define KEYPAD 		(1 << PINA1) // ADC1 (Input)
#define MIC 		(1 << PINA0) // ADC0 (Input)

// Initial value of port and direction registers.
#define INIT_DDRA 0b00000000
#define INIT_PRTA 0b00000000

// ---------------------------------------------------
// PORTA A/D Convertor channels

#define ADC_7			7
#define ADC_6 			6
#define ADC_5 			5
#define ADC_4 			4
#define ADC_3 			3
#define ADC_2 			2
#define ADC_KEYPAD 		1
#define ADC_MIC 		0

// ---------------------------------------------------
// PORTB

#define SCK 	 (1 << PINB7) 	// Output
#define MISO 	 (1 << PINB6) 	// Input
#define MOSI 	 (1 << PINB5) 	// Output
#define LCD_EN 	 (1 << PINB4)	// Output
#define LCD_RS 	 (1 << PINB3) 	// Output
#define EINT3 	 (1 << PINB2)   // INT2 (Input - Pullup)
#define MEM_CS2  (1 << PINB1)	// Output
#define MEM_CS   (1 << PINB0)   // Output

// Initial value of port and direction registers.
#define INIT_DDRB 0b10111011
#define INIT_PRTB 0b00000111

// ---------------------------------------------------
// PORTC

#define IO_PC7 	(1 << PINC7)	// I/O
#define IO_PC6 	(1 << PINC6)	// I/O
#define IO_PC5 	(1 << PINC5)	// I/O (Optional JTAG: TDI)
#define IO_PC4 	(1 << PINC4)	// I/O (JTAG: TDO)
#define IO_PC3 	(1 << PINC3)	// I/O (JTAG: TMS)
#define IO_PC2 	(1 << PINC2)	// I/O (JTAG: TCK)
#define SDA 	(1 << PINC1)	// I2C Data (I/O)
#define SCL 	(1 << PINC0)	// I2C Clock (Output as Master, Input as Slave)

// Initial value of port and direction registers.
#define INIT_DDRC 0b00000000
#define INIT_PRTC 0b11111100

// ---------------------------------------------------
// PORTD

#define BUZ 	(1 << PIND7)	// Output
#define IO_PD6 	(1 << PIND6)	// I/O
#define IO_PD5 	(1 << PIND5)	// I/O
#define STR 	(1 << PIND4)	// Output
#define EINT2 	(1 << PIND3)	// INT1 (Input - Pullup)
#define EINT1 	(1 << PIND2)	// INT0 (Input - Pullup)
#define TX 		(1 << PIND1)	// USART TX (Output)
#define RX 		(1 << PIND0)	// USART RX (Input)

// Initial value of port and direction registers.
#define INIT_DDRD 0b10010010
#define INIT_PRTD 0b01100001

/*****************************************************************************/
// I/O Port init macro - always call this first! It is called first from
// initRP6Control() in the RP6ControlLib!
//
// Example:
// int main(void)
// {
// 		portInit();
// 		// ...
//		// your application
//		while(true);
//		return 0;
// }

#define portInit();	\
PORTA = INIT_PRTA;	\
PORTB = INIT_PRTB;	\
PORTC = INIT_PRTC;	\
PORTD = INIT_PRTD;	\
DDRA = INIT_DDRA;	\
DDRB = INIT_DDRB;	\
DDRC = INIT_DDRC;	\
DDRD = INIT_DDRD;

/*****************************************************************************/
// Some additional definitions/macros

// Boolean:
#define true 1
#define false 0
#define TRUE 1
#define FALSE 0

// Assembly and system macros:
#define nop() asm volatile("nop\n\t")
#define sysSleep() asm volatile("sleep\n\t")

/*****************************************************************************/
// Standard Baudrates for RP6:

#define BAUD_LOW		38400UL  // Low speed - 38.4 kBaud
#define UBRR_BAUD_LOW	((F_CPU/(16*BAUD_LOW))-1)

#define BAUD_HIGH		500000UL // High speed - 500 kBaud
#define UBRR_BAUD_HIGH	((F_CPU/(16*BAUD_HIGH))-1)

/******************************************************************************
 * Additional info
 * ****************************************************************************
 * Changelog:
 * - v. 1.0 (initial release) 16.05.2007 by Dominik S. Herwald
 *
 * ****************************************************************************
 * Bugs, feedback, questions and modifications can be posted on the AREXX Forum
 * on http://www.arexx.com/forum/ !
 * Of course you can also write us an e-mail to: info@arexx.nl
 * AREXX Engineering may publish updates from time to time on AREXX.com!
 * ****************************************************************************
 * - LICENSE -
 * GNU GPL v2 (http://www.gnu.org/licenses/gpl.txt, a local copy can be found
 * on the RP6 CD in the RP6 sorce code folders!)
 * This program is free software. You can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 * ****************************************************************************
 */

#endif

/*****************************************************************************/
// EOF


text:
package com.client.core.scheduledtasks.model.helper.impl;

import com.bullhornsdk.data.model.entity.core.standard.ClientContact;
import com.bullhornsdk.data.model.entity.core.standard.ClientCorporation;
import com.bullhornsdk.data.model.entity.core.standard.CorporateUser;
import com.client.core.base.model.relatedentity.BullhornRelatedEntity;
import com.client.core.base.model.relatedentity.ClientContactRelatedEntity;
import com.client.core.scheduledtasks.model.helper.AbstractScheduledTaskHelper;
import com.client.core.scheduledtasks.model.helper.CustomSubscriptionEvent;

import java.util.Map;
import java.util.Set;

public class ClientContactScheduledTaskHelper extends AbstractScheduledTaskHelper<ClientContact> {

	private ClientCorporation clientCorporation;
	private CorporateUser clientContactOwner;

	public ClientContactScheduledTaskHelper(CustomSubscriptionEvent event, Map<? extends BullhornRelatedEntity, Set<String>> relatedEntityFields) {
		super(event, ClientContact.class, ClientContactRelatedEntity.CLIENT_CONTACT, relatedEntityFields);
	}

    public ClientContact getClientContact() {
        return getEntity();
    }

	public ClientCorporation getClientCorporation() {
		if (clientCorporation == null) {
			this.clientCorporation = findClientCorporation(getClientContact().getClientCorporation().getId(), ClientContactRelatedEntity.CLIENT_CORPORATION);
		}

		return clientCorporation;
	}

	public CorporateUser getClientContactOwner() {
		if (clientContactOwner == null) {
			this.clientContactOwner = findCorporateUser(getClientContact().getOwner().getId(), ClientContactRelatedEntity.CLIENT_CONTACT_OWNER);
		}

		return clientContactOwner;
	}

}


text:
This sample demonstrates how to analyze sentiment of documents and get more granular information about the opinions related to targets of a product/service, also knows as Aspect-based Sentiment Analysis in Natural Language Processing (NLP). This feature is only available for clients with api version v3.1-preview.1 and higher.

For example, if a customer leaves feedback about a hotel such as "The room was great, but the staff was unfriendly.", Opinion Mining will locate targets in the text, and their associated opinion and sentiments. Sentiment Analysis might only report a negative sentiment.

![opinion mining diagram](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/assets/opinion-mining.png)

For the purpose of the sample, we will be the administrator of a hotel and we've set a system to look at the online reviews customers are posting to identify the major complaints about our hotel.
In order to do so, we will use the Sentiment Analysis feature of the Text Analytics client library. To get started you'll need a Text Analytics endpoint and credentials.  See [README][README] for links and instructions.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient`, you need a Text Analytics endpoint and credentials.  You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development.  In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

```C# Snippet:CreateTextAnalyticsClient
string endpoint = "<endpoint>";
string apiKey = "<apiKey>";
var client = new TextAnalyticsClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
```

## Identify complaints

To get a deeper analysis into which are the targets that people considered good or bad, we will need to set the `IncludeOpinionMining` type into the `AnalyzeSentimentOptions`.

```C# Snippet:TAAnalyzeSentimentWithOpinionMining
string reviewA = @"The food and service were unacceptable, but the concierge were nice.
                 After talking to them about the quality of the food and the process
                 to get room service they refunded the money we spent at the restaurant
                 and gave us a voucher for nearby restaurants.";

string reviewB = @"The rooms were beautiful. The AC was good and quiet, which was key for
                us as outside it was 100F and our baby was getting uncomfortable because of the heat.
                The breakfast was good too with good options and good servicing times.
                The thing we didn't like was that the toilet in our bathroom was smelly.
                It could have been that the toilet was not cleaned before we arrived.
                Either way it was very uncomfortable.
                Once we notified the staff, they came and cleaned it and left candles.";

string reviewC = @"Nice rooms! I had a great unobstructed view of the Microsoft campus
                but bathrooms were old and the toilet was dirty when we arrived.
                It was close to bus stops and groceries stores. If you want to be close to
                campus I will recommend it, otherwise, might be better to stay in a cleaner one.";

var documents = new List<string>
{
    reviewA,
    reviewB,
    reviewC
};

var options = new AnalyzeSentimentOptions() { IncludeOpinionMining = true };
Response<AnalyzeSentimentResultCollection> response = client.AnalyzeSentimentBatch(documents, options: options);
AnalyzeSentimentResultCollection reviews = response.Value;

Dictionary<string, int> complaints = GetComplaints(reviews);

var negativeAspect = complaints.Aggregate((l, r) => l.Value > r.Value ? l : r).Key;
Console.WriteLine($"Alert! major complaint is *{negativeAspect}*");
Console.WriteLine();
Console.WriteLine("---All complaints:");
foreach (KeyValuePair<string, int> complaint in complaints)
{
    Console.WriteLine($"   {complaint.Key}, {complaint.Value}");
}
```

Output:
```
Alert! major complaint is *toilet*

---All complaints:
   food, 1
   service, 1
   toilet, 3
```

## Define method `GetComplaints`
Implementation for calculating complaints:

```C# Snippet:TAGetComplaints
private Dictionary<string, int> GetComplaints(AnalyzeSentimentResultCollection reviews)
{
    var complaints = new Dictionary<string, int>();
    foreach (AnalyzeSentimentResult review in reviews)
    {
        foreach (SentenceSentiment sentence in review.DocumentSentiment.Sentences)
        {
            foreach (SentenceOpinion opinion in sentence.Opinions)
            {
                if (opinion.Target.Sentiment == TextSentiment.Negative)
                {
                    complaints.TryGetValue(opinion.Target.Text, out var value);
                    complaints[opinion.Target.Text] = value + 1;
                }
            }
        }
    }
    return complaints;
}
```

To see the full example source files, see:
* [Synchronous Analyze Sentiment with Opinion Mining](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/textanalytics/Azure.AI.TextAnalytics//tests/samples/Sample2.1_AnalyzeSentimentWithOpinionMining.cs)
* [Asynchronous Analyze Sentiment with Opinion Mining](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/textanalytics/Azure.AI.TextAnalytics//tests/samples/Sample2.1_AnalyzeSentimentWithOpinionMiningAsync.cs)

[DefaultAzureCredential]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/README.md
[README]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/textanalytics/Azure.AI.TextAnalytics/README.md


text:
# define JSONCPP_VERSION_STRING "1.7.2"
# define JSONCPP_VERSION_MAJOR 1
# define JSONCPP_VERSION_MINOR 7
# define JSONCPP_VERSION_PATCH 2
# define JSONCPP_VERSION_QUALIFIER
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))

#ifdef JSONCPP_USING_SECURE_MEMORY
#undef JSONCPP_USING_SECURE_MEMORY
#endif
#define JSONCPP_USING_SECURE_MEMORY 0
// If non-zero, the library zeroes any memory that it has allocated before
// it frees its memory.

#endif // JSON_VERSION_H_INCLUDED


text:
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using Remotion.Linq.Parsing;
using Remotion.Linq.Utilities;
using Remotion.Utilities;

namespace Remotion.Linq.Clauses.ExpressionVisitors
{
  /// <summary>
  /// Constructs a <see cref="LambdaExpression"/> that is able to extract a specific simple expression from a complex <see cref="NewExpression"/>
  /// or <see cref="MemberInitExpression"/>.
  /// </summary>
  /// <example>
  /// <para>
  /// For example, consider the task of determining the value of a specific query source [s] from an input value corresponding to a complex
  /// expression. This <see cref="AccessorFindingExpressionVisitor"/> will return a <see cref="LambdaExpression"/> able to perform this task.
  /// </para>
  /// <para>
  /// <list type="bullet">
  /// <item>If the complex expression is [s], it will simply return input => input.</item>
  /// <item>If the complex expression is new { a = [s], b = "..." }, it will return input => input.a.</item>
  /// <item>If the complex expression is new { a = new { b = [s], c = "..." }, d = "..." }, it will return input => input.a.b.</item>
  /// </list>
  /// </para>
  /// </example>
  public sealed class AccessorFindingExpressionVisitor : RelinqExpressionVisitor
  {
    /// <summary>
    /// Constructs a <see cref="LambdaExpression"/> that is able to extract a specific simple <paramref name="searchedExpression"/> from a
    /// complex <paramref name="fullExpression"/>.
    /// </summary>
    /// <param name="searchedExpression">The expression an accessor to which should be created.</param>
    /// <param name="fullExpression">The full expression containing the <paramref name="searchedExpression"/>.</param>
    /// <param name="inputParameter">The input parameter to be used by the resulting lambda. Its type must match the type of <paramref name="fullExpression"/>.</param>
    /// <remarks>The <see cref="AccessorFindingExpressionVisitor"/> compares the <paramref name="searchedExpression"/> via reference equality,
    /// which means that exactly the same expression reference must be contained by <paramref name="fullExpression"/> for the visitor to return the
    /// expected result. In addition, the visitor can only provide accessors for expressions nested in <see cref="NewExpression"/> or
    /// <see cref="MemberInitExpression"/>.</remarks>
    /// <returns>A <see cref="LambdaExpression"/> acting as an accessor for the <paramref name="searchedExpression"/> when an input matching
    /// <paramref name="fullExpression"/> is given.
    /// </returns>
    public static LambdaExpression FindAccessorLambda (Expression searchedExpression, Expression fullExpression, ParameterExpression inputParameter)
    {
      ArgumentUtility.CheckNotNull ("searchedExpression", searchedExpression);
      ArgumentUtility.CheckNotNull ("fullExpression", fullExpression);
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);

      if (inputParameter.Type != fullExpression.Type)
      {
        throw new ArgumentException (
            string.Format ("The inputParameter's type '{0}' must match the fullExpression's type '{1}'.", inputParameter.Type, fullExpression.Type),
            "inputParameter");
      }

      var visitor = new AccessorFindingExpressionVisitor (searchedExpression, inputParameter);
      visitor.Visit (fullExpression);

      if (visitor.AccessorPath != null)
        return visitor.AccessorPath;
      else
      {
        var message = string.Format (
            "The given expression '{0}' does not contain the searched expression '{1}' in a nested NewExpression with member assignments or a "
                + "MemberBindingExpression.",
            fullExpression.BuildString(),
            searchedExpression.BuildString());
        throw new ArgumentException (message, "fullExpression");
      }
    }

    private readonly Expression _searchedExpression;
    private readonly ParameterExpression _inputParameter;

    private readonly Stack<Expression> _accessorPathStack = new Stack<Expression> ();

    private AccessorFindingExpressionVisitor (Expression searchedExpression, ParameterExpression inputParameter)
    {
      ArgumentUtility.CheckNotNull ("searchedExpression", searchedExpression);
      ArgumentUtility.CheckNotNull ("inputParameter", inputParameter);

      _searchedExpression = searchedExpression;
      _inputParameter = inputParameter;
      _accessorPathStack.Push (_inputParameter);
    }

    private LambdaExpression AccessorPath { get; set; }

    public override Expression Visit (Expression expression)
    {
      if (Equals (expression, _searchedExpression))
      {
        Expression path = _accessorPathStack.Peek ();
        AccessorPath = Expression.Lambda (path, _inputParameter);

        return expression;
      }
      else if (expression is NewExpression || expression is MemberInitExpression || expression is UnaryExpression)
      {
        return base.Visit (expression);
      }
      else
      {
        return expression;
      }
    }

    protected override Expression VisitNew (NewExpression expression)
    {
      ArgumentUtility.CheckNotNull ("expression", expression);

      if (expression.Members != null && expression.Members.Count > 0)
      {
        for (int i = 0; i < expression.Members.Count; i++)
          CheckAndVisitMemberAssignment (expression.Members[i], expression.Arguments[i]);
      }

      return expression;
    }

    protected override Expression VisitUnary (UnaryExpression expression)
    {
      ArgumentUtility.CheckNotNull ("expression", expression);

      if (expression.NodeType == ExpressionType.Convert || expression.NodeType == ExpressionType.ConvertChecked)
      {
        var reverseConvert = Expression.Convert (_accessorPathStack.Peek (), expression.Operand.Type);
        _accessorPathStack.Push (reverseConvert);
        base.VisitUnary (expression);
        _accessorPathStack.Pop ();
      }

      return expression;
    }

    protected override MemberBinding VisitMemberBinding (MemberBinding memberBinding)
    {
      ArgumentUtility.CheckNotNull ("memberBinding", memberBinding);

      if (memberBinding is MemberAssignment)
        return base.VisitMemberBinding (memberBinding);
      else
        return memberBinding;
    }

    protected override MemberAssignment VisitMemberAssignment (MemberAssignment memberAssigment)
    {
      ArgumentUtility.CheckNotNull ("memberAssigment", memberAssigment);

      CheckAndVisitMemberAssignment (memberAssigment.Member, memberAssigment.Expression);
      return memberAssigment;
    }

    private void CheckAndVisitMemberAssignment (MemberInfo member, Expression expression)
    {
      var memberAccess = GetMemberAccessExpression (_accessorPathStack.Peek (), member);
      _accessorPathStack.Push (memberAccess);
      Visit (expression);
      _accessorPathStack.Pop ();
    }

    private Expression GetMemberAccessExpression (Expression input, MemberInfo member)
    {
      var normalizedInput = EnsureMemberIsAccessibleFromInput (input, member);

      var methodInfo = member as MethodInfo;
      if (methodInfo != null)
        return Expression.Call (normalizedInput, methodInfo);
      else
        return Expression.MakeMemberAccess (normalizedInput, member);
    }

    private Expression EnsureMemberIsAccessibleFromInput (Expression input, MemberInfo member)
    {
      var memberDeclaringType = member.DeclaringType.GetTypeInfo();
      var inputType = input.Type.GetTypeInfo();

      var isMemberDeclaredOnInputType = memberDeclaringType.IsAssignableFrom (inputType);
      if (isMemberDeclaredOnInputType)
        return input;

      Assertion.IsTrue (
          inputType.IsAssignableFrom (memberDeclaringType),
          "Input expression of type '{0}' cannot be converted to declaring type '{1}' of member '{2}'.",
          input.Type.FullName,
          member.DeclaringType.FullName,
          member.Name);

      return Expression.Convert (input, member.DeclaringType);
    }
  }
}


text:
<?php

namespace doc\MotoBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use doc\MotoBundle\Entity\MotoRepository;

class AnnonceType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('titre',      		'text')
            ->add('annee',      		'text')
            ->add('kilometrage',      	'text')
            ->add('description',      	'textarea')
            ->add('prix',      			'text')
            ->add('pseudo',      		'text')
            ->add('mail',      			'email')
            ->add('telephone',      	'text', array('required' => false))
            ->add('password', 'repeated', array(
				'type' => 'password',
				'invalid_message' => 'Les mots de passe doivent correspondre',
				'options' => array('required' => true)
			  ))

			->add('departement', 'entity', array(
				'class'    => 'docMotoBundle:Departement',
				'property' => 'getAffichage',
				'multiple' => false
			  ))

            ->add('marques_voulues', 'entity', array(
				'class'    => 'docMotoBundle:Marque',
				'property' => 'nom',
				'multiple' => true,
				'required' => false,
				'attr' => array('class' => 'chzn-select')
			  ))

            ->add('genres_voulus', 'entity', array(
				'class'    => 'docMotoBundle:Genre',
				'property' => 'nom',
				'multiple' => true,
				'required' => false,
				'attr' => array('class' => 'chzn-select')
			  ))

			->add('moto', 'entity', array(
				'class'    => 'docMotoBundle:Moto',
				'property' => 'getAffichage',
				'multiple' => false,
				'attr' => array('class' => 'chzn-select')
			  ))

            ->add('motos_voulues', 'entity', array(
				'class'    => 'docMotoBundle:Moto',
				'property' => 'modele',
				'multiple' => true,
				'group_by' => 'getNomMarque',
				'required' => false,
				'attr' => array('class' => 'chzn-select')
			  ))

			->add('photos', 'collection', array(
				'type'         => new PhotoType(),
                'by_reference' => false,
				'allow_add'    => true,
				'allow_delete' => true,
				'required' => false,
			  ))

			->add('save',      			'submit')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'doc\MotoBundle\Entity\Annonce'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'doc_motobundle_annonce';
    }
}


text:
export default (ngModule) => {
    require('./fonts/MaterialIcons/material-icons.css');
    require('./table').default(ngModule);
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Poaephyllum uniflorum J.J.Wood

### Remarks
null


text:
RSpec.describe RuboCop::Cop::Rails::HasManyOrHasOneDependent do
  subject(:cop) { described_class.new }

  context 'has_one' do
    it 'registers an offense when not specifying any options' do
      expect_offense(<<-RUBY.strip_indent)
        class Person
          has_one :foo
          ^^^^^^^ Specify a `:dependent` option.
        end
      RUBY
    end

    it 'registers an offense when missing an explicit `:dependent` strategy' do
      expect_offense(<<-RUBY.strip_indent)
        class Person
          has_one :foo, class_name: 'bar'
          ^^^^^^^ Specify a `:dependent` option.
        end
      RUBY
    end

    it 'does not register an offense when specifying `:dependent` strategy' do
      expect_no_offenses(<<-RUBY.strip_indent)
        class Person
          has_one :foo, dependent: :destroy
        end
      RUBY
    end

    context 'with :through option' do
      it 'does not register an offense for non-nil value' do
        expect_no_offenses(<<-RUBY.strip_indent)
          class Person
            has_one :foo, through: :bar
          end
        RUBY
      end

      it 'registers an offense for nil value' do
        expect_offense(<<-RUBY.strip_indent)
        class Person
          has_one :foo, through: nil
          ^^^^^^^ Specify a `:dependent` option.
        end
        RUBY
      end
    end

    context 'with_options dependent: :destroy' do
      it 'does not register an offense' do
        expect_no_offenses(<<-RUBY.strip_indent)
          class Person
            with_options dependent: :destroy do
              has_one :foo
            end
          end
        RUBY
      end

      it 'does not register an offense for using `class_name` option' do
        expect_no_offenses(<<-RUBY.strip_indent)
          class Person
            with_options dependent: :destroy do
              has_one :foo, class_name: 'Foo'
            end
          end
        RUBY
      end
    end
  end

  context 'has_many' do
    it 'registers an offense when not specifying any options' do
      expect_offense(<<-RUBY.strip_indent)
        class Person
          has_many :foo
          ^^^^^^^^ Specify a `:dependent` option.
        end
      RUBY
    end

    it 'registers an offense when missing an explicit `:dependent` strategy' do
      expect_offense(<<-RUBY.strip_indent)
        class Person
          has_many :foo, class_name: 'bar'
          ^^^^^^^^ Specify a `:dependent` option.
        end
      RUBY
    end

    it 'does not register an offense when specifying `:dependent` strategy' do
      expect_no_offenses('has_many :foo, dependent: :bar')
    end

    context 'with :through option' do
      it 'does not register an offense for non-nil value' do
        expect_no_offenses('has_many :foo, through: :bars')
      end

      it 'registers an offense for nil value' do
        expect_offense(<<-RUBY.strip_indent)
        class Person
          has_many :foo, through: nil
          ^^^^^^^^ Specify a `:dependent` option.
        end
        RUBY
      end
    end

    context 'Surrounded `with_options` block' do
      it 'registers an offense when `dependent: :destroy` is not present' do
        expect_offense(<<-RUBY.strip_indent)
          class Person
            with_options through: nil do
              has_many :foo
              ^^^^^^^^ Specify a `:dependent` option.
            end
          end
        RUBY
      end

      it "doesn't register an offense for `with_options dependent: :destroy`" do
        expect_no_offenses(<<-RUBY.strip_indent)
          class Person
            with_options dependent: :destroy do
              has_many :foo
            end
          end
        RUBY
      end

      context 'Multiple associations' do
        it "doesn't register an offense for " \
           '`with_options dependent: :destroy`' do
          expect_no_offenses(<<-RUBY.strip_indent)
            class Person
              with_options dependent: :destroy do
                has_many :foo
                has_many :bar
              end
            end
          RUBY
        end
      end
    end
  end
end


text:
set -xe

#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/cmake)
BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
SKIA_DIR=`cd $BASE_DIR/../.. && pwd`

# Delete everything to do a clean build
rm -rf $SKIA_DIR/out/CMAKE
mkdir --mode=0777 -p $SKIA_DIR/out/CMAKE

cd $SKIA_DIR
./bin/fetch-gn
gn gen out/CMAKE --args='is_debug=false' --ide=json --json-ide-script=../../gn/gn_to_cmake.py

cd $SKIA_DIR/out/CMAKE
cmake -G"CodeBlocks - Unix Makefiles" .
cmake --build . --parallel 8

# Copy build products, ignoring the warning
# for not copying directories.
cp $SKIA_DIR/out/CMAKE/* /OUT || true
chmod +rw /OUT/*


text:
package com.ait.lienzo.charts.client.xy.bar.event;

import com.google.gwt.event.shared.GwtEvent;

public class ValueSelectedEvent extends GwtEvent<ValueSelectedHandler> {

    public static Type<ValueSelectedHandler> TYPE = new Type<ValueSelectedHandler>();
    private String series;
    private String column;
    private int row;

    public ValueSelectedEvent(String series, String column, int row) {
        this.series = series;
        this.column = column;
        this.row = row;
    }

    public int getRow() {
        return row;
    }

    public String getColumn() {
        return column;
    }

    public String getSeries() {
        return series;
    }

    @Override
    public Type<ValueSelectedHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(ValueSelectedHandler handler) {
        handler.onValueSelected(this);
    }
}


text:
package at.ac.tuwien.oz.translator.templates.preconditions;

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

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.stringtemplate.v4.ST;

import at.ac.tuwien.oz.datatypes.Declarations;
import at.ac.tuwien.oz.datatypes.ExpressionType;
import at.ac.tuwien.oz.datatypes.Variable;
import at.ac.tuwien.oz.datatypes.preconditions.PreconditionFunctionCall;
import at.ac.tuwien.oz.datatypes.preconditions.combinable.PreconditionFunctionCalls;
import at.ac.tuwien.oz.datatypes.preconditions.composable.NonDeterministicPreconditions;
import at.ac.tuwien.oz.datatypes.preconditions.composable.NonDeterministicPreconditions.PreconditionItem;
import at.ac.tuwien.oz.definitions.operation.TemporaryVariableMap;
import at.ac.tuwien.oz.definitions.operation.interfaces.IPromotedOperation;
import at.ac.tuwien.oz.translator.TempVarProvider;
import at.ac.tuwien.oz.translator.templates.NonDeterministicChoiceTemplateProvider;
import at.ac.tuwien.oz.translator.templates.postconditions.PostconditionTestMockProvider;

public class CreateNonDeterministicPreconditionTest {

	private NonDeterministicChoiceTemplateProvider provider = new NonDeterministicChoiceTemplateProvider();

	private PreconditionTestMockProvider preconditionMockProvider = new PreconditionTestMockProvider();
	private PostconditionTestMockProvider postconditionMockProvider = new PostconditionTestMockProvider();

	private NonDeterministicPreconditions nonDeterministicPreconditions;

	private List<PreconditionItem> preconditionItems;

	private static final ExpressionType NAT = ExpressionType.getNat();

	@Before
	public void before(){
		TempVarProvider.resetNameCounter();
		nonDeterministicPreconditions = Mockito.mock(NonDeterministicPreconditions.class);
		preconditionItems = new ArrayList<PreconditionItem>();
		Mockito.when(nonDeterministicPreconditions.getPreconditions()).thenReturn(preconditionItems);
	}

	private void withPreconditionItem(PreconditionItem precondition){
		this.preconditionItems.add(precondition);
	}

	@Test
	public void combiningTwoSimpleComposablePreconditions(){
		// a.func [] b.func
		// =>
		// a.func_prec | b.func_prec

		PreconditionFunctionCall afunc1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "func1_prec", Declarations.empty());
		PreconditionFunctionCall bfunc2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "func2_prec", Declarations.empty());

		IPromotedOperation afunc1 = postconditionMockProvider.buildFunctionPromotionMock("a", "func1", Declarations.empty(), Variable.createOutputVariable("outVar1", NAT));
		IPromotedOperation bfunc2 = postconditionMockProvider.buildFunctionPromotionMock("b", "func2", Declarations.empty(), Variable.createOutputVariable("outVar2", NAT));

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(afunc1Prec), Arrays.asList(afunc1));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(bfunc2Prec), Arrays.asList(bfunc2));

		withPreconditionItem(item1);
		withPreconditionItem(item2);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, null);

		String expectedResult =
					"a.func1_prec | "
				+   "b.func2_prec";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

	@Test
	public void combiningComposablePreconditionsWithConjunction(){
		// a.func1 [] (b.func2 && c.func3)
		// =>
		// a.func1_prec | b.func2_prec & c.func3_prec

		PreconditionFunctionCall afunc1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "func1_prec", Declarations.empty());
		PreconditionFunctionCall bfunc2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "func2_prec", Declarations.empty());
		PreconditionFunctionCall cfunc3Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("c", "func3_prec", Declarations.empty());

		IPromotedOperation afunc1 = postconditionMockProvider.buildFunctionPromotionMock("a", "func1", Declarations.empty(), Variable.createOutputVariable("outVar1", NAT));
		IPromotedOperation bfunc2 = postconditionMockProvider.buildFunctionPromotionMock("b", "func2", Declarations.empty(), Variable.createOutputVariable("outVar2", NAT));
		IPromotedOperation cfunc3 = postconditionMockProvider.buildFunctionPromotionMock("c", "func3", Declarations.empty(), Variable.createOutputVariable("outVar3", NAT));

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(afunc1Prec), Arrays.asList(afunc1));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(bfunc2Prec, cfunc3Prec), Arrays.asList(bfunc2, cfunc3));

		withPreconditionItem(item1);
		withPreconditionItem(item2);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, null);

		String expectedResult =
					"a.func1_prec | "
				+   "b.func2_prec & "
				+   "c.func3_prec";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

	@Test
	public void combiningThreeComposablePreconditions(){
		// a.func1 [] (b.func2 && c.func3)
		// =>
		// a.func1_prec | b.func2_prec & c.func3_prec

		PreconditionFunctionCall afunc1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "func1_prec", Declarations.empty());
		PreconditionFunctionCall bfunc2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "func2_prec", Declarations.empty());
		PreconditionFunctionCall cfunc3Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("c", "func3_prec", Declarations.empty());
		PreconditionFunctionCall dfunc4Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("d", "func4_prec", Declarations.empty());

		IPromotedOperation afunc1 = postconditionMockProvider.buildFunctionPromotionMock("a", "func1", Declarations.empty(), Variable.createOutputVariable("outVar1", NAT));
		IPromotedOperation bfunc2 = postconditionMockProvider.buildFunctionPromotionMock("b", "func2", Declarations.empty(), Variable.createOutputVariable("outVar2", NAT));
		IPromotedOperation cfunc3 = postconditionMockProvider.buildFunctionPromotionMock("c", "func3", Declarations.empty(), Variable.createOutputVariable("outVar3", NAT));
		IPromotedOperation dfunc4 = postconditionMockProvider.buildFunctionPromotionMock("d", "func4", Declarations.empty(), Variable.createOutputVariable("outVar4", NAT));

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(afunc1Prec), Arrays.asList(afunc1));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(bfunc2Prec, cfunc3Prec), Arrays.asList(bfunc2, cfunc3));
		PreconditionItem item3 = new PreconditionItem(new PreconditionFunctionCalls(dfunc4Prec), Arrays.asList(dfunc4));

		withPreconditionItem(item1);
		withPreconditionItem(item2);
		withPreconditionItem(item3);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, null);

		String expectedResult =
					"a.func1_prec | "
				+   "b.func2_prec & "
				+   "c.func3_prec | "
				+   "d.func4_prec";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

	@Test
	public void functionsWithCommunicationInputParameters(){
		Variable commVarIn = Variable.createInputVariable("commVar", NAT);
		Variable commVarOut = Variable.createInputVariable("commVar", NAT);

		TemporaryVariableMap tempVarMap = new TemporaryVariableMap();
		tempVarMap.add(commVarOut);
		// a.func1(commVarIn) [] b.func2(commVarIn)
		// =>
		// a.func_prec(tempVar1) | b.func_prec(tempVar1)

		PreconditionFunctionCall afunc1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "func1_prec", new Declarations(commVarIn));
		PreconditionFunctionCall bfunc2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "func2_prec", new Declarations(commVarIn));
		PreconditionFunctionCall cfunc3Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("c", "func3_prec", Declarations.empty());

		IPromotedOperation afunc1 = postconditionMockProvider.buildFunctionPromotionMock("a", "func1", new Declarations(commVarIn), Variable.createOutputVariable("outVar1", NAT));
		IPromotedOperation bfunc2 = postconditionMockProvider.buildFunctionPromotionMock("b", "func2", new Declarations(commVarIn), Variable.createOutputVariable("outVar2", NAT));
		IPromotedOperation cfunc3 = postconditionMockProvider.buildFunctionPromotionMock("c", "func3", Declarations.empty(), Variable.createOutputVariable("outVar3", NAT));

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(afunc1Prec), Arrays.asList(afunc1));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(bfunc2Prec, cfunc3Prec), Arrays.asList(bfunc2, cfunc3));

		withPreconditionItem(item1);
		withPreconditionItem(item2);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, tempVarMap);

		String expectedResult =
					"a.func1_prec(tempVar1) | "
				+   "b.func2_prec(tempVar1) & "
				+   "c.func3_prec";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

	@Test
	public void schemasWithCommunicationInputParameters(){
		Variable commVarIn = Variable.createInputVariable("commVar", NAT);
		Variable commVarOut = Variable.createInputVariable("commVar", NAT);

		TemporaryVariableMap tempVarMap = new TemporaryVariableMap();
		tempVarMap.add(commVarOut);
		// a.func1(commVarIn) [] b.func2(commVarIn)
		// =>
		// a.func_prec(tempVar1) | b.func_prec(tempVar1)

		PreconditionFunctionCall aOp1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "op1_prec", new Declarations(commVarIn));
		PreconditionFunctionCall bOp2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "op2_prec", new Declarations(commVarIn));
		PreconditionFunctionCall cOp3Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("c", "op3_prec", Declarations.empty());

		IPromotedOperation aOp1 = postconditionMockProvider.buildSchemaPromotionMock("a", "op1", new Declarations(commVarIn), new Declarations(Variable.createOutputVariable("outVar1", NAT)));
		IPromotedOperation bOp2 = postconditionMockProvider.buildSchemaPromotionMock("b", "op2", new Declarations(commVarIn), new Declarations(Variable.createOutputVariable("outVar2", NAT)));
		IPromotedOperation cOp3 = postconditionMockProvider.buildSchemaPromotionMock("c", "op3", Declarations.empty(), new Declarations(Variable.createOutputVariable("outVar3", NAT)));

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(aOp1Prec), Arrays.asList(aOp1));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(bOp2Prec, cOp3Prec), Arrays.asList(bOp2, cOp3));

		withPreconditionItem(item1);
		withPreconditionItem(item2);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, tempVarMap);

		String expectedResult =
					"a.op1_prec(tempVar1) | "
				+   "b.op2_prec(tempVar1) & "
				+   "c.op3_prec";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

	@Test
	public void functionsWithCommunicationOutputParameters(){
		Variable commVarOut = Variable.createOutputVariable("commVar", NAT);

		TemporaryVariableMap tempVarMap = new TemporaryVariableMap();
		tempVarMap.add(commVarOut);
		// a.func1 && b.func2 [] c.func3
		// func1: commVarOut
		// func2: outVarOut
		// func3: commVarOut outVarOut

		// =>
		// a.func_prec(tempVar1) | b.func_prec(tempVar1)

		PreconditionFunctionCall afunc1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "func1_prec", Declarations.empty());
		PreconditionFunctionCall bfunc2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "func2_prec", Declarations.empty());
		PreconditionFunctionCall cfunc3Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("c", "func3_prec", Declarations.empty());

		IPromotedOperation afunc1 = postconditionMockProvider.buildFunctionPromotionMock("a", "func1", Declarations.empty(), commVarOut);
		IPromotedOperation bfunc2 = postconditionMockProvider.buildFunctionPromotionMock("b", "func2", Declarations.empty(), Variable.createOutputVariable("outVar2", NAT));
		IPromotedOperation cfunc3 = postconditionMockProvider.buildFunctionPromotionMock("c", "func3", Declarations.empty(), commVarOut);

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(afunc1Prec, bfunc2Prec), Arrays.asList(afunc1, bfunc2));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(cfunc3Prec), Arrays.asList(cfunc3));

		withPreconditionItem(item1);
		withPreconditionItem(item2);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, tempVarMap);

		String expectedResult =
					"a.func1_prec & "
				+   "b.func2_prec & "
				+   "tempVar1 = a.func1.commVar_out | "
				+   "c.func3_prec & "
				+   "tempVar1 = c.func3.commVar_out";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

	@Test
	public void schemasWithCommunicationOutputParameters(){
		Variable commVarOut = Variable.createOutputVariable("commVar", NAT);

		TemporaryVariableMap tempVarMap = new TemporaryVariableMap();
		tempVarMap.add(commVarOut);
		// a.func1 && b.func2 [] c.func3
		// func1: commVarOut
		// func2: outVarOut
		// func3: commVarOut outVarOut

		// =>
		// a.func_prec(tempVar1) | b.func_prec(tempVar1)

		PreconditionFunctionCall aOp1Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("a", "op1_prec", Declarations.empty());
		PreconditionFunctionCall bOp2Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("b", "op2_prec", Declarations.empty());
		PreconditionFunctionCall cOp3Prec =
				preconditionMockProvider.buildPreconditionFunctionCallMock("c", "op3_prec", Declarations.empty());

		IPromotedOperation aOp1 = postconditionMockProvider.buildSchemaPromotionMock("a", "op1", Declarations.empty(), new Declarations(commVarOut));
		IPromotedOperation bOp2 = postconditionMockProvider.buildSchemaPromotionMock("b", "op2", Declarations.empty(), new Declarations(Variable.createOutputVariable("outVar2", NAT)));
		IPromotedOperation cOp3 = postconditionMockProvider.buildSchemaPromotionMock("c", "op3", Declarations.empty(), new Declarations(commVarOut));

		PreconditionItem item1 = new PreconditionItem(new PreconditionFunctionCalls(aOp1Prec, bOp2Prec), Arrays.asList(aOp1, bOp2));
		PreconditionItem item2 = new PreconditionItem(new PreconditionFunctionCalls(cOp3Prec), Arrays.asList(cOp3));

		withPreconditionItem(item1);
		withPreconditionItem(item2);

		ST resultTemplate = provider.createNonDeterministicPrecondition(nonDeterministicPreconditions, tempVarMap);

		String expectedResult =
					"a.op1_prec & "
				+   "b.op2_prec & "
				+   "tempVar1 = a.op1.commVar_out | "
				+   "c.op3_prec & "
				+   "tempVar1 = c.op3.commVar_out";

		Assert.assertEquals(expectedResult, resultTemplate.render());
	}

}