text:
using System.Linq;

namespace Content.Server.Chemistry.Components
{
    /// <summary>
    /// The "mastermind" of a SolutionAreaEffect group. It gets updated by the SolutionAreaEffectSystem and tells the
    /// group when to spread, react and remove itself. This makes the group act like a single unit.
    /// </summary>
    /// <remarks> It should only be manually added to an entity by the <see cref="SolutionAreaEffectComponent"/> and not with a prototype.</remarks>
    [RegisterComponent]
    public sealed class SolutionAreaEffectInceptionComponent : Component
    {
        private const float ReactionDelay = 1.5f;

        private readonly HashSet<SolutionAreaEffectComponent> _group = new();

        [ViewVariables] private float _lifeTimer;
        [ViewVariables] private float _spreadTimer;
        [ViewVariables] private float _reactionTimer;

        [ViewVariables] private int _amountCounterSpreading;
        [ViewVariables] private int _amountCounterRemoving;

        /// <summary>
        /// How much time to wait after fully spread before starting to remove itself.
        /// </summary>
        [ViewVariables] private float _duration;

        /// <summary>
        /// Time between each spread step. Decreasing this makes spreading faster.
        /// </summary>
        [ViewVariables] private float _spreadDelay;

        /// <summary>
        /// Time between each remove step. Decreasing this makes removing faster.
        /// </summary>
        [ViewVariables] private float _removeDelay;

        /// <summary>
        /// How many times will the effect react. As some entities from the group last a different amount of time than
        /// others, they will react a different amount of times, so we calculate the average to make the group behave
        /// a bit more uniformly.
        /// </summary>
        [ViewVariables] private float _averageExposures;

        public void Setup(int amount, float duration, float spreadDelay, float removeDelay)
        {
            _amountCounterSpreading = amount;
            _duration = duration;
            _spreadDelay = spreadDelay;
            _removeDelay = removeDelay;

            // So the first square reacts immediately after spawning
            _reactionTimer = ReactionDelay;
            /*
            The group takes amount*spreadDelay seconds to fully spread, same with fully disappearing.
            The outer squares will last duration seconds.
            The first square will last duration + how many seconds the group takes to fully spread and fully disappear, so
            it will last duration + amount*(spreadDelay+removeDelay).
            Thus, the average lifetime of the smokes will be (outerSmokeLifetime + firstSmokeLifetime)/2 = duration + amount*(spreadDelay+removeDelay)/2
            */
            _averageExposures = (duration + amount * (spreadDelay+removeDelay) / 2)/ReactionDelay;
        }

        public void InceptionUpdate(float frameTime)
        {
            _group.RemoveWhere(effect => effect.Deleted);
            if (_group.Count == 0)
                return;

            // Make every outer square from the group spread
            if (_amountCounterSpreading > 0)
            {
                _spreadTimer += frameTime;
                if (_spreadTimer > _spreadDelay)
                {
                    _spreadTimer -= _spreadDelay;

                    var outerEffects = new HashSet<SolutionAreaEffectComponent>(_group.Where(effect => effect.Amount == _amountCounterSpreading));
                    foreach (var effect in outerEffects)
                    {
                        effect.Spread();
                    }

                    _amountCounterSpreading -= 1;
                }
            }
            // Start counting for _duration after fully spreading
            else
            {
                _lifeTimer += frameTime;
            }

            // Delete every outer square
            if (_lifeTimer > _duration)
            {
                _spreadTimer += frameTime;
                if (_spreadTimer > _removeDelay)
                {
                    _spreadTimer -= _removeDelay;

                    var outerEffects = new HashSet<SolutionAreaEffectComponent>(_group.Where(effect => effect.Amount == _amountCounterRemoving));
                    foreach (var effect in outerEffects)
                    {
                        effect.Kill();
                    }

                    _amountCounterRemoving += 1;
                }
            }

            // Make every square from the group react with the tile and entities
            _reactionTimer += frameTime;
            if (_reactionTimer > ReactionDelay)
            {
                _reactionTimer -= ReactionDelay;
                foreach (var effect in _group)
                {
                    effect.React(_averageExposures);
                }
            }
        }

        public void Add(SolutionAreaEffectComponent effect)
        {
            _group.Add(effect);
            effect.Inception = this;
        }

        public void Remove(SolutionAreaEffectComponent effect)
        {
            _group.Remove(effect);
            effect.Inception = null;
        }
    }
}


text:
 function yn = has_mex_jf
%function yn = has_mex_jf
% determine whether this matlab session has access to .mex files needed
% for advanced features of this toolbox.

yn = which('dtft_mex'); % seems to force a path check ??

yn =	...
	exist('jf_mex') == 3 & ...
	exist('wtfmex') == 3 & ...
	exist('f3d_mex') == 3 & ...
	exist('dtft_mex') == 3 & ...
	exist('rotmex') == 3;

persistent Mexwarned
if ~isvar('Mexwarned') || isempty(Mexwarned)
	Mexwarned = false;
end

if ~yn & ~Mexwarned
	if ispc
		warn('your operating system came from a monopoly.')
		warn('mex files are not available for this system.')
		warn('upgrade to unix to get the full features!')
	else
		warn('mex files not found: are your paths correct?')
	end
	Mexwarned = true;
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<servico xsi:schemaLocation="http://servicos.gov.br/v3/schema.../servico.xsd" xmlns="http://servicos.gov.br/v3/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <id>obter-validacao-de-grande-modificacao-ao-projeto-de-tipo-estrangeiro</id>
    <dbId>3138</dbId>
    <nome>Obter validação de grande modificação ao projeto de tipo estrangeiro</nome>
    <sigla></sigla>
    <descricao>Obter validação de grande modificação a um certificado de tipo estrangeiro</descricao>
    <contato></contato>
    <gratuito>true</gratuito>
    <porcentagem-manual>false</porcentagem-manual>
    <servico-digital>false</servico-digital>
    <link-servico-digital></link-servico-digital>
    <solicitantes>
        <solicitante id="3724">
            <tipo>Detentores de Certificado de Tipo Estrangeiro</tipo>
            <requisitos></requisitos>
        </solicitante>
    </solicitantes>
    <tempo-total-estimado>
        <entre min="31" max="60" unidade="dias-corridos"/>
        <descricao></descricao>
    </tempo-total-estimado>
    <validade-documento>
        <descricao></descricao>
    </validade-documento>
    <etapas>
        <etapa id="7134">
            <titulo>Solicitar validação</titulo>
            <descricao>Solicitar aprovação de grande modificação ao projeto de tipo</descricao>
            <documentos>
                <default>
                    <item id="9963">Certificado de Tipo Estrangeiro</item>
                    <item id="9964">Documentação Técnica</item>
                    <item id="9965">Solicitação de aprovação</item>
                </default>
            </documentos>
            <custos>
                <default/>
            </custos>
            <canais-de-prestacao>
                <default>
                    <canal-de-prestacao id="7495" tipo="postal">
                        <descricao>**Agência Nacional de Aviação Civil - Superintendência de Aeronavegabilidade - Gerência Geral de Certificação de Produtos Aeronáuticos** - Rua Laurent Martins, 209 - Jardim Esplanada - CEP: 12242-431 - São José dos Campos - SP</descricao>
                    </canal-de-prestacao>
                </default>
            </canais-de-prestacao>
        </etapa>
    </etapas>
    <orgao id="http://estruturaorganizacional.dados.gov.br/id/unidade-organizacional/86144" dbId="908">
        <nomeOrgao>Agência Nacional de Aviação Civil (ANAC)</nomeOrgao>
    </orgao>
    <segmentos-da-sociedade>
        <item idSegmento="1" idServicoSegmento="7052">Cidadãos</item>
        <item idSegmento="3" idServicoSegmento="7053">Empresas</item>
    </segmentos-da-sociedade>
    <areas-de-interesse>
        <item>Pesquisa e Desenvolvimento</item>
        <item>Relações Internacionais</item>
        <item>Transportes</item>
        <item>Comercio externo</item>
        <item>Cooperação Internacional</item>
        <item>Pesquisa, Ciência, Inovação e Tecnologia</item>
        <item>Transporte Aéreo</item>
    </areas-de-interesse>
    <palavras-chave>
        <item id="13117">estrangeiro</item>
        <item id="13118">aviação</item>
        <item id="13119">anac</item>
    </palavras-chave>
</servico>


text:
using FluentAssertions;
using NSubstitute;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Toggl.Core.Interactors.Location;
using Toggl.Core.Tests.TestExtensions;
using Toggl.Networking;
using Toggl.Shared.Models;
using Xunit;

namespace Toggl.Core.Tests.Interactors.Location
{
    public sealed class GetCurrentLocationInteractorTests
    {
        public sealed class TheExecuteMethod
        {
            [Fact, LogIfTooSlow]
            public async Task ReturnsTheLocationApiResponse()
            {
                var location = Substitute.For<ILocation>();
                var api = Substitute.For<ITogglApi>();
                api.Location.Get().ReturnsTaskOf(location);
                var interactor = new GetCurrentLocationInteractor(api);

                var returnedLocation = await interactor.Execute();

                returnedLocation.Should().BeSameAs(location);
            }
        }
    }
}


text:
<?php

namespace Flying\Bundle\ClientActionBundle\Factory;

use Flying\Bundle\ClientActionBundle\ClientAction\ClientAction;

/**
 * Factory for creating client action objects
 *
 * Client action can be defined as URI-like form:
 *
 * [action ":"] ["[" target "]"]? [content]? ["?" args]? ["#" state]?
 *
 * See examples about details of format:
 *
 * Set application state object properties:
 * state:?param1=value1&param2=value2
 * state:toggle?collection=value
 *
 * Trigger event "eventName":
 * event:eventName
 *
 * Trigger event "eventName" with specified additional arguments:
 * event:eventName?arg1=value1&arg2=value2
 *
 * Trigger event "eventName" to "#targetId" page element and additional arguments:
 * event:[#targetId]eventName?arg1=value1&arg2=value2
 *
 * Load information from server from "/some/url/path" using GET method into "#targetId" page element with additional arguments:
 * load:[#targetId]{method:GET}/some/url/path?arg1=value1&arg2=value2
 *
 * Load information from URL generated for "my_route" route with additional arguments into #targetId target:
 * load:[#targetId]my_route?param1=value1&param2=value2
 */
class ClientActionFactory
{
    /**
     * List of registered client action classes
     *
     * @var array
     */
    protected $actions = array();

    /**
     * Class constructor
     */
    public function __construct()
    {
        $this->actions = array();
    }

    /**
     * Register client action type
     *
     * @param ClientAction $action Reference implementation of client action of given type
     * @param string $type         OPTIONAL Client action type
     * @return void
     */
    public function registerAction(ClientAction $action, $type)
    {
        $this->actions[strtolower($type)] = $action;
    }

    /**
     * Create client action object by given information
     *
     * @param string|array|ClientAction $info Client action information to use to create new client action
     * @param array $config                   OPTIONAL Configuration options for new client action object
     * @throws \InvalidArgumentException
     * @return ClientAction
     */
    public function create($info, array $config = null)
    {
        $type = null;
        if ($info instanceof ClientAction) {
            $type = $info->action;
        } elseif (is_array($info)) {
            $type = (array_key_exists('action', $info)) ? $info['action'] : null;
        } elseif (is_string($info)) {
            $t = explode(':', $info, 2);
            $type = array_shift($t);
        }
        if (!$type) {
            throw new \InvalidArgumentException('Unable to recognize given type of client action information');
        }
        $type = strtolower($type);
        if (!array_key_exists($type, $this->actions)) {
            throw new \InvalidArgumentException('Unknown client action type: ' . $type);
        }
        /** @var $ca ClientAction */
        $ca = $this->actions[$type];
        $config = $ca->modifyConfig(array(), $config);
        $class = get_class($ca);
        $ca = new $class($info, $config);
        return $ca;
    }
}


text:
<?php

namespace Google\Auth;

use GuzzleHttp\ClientInterface;
use GuzzleHttp\Client;

/**
 * The AppIdentityService class is automatically defined on App Engine,
 * so including this dependency is not necessary, and will result in a
 * PHP fatal error in the App Engine environment.
 */
use google\appengine\api\app_identity\AppIdentityService;

/**
 * AppIdentityCredentials supports authorization on Google App Engine.
 *
 * It can be used to authorize requests using the AuthTokenFetcher, but will
 * only succeed if being run on App Engine:
 *
 *   use GuzzleHttp\Client;
 *   use Google\Auth\AppIdentityCredentials;
 *   use Google\Auth\AuthTokenFetcher;
 *
 *   $gae = new AppIdentityCredentials('https://www.googleapis.com/auth/books');
 *   $subscriber = new AuthTokenFetcher($gae);
 *   $client = new Client([
 *      'base_url' => 'https://www.googleapis.com/books/v1',
 *      'defaults' => ['auth' => 'google_auth']
 *   ]);
 *   $client->setDefaultOption('verify', '/etc/ca-certificates.crt');
 *   $client->getEmitter()->attach($subscriber);
 *   $res = $client->get('volumes?q=Henry+David+Thoreau&country=US');
 *
 * In Guzzle 5 and below, the App Engine certificates need to be set on the
 * guzzle client in order for SSL requests to succeed.
 *
 *   $client->setDefaultOption('verify', '/etc/ca-certificates.crt');
 */
class AppIdentityCredentials extends CredentialsLoader
{
  private $scope;

  public function __construct($scope = array())
  {
    $this->scope = $scope;
  }

  /**
   * Determines if this an App Engine instance, by accessing the SERVER_SOFTWARE
   * environment variable.
   *
   * @return true if this an App Engine Instance, false otherwise
   */
  public static function onAppEngine()
  {
    return (isset($_SERVER['SERVER_SOFTWARE']) &&
        strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
  }

  /**
   * Implements FetchAuthTokenInterface#fetchAuthToken.
   *
   * Fetches the auth tokens using the AppIdentityService if available.
   * As the AppIdentityService uses protobufs to fetch the access token,
   * the GuzzleHttp\ClientInterface instance passed in will not be used.
   *
   * @param $client GuzzleHttp\ClientInterface optional client.
   * @return array the auth metadata:
   *  array(2) {
   *   ["access_token"]=>
   *   string(3) "xyz"
   *   ["expiration_time"]=>
   *   string(10) "1444339905"
   *  }
   */
  public function fetchAuthToken(ClientInterface $unusedClient = null)
  {
    if (!self::onAppEngine()) {
      return array();
    }

    if (!class_exists('google\appengine\api\app_identity\AppIdentityService')) {
      throw new \Exception(
        'This class must be run in App Engine, or you must include the AppIdentityService '
        . 'mock class defined in tests/mocks/AppIdentityService.php'
      );
    }

    // AppIdentityService expects an array when multiple scopes are supplied
    $scope = is_array($this->scope) ? $this->scope : explode(' ', $this->scope);

    $token = AppIdentityService::getAccessToken($scope);

    return $token;
  }

  /**
   * Implements FetchAuthTokenInterface#getCacheKey.
   *
   * @return 'GOOGLE_AUTH_PHP_APPIDENTITY'
   */
  public function getCacheKey()
  {
    return 'GOOGLE_AUTH_PHP_APPIDENTITY';
  }
}


text:
<?php
namespace W3TC;

/**
 * W3 Object Cache object
 */
class ObjectCache_WpObjectCache_Regular {
	/**
	 * Internal cache array
	 *
	 * @var array
	 */
	var $cache = array();

	/**
	 * Array of global groups
	 *
	 * @var array
	 */
	var $global_groups = array();

	/**
	 * List of non-persistent groups
	 *
	 * @var array
	 */
	var $nonpersistent_groups = array();

	/**
	 * Total count of calls
	 *
	 * @var integer
	 */
	var $cache_total = 0;

	/**
	 * Cache hits count
	 *
	 * @var integer
	 */
	var $cache_hits = 0;

	/**
	 * Cache misses count
	 *
	 * @var integer
	 */
	var $cache_misses = 0;

	/**
	 * Total time
	 *
	 * @var integer
	 */
	var $time_total = 0;

	/**
	 * Store debug information of w3tc using
	 *
	 * @var array
	 */
	var $debug_info = array();

	/**
	 * Blog id of cache
	 *
	 * @var integer
	 */
	private $_blog_id;

	/**
	 * Key cache
	 *
	 * @var array
	 */
	var $_key_cache = array();

	/**
	 * Config
	 */
	var $_config = null;

	/**
	 * Caching flag
	 *
	 * @var boolean
	 */
	var $_caching = false;

	/**
	 * Dynamic Caching flag
	 *
	 * @var boolean
	 */
	var $_can_cache_dynamic = null;
	/**
	 * Cache reject reason
	 *
	 * @var string
	 */
	private $cache_reject_reason = '';

	/**
	 * Lifetime
	 *
	 * @var integer
	 */
	var $_lifetime = null;

	/**
	 * Debug flag
	 *
	 * @var boolean
	 */
	var $_debug = false;

	/**
	 * PHP5 style constructor
	 */
	function __construct() {
		global $_wp_using_ext_object_cache;

		$this->_config = Dispatcher::config();
		$this->_lifetime = $this->_config->get_integer( 'objectcache.lifetime' );
		$this->_debug = $this->_config->get_boolean( 'objectcache.debug' );
		$this->_caching = $_wp_using_ext_object_cache = $this->_can_cache();
		$this->global_groups = $this->_config->get_array( 'objectcache.groups.global' );
		$this->nonpersistent_groups = $this->_config->get_array(
			'objectcache.groups.nonpersistent' );

		$this->_blog_id = Util_Environment::blog_id();
	}

	/**
	 * Get from the cache
	 *
	 * @param string  $id
	 * @param string  $group
	 * @return mixed
	 */
	function get( $id, $group = 'default', $force = false, &$found = null ) {
		if ( $this->_debug ) {
			$time_start = Util_Debug::microtime();
		}

		$key = $this->_get_cache_key( $id, $group );
		$in_incall_cache = isset( $this->cache[$key] );
		$fallback_used = false;

		if ( $in_incall_cache && !$force ) {
			$found = true;
			$value = $this->cache[$key];
		} elseif ( $this->_caching &&
			!in_array( $group, $this->nonpersistent_groups ) &&
			$this->_check_can_cache_runtime( $group ) ) {
			$cache = $this->_get_cache( null, $group );
			$v = $cache->get( $key );

			/* for debugging
				$a = $cache->_get_with_old_raw( $key );
				$path = $cache->get_full_path( $key);
				$returned = 'x ' . $path . ' ' .
					(is_readable( $path ) ? ' readable ' : ' not-readable ') .
					json_encode($a);
			*/

			$this->cache_total++;

			if ( is_array( $v ) && isset( $v['content'] ) ) {
				$found = true;
				$value = $v['content'];
				$this->cache_hits++;
			} else {
				$found = false;
				$value = false;
				$this->cache_misses++;
			}
		} else {
			$found = false;
			$value = false;
		}

		if ( $value === null ) {
			$value = false;
		}

		if ( is_object( $value ) ) {
			$value = clone $value;
		}

		if ( !$found &&
			$this->_is_transient_group( $group ) &&
			$this->_config->get_boolean( 'objectcache.fallback_transients' ) ) {
			$fallback_used = true;
			$value = $this->_transient_fallback_get( $id, $group );
			$found = ( $value !== false );
		}

		if ( $found ) {
			if ( !$in_incall_cache ) {
				$this->cache[$key] = $value;
			}
		}

		/**
		 * Add debug info
		 */
		if ( $this->_debug ) {
			$time = Util_Debug::microtime() - $time_start;
			$this->time_total += $time;

			if ( !$group ) {
				$group = 'default';
			}

			if ( $fallback_used ) {
				if ( !$found )
					$returned = 'not in db';
				else
					$returned = 'from db fallback';
			} else {
				if ( !$found )
					$returned = 'not in cache';
				else {
					if ( $in_incall_cache )
						$returned = 'from in-call cache';
					else
						$returned = 'from persistent cache';
				}
			}

			if ( !$in_incall_cache ) {
				$this->debug_info[] = array(
					'id' => $id,
					'group' => $group,
					'operation' => 'get',
					'returned' => $returned,
					'data_size' => ( $value ? strlen( serialize( $value ) ) : '' ),
					'time' => $time
				);
			}
		}

		return $value;
	}

	/**
	 * Set to the cache
	 *
	 * @param string  $id
	 * @param mixed   $data
	 * @param string  $group
	 * @param integer $expire
	 * @return boolean
	 */
	function set( $id, $data, $group = 'default', $expire = 0 ) {
		$key = $this->_get_cache_key( $id, $group );

		if ( is_object( $data ) ) {
			$data = clone $data;
		}

		$this->cache[$key] = $data;
		$return = true;
		$ext_return = false;

		if ( $this->_caching &&
			!in_array( $group, $this->nonpersistent_groups ) &&
			$this->_check_can_cache_runtime( $group ) ) {
			$cache = $this->_get_cache( null, $group );

			if ( $id == 'alloptions' && $group == 'options' ) {
				// alloptions are deserialized on the start when some classes are not loaded yet
				// so postpone it until requested
				foreach ( $data as $k => $v ) {
					if ( is_object( $v ) ) {
						$data[$k] = serialize( $v );
					}
				}
			}

			$v = array( 'content' => $data );
			$ext_return = $cache->set( $key, $v,
				( $expire ? $expire : $this->_lifetime ) );
			$return = $ext_return;
		}

		if ( $this->_is_transient_group( $group ) &&
			$this->_config->get_boolean( 'objectcache.fallback_transients' ) ) {
			$this->_transient_fallback_set( $id, $data, $group, $expire );
		}

		if ( $this->_debug ) {
			$this->debug_info[] = array(
				'id' => $id,
				'group' => $group,
				'operation' => 'set',
				'returned' => ( $ext_return ? 'put in cache' : 'discarded' ),
				'data_size' => ( $data ? strlen( serialize( $data ) ) : '' ),
				'time' => 0
			);
		}

		return $return;
	}

	/**
	 * Delete from the cache
	 *
	 * @param string  $id
	 * @param string  $group
	 * @param bool    $force
	 * @return boolean
	 */
	function delete( $id, $group = 'default', $force = false ) {
		if ( !$force && $this->get( $id, $group ) === false ) {
			return false;
		}

		$key = $this->_get_cache_key( $id, $group );
		$return = true;
		unset( $this->cache[$key] );

		if ( $this->_caching && !in_array( $group, $this->nonpersistent_groups ) ) {
			$cache = $this->_get_cache( null, $group );
			$return = $cache->delete( $key );
		}

		if ( $this->_is_transient_group( $group ) &&
			$this->_config->get_boolean( 'objectcache.fallback_transients' ) ) {
			$this->_transient_fallback_delete( $id, $group );
		}

		if ( $this->_debug ) {
			$this->debug_info[] = array(
				'id' => $id,
				'group' => $group,
				'operation' => 'delete',
				'returned' => ( $return ? 'deleted' : 'discarded' ),
				'data_size' => 0,
				'time' => 0
			);
		}

		return $return;
	}

	/**
	 * Add to the cache
	 *
	 * @param string  $id
	 * @param mixed   $data
	 * @param string  $group
	 * @param integer $expire
	 * @return boolean
	 */
	function add( $id, $data, $group = 'default', $expire = 0 ) {
		if ( $this->get( $id, $group ) !== false ) {
			return false;
		}

		return $this->set( $id, $data, $group, $expire );
	}

	/**
	 * Replace in the cache
	 *
	 * @param string  $id
	 * @param mixed   $data
	 * @param string  $group
	 * @param integer $expire
	 * @return boolean
	 */
	function replace( $id, $data, $group = 'default', $expire = 0 ) {
		if ( $this->get( $id, $group ) === false ) {
			return false;
		}

		return $this->set( $id, $data, $group, $expire );
	}

	/**
	 * Reset keys
	 *
	 * @return boolean
	 */
	function reset() {
		global $_wp_using_ext_object_cache;

		$_wp_using_ext_object_cache = $this->_caching;

		return true;
	}

	/**
	 * Flush cache
	 *
	 * @return boolean
	 */
	function flush( $reason = '' ) {
		$this->cache = array();

		global $w3_multisite_blogs;
		if ( isset( $w3_multisite_blogs ) ) {
			foreach ( $w3_multisite_blogs as $blog ) {
				$cache = $this->_get_cache( $blog->userblog_id );
				$cache->flush();
			}
		} else {
			$cache = $this->_get_cache( 0 );
			$cache->flush();

			$cache = $this->_get_cache();
			$cache->flush();
		}

		if ( $this->_debug ) {
			$this->debug_info[] = array(
				'id' => '',
				'group' => '',
				'operation' => 'flush',
				'returned' => $reason,
				'data_size' => 0,
				'time' => 0
			);
		}

		return true;
	}

	/**
	 * Add global groups
	 *
	 * @param array   $groups
	 * @return void
	 */
	function add_global_groups( $groups ) {
		if ( !is_array( $groups ) ) {
			$groups = (array) $groups;
		}

		$this->global_groups = array_merge( $this->global_groups, $groups );
		$this->global_groups = array_unique( $this->global_groups );
	}

	/**
	 * Add non-persistent groups
	 *
	 * @param array   $groups
	 * @return void
	 */
	function add_nonpersistent_groups( $groups ) {
		if ( !is_array( $groups ) ) {
			$groups = (array) $groups;
		}

		$this->nonpersistent_groups = array_merge( $this->nonpersistent_groups, $groups );
		$this->nonpersistent_groups = array_unique( $this->nonpersistent_groups );
	}

	/**
	 * Increment numeric cache item's value
	 *
	 * @param int|string $key    The cache key to increment
	 * @param int     $offset The amount by which to increment the item's value. Default is 1.
	 * @param string  $group  The group the key is in.
	 * @return bool|int False on failure, the item's new value on success.
	 */
	function incr( $key, $offset = 1, $group = 'default' ) {
		$value = $this->get( $key, $group );
		if ( $value === false )
			return false;

		if ( !is_numeric( $value ) )
			$value = 0;

		$offset = (int) $offset;
		$value += $offset;

		if ( $value < 0 )
			$value = 0;
		$this->replace( $key, $value, $group );
		return $value;
	}

	/**
	 * Decrement numeric cache item's value
	 *
	 * @param int|string $key    The cache key to increment
	 * @param int     $offset The amount by which to decrement the item's value. Default is 1.
	 * @param string  $group  The group the key is in.
	 * @return bool|int False on failure, the item's new value on success.
	 */
	function decr( $key, $offset = 1, $group = 'default' ) {
		$value = $this->get( $key, $group );
		if ( $value === false )
			return false;

		if ( !is_numeric( $value ) )
			$value = 0;

		$offset = (int) $offset;
		$value -= $offset;

		if ( $value < 0 )
			$value = 0;
		$this->replace( $key, $value, $group );
		return $value;
	}

	private function _transient_fallback_get( $transient, $group ) {
		if ( $group == 'transient' ) {
			$transient_option = '_transient_' . $transient;
			if ( function_exists( 'wp_installing') && ! wp_installing() ) {
				// If option is not in alloptions, it is not autoloaded and thus has a timeout
				$alloptions = wp_load_alloptions();
				if ( !isset( $alloptions[$transient_option] ) ) {
					$transient_timeout = '_transient_timeout_' . $transient;
					$timeout = get_option( $transient_timeout );
					if ( false !== $timeout && $timeout < time() ) {
						delete_option( $transient_option  );
						delete_option( $transient_timeout );
						$value = false;
					}
				}
			}

			if ( ! isset( $value ) )
				$value = get_option( $transient_option );
		} elseif ( $group == 'site-transient' ) {
			// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
			$no_timeout = array('update_core', 'update_plugins', 'update_themes');
			$transient_option = '_site_transient_' . $transient;
			if ( ! in_array( $transient, $no_timeout ) ) {
				$transient_timeout = '_site_transient_timeout_' . $transient;
				$timeout = get_site_option( $transient_timeout );
				if ( false !== $timeout && $timeout < time() ) {
					delete_site_option( $transient_option  );
					delete_site_option( $transient_timeout );
					$value = false;
				}
			}

			if ( ! isset( $value ) )
				$value = get_site_option( $transient_option );
		} else {
			$value = false;
		}

		return $value;
	}

	private function _transient_fallback_delete( $transient, $group ) {
		if ( $group == 'transient' ) {
			$option_timeout = '_transient_timeout_' . $transient;
			$option = '_transient_' . $transient;
			$result = delete_option( $option );
			if ( $result )
				delete_option( $option_timeout );
		} elseif ( $group == 'site-transient' ) {
			$option_timeout = '_site_transient_timeout_' . $transient;
			$option = '_site_transient_' . $transient;
			$result = delete_site_option( $option );
			if ( $result )
				delete_site_option( $option_timeout );
		}
	}

	private function _transient_fallback_set( $transient, $value, $group, $expiration ) {
		if ( $group == 'transient' ) {
			$transient_timeout = '_transient_timeout_' . $transient;
			$transient_option = '_transient_' . $transient;
			if ( false === get_option( $transient_option ) ) {
				$autoload = 'yes';
				if ( $expiration ) {
					$autoload = 'no';
					add_option( $transient_timeout, time() + $expiration, '', 'no' );
				}
				$result = add_option( $transient_option, $value, '', $autoload );
			} else {
				// If expiration is requested, but the transient has no timeout option,
				// delete, then re-create transient rather than update.
				$update = true;
				if ( $expiration ) {
					if ( false === get_option( $transient_timeout ) ) {
						delete_option( $transient_option );
						add_option( $transient_timeout, time() + $expiration, '', 'no' );
						$result = add_option( $transient_option, $value, '', 'no' );
						$update = false;
					} else {
						update_option( $transient_timeout, time() + $expiration );
					}
				}
				if ( $update ) {
					$result = update_option( $transient_option, $value );
				}
			}
		} elseif ( $group == 'site-transient' ) {
			$transient_timeout = '_site_transient_timeout_' . $transient;
			$option = '_site_transient_' . $transient;
			if ( false === get_site_option( $option ) ) {
				if ( $expiration )
					add_site_option( $transient_timeout, time() + $expiration );
				$result = add_site_option( $option, $value );
			} else {
				if ( $expiration )
					update_site_option( $transient_timeout, time() + $expiration );
				$result = update_site_option( $option, $value );
			}
		}
	}

	/**
	 * Print Object Cache stats
	 *
	 * @return void
	 */
	function stats() {
		echo '
Summary
';
		echo '
';
		echo 'Engine: ' . Cache::engine_name(
			$this->_config->get_string( 'objectcache.engine' ) ) . '
';
		echo 'Caching: ' .
			( $this->_caching ? 'enabled' : 'disabled' ) . '
';

		if ( !$this->_caching ) {
			echo 'Reject reason: ' .
				$this->get_reject_reason() . '
';
		}

		echo 'Total calls: ' . $this->cache_total . '
';
		echo 'Cache hits: ' . $this->cache_hits . '
';
		echo 'Cache misses: ' . $this->cache_misses . '
';
		echo 'Total time: '. round( $this->time_total, 4 ) . 's';
		echo '
';

		echo '
Cache info
';

		if ( $this->_debug ) {
			echo '
';
			echo '
#	Operation	Returned	Data size (b)	Query time (s)	ID:Group
';

			foreach ( $this->debug_info as $index => $debug ) {
				echo '
';
				echo '' . ( $index + 1 ) . '	';
				echo '' . $debug['operation'] . '	';
				echo '' . $debug['returned'] . '	';
				echo '' . $debug['data_size'] . '	';
				echo '' . round( $debug['time'], 4 ) . '	';
				echo '' . sprintf( '%s:%s', $debug['id'], $debug['group'] ) . '	';
				echo '
';
			}

			echo '
';
		} else {
			echo '
Enable debug mode.
';
		}
	}

	/**
	 * Switches context to another blog
	 *
	 * @param integer $blog_id
	 */
	function switch_blog( $blog_id ) {
		$this->reset();
		$this->_blog_id = $blog_id;
	}

	/**
	 * Returns cache key
	 *
	 * @param string  $id
	 * @param string  $group
	 * @return string
	 */
	function _get_cache_key( $id, $group = 'default' ) {
		if ( !$group ) {
			$group = 'default';
		}

		$blog_id = $this->_blog_id;
		if ( in_array( $group, $this->global_groups ) )
			$blog_id = 0;

		return $blog_id . $group . $id;
	}

	public function get_usage_statistics_cache_config() {
		$engine = $this->_config->get_string( 'objectcache.engine' );

		switch ( $engine ) {
		case 'memcached':
			$engineConfig = array(
				'servers' => $this->_config->get_array( 'objectcache.memcached.servers' ),
				'persistent' => $this->_config->get_boolean( 'objectcache.memcached.persistent' ),
				'aws_autodiscovery' => $this->_config->get_boolean( 'objectcache.memcached.aws_autodiscovery' ),
				'username' => $this->_config->get_string( 'objectcache.memcached.username' ),
				'password' => $this->_config->get_string( 'objectcache.memcached.password' )
			);
			break;

		case 'redis':
			$engineConfig = array(
				'servers' => $this->_config->get_array( 'objectcache.redis.servers' ),
				'persistent' => $this->_config->get_boolean( 'objectcache.redis.persistent' ),
				'dbid' => $this->_config->get_integer( 'objectcache.redis.dbid' ),
				'password' => $this->_config->get_string( 'objectcache.redis.password' )
			);
			break;

		default:
			$engineConfig = array();
		}

		$engineConfig['engine'] = $engine;
		return $engineConfig;
	}

	/**
	 * Returns cache object
	 *
	 * @param int|null $blog_id
	 * @param string  $group
	 * @return W3_Cache_Base
	 */
	function _get_cache( $blog_id = null, $group = '' ) {
		static $cache = array();

		if ( is_null( $blog_id ) && !in_array( $group, $this->global_groups ) )
			$blog_id = $this->_blog_id;
		elseif ( is_null( $blog_id ) )
			$blog_id = 0;

		if ( !isset( $cache[$blog_id] ) ) {
			$engine = $this->_config->get_string( 'objectcache.engine' );

			switch ( $engine ) {
			case 'memcached':
				$engineConfig = array(
					'servers' => $this->_config->get_array( 'objectcache.memcached.servers' ),
					'persistent' => $this->_config->get_boolean(
						'objectcache.memcached.persistent' ),
					'aws_autodiscovery' => $this->_config->get_boolean( 'objectcache.memcached.aws_autodiscovery' ),
					'username' => $this->_config->get_string( 'objectcache.memcached.username' ),
					'password' => $this->_config->get_string( 'objectcache.memcached.password' )
				);
				break;

			case 'redis':
				$engineConfig = array(
					'servers' => $this->_config->get_array( 'objectcache.redis.servers' ),
					'persistent' => $this->_config->get_boolean(
						'objectcache.redis.persistent' ),
					'dbid' => $this->_config->get_integer( 'objectcache.redis.dbid' ),
					'password' => $this->_config->get_string( 'objectcache.redis.password' )
				);
				break;

			case 'file':
				$engineConfig = array(
					'section' => 'object',
					'locking' => $this->_config->get_boolean( 'objectcache.file.locking' ),
					'flush_timelimit' => $this->_config->get_integer( 'timelimit.cache_flush' )
				);
				break;

			default:
				$engineConfig = array();
			}
			$engineConfig['blog_id'] = $blog_id;
			$engineConfig['module'] = 'object';
			$engineConfig['host'] = Util_Environment::host();
			$engineConfig['instance_id'] = Util_Environment::instance_id();

			$cache[$blog_id] = Cache::instance( $engine, $engineConfig );
		}

		return $cache[$blog_id];
	}

	/**
	 * Check if caching allowed on init
	 *
	 * @return boolean
	 */
	function _can_cache() {
		/**
		 * Don't cache in console mode
		 */
		if ( PHP_SAPI === 'cli' ) {
			$this->cache_reject_reason = 'Console mode';

			return false;
		}

		/**
		 * Skip if disabled
		 */
		if ( !$this->_config->get_boolean( 'objectcache.enabled' ) ) {
			$this->cache_reject_reason = 'objectcache.disabled';

			return false;
		}

		/**
		 * Check for DONOTCACHEOBJECT constant
		 */
		if ( defined( 'DONOTCACHEOBJECT' ) && DONOTCACHEOBJECT ) {
			$this->cache_reject_reason = 'DONOTCACHEOBJECT';

			return false;
		}

		return true;
	}

	/**
	 * Returns if we can cache, that condition can change in runtime
	 *
	 * @param unknown $group
	 * @return boolean
	 */
	function _check_can_cache_runtime( $group ) {
		//Need to be handled in wp admin as well as frontend
		if ( $this->_is_transient_group( $group ) )
			return true;

		if ( $this->_can_cache_dynamic != null )
			return $this->_can_cache_dynamic;

		if ( $this->_config->get_boolean( 'objectcache.enabled_for_wp_admin' ) ) {
			$this->_can_cache_dynamic = true;
		} else {
			if ( $this->_caching ) {
				if ( defined( 'WP_ADMIN' ) &&
					( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ) {
					$this->_can_cache_dynamic = false;
					$this->cache_reject_reason = 'WP_ADMIN defined';
					return $this->_can_cache_dynamic;
				}
			}
		}

		return $this->_caching;
	}

	private function _is_transient_group( $group ) {
		return in_array( $group, array( 'transient', 'site-transient' ) ) ;
	}

	public function w3tc_footer_comment( $strings ) {
		$reason = $this->get_reject_reason();
		$append = ( $reason != '' ? sprintf( ' (%s)', $reason ) : '' );

		$strings[] = sprintf(
			__( 'Object Caching %d/%d objects using %s%s', 'w3-total-cache' ),
			$this->cache_hits, $this->cache_total,
			Cache::engine_name( $this->_config->get_string( 'objectcache.engine' ) ),
			$append );

		if ( $this->_config->get_boolean( 'objectcache.debug' ) ) {
			$strings[] = '';
			$strings[] = 'Object Cache debug info:';
			$strings[] = sprintf( "%s%s", str_pad( 'Caching: ', 20 ),
				( $this->_caching ? 'enabled' : 'disabled' ) );

			$strings[] = sprintf( "%s%d", str_pad( 'Total calls: ', 20 ), $this->cache_total );
			$strings[] = sprintf( "%s%d", str_pad( 'Cache hits: ', 20 ), $this->cache_hits );
			$strings[] = sprintf( "%s%d", str_pad( 'Cache misses: ', 20 ), $this->cache_misses );
			$strings[] = sprintf( "%s%.4f", str_pad( 'Total time: ', 20 ), $this->time_total );

			$strings[] = "W3TC Object Cache info:";
			$strings[] = sprintf( "%s | %s | %s | %s | %s | %s | %s",
				str_pad( '#', 5, ' ', STR_PAD_LEFT ),
				str_pad( 'Op', 5, ' ', STR_PAD_BOTH ),
				str_pad( 'Returned', 25, ' ', STR_PAD_BOTH ),
				str_pad( 'Data size (b)', 13, ' ', STR_PAD_LEFT ),
				str_pad( 'Query time (s)', 14, ' ', STR_PAD_LEFT ),
				str_pad( 'Group', 15, ' ', STR_PAD_LEFT ),
				'ID' );

			foreach ( $this->debug_info as $index => $debug ) {
				$strings[] = sprintf( "%s | %s | %s | %s | %s | %s | %s",
					str_pad( $index + 1, 5, ' ', STR_PAD_LEFT ),
					str_pad( $debug['operation'], 5, ' ', STR_PAD_BOTH ),
					str_pad( $debug['returned'], 25, ' ', STR_PAD_BOTH ),
					str_pad( $debug['data_size'], 13, ' ', STR_PAD_LEFT ),
					str_pad( round( $debug['time'], 4 ), 14, ' ', STR_PAD_LEFT ),
					str_pad( $debug['group'], 15, ' ', STR_PAD_LEFT ),
					$debug['id'] );
			}
			$strings[] = '';
		}

		return $strings;
	}

	public function w3tc_usage_statistics_of_request( $storage ) {
		$storage->counter_add( 'objectcache_calls_total', $this->cache_total );
		$storage->counter_add( 'objectcache_calls_hits', $this->cache_hits );
	}

	public function get_reject_reason() {
		if ( is_null( $this->cache_reject_reason ) )
			return '';
		return $this->_get_reject_reason_message( $this->cache_reject_reason );
	}

	/**
	 *
	 *
	 * @param unknown $key
	 * @return string|void
	 */
	private function _get_reject_reason_message( $key ) {
		if ( !function_exists( '__' ) )
			return $key;

		switch ( $key ) {
		case 'objectcache.disabled':
			return __( 'Object caching is disabled', 'w3-total-cache' );
		case 'DONOTCACHEOBJECT':
			return __( 'DONOTCACHEOBJECT constant is defined', 'w3-total-cache' );
		default:
			return '';
		}
	}
}


text:
package de.paydirekt.client.reports.model;

import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import static java.util.Collections.unmodifiableList;

/**
 * Encapsulates the query parameters needed for the creation of a {@link TransactionReport}.
 */
public class TransactionReportQueryParameters {

    private final Optional<ZonedDateTime> from;
    private final Optional<ZonedDateTime> to;
    private final List<String> fields;

    /**
     * Constructor.
     */
    public TransactionReportQueryParameters() {
        this.from = Optional.empty();
        this.to = Optional.empty();
        this.fields = Collections.emptyList();
    }

    /**
     * Constructor.
     *
     * @param from   Time stamp in ISO-8601 format, from which transactions should be considered. (Optional)
     * @param to     Time stamp in ISO-8601 format, until which transactions should be considered. (Optional)
     * @param fields The fields of the transactions which to consider in the report, if left empty all fields will be considered. (Optional)
     */
    public TransactionReportQueryParameters(ZonedDateTime from, ZonedDateTime to, List<String> fields) {
        this.from = Optional.ofNullable(from);
        this.to = Optional.ofNullable(to);
        this.fields = unmodifiableList(fields);
    }

    public Optional<ZonedDateTime> getFrom() {
        return from;
    }

    public Optional<ZonedDateTime> getTo() {
        return to;
    }

    public List<String> getFields() {
        return fields;
    }
}


text:
from ..broker import Broker

class DeviceFilterStatBroker(Broker):
    controller = "device_filter_stats"

    def show(self, **kwargs):
        """Shows the details for the specified device filter stat.

            **Inputs**

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` True
            |  ``default:`` None

             :param DeviceFilterStatsID: The internal NetMRI identifier of the device filter stat.
             :type DeviceFilterStatsID: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param methods: A list of device filter stat methods. The listed methods will be called on each device filter stat returned and included in the output. Available methods are: data_source, device.
             :type methods: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param include: A list of associated object types to include in the output. The listed associations will be returned as outputs named according to the association name (see outputs below). Available includes are: data_source, device.
             :type include: Array of String

            **Outputs**

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :return device_filter_stat: The device filter stat identified by the specified DeviceFilterStatsID.
             :rtype device_filter_stat: DeviceFilterStat

            """

        return self.api_request(self._get_method_fullname("show"), kwargs)

    def index(self, **kwargs):
        """Lists the available device filter stats. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to query lists, using this method is most efficient.

            **Inputs**

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceFilterStatsID: No description is available for DeviceFilterStatsID.
             :type DeviceFilterStatsID: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceID: No description is available for DeviceID.
             :type DeviceID: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param Timestamp: No description is available for Timestamp.
             :type Timestamp: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceGroupID: The internal NetMRI identifier of the device groups to which to limit the results.
             :type DeviceGroupID: Array of Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` today

             :param starttime: The data returned will represent the device filter stats with this date and time as lower boundary. If omitted, the result will indicate the most recently collected data.
             :type starttime: DateTime

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` tomorrow

             :param endtime: The data returned will represent the device filter stats with this date and time as upper boundary. If omitted, the result will indicate the most recently collected data.
             :type endtime: DateTime

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param methods: A list of device filter stat methods. The listed methods will be called on each device filter stat returned and included in the output. Available methods are: data_source, device.
             :type methods: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param include: A list of associated object types to include in the output. The listed associations will be returned as outputs named according to the association name (see outputs below). Available includes are: data_source, device.
             :type include: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` 0

             :param start: The record number to return in the selected page of data. It will always appear, although it may not be the first record. See the :limit for more information.
             :type start: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` 1000

             :param limit: The size of the page of data, that is, the maximum number of records returned. The limit size will be used to break the data up into pages and the first page with the start record will be returned. So if you have 100 records and use a :limit of 10 and a :start of 10, you will get records 10-19. The maximum limit is 10000.
             :type limit: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` DeviceFilterStatsID

             :param sort: The data field(s) to use for sorting the output. Default is DeviceFilterStatsID. Valid values are DeviceFilterStatsID, DataSourceID, DeviceID, DeviceFilterID, Timestamp, HitCount.
             :type sort: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` asc

             :param dir: The direction(s) in which to sort the data. Default is 'asc'. Valid values are 'asc' and 'desc'.
             :type dir: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param select: The list of attributes to return for each DeviceFilterStat. Valid values are DeviceFilterStatsID, DataSourceID, DeviceID, DeviceFilterID, Timestamp, HitCount. If empty or omitted, all attributes will be returned.
             :type select: Array

            |  ``api version min:`` 2.8
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param goto_field: The field name for NIOS GOTO that is used for locating a row position of records.
             :type goto_field: String

            |  ``api version min:`` 2.8
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param goto_value: The value of goto_field for NIOS GOTO that is used for locating a row position of records.
             :type goto_value: String

            **Outputs**

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :return device_filter_stats: An array of the DeviceFilterStat objects that match the specified input criteria.
             :rtype device_filter_stats: Array of DeviceFilterStat

            """

        return self.api_list_request(self._get_method_fullname("index"), kwargs)

    def search(self, **kwargs):
        """Lists the available device filter stats matching the input criteria. This method provides a more flexible search interface than the index method, but searching using this method is more demanding on the system and will not perform to the same level as the index method. The input fields listed below will be used as in the index method, to filter the result, along with the optional query string and XML filter described below.

            **Inputs**

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DataSourceID: No description is available for DataSourceID.
             :type DataSourceID: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceFilterID: No description is available for DeviceFilterID.
             :type DeviceFilterID: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceFilterStatsID: No description is available for DeviceFilterStatsID.
             :type DeviceFilterStatsID: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceID: No description is available for DeviceID.
             :type DeviceID: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param HitCount: No description is available for HitCount.
             :type HitCount: Array of String

            |  ``api version min:`` 2.6
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param Timestamp: No description is available for Timestamp.
             :type Timestamp: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceGroupID: The internal NetMRI identifier of the device groups to which to limit the results.
             :type DeviceGroupID: Array of Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` today

             :param starttime: The data returned will represent the device filter stats with this date and time as lower boundary. If omitted, the result will indicate the most recently collected data.
             :type starttime: DateTime

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` tomorrow

             :param endtime: The data returned will represent the device filter stats with this date and time as upper boundary. If omitted, the result will indicate the most recently collected data.
             :type endtime: DateTime

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param methods: A list of device filter stat methods. The listed methods will be called on each device filter stat returned and included in the output. Available methods are: data_source, device.
             :type methods: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param include: A list of associated object types to include in the output. The listed associations will be returned as outputs named according to the association name (see outputs below). Available includes are: data_source, device.
             :type include: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` 0

             :param start: The record number to return in the selected page of data. It will always appear, although it may not be the first record. See the :limit for more information.
             :type start: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` 1000

             :param limit: The size of the page of data, that is, the maximum number of records returned. The limit size will be used to break the data up into pages and the first page with the start record will be returned. So if you have 100 records and use a :limit of 10 and a :start of 10, you will get records 10-19. The maximum limit is 10000.
             :type limit: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` DeviceFilterStatsID

             :param sort: The data field(s) to use for sorting the output. Default is DeviceFilterStatsID. Valid values are DeviceFilterStatsID, DataSourceID, DeviceID, DeviceFilterID, Timestamp, HitCount.
             :type sort: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` asc

             :param dir: The direction(s) in which to sort the data. Default is 'asc'. Valid values are 'asc' and 'desc'.
             :type dir: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param select: The list of attributes to return for each DeviceFilterStat. Valid values are DeviceFilterStatsID, DataSourceID, DeviceID, DeviceFilterID, Timestamp, HitCount. If empty or omitted, all attributes will be returned.
             :type select: Array

            |  ``api version min:`` 2.8
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param goto_field: The field name for NIOS GOTO that is used for locating a row position of records.
             :type goto_field: String

            |  ``api version min:`` 2.8
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param goto_value: The value of goto_field for NIOS GOTO that is used for locating a row position of records.
             :type goto_value: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param query: This value will be matched against device filter stats, looking to see if one or more of the listed attributes contain the passed value. You may also surround the value with '/' and '/' to perform a regular expression search rather than a containment operation. Any record that matches will be returned. The attributes searched are: DataSourceID, DeviceFilterID, DeviceFilterStatsID, DeviceID, HitCount, Timestamp.
             :type query: String

            |  ``api version min:`` 2.3
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param xml_filter: A SetFilter XML structure to further refine the search. The SetFilter will be applied AFTER any search query or field values, but before any limit options. The limit and pagination will be enforced after the filter. Remind that this kind of filter may be costly and inefficient if not associated with a database filtering.
             :type xml_filter: String

            **Outputs**

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :return device_filter_stats: An array of the DeviceFilterStat objects that match the specified input criteria.
             :rtype device_filter_stats: Array of DeviceFilterStat

            """

        return self.api_list_request(self._get_method_fullname("search"), kwargs)

    def find(self, **kwargs):
        """Lists the available device filter stats matching the input specification. This provides the most flexible search specification of all the query mechanisms, enabling searching using comparison operations other than equality. However, it is more complex to use and will not perform as efficiently as the index or search methods. In the input descriptions below, 'field names' refers to the following fields: DataSourceID, DeviceFilterID, DeviceFilterStatsID, DeviceID, HitCount, Timestamp.

            **Inputs**

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param op_DataSourceID: The operator to apply to the field DataSourceID. Valid values are: =, <>, rlike, not rlike, >, >=, <, <=, like, not like, is null, is not null, between. DataSourceID: No description is available for DataSourceID. For the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
             :type op_DataSourceID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_f_DataSourceID: If op_DataSourceID is specified, the field named in this input will be compared to the value in DataSourceID using the specified operator. That is, the value in this input will be treated as another field name, rather than a constant value. Either this field or val_c_DataSourceID must be specified if op_DataSourceID is specified.
             :type val_f_DataSourceID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_c_DataSourceID: If op_DataSourceID is specified, this value will be compared to the value in DataSourceID using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_DataSourceID must be specified if op_DataSourceID is specified.
             :type val_c_DataSourceID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param op_DeviceFilterID: The operator to apply to the field DeviceFilterID. Valid values are: =, <>, rlike, not rlike, >, >=, <, <=, like, not like, is null, is not null, between. DeviceFilterID: No description is available for DeviceFilterID. For the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
             :type op_DeviceFilterID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_f_DeviceFilterID: If op_DeviceFilterID is specified, the field named in this input will be compared to the value in DeviceFilterID using the specified operator. That is, the value in this input will be treated as another field name, rather than a constant value. Either this field or val_c_DeviceFilterID must be specified if op_DeviceFilterID is specified.
             :type val_f_DeviceFilterID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_c_DeviceFilterID: If op_DeviceFilterID is specified, this value will be compared to the value in DeviceFilterID using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_DeviceFilterID must be specified if op_DeviceFilterID is specified.
             :type val_c_DeviceFilterID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param op_DeviceFilterStatsID: The operator to apply to the field DeviceFilterStatsID. Valid values are: =, <>, rlike, not rlike, >, >=, <, <=, like, not like, is null, is not null, between. DeviceFilterStatsID: No description is available for DeviceFilterStatsID. For the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
             :type op_DeviceFilterStatsID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_f_DeviceFilterStatsID: If op_DeviceFilterStatsID is specified, the field named in this input will be compared to the value in DeviceFilterStatsID using the specified operator. That is, the value in this input will be treated as another field name, rather than a constant value. Either this field or val_c_DeviceFilterStatsID must be specified if op_DeviceFilterStatsID is specified.
             :type val_f_DeviceFilterStatsID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_c_DeviceFilterStatsID: If op_DeviceFilterStatsID is specified, this value will be compared to the value in DeviceFilterStatsID using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_DeviceFilterStatsID must be specified if op_DeviceFilterStatsID is specified.
             :type val_c_DeviceFilterStatsID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param op_DeviceID: The operator to apply to the field DeviceID. Valid values are: =, <>, rlike, not rlike, >, >=, <, <=, like, not like, is null, is not null, between. DeviceID: No description is available for DeviceID. For the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
             :type op_DeviceID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_f_DeviceID: If op_DeviceID is specified, the field named in this input will be compared to the value in DeviceID using the specified operator. That is, the value in this input will be treated as another field name, rather than a constant value. Either this field or val_c_DeviceID must be specified if op_DeviceID is specified.
             :type val_f_DeviceID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_c_DeviceID: If op_DeviceID is specified, this value will be compared to the value in DeviceID using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_DeviceID must be specified if op_DeviceID is specified.
             :type val_c_DeviceID: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param op_HitCount: The operator to apply to the field HitCount. Valid values are: =, <>, rlike, not rlike, >, >=, <, <=, like, not like, is null, is not null, between. HitCount: No description is available for HitCount. For the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
             :type op_HitCount: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_f_HitCount: If op_HitCount is specified, the field named in this input will be compared to the value in HitCount using the specified operator. That is, the value in this input will be treated as another field name, rather than a constant value. Either this field or val_c_HitCount must be specified if op_HitCount is specified.
             :type val_f_HitCount: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_c_HitCount: If op_HitCount is specified, this value will be compared to the value in HitCount using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_HitCount must be specified if op_HitCount is specified.
             :type val_c_HitCount: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param op_Timestamp: The operator to apply to the field Timestamp. Valid values are: =, <>, rlike, not rlike, >, >=, <, <=, like, not like, is null, is not null, between. Timestamp: No description is available for Timestamp. For the between operator the value will be treated as an Array if comma delimited string is passed, and it must contain an even number of values.
             :type op_Timestamp: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_f_Timestamp: If op_Timestamp is specified, the field named in this input will be compared to the value in Timestamp using the specified operator. That is, the value in this input will be treated as another field name, rather than a constant value. Either this field or val_c_Timestamp must be specified if op_Timestamp is specified.
             :type val_f_Timestamp: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param val_c_Timestamp: If op_Timestamp is specified, this value will be compared to the value in Timestamp using the specified operator. The value in this input will be treated as an explicit constant value. Either this field or val_f_Timestamp must be specified if op_Timestamp is specified.
             :type val_c_Timestamp: String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param DeviceGroupID: The internal NetMRI identifier of the device groups to which to limit the results.
             :type DeviceGroupID: Array of Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` today

             :param starttime: The data returned will represent the device filter stats with this date and time as lower boundary. If omitted, the result will indicate the most recently collected data.
             :type starttime: DateTime

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` tomorrow

             :param endtime: The data returned will represent the device filter stats with this date and time as upper boundary. If omitted, the result will indicate the most recently collected data.
             :type endtime: DateTime

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param methods: A list of device filter stat methods. The listed methods will be called on each device filter stat returned and included in the output. Available methods are: data_source, device.
             :type methods: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param include: A list of associated object types to include in the output. The listed associations will be returned as outputs named according to the association name (see outputs below). Available includes are: data_source, device.
             :type include: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` 0

             :param start: The record number to return in the selected page of data. It will always appear, although it may not be the first record. See the :limit for more information.
             :type start: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` 1000

             :param limit: The size of the page of data, that is, the maximum number of records returned. The limit size will be used to break the data up into pages and the first page with the start record will be returned. So if you have 100 records and use a :limit of 10 and a :start of 10, you will get records 10-19. The maximum limit is 10000.
             :type limit: Integer

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` DeviceFilterStatsID

             :param sort: The data field(s) to use for sorting the output. Default is DeviceFilterStatsID. Valid values are DeviceFilterStatsID, DataSourceID, DeviceID, DeviceFilterID, Timestamp, HitCount.
             :type sort: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` asc

             :param dir: The direction(s) in which to sort the data. Default is 'asc'. Valid values are 'asc' and 'desc'.
             :type dir: Array of String

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param select: The list of attributes to return for each DeviceFilterStat. Valid values are DeviceFilterStatsID, DataSourceID, DeviceID, DeviceFilterID, Timestamp, HitCount. If empty or omitted, all attributes will be returned.
             :type select: Array

            |  ``api version min:`` 2.8
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param goto_field: The field name for NIOS GOTO that is used for locating a row position of records.
             :type goto_field: String

            |  ``api version min:`` 2.8
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param goto_value: The value of goto_field for NIOS GOTO that is used for locating a row position of records.
             :type goto_value: String

            |  ``api version min:`` 2.3
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :param xml_filter: A SetFilter XML structure to further refine the search. The SetFilter will be applied AFTER any search query or field values, but before any limit options. The limit and pagination will be enforced after the filter. Remind that this kind of filter may be costly and inefficient if not associated with a database filtering.
             :type xml_filter: String

            **Outputs**

            |  ``api version min:`` None
            |  ``api version max:`` None
            |  ``required:`` False
            |  ``default:`` None

             :return device_filter_stats: An array of the DeviceFilterStat objects that match the specified input criteria.
             :rtype device_filter_stats: Array of DeviceFilterStat

            """

        return self.api_list_request(self._get_method_fullname("find"), kwargs)


text:
/**
 *
 */
package com.vito16.shop.model;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 管理员
 * @author Vito16 zhouwentao16@gmail.com
 * @date 2013-7-8
 *
 */
@Entity
@Table(name = "T_ADMIN")
public class Admin implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String username;//账户名
	private String password;//密码

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}


text:
require 'rspec'
require 'fabricio/networking/app_request_model_factory'
require 'fabricio/networking/request_model'
require 'fabricio/authorization/session'
require 'fabricio/authorization/memory_param_storage'

describe 'AppRequestModelFactory' do

  before(:each) do
    param_storage = Fabricio::Authorization::MemoryParamStorage.new
    param_storage.store_organization_id('1')
    param_storage.store_app_id('1')
    @factory = Fabricio::Networking::AppRequestModelFactory.new(param_storage)
  end

  it 'should form all apps request model' do
    result = @factory.all_apps_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form get app request model' do
    result = @factory.get_app_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form active_now app request model' do
    result = @factory.active_now_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form daily_new app request model' do
    result = @factory.daily_new_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form daily_active app request model' do
    result = @factory.daily_active_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form weekly_active app request model' do
    result = @factory.weekly_active_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form monthly_active app request model' do
    result = @factory.monthly_active_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form session_count app request model' do
    result = @factory.total_sessions_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form crashes app request model' do
    result = @factory.crash_count_request_model

    expect(result.type).to eq :POST
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form top issues request model' do
    result = @factory.top_issues_request_model

    expect(result.type).to eq :POST
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form single issue request model' do
    result = @factory.single_issue_request_model(issue_id: '1')

    expect(result.type).to eq :POST
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form issue session request model' do
    result = @factory.issue_session_request_model(issue_id: '1')

    expect(result.type).to eq :POST
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form add comment request model' do
    result = @factory.add_comment_request_model(issue_id: '1')

    expect(result.type).to eq :POST
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form oomfree app request model' do
    result = @factory.oom_count_request_model

    expect(result.type).to eq :POST
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form all custom event request model' do
    result = @factory.all_custom_event_request_model

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form custom event total request model' do
    result = @factory.custom_event_total_request_model(event_type: 'Custom Event Name')

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form custom event unique devices request model' do
    result = @factory.custom_event_unique_devices_request_model(event_type: 'Custom Event Name')

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form all custom event attribute request model' do
    result = @factory.all_custom_event_attribute_request_model(event_type: 'Custom Event Name')

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end

  it 'should form custom event attribute request model' do
    result = @factory.custom_event_attribute_request_model(event_type: 'Custom Event Name', event_attribute: 'Custom Attribute', selected_time: 1523800800)

    expect(result.type).to eq :GET
    expect(result.base_url).not_to be_nil
    expect(result.api_path).not_to be_nil
    expect(result.headers).not_to be_nil
  end
end


text:
<?php

declare (strict_types=1);
namespace RectorPrefix20210615;

use Rector\PHPUnit\Rector\MethodCall\UseSpecificWillMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $containerConfigurator) : void {
    $services = $containerConfigurator->services();
    $services->set(\Rector\PHPUnit\Rector\MethodCall\UseSpecificWillMethodRector::class);
};


text:
package org.awaitility.constraint;

import java.time.Duration;

/**
 * Interface that defines the wait strategy.
 * Max wait time stands for upper bound of condition evaluation duration. Min wait time stands for lower bound condition
 * evaluation duration. In case operation is executed before getMinWaitTime the exception is thrown indicating that
 * condition shouldn't be executed earlier than specified amount of time. Also operation is not allowed to be
 * executed longer than getMaxWaitTime.
 */
public interface WaitConstraint {

    Duration getMaxWaitTime();

    Duration getMinWaitTime();

    Duration getHoldPredicateTime();

    WaitConstraint withMinWaitTime(Duration minWaitTime);

    WaitConstraint withMaxWaitTime(Duration maxWaitTime);

    WaitConstraint withHoldPredicateTime(Duration holdConditionTime);
}


text:
module Gitlab
  module Middleware
    class BasicHealthCheck
      # This can't be frozen because Rails::Rack::Logger wraps the body
      # rubocop:disable Style/MutableConstant
      OK_RESPONSE = [200, { 'Content-Type' => 'text/plain' }, ["GitLab OK"]]
      EMPTY_RESPONSE = [404, { 'Content-Type' => 'text/plain' }, [""]]
      # rubocop:enable Style/MutableConstant
      HEALTH_PATH = '/-/health'

      def initialize(app)
        @app = app
      end

      def call(env)
        return @app.call(env) unless env['PATH_INFO'] == HEALTH_PATH

        # We should be using ActionDispatch::Request instead of
        # Rack::Request to be consistent with Rails, but due to a Rails
        # bug described in
        # https://gitlab.com/gitlab-org/gitlab-foss/issues/58573#note_149799010
        # hosts behind a load balancer will only see 127.0.0.1 for the
        # load balancer's IP.
        request = Rack::Request.new(env)

        return OK_RESPONSE if client_ip_whitelisted?(request)

        EMPTY_RESPONSE
      end

      def client_ip_whitelisted?(request)
        ip_whitelist.any? { |e| e.include?(request.ip) }
      end

      def ip_whitelist
        @ip_whitelist ||= Settings.monitoring.ip_whitelist.map(&IPAddr.method(:new))
      end
    end
  end
end


text:
namespace rocksdb {

#if ROCKSDB_USING_THREAD_STATUS
__thread ThreadStatusUpdater*
    ThreadStatusUtil::thread_updater_local_cache_ = nullptr;
__thread bool ThreadStatusUtil::thread_updater_initialized_ = false;

void ThreadStatusUtil::RegisterThread(
    const Env* env, ThreadStatus::ThreadType thread_type) {
  if (!MaybeInitThreadLocalUpdater(env)) {
    return;
  }
  assert(thread_updater_local_cache_);
  thread_updater_local_cache_->RegisterThread(
      thread_type, env->GetThreadID());
}

void ThreadStatusUtil::UnregisterThread() {
  thread_updater_initialized_ = false;
  if (thread_updater_local_cache_ != nullptr) {
    thread_updater_local_cache_->UnregisterThread();
    thread_updater_local_cache_ = nullptr;
  }
}

void ThreadStatusUtil::SetColumnFamily(const ColumnFamilyData* cfd,
                                       const Env* env,
                                       bool enable_thread_tracking) {
  if (!MaybeInitThreadLocalUpdater(env)) {
    return;
  }
  assert(thread_updater_local_cache_);
  if (cfd != nullptr && enable_thread_tracking) {
    thread_updater_local_cache_->SetColumnFamilyInfoKey(cfd);
  } else {
    // When cfd == nullptr or enable_thread_tracking == false, we set
    // ColumnFamilyInfoKey to nullptr, which makes SetThreadOperation
    // and SetThreadState become no-op.
    thread_updater_local_cache_->SetColumnFamilyInfoKey(nullptr);
  }
}

void ThreadStatusUtil::SetThreadOperation(ThreadStatus::OperationType op) {
  if (thread_updater_local_cache_ == nullptr) {
    // thread_updater_local_cache_ must be set in SetColumnFamily
    // or other ThreadStatusUtil functions.
    return;
  }

  if (op != ThreadStatus::OP_UNKNOWN) {
    uint64_t current_time = Env::Default()->NowMicros();
    thread_updater_local_cache_->SetOperationStartTime(current_time);
  } else {
    // TDOO(yhchiang): we could report the time when we set operation to
    // OP_UNKNOWN once the whole instrumentation has been done.
    thread_updater_local_cache_->SetOperationStartTime(0);
  }
  thread_updater_local_cache_->SetThreadOperation(op);
}

ThreadStatus::OperationStage ThreadStatusUtil::SetThreadOperationStage(
    ThreadStatus::OperationStage stage) {
  if (thread_updater_local_cache_ == nullptr) {
    // thread_updater_local_cache_ must be set in SetColumnFamily
    // or other ThreadStatusUtil functions.
    return ThreadStatus::STAGE_UNKNOWN;
  }

  return thread_updater_local_cache_->SetThreadOperationStage(stage);
}

void ThreadStatusUtil::SetThreadOperationProperty(
    int code, uint64_t value) {
  if (thread_updater_local_cache_ == nullptr) {
    // thread_updater_local_cache_ must be set in SetColumnFamily
    // or other ThreadStatusUtil functions.
    return;
  }

  thread_updater_local_cache_->SetThreadOperationProperty(
      code, value);
}

void ThreadStatusUtil::IncreaseThreadOperationProperty(
    int code, uint64_t delta) {
  if (thread_updater_local_cache_ == nullptr) {
    // thread_updater_local_cache_ must be set in SetColumnFamily
    // or other ThreadStatusUtil functions.
    return;
  }

  thread_updater_local_cache_->IncreaseThreadOperationProperty(
      code, delta);
}

void ThreadStatusUtil::SetThreadState(ThreadStatus::StateType state) {
  if (thread_updater_local_cache_ == nullptr) {
    // thread_updater_local_cache_ must be set in SetColumnFamily
    // or other ThreadStatusUtil functions.
    return;
  }

  thread_updater_local_cache_->SetThreadState(state);
}

void ThreadStatusUtil::ResetThreadStatus() {
  if (thread_updater_local_cache_ == nullptr) {
    return;
  }
  thread_updater_local_cache_->ResetThreadStatus();
}

void ThreadStatusUtil::NewColumnFamilyInfo(const DB* db,
                                           const ColumnFamilyData* cfd,
                                           const std::string& cf_name,
                                           const Env* env) {
  if (!MaybeInitThreadLocalUpdater(env)) {
    return;
  }
  assert(thread_updater_local_cache_);
  if (thread_updater_local_cache_) {
    thread_updater_local_cache_->NewColumnFamilyInfo(db, db->GetName(), cfd,
                                                     cf_name);
  }
}

void ThreadStatusUtil::EraseColumnFamilyInfo(
    const ColumnFamilyData* cfd) {
  if (thread_updater_local_cache_ == nullptr) {
    return;
  }
  thread_updater_local_cache_->EraseColumnFamilyInfo(cfd);
}

void ThreadStatusUtil::EraseDatabaseInfo(const DB* db) {
  if (thread_updater_local_cache_ == nullptr) {
    return;
  }
  thread_updater_local_cache_->EraseDatabaseInfo(db);
}

bool ThreadStatusUtil::MaybeInitThreadLocalUpdater(const Env* env) {
  if (!thread_updater_initialized_ && env != nullptr) {
    thread_updater_initialized_ = true;
    thread_updater_local_cache_ = env->GetThreadStatusUpdater();
  }
  return (thread_updater_local_cache_ != nullptr);
}

AutoThreadOperationStageUpdater::AutoThreadOperationStageUpdater(
    ThreadStatus::OperationStage stage) {
  prev_stage_ = ThreadStatusUtil::SetThreadOperationStage(stage);
}

AutoThreadOperationStageUpdater::~AutoThreadOperationStageUpdater() {
  ThreadStatusUtil::SetThreadOperationStage(prev_stage_);
}

#else

ThreadStatusUpdater* ThreadStatusUtil::thread_updater_local_cache_ = nullptr;
bool ThreadStatusUtil::thread_updater_initialized_ = false;

bool ThreadStatusUtil::MaybeInitThreadLocalUpdater(const Env* env) {
  return false;
}

void ThreadStatusUtil::SetColumnFamily(const ColumnFamilyData* cfd,
                                       const Env* env,
                                       bool enable_thread_tracking) {}

void ThreadStatusUtil::SetThreadOperation(ThreadStatus::OperationType op) {
}

void ThreadStatusUtil::SetThreadOperationProperty(
    int code, uint64_t value) {
}

void ThreadStatusUtil::IncreaseThreadOperationProperty(
    int code, uint64_t delta) {
}

void ThreadStatusUtil::SetThreadState(ThreadStatus::StateType state) {
}

void ThreadStatusUtil::NewColumnFamilyInfo(const DB* db,
                                           const ColumnFamilyData* cfd,
                                           const std::string& cf_name,
                                           const Env* env) {}

void ThreadStatusUtil::EraseColumnFamilyInfo(
    const ColumnFamilyData* cfd) {
}

void ThreadStatusUtil::EraseDatabaseInfo(const DB* db) {
}

void ThreadStatusUtil::ResetThreadStatus() {
}

AutoThreadOperationStageUpdater::AutoThreadOperationStageUpdater(
    ThreadStatus::OperationStage stage) {
}

AutoThreadOperationStageUpdater::~AutoThreadOperationStageUpdater() {
}

#endif  // ROCKSDB_USING_THREAD_STATUS

}  // namespace rocksdb


text:
using System;
using System.Collections.Generic;
using JetBrains.DocumentManagers;
using JetBrains.Lifetimes;
using JetBrains.Metadata.Reader.API;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.Core.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.Shaders.ShaderLab.ProjectModel;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Cpp.Language;
using JetBrains.ReSharper.Psi.Impl;
using JetBrains.ReSharper.Psi.Modules;
using JetBrains.Util;
using JetBrains.Util.DataStructures.Collections;
using JetBrains.Util.Dotnet.TargetFrameworkIds;

namespace JetBrains.ReSharper.Plugins.Unity.Shaders.HlslSupport.Integration.Cpp
{
    public class ShaderFilesProperties : IPsiSourceFileProperties
    {
        public ShaderFilesProperties(bool isICacheParticipant)
        {
            IsICacheParticipant = isICacheParticipant;
        }
        public bool ShouldBuildPsi => true;

        public bool IsGeneratedFile => false;

        public bool IsICacheParticipant { get; }

        public bool ProvidesCodeModel => true;

        public bool IsNonUserFile => false;

        public IEnumerable<string> GetPreImportedNamespaces()
        {
            return EmptyList<string>.Instance;
        }

        public string GetDefaultNamespace() => "";

        public ICollection<PreProcessingDirective> GetDefines()
        {
            return EmptyList<PreProcessingDirective>.Instance;
        }
    }

    public class UnityShaderModule : UserDataHolder, IPsiModule
    {
        private readonly ISolution mySolution;
        private readonly string myPersistentId;

        public UnityShaderModule(ISolution solution, String name, TargetFrameworkId targetFrameworkId)
        {
            mySolution = solution;
            myPersistentId = "UnityShaderModule:" + name;
            TargetFrameworkId = targetFrameworkId;
            Files = new Dictionary<IProjectFile, PsiProjectFile>();
        }

        public string Name => "UnityShaderModule";

        public string DisplayName => "Unity Editor Shader module";

        public TargetFrameworkId TargetFrameworkId { get; }

        public ISolution GetSolution()
        {
            return mySolution;
        }

        public Dictionary<IProjectFile, PsiProjectFile> Files { get; }

        public IEnumerable<IPsiSourceFile> GetPsiSourceFileFor(IProjectFile projectFile)
        {
            if (Files.ContainsKey(projectFile))
                return new[] {Files[projectFile]};
            return EmptyList<IPsiSourceFile>.InstanceList;
        }

        public PsiLanguageType PsiLanguage => CppLanguage.Instance;

        public ProjectFileType ProjectFileType => KnownProjectFileType.Instance;

        public IEnumerable<IPsiModuleReference> GetReferences(
            IModuleReferenceResolveContext moduleReferenceResolveContext)
        {
            return EmptyList<IPsiModuleReference>.InstanceList;
        }

        public IModule ContainingProjectModule => null;

        public IEnumerable<IPsiSourceFile> SourceFiles => Files.Values;

        public IPsiServices GetPsiServices()
        {
            return mySolution.GetPsiServices();
        }

        public ICollection<PreProcessingDirective> GetAllDefines()
        {
            return EmptyList<PreProcessingDirective>.InstanceList;
        }

        public bool IsValid()
        {
            return true;
        }

        public string GetPersistentID()
        {
            return myPersistentId;
        }
    }

    [SolutionComponent]
    public class UnityShaderPsiModuleProviderFilter : IProjectPsiModuleProviderFilter
    {
        public Tuple<IProjectPsiModuleHandler, IPsiModuleDecorator> OverrideHandler(Lifetime lifetime, IProject project,
            IProjectPsiModuleHandler handler)
        {
            if ( handler.PrimaryModule != null && project.GetComponent<UnityReferencesTracker>().IsUnityProject(project))
            {
                var module = new UnityShaderModule(project.GetSolution(), project.Name, handler.PrimaryModule.TargetFrameworkId);
                var newHandlerAndDecorator = new UnityShaderModuleHandlerAndDecorator(module, handler);
                return new Tuple<IProjectPsiModuleHandler, IPsiModuleDecorator>(newHandlerAndDecorator,
                    newHandlerAndDecorator);
            }

            return null;
        }
    }

    public class UnityShaderModuleHandlerAndDecorator : DelegatingProjectPsiModuleHandler, IPsiModuleDecorator
    {
        private readonly IList<IPsiModule> myAllModules;
        private readonly DocumentManager myDocumentManager;
        private UnityShaderModule myModule;
        private ShaderFilesProperties myShaderLabProperties;
        private ShaderFilesProperties myCppProperties;

        public UnityShaderModuleHandlerAndDecorator(
            UnityShaderModule module,
            IProjectPsiModuleHandler handler)
            : base(handler)
        {
            myAllModules = new List<IPsiModule>(base.GetAllModules());
            myAllModules.Add(module);

            myShaderLabProperties = new ShaderFilesProperties(true);
            myCppProperties = new ShaderFilesProperties(false);
            myModule = module;
            myDocumentManager = module.GetSolution().GetComponent<DocumentManager>();
        }

        public IEnumerable<IPsiModuleReference> OverrideModuleReferences(IEnumerable<IPsiModuleReference> references)
        {
            return references;
        }

        public override IList<IPsiModule> GetAllModules()
        {
            return myAllModules;
        }

        public IEnumerable<IPsiSourceFile> OverrideSourceFiles(IEnumerable<IPsiSourceFile> files)
        {
            return files;
        }

        public override IEnumerable<IPsiSourceFile> GetPsiSourceFilesFor(IProjectFile projectFile)
        {
            var extension = projectFile.Location.ExtensionWithDot;
            if (!CppProjectFileType.ALL_HLSL_EXTENSIONS.Contains(extension) &&
                !ShaderLabProjectFileType.SHADERLAB_EXTENSION.Equals(extension))
                return base.GetPsiSourceFilesFor(projectFile);

            if (myModule.Files.TryGetValue(projectFile, out var psiFile))
                return FixedList.Of(psiFile);

            return EmptyList<IPsiSourceFile>.Instance;
        }

        public override void OnProjectFileChanged(IProjectFile projectFile, VirtualFileSystemPath oldLocation,
            PsiModuleChange.ChangeType changeType,
            PsiModuleChangeBuilder changeBuilder)
        {
            var extension = VirtualFileSystemPath.TryParse(projectFile.Name, InteractionContext.SolutionContext).ExtensionWithDot;
            if (!CppProjectFileType.ALL_HLSL_EXTENSIONS.Contains(extension) &&
                !ShaderLabProjectFileType.SHADERLAB_EXTENSION.Equals(extension))
            {
                base.OnProjectFileChanged(projectFile, oldLocation, changeType, changeBuilder);
                return;
            }

            if (changeType == PsiModuleChange.ChangeType.Removed)
            {
                if (myModule.Files.TryGetValue(projectFile, out var psiFile))
                {
                    myModule.Files.Remove(projectFile);
                    changeBuilder.AddFileChange(psiFile, PsiModuleChange.ChangeType.Removed);
                }
            }
            else if (changeType == PsiModuleChange.ChangeType.Added)
            {
                var sourceFile = new PsiProjectFile(myModule,
                    projectFile,
                    (file, sf) => sf.GetLocation().ExtensionWithDot.Equals(ShaderLabProjectFileType.SHADERLAB_EXTENSION) ? myShaderLabProperties : myCppProperties,
                    (file, sf) => myModule.Files.ContainsKey(file),
                    myDocumentManager,
                    BaseHandler.PrimaryModule.GetResolveContextEx(projectFile));

                myModule.Files.Add(projectFile, sourceFile);
                changeBuilder.AddFileChange(sourceFile, PsiModuleChange.ChangeType.Added);
            }
            else if (changeType == PsiModuleChange.ChangeType.Modified)
            {
                if (myModule.Files.TryGetValue(projectFile, out var psiFile))
                    changeBuilder.AddFileChange(psiFile, PsiModuleChange.ChangeType.Modified);
            }
        }
    }
}


text:
using System;
using System.Security.Principal;
using Csla.Security;

namespace Rolodex.Business.Security
{
  [Serializable]
  public class RolodexPrincipal : CslaPrincipal
  {
    private RolodexPrincipal(IIdentity identity)
      : base(identity)
    {
    }

    public RolodexPrincipal() : base()
    {
    }

    public static void Login(string username, string password)
    {
      RolodexIdentity identity = RolodexIdentity.GetIdentity(username, password);
      SetPrincipal(identity);
    }

    private static void SetPrincipal(CslaIdentity identity)
    {
      RolodexPrincipal principal = new RolodexPrincipal(identity);
      Csla.ApplicationContext.User = principal;
    }

    public static void Logout()
    {
      var identity = RolodexIdentity.UnauthenticatedIdentity();
      RolodexPrincipal principal = new RolodexPrincipal(identity);
      Csla.ApplicationContext.User = principal;
    }

    public override bool IsInRole(string role)
    {
      return ((ICheckRoles) base.Identity).IsInRole(role);
    }
  }
}