text:
ExtensionJSBrowserTest::ExtensionJSBrowserTest() : libs_loaded_(false) {
}

ExtensionJSBrowserTest::~ExtensionJSBrowserTest() {
}

void ExtensionJSBrowserTest::WaitForExtension(const char* extension_id,
                                              const base::Closure& load_cb) {
  load_waiter_.reset(new ExtensionLoadWaiterOneShot());
  load_waiter_->WaitForExtension(extension_id, load_cb);
}

bool ExtensionJSBrowserTest::RunJavascriptTestF(bool is_async,
                                                const std::string& test_fixture,
                                                const std::string& test_name) {
  EXPECT_TRUE(load_waiter_->browser_context());
  if (!load_waiter_->browser_context())
    return false;
  ConstValueVector args;
  args.push_back(new base::StringValue(test_fixture));
  args.push_back(new base::StringValue(test_name));
  std::vector<base::string16> scripts;
  if (!libs_loaded_) {
    BuildJavascriptLibraries(&scripts);
    libs_loaded_ = true;
  }
  scripts.push_back(BuildRunTestJSCall(is_async, "RUN_TEST_F", args));

  base::string16 script_16 = JoinString(scripts, '\n');
  std::string script = base::UTF16ToUTF8(script_16);

  std::string result =
      extensions::browsertest_util::ExecuteScriptInBackgroundPage(
          Profile::FromBrowserContext(load_waiter_->browser_context()),
          load_waiter_->extension_id(),
          script);

  base::JSONReader reader;
  scoped_ptr<base::Value> value_result;
  value_result.reset(reader.Read(result));
  CHECK_EQ(base::Value::TYPE_DICTIONARY, value_result->GetType());
  base::DictionaryValue* dict_value =
      static_cast<base::DictionaryValue*>(value_result.get());
  bool test_result;
  std::string test_result_message;
  CHECK(dict_value->GetBoolean("result", &test_result));
  CHECK(dict_value->GetString("message", &test_result_message));
  if (!test_result_message.empty())
    ADD_FAILURE() << test_result_message;
  return test_result;
}


text:
goog.provide('ash.signals.Signal1');
goog.require('ash.signals.SignalBase');
/**
 * @extends {ash.signals.SignalBase}
 * @constructor
 */
ash.signals.Signal1 = function() {
  return ash.signals.Signal1.superClass_.constructor.apply(this, arguments);
}
goog.inherits(ash.signals.Signal1, ash.signals.SignalBase);

/**
 * dispatch the event
 * @param {any}
 */
ash.signals.Signal1.prototype.dispatch = function($1) {
  var node;
  this.startDispatch();
  node = this.head;
  while (node !== null) {
    node.listener($1);
    if (node.once) {
      this.remove(node.listener);
    }
    node = node.next;
  }
  return this.endDispatch();
};

redpajama_set_name: RedPajamaGithub


text:
package models;

import play.db.jpa.JPA;

import javax.persistence.EntityManager;
import java.util.function.Function;

public class AudioEntityManager {

    private <A> A withTransaction(Function<EntityManager, A> f) {
        try {
            return JPA.withTransaction(() -> f.apply(JPA.em()));
        } catch (Throwable throwable) {
            throw new RuntimeException(throwable);
        }
    }

    public AudioEntity create(String id, String acSampleRate, String acState, String acMaxChannelCount,
                              String acNumberOfInputs, String acNumberOfOutputs, String acChannelCount,
                              String acChannelCountMode, String acChannelInterpretation, String anFftSize,
                              String anFrequencyBinCount, String anMinDecibels, String anMaxDecibels,
                              String anSmoothingTimeConstant, String anNumberOfInputs, String anNumberOfOutputs,
                              String anChannelCount, String anChannelCountMode, String anChannelInterpretation,
                              String audioDynSum, String audioDynHash, String audioPoints, String audioDynPoints){
        return withTransaction(em -> {
            AudioEntity at = new AudioEntity();
            at.setId(id);
            at.setAcSampleRate(acSampleRate);
            at.setAcState(acState);
            at.setAcMaxChannelCount(acMaxChannelCount);
            at.setAcNumberOfInputs(acNumberOfInputs);
            at.setAcNumberOfOutputs(acNumberOfOutputs);
            at.setAcChannelCount(acChannelCount);
            at.setAcChannelCountMode(acChannelCountMode);
            at.setAcChannelInterpretation(acChannelInterpretation);
            at.setAnFftSize(anFftSize);
            at.setAnFrequencyBinCount(anFrequencyBinCount);
            at.setAnMinDecibels(anMinDecibels);
            at.setAnMaxDecibels(anMaxDecibels);
            at.setAnSmoothingTimeConstant(anSmoothingTimeConstant);
            at.setAnNumberOfInputs(anNumberOfInputs);
            at.setAnNumberOfOutputs(anNumberOfOutputs);
            at.setAnChannelCount(anChannelCount);
            at.setAnChannelCountMode(anChannelCountMode);
            at.setAnChannelInterpretation(anChannelInterpretation);
            at.setAudioDynSum(audioDynSum);
            at.setAudioDynHash(audioDynHash);
            at.setAudioPoints(audioPoints);
            at.setAudioDynPoints(audioDynPoints);
            em.persist(at);
            return at;
        });
    }

}


text:
package com.github.jasminb.jsonapi.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.jasminb.jsonapi.annotations.Id;
import com.github.jasminb.jsonapi.annotations.Type;

/**
 * Model used for testing object instantiation without default constructor present.
 *
 * @author jbegic
 */
@Type("no-def-ctor")
public class NoDefaultConstructorClass {

	@Id
	private String id;

	private String name;

	@JsonCreator
	public NoDefaultConstructorClass(@JsonProperty("id") String id, @JsonProperty("name") String name) {
		this.id = id;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}
}


text:
/* global Puzzle:false */
'use strict';

class OfflinePuzzle extends Puzzle {
  constructor (id, game) {
    super(id, game);

    this.subpuzzles = [false, false];
  }

  onActivate () {
    const online = navigator.onLine;

    this.completeSubPuzzle(Number(online));

    window.addEventListener('offline', () => {
      this.completeSubPuzzle(0);
    });

    window.addEventListener('online', () => {
      this.completeSubPuzzle(1);
    });
  }
}


text:
template <class T, std::float_round_style expected>
void
test()
{
    static_assert(std::numeric_limits<T>::round_style == expected, "round_style test 1");
    static_assert(std::numeric_limits<const T>::round_style == expected, "round_style test 2");
    static_assert(std::numeric_limits<volatile T>::round_style == expected, "round_style test 3");
    static_assert(std::numeric_limits<const volatile T>::round_style == expected, "round_style test 4");
}

int main(int, char**)
{
    test<bool, std::round_toward_zero>();
    test<char, std::round_toward_zero>();
    test<signed char, std::round_toward_zero>();
    test<unsigned char, std::round_toward_zero>();
    test<wchar_t, std::round_toward_zero>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
    test<char8_t, std::round_toward_zero>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
    test<char16_t, std::round_toward_zero>();
    test<char32_t, std::round_toward_zero>();
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
    test<short, std::round_toward_zero>();
    test<unsigned short, std::round_toward_zero>();
    test<int, std::round_toward_zero>();
    test<unsigned int, std::round_toward_zero>();
    test<long, std::round_toward_zero>();
    test<unsigned long, std::round_toward_zero>();
    test<long long, std::round_toward_zero>();
    test<unsigned long long, std::round_toward_zero>();
#ifndef _LIBCPP_HAS_NO_INT128
    test<__int128_t, std::round_toward_zero>();
    test<__uint128_t, std::round_toward_zero>();
#endif
    test<float, std::round_to_nearest>();
    test<double, std::round_to_nearest>();
    test<long double, std::round_to_nearest>();

  return 0;
}


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class CI_Timer{
	var $CI;

	public function __construct()
    {
		$this->CI = & get_instance();
	}

	public function tick()
	{
		//不限脚本运行时间
		set_time_limit(0);
		//计算现在有多少分钟
		$now = time();
		$nowMinutes = $now/60;
		$nowSeconds = $now%60;
		//遍历所有任务
		$timerTasks = $this->CI->config->item('timer');
		foreach( $timerTasks as $singleTimerTask ){
			$singleTimerTaskTime = $singleTimerTask['period'];
			$singleTimerTaskTask = $singleTimerTask['task'];
			$singleTimerTaskTime = ceil($singleTimerTaskTime /60);
			if( $nowMinutes % $singleTimerTaskTime == 0 ){
				try{
					$this->tickSingleTask($singleTimerTaskTask);
				}catch(Exception $e){
					log_message('error','run '.$singleTimerTask['task'].' fail '.$e->getMessage());
				}
			}
		}
		//调试
		log_message('DEBUG','timer tick finish');
	}

	public function tickSingleTask($task)
	{
		$taskPath = APPPATH.'timer/'.$task.'.php';
		if( !file_exists($taskPath))
			throw new CI_MyException(1,'unknown task path '.$taskPath);

		require_once($taskPath);

		log_message('INFO',$task.' finish!');
	}
}
?>


text:
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]

Encode a URL to a percent-encoded form, excluding already-encoded sequences

## Installation

This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):

```sh
$ npm install encodeurl
```

## API

```js
var encodeUrl = require('encodeurl')
```

### encodeUrl(url)

Encode a URL to a percent-encoded form, excluding already-encoded sequences.

This function will take an already-encoded URL and encode all the non-URL
code points (as UTF-8 byte sequences). This function will not encode the
"%" character unless it is not part of a valid sequence (`%20` will be
left as-is, but `%foo` will be encoded as `%25foo`).

This encode is meant to be "safe" and does not throw errors. It will try as
hard as it can to properly encode the given URL, including replacing any raw,
unpaired surrogate pairs with the Unicode replacement character prior to
encoding.

This function is _similar_ to the intrinsic function `encodeURI`, except it
will not encode the `%` character if that is part of a valid sequence, will
not encode `[` and `]` (for IPv6 hostnames) and will replace raw, unpaired
surrogate pairs with the Unicode replacement character (instead of throwing).

## Examples

### Encode a URL containing user-controled data

```js
var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')

http.createServer(function onRequest (req, res) {
  // get encoded form of inbound url
  var url = encodeUrl(req.url)

  // create html message
  var body = '<p>Location ' + escapeHtml(url) + ' not found</p>'

  // send a 404
  res.statusCode = 404
  res.setHeader('Content-Type', 'text/html; charset=UTF-8')
  res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
  res.end(body, 'utf-8')
})
```

### Encode a URL for use in a header field

```js
var encodeUrl = require('encodeurl')
var escapeHtml = require('escape-html')
var url = require('url')

http.createServer(function onRequest (req, res) {
  // parse inbound url
  var href = url.parse(req)

  // set new host for redirect
  href.host = 'localhost'
  href.protocol = 'https:'
  href.slashes = true

  // create location header
  var location = encodeUrl(url.format(href))

  // create html message
  var body = '<p>Redirecting to new site: ' + escapeHtml(location) + '</p>'

  // send a 301
  res.statusCode = 301
  res.setHeader('Content-Type', 'text/html; charset=UTF-8')
  res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
  res.setHeader('Location', location)
  res.end(body, 'utf-8')
})
```

## Testing

```sh
$ npm test
$ npm run lint
```

## References

- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax][rfc-3986]
- [WHATWG URL Living Standard][whatwg-url]

[rfc-3986]: https://tools.ietf.org/html/rfc3986
[whatwg-url]: https://url.spec.whatwg.org/

## License

[MIT](LICENSE)

[npm-image]: https://img.shields.io/npm/v/encodeurl.svg
[npm-url]: https://npmjs.org/package/encodeurl
[node-version-image]: https://img.shields.io/node/v/encodeurl.svg
[node-version-url]: https://nodejs.org/en/download
[travis-image]: https://img.shields.io/travis/pillarjs/encodeurl.svg
[travis-url]: https://travis-ci.org/pillarjs/encodeurl
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/encodeurl.svg
[coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master
[downloads-image]: https://img.shields.io/npm/dm/encodeurl.svg
[downloads-url]: https://npmjs.org/package/encodeurl


text:
@interface ViewController ()
@property(nonatomic) float animSpeed;
@property(weak, nonatomic) IBOutlet UILabel *hpsLabel;
@property(weak, nonatomic) IBOutlet UIImageView *rabbit1;
@property(weak, nonatomic) IBOutlet UIImageView *rabbit2;
@property(weak, nonatomic) IBOutlet UIImageView *rabbit3;
@property(weak, nonatomic) IBOutlet UIImageView *rabbit4;
@property(weak, nonatomic) IBOutlet UIImageView *rabbit5;
@property(weak, nonatomic) IBOutlet UILabel *speedLabel;
@property(weak, nonatomic) IBOutlet UITextField *inputField;
@property(weak, nonatomic) IBOutlet UISlider *slider;
@property(weak, nonatomic) IBOutlet UIStepper *stepper;
@property(weak, nonatomic) IBOutlet UIButton *btnClick;

@end

@implementation ViewController

- (void)startAnim {
  self.rabbit1.animationDuration = self.animSpeed;
  self.rabbit2.animationDuration = self.animSpeed;
  self.rabbit3.animationDuration = self.animSpeed;
  self.rabbit4.animationDuration = self.animSpeed;
  self.rabbit5.animationDuration = self.animSpeed;
  [self.rabbit1 startAnimating];
  [self.rabbit2 startAnimating];
  [self.rabbit3 startAnimating];
  [self.rabbit4 startAnimating];
  [self.rabbit5 startAnimating];
  [self.btnClick setTitle:@"Sit!" forState:UIControlStateNormal];
}

- (void)stopAnim {
  [self.rabbit1 stopAnimating];
  [self.rabbit2 stopAnimating];
  [self.rabbit3 stopAnimating];
  [self.rabbit4 stopAnimating];
  [self.rabbit5 stopAnimating];
  [self.btnClick setTitle:@"Hop!" forState:UIControlStateNormal];
}

- (void)toggleAnim {
  [self.rabbit1 isAnimating] ? [self stopAnim] : [self startAnim];
}

- (void)setAnimSpeed:(float)animSpeed {
  _animSpeed = animSpeed;
  self.hpsLabel.text = [NSString stringWithFormat:@"%1.2f hps", 1 / animSpeed];
  self.speedLabel.text = [NSString stringWithFormat:@"Speed: %1.2f", animSpeed];
  self.inputField.text = [NSString stringWithFormat:@"%1.2f", animSpeed];
}

- (IBAction)toggleAnimation:(UIButton *)sender {
  [self toggleAnim];
}
- (IBAction)setSpeed:(UISlider *)sender {
  self.animSpeed = 2 - self.slider.value;
  if (![self.rabbit1 isAnimating]) {
    [self startAnim];
  }
}
- (IBAction)setIncrement:(UIStepper *)sender {
  self.slider.value = self.stepper.value;
  [self setSpeed:nil];
}
- (IBAction)inputSpeed:(UITextField *)sender {
  if (sender.text) {
    self.animSpeed = [self.inputField.text floatValue];
    [self.inputField resignFirstResponder];
  }
}

- (void)viewDidLoad {
  [super viewDidLoad];
  NSArray *animation = @[
    [UIImage imageNamed:@"frame-1.png"],
    [UIImage imageNamed:@"frame-2.png"],
    [UIImage imageNamed:@"frame-3.png"],
    [UIImage imageNamed:@"frame-4.png"],
    [UIImage imageNamed:@"frame-5.png"],
    [UIImage imageNamed:@"frame-6.png"],
    [UIImage imageNamed:@"frame-7.png"],
    [UIImage imageNamed:@"frame-8.png"],
    [UIImage imageNamed:@"frame-9.png"],
    [UIImage imageNamed:@"frame-10.png"],
    [UIImage imageNamed:@"frame-11.png"],
    [UIImage imageNamed:@"frame-12.png"],
    [UIImage imageNamed:@"frame-13.png"],
    [UIImage imageNamed:@"frame-14.png"],
    [UIImage imageNamed:@"frame-15.png"],
    [UIImage imageNamed:@"frame-16.png"],
    [UIImage imageNamed:@"frame-17.png"],
    [UIImage imageNamed:@"frame-18.png"],
    [UIImage imageNamed:@"frame-19.png"],
    [UIImage imageNamed:@"frame-20.png"],
  ];
  self.rabbit1.animationImages = animation;
  self.rabbit2.animationImages = animation;
  self.rabbit3.animationImages = animation;
  self.rabbit4.animationImages = animation;
  self.rabbit5.animationImages = animation;

  self.animSpeed = 1;
}

- (UIStatusBarStyle)preferredStatusBarStyle {
  return UIStatusBarStyleLightContent;
}

@end


text:
package com.ibm.xsp.extlib.renderkit.html_extended.oneuiv302.data;

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

import com.ibm.commons.util.StringUtil;
import com.ibm.xsp.extlib.component.data.UIForumPost;
import com.ibm.xsp.extlib.renderkit.html_extended.oneui.data.OneUIForumPostRenderer;
import com.ibm.xsp.extlib.util.ExtLibUtil;
import com.ibm.xsp.util.FacesUtil;

public class OneUIv302ForumPostRenderer extends OneUIForumPostRenderer {

     @Override
        protected Object getProperty(int prop) {
            switch(prop) {
                case PROP_MAINCLASS:                return "lotusPost"; // $NON-NLS-1$
                case PROP_POSTMETACLASS:            return "lotusMeta"; // $NON-NLS-1$
                case PROP_POSTACTIONSCLASS:         return "lotusActions"; // $NON-NLS-1$
            }
            return super.getProperty(prop);
        }

     @Override
    protected void writeForumPost(FacesContext context, ResponseWriter w, UIForumPost c) throws IOException {
            w.startElement("div", c); // $NON-NLS-1$
            w.writeAttribute("role", "article", null); // $NON-NLS-1$ $NON-NLS-2$
            String style = c.getStyle();
            if(StringUtil.isEmpty(style)) {
                style = (String)getProperty(PROP_MAINSTYLE);
            }
            // We add a fix to the style, in case it is embedded within a forum view
            if(isInForumView(c)) {
                style = ExtLibUtil.concatStyles(style,(String)getProperty(PROP_MAINSTYLEVIEWFIX));
            }
            if(StringUtil.isNotEmpty(style)) {
                w.writeAttribute("style", style, null); // $NON-NLS-1$
            }
            String styleClass = c.getStyleClass();
            if(StringUtil.isEmpty(styleClass)) {
                styleClass = (String)getProperty(PROP_MAINCLASS);
            }
            if(StringUtil.isNotEmpty(styleClass)) {
                w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
            }

            writeAuthor(context, w, c);
            writePost(context, w, c);

            w.endElement("div"); // $NON-NLS-1$
        }

     @Override
    protected void writePostTitle(FacesContext context, ResponseWriter w, UIForumPost c, UIComponent facet) throws IOException {
         if(facet==null) {
             return;
         }
         FacesUtil.renderComponent(context, facet);

    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_enabled="false" android:state_pressed="false" android:drawable="@drawable/operation_meet_button_disable" />
    <item android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/operation_meet_button_enable" />
    <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/operation_meet_button_disable" />
</selector><!-- From: file:/Users/Breeze/Downloads/Products/Android/IntelliJ/trunk/moxtrasdk/products/ConversationSDK/src/main/res/drawable/operation_meet_button.xml -->


text:
package com.intellij.vcs.log.visible.filters;

import com.intellij.openapi.util.text.StringUtil;
import com.intellij.vcs.log.VcsLogHashFilter;
import com.intellij.vcs.log.util.VcsLogUtil;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;

class VcsLogHashFilterImpl implements VcsLogHashFilter {

  @NotNull private final Collection<String> myHashes;

  VcsLogHashFilterImpl(@NotNull Collection<String> hashes) {
    myHashes = hashes;
  }

  @NotNull
  @Override
  public Collection<String> getHashes() {
    return myHashes;
  }

  @NotNull
  @Override
  public String getPresentation() {
    return StringUtil.join(getHashes(), it -> VcsLogUtil.getShortHash(it), ", ");
  }

  @Override
  public String toString() {
    return "hashes:" + myHashes;
  }
}


text:
from __future__ import absolute_import, print_function

import os
import struct

if os.environ.get('USE_TWISTED', False):
    from twisted.trial import unittest
    from twisted.internet.address import IPv4Address
    from twisted.internet.task import Clock
    from six import PY3

    from autobahn.twisted.websocket import WebSocketServerProtocol
    from autobahn.twisted.websocket import WebSocketServerFactory
    from autobahn.twisted.websocket import WebSocketClientProtocol
    from autobahn.twisted.websocket import WebSocketClientFactory

    from mock import MagicMock, patch
    from txaio.testutil import replace_loop

    from base64 import b64decode

    @patch('base64.b64encode')
    def create_client_frame(b64patch, **kwargs):
        """
        Kind-of hack-y; maybe better to re-factor the Protocol to have a
        frame-encoder method-call? Anyway, makes a throwaway protocol
        encode a frame for us, collects the .sendData call and returns
        the data that would have gone out. Accepts all the kwargs that
        WebSocketClientProtocol.sendFrame() accepts.
        """

        # only real way to inject a "known" secret-key for the headers
        # to line up... :/
        b64patch.return_value = b'QIatSt9QkZPyS4QQfdufO8TgkL0='

        factory = WebSocketClientFactory(protocols=['wamp.2.json'])
        factory.protocol = WebSocketClientProtocol
        factory.doStart()
        proto = factory.buildProtocol(IPv4Address('TCP', '127.0.0.9', 65534))
        proto.transport = MagicMock()
        proto.connectionMade()
        proto.data = mock_handshake_server
        proto.processHandshake()

        data = []

        def collect(d, *args):
            data.append(d)
        proto.sendData = collect

        proto.sendFrame(**kwargs)
        return b''.join(data)

    # beware the evils of line-endings...
    mock_handshake_client = b'GET / HTTP/1.1\r\nUser-Agent: AutobahnPython/0.10.2\r\nHost: localhost:80\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nSec-WebSocket-Key: 6Jid6RgXpH0RVegaNSs/4g==\r\nSec-WebSocket-Protocol: wamp.2.json\r\nSec-WebSocket-Version: 13\r\n\r\n'

    mock_handshake_server = b'HTTP/1.1 101 Switching Protocols\r\nServer: AutobahnPython/0.10.2\r\nX-Powered-By: AutobahnPython/0.10.2\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nSec-WebSocket-Protocol: wamp.2.json\r\nSec-WebSocket-Accept: QIatSt9QkZPyS4QQfdufO8TgkL0=\r\n\r\n\x81~\x02\x19[1,"crossbar",{"roles":{"subscriber":{"features":{"publisher_identification":true,"pattern_based_subscription":true,"subscription_revocation":true}},"publisher":{"features":{"publisher_identification":true,"publisher_exclusion":true,"subscriber_blackwhite_listing":true}},"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"progressive_call_results":true,"pattern_based_registration":true,"registration_revocation":true,"shared_registration":true,"caller_identification":true}}}}]\x18'

    class TestClient(unittest.TestCase):
        def setUp(self):
            self.factory = WebSocketClientFactory(protocols=['wamp.2.json'])
            self.factory.protocol = WebSocketClientProtocol
            self.factory.doStart()

            self.proto = self.factory.buildProtocol(IPv4Address('TCP', '127.0.0.1', 65534))
            self.transport = MagicMock()
            self.proto.transport = self.transport
            self.proto.connectionMade()

        def tearDown(self):
            if self.proto.openHandshakeTimeoutCall:
                self.proto.openHandshakeTimeoutCall.cancel()
            self.factory.doStop()
            # not really necessary, but ...
            del self.factory
            del self.proto

        def test_missing_reason_raw(self):
            # we want to hit the "STATE_OPEN" case, so pretend we're there
            self.proto.echoCloseCodeReason = True
            self.proto.state = self.proto.STATE_OPEN
            self.proto.websocket_version = 1

            self.proto.sendCloseFrame = MagicMock()

            self.proto.onCloseFrame(1000, None)

        def test_unclean_timeout_client(self):
            """
            make a delayed call to drop the connection (client-side)
            """

            if False:
                self.proto.factory._log = print

            # get to STATE_OPEN
            self.proto.websocket_key = b64decode('6Jid6RgXpH0RVegaNSs/4g==')
            self.proto.data = mock_handshake_server
            self.proto.processHandshake()
            self.assertEqual(self.proto.state, WebSocketServerProtocol.STATE_OPEN)
            self.assertTrue(self.proto.serverConnectionDropTimeout > 0)

            with replace_loop(Clock()) as reactor:
                # now 'do the test' and transition to CLOSING
                self.proto.sendCloseFrame()
                self.proto.onCloseFrame(1000, b"raw reason")

                # check we scheduled a call
                self.assertEqual(len(reactor.calls), 1)
                self.assertEqual(reactor.calls[0].func, self.proto.onServerConnectionDropTimeout)
                self.assertEqual(reactor.calls[0].getTime(), self.proto.serverConnectionDropTimeout)

                # now, advance the clock past the call (and thereby
                # execute it)
                reactor.advance(self.proto.closeHandshakeTimeout + 1)

                # we should have called abortConnection
                self.assertEqual("call.abortConnection()", str(self.proto.transport.method_calls[-1]))
                self.assertTrue(self.proto.transport.abortConnection.called)
                # ...too "internal" for an assert?
                self.assertEqual(self.proto.state, WebSocketServerProtocol.STATE_CLOSED)

    class TestPing(unittest.TestCase):
        def setUp(self):
            self.factory = WebSocketServerFactory(protocols=['wamp.2.json'])
            self.factory.protocol = WebSocketServerProtocol
            self.factory.doStart()

            self.proto = self.factory.buildProtocol(IPv4Address('TCP', '127.0.0.1', 65534))
            self.transport = MagicMock()
            self.proto.transport = self.transport
            self.proto.connectionMade()

        def tearDown(self):
            if self.proto.openHandshakeTimeoutCall:
                self.proto.openHandshakeTimeoutCall.cancel()
            self.factory.doStop()
            # not really necessary, but ...
            del self.factory
            del self.proto

        def test_unclean_timeout(self):
            """
            make a delayed call to drop the connection
            """
            # first we have to drive the protocol to STATE_CLOSING
            # ... which we achieve by sendCloseFrame after we're in
            # STATE_OPEN
            # XXX double-check this is the correct code-path to get here
            # "normally"?

            # get to STATE_OPEN
            self.proto.data = mock_handshake_client
            self.proto.processHandshake()
            self.assertTrue(self.proto.state == WebSocketServerProtocol.STATE_OPEN)

            with replace_loop(Clock()) as reactor:
                # now 'do the test' and transition to CLOSING
                self.proto.sendCloseFrame()

                # check we scheduled a call
                self.assertEqual(len(reactor.calls), 1)

                # now, advance the clock past the call (and thereby
                # execute it)
                reactor.advance(self.proto.closeHandshakeTimeout + 1)

                # we should have called abortConnection
                self.assertEqual("call.abortConnection()", str(self.proto.transport.method_calls[-1]))
                self.assertTrue(self.proto.transport.abortConnection.called)
                # ...too "internal" for an assert?
                self.assertEqual(self.proto.state, WebSocketServerProtocol.STATE_CLOSED)

        def test_auto_pingpong_timeout(self):
            """
            autoping and autoping-timeout timing
            """
            # options are evaluated in succeedHandshake, called below
            self.proto.autoPingInterval = 5
            self.proto.autoPingTimeout = 2

            with replace_loop(Clock()) as reactor:
                # get to STATE_OPEN
                self.proto.data = mock_handshake_client
                self.proto.processHandshake()
                self.assertTrue(self.proto.state == WebSocketServerProtocol.STATE_OPEN)

                # we should have scheduled an autoPing
                self.assertEqual(1, len(reactor.calls))

                # advance past first auto-ping timeout
                reactor.advance(5)

                # first element from args tuple from transport.write()
                # call is our data
                self.assertTrue(self.transport.write.called)
                data = self.transport.write.call_args[0][0]

                if PY3:
                    _data = bytes([data[0]])
                else:
                    _data = data[0]

                # the opcode is the lower 7 bits of the first byte.
                (opcode,) = struct.unpack("B", _data)
                opcode = opcode & (~0x80)

                # ... and should be "9" for ping
                self.assertEqual(9, opcode)

                # Because we have autoPingTimeout there should be
                # another delayed-called created now
                self.assertEqual(1, len(reactor.calls))
                self.assertNotEqual(self.proto.state, self.proto.STATE_CLOSED)

                # ...which we'll now cause to trigger, aborting the connection
                reactor.advance(3)
                self.assertEqual(self.proto.state, self.proto.STATE_CLOSED)

        def test_auto_ping_got_pong(self):
            """
            auto-ping with correct reply cancels timeout
            """
            # options are evaluated in succeedHandshake, called below
            self.proto.autoPingInterval = 5
            self.proto.autoPingTimeout = 2

            with replace_loop(Clock()) as reactor:
                # get to STATE_OPEN
                self.proto.data = mock_handshake_client
                self.proto.processHandshake()
                self.assertTrue(self.proto.state == WebSocketServerProtocol.STATE_OPEN)

                # we should have scheduled an autoPing
                self.assertEqual(1, len(reactor.calls))

                # advance past first auto-ping timeout
                reactor.advance(5)

                # should have an auto-ping timeout scheduled, and we
                # save it for later (to check it got cancelled)
                self.assertEqual(1, len(reactor.calls))
                timeout_call = reactor.calls[0]

                # elsewhere we check that we actually send an opcode-9
                # message; now we just blindly inject our own reply
                # with a PONG frame

                frame = create_client_frame(opcode=10, payload=self.proto.autoPingPending)
                self.proto.data = frame
                # really needed twice; does header first, then rest
                self.proto.processData()
                self.proto.processData()

                # which should have cancelled the call
                self.assertTrue(timeout_call.cancelled)


text:
#pragma once

#if ENABLE(DFG_JIT)

#include "DFGCommon.h"
#include "DFGOperations.h"
#include "DFGSlowPathGenerator.h"
#include "DFGSpeculativeJIT.h"
#include "DirectArguments.h"

namespace JSC { namespace DFG {

// This calls operationCreateDirectArguments but then restores the value of lengthGPR.
class CallCreateDirectArgumentsSlowPathGenerator : public JumpingSlowPathGenerator<MacroAssembler::JumpList> {
public:
    CallCreateDirectArgumentsSlowPathGenerator(
        MacroAssembler::JumpList from, SpeculativeJIT* jit, GPRReg resultGPR, RegisteredStructure structure,
        GPRReg lengthGPR, unsigned minCapacity)
        : JumpingSlowPathGenerator<MacroAssembler::JumpList>(from, jit)
        , m_resultGPR(resultGPR)
        , m_structure(structure)
        , m_lengthGPR(lengthGPR)
        , m_minCapacity(minCapacity)
    {
        jit->silentSpillAllRegistersImpl(false, m_plans, resultGPR);
    }

protected:
    void generateInternal(SpeculativeJIT* jit) override
    {
        linkFrom(jit);
        for (unsigned i = 0; i < m_plans.size(); ++i)
            jit->silentSpill(m_plans[i]);
        jit->callOperation(
            operationCreateDirectArguments, m_resultGPR, m_structure, m_lengthGPR, m_minCapacity);
        GPRReg canTrample = SpeculativeJIT::pickCanTrample(m_resultGPR);
        for (unsigned i = m_plans.size(); i--;)
            jit->silentFill(m_plans[i], canTrample);
        jit->m_jit.exceptionCheck();
        jit->m_jit.loadPtr(
            MacroAssembler::Address(m_resultGPR, DirectArguments::offsetOfLength()), m_lengthGPR);
        jumpTo(jit);
    }

private:
    GPRReg m_resultGPR;
    RegisteredStructure m_structure;
    GPRReg m_lengthGPR;
    unsigned m_minCapacity;
    Vector<SilentRegisterSavePlan, 2> m_plans;
};

} } // namespace JSC::DFG

#endif // ENABLE(DFG_JIT)


text:
#pragma once
#include <aws/lexv2-models/LexModelsV2_EXPORTS.h>
#include <aws/lexv2-models/LexModelsV2Request.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace LexModelsV2
{
namespace Model
{

  /**
   */
  class AWS_LEXMODELSV2_API DescribeBotVersionRequest : public LexModelsV2Request
  {
  public:
    DescribeBotVersionRequest();

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

    Aws::String SerializePayload() const override;

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline const Aws::String& GetBotId() const{ return m_botId; }

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline bool BotIdHasBeenSet() const { return m_botIdHasBeenSet; }

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline void SetBotId(const Aws::String& value) { m_botIdHasBeenSet = true; m_botId = value; }

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline void SetBotId(Aws::String&& value) { m_botIdHasBeenSet = true; m_botId = std::move(value); }

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline void SetBotId(const char* value) { m_botIdHasBeenSet = true; m_botId.assign(value); }

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline DescribeBotVersionRequest& WithBotId(const Aws::String& value) { SetBotId(value); return *this;}

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline DescribeBotVersionRequest& WithBotId(Aws::String&& value) { SetBotId(std::move(value)); return *this;}

    /**
     *
The identifier of the bot containing the version to return metadata for.

     */
    inline DescribeBotVersionRequest& WithBotId(const char* value) { SetBotId(value); return *this;}

    /**
     *
The version of the bot to return metadata for.

     */
    inline const Aws::String& GetBotVersion() const{ return m_botVersion; }

    /**
     *
The version of the bot to return metadata for.

     */
    inline bool BotVersionHasBeenSet() const { return m_botVersionHasBeenSet; }

    /**
     *
The version of the bot to return metadata for.

     */
    inline void SetBotVersion(const Aws::String& value) { m_botVersionHasBeenSet = true; m_botVersion = value; }

    /**
     *
The version of the bot to return metadata for.

     */
    inline void SetBotVersion(Aws::String&& value) { m_botVersionHasBeenSet = true; m_botVersion = std::move(value); }

    /**
     *
The version of the bot to return metadata for.

     */
    inline void SetBotVersion(const char* value) { m_botVersionHasBeenSet = true; m_botVersion.assign(value); }

    /**
     *
The version of the bot to return metadata for.

     */
    inline DescribeBotVersionRequest& WithBotVersion(const Aws::String& value) { SetBotVersion(value); return *this;}

    /**
     *
The version of the bot to return metadata for.

     */
    inline DescribeBotVersionRequest& WithBotVersion(Aws::String&& value) { SetBotVersion(std::move(value)); return *this;}

    /**
     *
The version of the bot to return metadata for.

     */
    inline DescribeBotVersionRequest& WithBotVersion(const char* value) { SetBotVersion(value); return *this;}

  private:

    Aws::String m_botId;
    bool m_botIdHasBeenSet = false;

    Aws::String m_botVersion;
    bool m_botVersionHasBeenSet = false;
  };

} // namespace Model
} // namespace LexModelsV2
} // namespace Aws


text:
using Sonak.Analyzer.Layouts;

namespace Sonak.Analyzer.Keyboards
{
    internal class UsInternationalKeyboard : IUsInternationalKeyboard
    {
        public UsInternationalKeyboard(IUsInternationalLayout layout)
        {
            Name = "US-International Keyboard";
            Layout = layout;
        }

        public string Name { get; }

        public ILayout Layout { get; }
    }
}


text:
package com.wildbitsfoundry.etk4j.math.solvers.multivariate;

import com.wildbitsfoundry.etk4j.constants.ConstantsETK;
import com.wildbitsfoundry.etk4j.math.functions.MultivariateFunction;
import com.wildbitsfoundry.etk4j.math.solvers.multivariate.SolverResults.SolverStatus;
import com.wildbitsfoundry.etk4j.math.solvers.multivariate.SolverUtils.LU;
import com.wildbitsfoundry.etk4j.util.NumArrays;

public class NewtonRaphson implements MultivariateSolver {

	protected int _maxIter = 100;
	protected double _absTol = 1e-9;
	protected double _relTol = 1e-6;
	protected double _maxVal = Double.NaN;
	protected double _step = 1e-7;
	protected double[] _x0;

	MultivariateFunction[] _functions;
	MultivariateFunction[][] _jacobian;

	private ErrorEstimationScheme _errorScheme;

	public NewtonRaphson(MultivariateFunction[] functions, double[] initialGuess) {
		this(functions, null, initialGuess);
	}

	public NewtonRaphson(MultivariateFunction[] functions, MultivariateFunction[][] jacobian, double[] initialGuess) {
		_functions = functions;
		_jacobian = jacobian;
		_x0 = initialGuess;
		_errorScheme = ErrorEstimationScheme.SQRT_SUM_ABS_ERROR_SQUARED;
	}

	@Override
	public SolverResults solve() {
		return this.solve(_jacobian);
	}

	@Override
	public NewtonRaphson setIterationLimit(int limit) {
		_maxIter = limit;
		return this;
	}

	@Override
	public NewtonRaphson setAbsTolerance(double tol) {
		_absTol = tol;
		return this;
	}

	@Override
	public NewtonRaphson setRelTolerance(double tol) {
		_relTol = tol;
		return this;
	}

	@Override
	public NewtonRaphson setMaxAbsAllowedValue(double max) {
		_maxVal = max;
		return this;
	}

	@Override
	public NewtonRaphson setDifferentiationStepSize(double step) {
		_step = step;
		return this;
	}

	@Override
	public NewtonRaphson setErrorEstimationScheme(ErrorEstimationScheme scheme) {
		_errorScheme = scheme;
		return this;
	}

	private static void evaluateJacobian(double[] x, MultivariateFunction[][] jacobian, double[][] out) {
		int rows = out.length;
		int cols = out[0].length;
		for (int i = 0; i < rows; i++) {
			for (int j = 0; j < cols; j++) {
				out[i][j] = jacobian[i][j].evaluateAt(x);
			}
		}
	}

	private static void evaluateFunctionsAt(double[] x, MultivariateFunction[] functions, double[] out) {
		int length = x.length;
		for (int i = 0; i < length; i++) {
			out[i] = functions[i].evaluateAt(x);
		}
	}

	private static void computeJacobian(double[] x, MultivariateFunction[] f, double[] dfx, double[] fx,
			double step, double[][] out) {
		double den = 0.5 / step;
		int rows = f.length;
		int cols = x.length;
		for (int i = 0; i < cols; i++) {
			x[i] = x[i] + step;
			evaluateFunctionsAt(x, f, dfx);
			x[i] = x[i] - 2.0 * step;
			evaluateFunctionsAt(x, f, fx);
			for (int j = 0; j < rows; j++) {
				out[j][i] = (dfx[j] - fx[j]) * den;
			}
		}
	}

	protected SolverResults solve(MultivariateFunction[][] jacobian) {
		int maxiter = _maxIter;
		double maxval = _maxVal;
		double step = _step;
		double[] x0 = _x0;
		MultivariateFunction[] functions = _functions;

		int rows = functions.length;
		int cols = x0.length;
		double[] xcurrent = new double[cols];
		double[] xfinal = new double[cols];
		double[] residuals = new double[cols];
		double[] functionValues = new double[cols];
		double[][] jacobianMatrixValues = new double[rows][cols];

		System.arraycopy(x0, 0, xcurrent, 0, rows);
		while (maxiter-- > 0) {
			if (jacobian != null) {
				evaluateJacobian(xcurrent, jacobian, jacobianMatrixValues);
				evaluateFunctionsAt(xcurrent, functions, functionValues);
			} else {
				computeJacobian(xcurrent, functions, residuals, functionValues, step, jacobianMatrixValues);
			}

			LU matrix = new LU(jacobianMatrixValues);
			if (Double.compare(Math.abs(matrix.det()), ConstantsETK.DOUBLE_EPS) <= 0) {
				double error = this.estimateError(xfinal, xcurrent);
				return buildResults(xfinal, SolverStatus.JACOBIAN_IS_SINGULAR, _maxIter - maxiter, error);
			}

			matrix.solve(functionValues, residuals);
			for (int i = 0; i < cols; i++) {
				xfinal[i] = xcurrent[i] - residuals[i];
			}
			evaluateFunctionsAt(xfinal, functions, functionValues);

			if (this.checkForConvergence(xfinal, xcurrent)) {
				double error = this.estimateError(xfinal, xcurrent);
				return buildResults(xfinal, SolverStatus.SUCCESS, _maxIter - maxiter, error);
			}

			if (!Double.isNaN(maxval) && Double.compare(NumArrays.normInf(xfinal), maxval) >= 0) {
				double error = this.estimateError(xfinal, xcurrent);
				return buildResults(xfinal, SolverStatus.MAX_ABS_VALUE_EXCEEDED, _maxIter - maxiter, error);
			}
			System.arraycopy(xfinal, 0, xcurrent, 0, rows);
		}
		double error = this.estimateError(xfinal, xcurrent);
		return buildResults(xfinal, SolverStatus.ITERATION_LIMIT_EXCEEDED, _maxIter - maxiter, error);
	}

	protected double estimateError(double[] x, double[] y) {
		return _errorScheme.calculateRelativeError(x, y);
	}

	protected boolean checkForConvergence(double[] x, double[] y) {
		double delta = this.estimateError(x, y);
		double tmp = _errorScheme.calculateMaxNormOfError(x, y);
		return delta < _absTol + _relTol * tmp;
	}

	protected static SolverResults buildResults(double[] xfinal, SolverStatus status, int iterCount, double error) {
		SolverResults sr = new SolverResults();
		sr.Iterations = iterCount;
		sr.Solution = xfinal;
		sr.Status = status;
		sr.Converged = status.equals(SolverStatus.SUCCESS) ? true : false;
		sr.EstimatedError = error;
		return sr;
	}
}


text:
<?php

require_once 'PHPUnit/Framework.php';

/**
 *
 */
class Db_CodeBuilder_ClassTest extends PHPUnit_Framework_TestCase
{
	function setUp()
	{
		require_once dirname(__FILE__).'/../../../lib/Db/CodeBuilder/Container.php';
		require_once dirname(__FILE__).'/../../../lib/Db/CodeBuilder/Class.php';
	}

	// ------------------------------------------------------------------------

	public function testGetName()
	{
		$c = new Db_CodeBuilder_Class();

		$this->assertEquals('class_', $c->getName());

		$c->name = 'Foo';

		$this->assertEquals('class_Foo', $c->getName());
	}

	// ------------------------------------------------------------------------

	public function testRender()
	{
		$c = new Db_CodeBuilder_Class();

		$this->assertEquals('class
{

}', $c->__toString());

		$c->name = 'Foo';

		$this->assertEquals('class Foo
{

}', $c->__toString());
	}
	public function testRender2()
	{
		$c = new Db_CodeBuilder_Class();

		$c->name = 'Foo';
		$c->extends = 'Bar';

		$this->assertEquals('class Foo extends Bar
{

}', $c->__toString());
	}
	public function testRender3()
	{
		$c = new Db_CodeBuilder_Class();

		$c->name = 'Foo';
		$c->implements = 'Baz';

		$this->assertEquals('class Foo implements Baz
{

}', $c->__toString());
	}
	public function testRender4()
	{
		$c = new Db_CodeBuilder_Class();

		$c->name = 'Foo';
		$c->implements = 'Baz';
		$c->extends = 'Bar';

		$this->assertEquals('class Foo extends Bar implements Baz
{

}', $c->__toString());
	}
	public function testRender5()
	{
		$c = new Db_CodeBuilder_Class();

		$c->name = 'Foo';

		$this->assertTrue($c->addPart('line one'));

		$this->assertEquals('class Foo
{
	line one
}', $c->__toString());

		$this->assertTrue($c->addPart('line two'));

		$this->assertEquals('class Foo
{
	line one

	line two
}', $c->__toString());
	}
}

/* End of file ClassTest.php */
/* Location: ./tests/Db/CodeBuilder */


text:
package org.apache.jena.sparql.expr;

import java.util.ArrayList ;
import java.util.List ;
import org.apache.jena.sparql.engine.binding.Binding ;
import org.apache.jena.sparql.function.FunctionEnv ;
import org.apache.jena.sparql.graph.NodeTransform;

/** A function which takes N arguments (N may be variable e.g. regex) */

public abstract class ExprFunctionN extends ExprFunction
{
    protected ExprList args = null ;

    protected ExprFunctionN(String fName, Expr... args)
    {
        this(fName, argList(args)) ;
    }

    protected ExprFunctionN(String fName, ExprList args)
    {
        super(fName) ;
        this.args = args ;
    }

    private static ExprList argList(Expr[] args)
    {
        ExprList exprList = new ExprList() ;
        for ( Expr e : args )
            if ( e != null )
                exprList.add(e) ;
        return exprList ;
    }

    @Override
    public Expr getArg(int i)
    {
        i = i-1 ;
        if ( i >= args.size() )
            return null ;
        return args.get(i) ;
    }

    @Override
    public int numArgs() { return args.size() ; }

    @Override
    public List<Expr> getArgs() { return args.getList() ; }

    @Override
    public Expr copySubstitute(Binding binding)
    {
        ExprList newArgs = new ExprList() ;
        for ( int i = 1 ; i <= numArgs() ; i++ )
        {
            Expr e = getArg(i) ;
            e = e.copySubstitute(binding) ;
            newArgs.add(e) ;
        }
        return copy(newArgs);
    }

    @Override
    public Expr applyNodeTransform(NodeTransform transform)
    {
        ExprList newArgs = new ExprList() ;
        for ( int i = 1 ; i <= numArgs() ; i++ )
        {
            Expr e = getArg(i) ;
            e = e.applyNodeTransform(transform) ;
            newArgs.add(e) ;
        }
        return copy(newArgs) ;
    }

    /** Special form evaluation (example, don't eval the arguments first) */
    protected NodeValue evalSpecial(Binding binding, FunctionEnv env) { return null ; }

    @Override
    final public NodeValue eval(Binding binding, FunctionEnv env)
    {
        NodeValue s = evalSpecial(binding, env) ;
        if ( s != null )
            return s ;

        List<NodeValue> argsEval = new ArrayList<>() ;
        for ( int i = 1 ; i <= numArgs() ; i++ )
        {
            NodeValue x = eval(binding, env, getArg(i)) ;
            argsEval.add(x) ;
        }
        return eval(argsEval, env) ;
    }

    public NodeValue eval(List<NodeValue> args, FunctionEnv env) { return eval(args) ; }

    public abstract NodeValue eval(List<NodeValue> args) ;

    public abstract Expr copy(ExprList newArgs) ;

    @Override
    public void visit(ExprVisitor visitor) { visitor.visit(this) ; }
    public Expr apply(ExprTransform transform, ExprList exprList) { return transform.transform(this, exprList) ; }

}


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

using bstrkr.mvvm.viewmodels;

using Cirrious.CrossCore.UI;
using Cirrious.MvvmCross.Plugins.Visibility;

namespace bstrkr.mvvm.converters
{
    public class RouteVehicleVMStateToVisibilityConverter : MvxBaseVisibilityValueConverter<RouteVehicleVMStates>
    {
        private enum UIParts
        {
            Progress,
            Station,
            Time,
            NoDataText
        }

        private IDictionary<RouteVehicleVMStates, IList<UIParts>> _map;

        public RouteVehicleVMStateToVisibilityConverter()
        {
            _map = new Dictionary<RouteVehicleVMStates, IList<UIParts>>
            {
                { RouteVehicleVMStates.Start, new List<UIParts> { UIParts.NoDataText }},
                { RouteVehicleVMStates.Loading, new List<UIParts> { UIParts.Progress }},
                { RouteVehicleVMStates.ForecastReceived, new List<UIParts> { UIParts.Station, UIParts.Time }},
                { RouteVehicleVMStates.NoForecast, new List<UIParts> { UIParts.NoDataText }}
            };
        }

        protected override MvxVisibility Convert(RouteVehicleVMStates value, object parameter, CultureInfo culture)
        {
            if (parameter == null)
            {
                return MvxVisibility.Visible;
            }

            UIParts uiPart;
            if (!Enum.TryParse(parameter.ToString(), out uiPart))
            {
                return MvxVisibility.Visible;
            }

            return _map[value].Contains(uiPart) ? MvxVisibility.Visible : MvxVisibility.Collapsed;
        }
    }
}


text:
<?php

namespace GapOrm\Exceptions;

class ProfilerParamsNotExistsException extends \RuntimeException {}


text:
package org.apereo.portal.concurrency.locking;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apereo.portal.concurrency.IEntityLockService;
import org.apereo.portal.concurrency.IEntityLockServiceFactory;
import org.apereo.portal.concurrency.LockingException;

/**
 * Creates the reference implemetation of IEntityLockService.
 *
 * @author Dan Ellentuck
 */
public class ReferenceEntityLockServiceFactory implements IEntityLockServiceFactory {
    private static final Log log = LogFactory.getLog(ReferenceEntityLockServiceFactory.class);
    /** ReferenceEntityLockServiceFactory constructor. */
    public ReferenceEntityLockServiceFactory() {
        super();
    }
    /**
     * Return an instance of the service implementation.
     *
     * @return org.apereo.portal.concurrency.locking.IEntityLockService
     * @exception LockingException
     */
    public IEntityLockService newLockService() throws LockingException {
        try {
            return ReferenceEntityLockService.singleton();
        } catch (LockingException le) {
            log.error("ReferenceEntityLockServiceFactory.newLockService(): " + le);
            throw new LockingException(le);
        }
    }
}


text:
namespace Microsoft.Azure.Management.CustomerInsights
{
    using Azure;
    using Management;
    using Rest;
    using Rest.Azure;
    using Models;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// Extension methods for RelationshipsOperations.
    /// </summary>
    public static partial class RelationshipsOperationsExtensions
    {
            /// <summary>
            /// Creates a relationship or updates an existing relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the Relationship.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the CreateOrUpdate Relationship operation.
            /// </param>
            public static RelationshipResourceFormat CreateOrUpdate(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, RelationshipResourceFormat parameters)
            {
                return operations.CreateOrUpdateAsync(resourceGroupName, hubName, relationshipName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates a relationship or updates an existing relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the Relationship.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the CreateOrUpdate Relationship operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<RelationshipResourceFormat> CreateOrUpdateAsync(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, RelationshipResourceFormat parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hubName, relationshipName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets information about the specified relationship.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the relationship.
            /// </param>
            public static RelationshipResourceFormat Get(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName)
            {
                return operations.GetAsync(resourceGroupName, hubName, relationshipName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets information about the specified relationship.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the relationship.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<RelationshipResourceFormat> GetAsync(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, hubName, relationshipName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Deletes a relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the relationship.
            /// </param>
            public static void Delete(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName)
            {
                operations.DeleteAsync(resourceGroupName, hubName, relationshipName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Deletes a relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the relationship.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task DeleteAsync(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, CancellationToken cancellationToken = default(CancellationToken))
            {
                await operations.DeleteWithHttpMessagesAsync(resourceGroupName, hubName, relationshipName, null, cancellationToken).ConfigureAwait(false);
            }

            /// <summary>
            /// Gets all relationships in the hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            public static IPage<RelationshipResourceFormat> ListByHub(this IRelationshipsOperations operations, string resourceGroupName, string hubName)
            {
                return operations.ListByHubAsync(resourceGroupName, hubName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets all relationships in the hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<RelationshipResourceFormat>> ListByHubAsync(this IRelationshipsOperations operations, string resourceGroupName, string hubName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByHubWithHttpMessagesAsync(resourceGroupName, hubName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Creates a relationship or updates an existing relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the Relationship.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the CreateOrUpdate Relationship operation.
            /// </param>
            public static RelationshipResourceFormat BeginCreateOrUpdate(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, RelationshipResourceFormat parameters)
            {
                return operations.BeginCreateOrUpdateAsync(resourceGroupName, hubName, relationshipName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates a relationship or updates an existing relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the Relationship.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the CreateOrUpdate Relationship operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<RelationshipResourceFormat> BeginCreateOrUpdateAsync(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, RelationshipResourceFormat parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, hubName, relationshipName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Deletes a relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the relationship.
            /// </param>
            public static void BeginDelete(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName)
            {
                operations.BeginDeleteAsync(resourceGroupName, hubName, relationshipName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Deletes a relationship within a hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='hubName'>
            /// The name of the hub.
            /// </param>
            /// <param name='relationshipName'>
            /// The name of the relationship.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task BeginDeleteAsync(this IRelationshipsOperations operations, string resourceGroupName, string hubName, string relationshipName, CancellationToken cancellationToken = default(CancellationToken))
            {
                await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, hubName, relationshipName, null, cancellationToken).ConfigureAwait(false);
            }

            /// <summary>
            /// Gets all relationships in the hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static IPage<RelationshipResourceFormat> ListByHubNext(this IRelationshipsOperations operations, string nextPageLink)
            {
                return operations.ListByHubNextAsync(nextPageLink).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets all relationships in the hub.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<RelationshipResourceFormat>> ListByHubNextAsync(this IRelationshipsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByHubNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

    }
}