text:
<?php
require_once __DIR__ . '/../../../src/chapter03/question3.1/ThreeStackArray.php';

class ThreeStackArrayTest extends \PHPUnit\Framework\TestCase {

    public function testThreeStackArray() {
        $stack = new ThreeStackArray(30);
        $this->assertNull($stack->pop(0));
        $this->assertNull($stack->pop(1));
        $this->assertNull($stack->pop(2));
        $this->assertTrue($stack->isEmpty(0));
        $this->assertTrue($stack->isEmpty(1));
        $this->assertTrue($stack->isEmpty(2));
        $this->assertEquals(0, $stack->getSize(0));
        $this->assertEquals(0, $stack->getSize(1));
        $this->assertEquals(0, $stack->getSize(2));
        $this->assertEquals(10, $stack->getFreeSlotCount(0));
        $this->assertEquals(10, $stack->getFreeSlotCount(1));
        $this->assertEquals(10, $stack->getFreeSlotCount(2));

        $stack->push(1, 'apple');
        $this->assertFalse($stack->isEmpty(1));
        $this->assertEquals(1, $stack->getSize(1));
        $this->assertEquals(9, $stack->getFreeSlotCount(1));
        $stack->push(1, 'orange');
        $this->assertEquals(2, $stack->getSize(1));
        $this->assertEquals(8, $stack->getFreeSlotCount(1));
        $stack->push(1, 'banana');
        $this->assertEquals(3, $stack->getSize(1));
        $this->assertEquals(7, $stack->getFreeSlotCount(1));

        $this->assertEquals(3, $stack->getTotal());

        $stack->push(0, 'dog');
        $this->assertFalse($stack->isEmpty(0));
        $this->assertEquals(1, $stack->getSize(0));
        $this->assertEquals(9, $stack->getFreeSlotCount(0));
        $stack->push(0, 'cat');
        $this->assertEquals(2, $stack->getSize(0));
        $this->assertEquals(8, $stack->getFreeSlotCount(0));
        $stack->push(0, 'fish');
        $this->assertEquals(3, $stack->getSize(0));
        $this->assertEquals(7, $stack->getFreeSlotCount(0));

        $this->assertEquals(6, $stack->getTotal());

        // remove every value from stack 1
        $this->assertEquals('banana', $stack->pop(1));
        $this->assertEquals(2, $stack->getSize(1));
        $this->assertEquals(8, $stack->getFreeSlotCount(1));
        $this->assertEquals('orange', $stack->pop(1));
        $this->assertEquals(1, $stack->getSize(1));
        $this->assertEquals(9, $stack->getFreeSlotCount(1));
        $this->assertEquals('apple', $stack->pop(1));
        $this->assertTrue($stack->isEmpty(1));
        $this->assertEquals(0, $stack->getSize(1));
        $this->assertEquals(10, $stack->getFreeSlotCount(1));
        $this->assertNull($stack->pop(1));

        $this->assertEquals(3, $stack->getTotal());

        // add new values to stack 1
        $stack->push(1, 'grape');
        $this->assertFalse($stack->isEmpty(1));
        $this->assertEquals(1, $stack->getSize(1));
        $this->assertEquals(9, $stack->getFreeSlotCount(1));
        $stack->push(1, 'kiwi');
        $this->assertEquals(2, $stack->getSize(1));
        $this->assertEquals(8, $stack->getFreeSlotCount(1));
        $stack->push(1, 'lemon');
        $this->assertEquals(3, $stack->getSize(1));
        $this->assertEquals(7, $stack->getFreeSlotCount(1));

        $this->assertEquals(6, $stack->getTotal());

        $stack->push(2, 'onion');
        $this->assertEquals(9, $stack->getFreeSlotCount(2));
        $stack->push(2, 'carrot');
        $this->assertEquals(8, $stack->getFreeSlotCount(2));
        $stack->push(2, 'celery');
        $this->assertEquals(7, $stack->getFreeSlotCount(2));
        $stack->push(2, 'kale');
        $this->assertEquals(6, $stack->getFreeSlotCount(2));
        $stack->push(2, 'cabbage');
        $this->assertEquals(5, $stack->getFreeSlotCount(2));
        $stack->push(2, 'eggplant');
        $this->assertEquals(4, $stack->getFreeSlotCount(2));
        $stack->push(2, 'zucchini');
        $this->assertEquals(3, $stack->getFreeSlotCount(2));
        $stack->push(2, 'spinach');
        $this->assertEquals(2, $stack->getFreeSlotCount(2));
        $stack->push(2, 'broccoli');
        $this->assertEquals(1, $stack->getFreeSlotCount(2));
        $stack->push(2, 'cauliflower');
        $this->assertEquals(0, $stack->getFreeSlotCount(2));

        $this->assertEquals(16, $stack->getTotal());

        // this will run into the end of the array, forcing an adjustment
        $stack->push(2, 'corn');
        $this->assertEquals(11, $stack->getSize(2));
        $stack->push(2, 'beet');
        $this->assertEquals(12, $stack->getSize(2));
        $stack->push(2, 'lettuce');
        $this->assertEquals(13, $stack->getSize(2));
        $stack->push(2, 'radicchio');
        $this->assertEquals(14, $stack->getSize(2));
        $stack->push(2, 'okra');
        $this->assertEquals(15, $stack->getSize(2));
        $stack->push(2, 'turnip');
        $this->assertEquals(16, $stack->getSize(2));
        $stack->push(2, 'cucumber');
        $this->assertEquals(17, $stack->getSize(2));
        $stack->push(2, 'artichoke');
        $this->assertEquals(18, $stack->getSize(2));
        $stack->push(2, 'tomato');
        $this->assertEquals(19, $stack->getSize(2));

        $this->assertEquals(25, $stack->getTotal());

        $stack->push(0, 'pig');
        $this->assertEquals(4, $stack->getSize(0));
        $stack->push(0, 'lizard');
        $this->assertEquals(5, $stack->getSize(0));
        $stack->push(0, 'mouse');
        $this->assertEquals(6, $stack->getSize(0));
        $stack->push(0, 'monkey');
        $this->assertEquals(7, $stack->getSize(0));
        $stack->push(0, 'rabbit');
        $this->assertEquals(8, $stack->getSize(0));

        $this->assertEquals(30, $stack->getTotal());

        $this->assertEquals('rabbit', $stack->pop(0));
        $this->assertEquals('monkey', $stack->pop(0));
        $this->assertEquals('mouse', $stack->pop(0));
        $this->assertEquals('lizard', $stack->pop(0));
        $this->assertEquals('pig', $stack->pop(0));
        $this->assertEquals('fish', $stack->pop(0));
        $this->assertEquals('cat', $stack->pop(0));
        $this->assertEquals('dog', $stack->pop(0));
        $this->assertNull($stack->pop(0));

        $this->assertEquals(22, $stack->getTotal());

        $this->assertEquals('lemon', $stack->pop(1));
        $this->assertEquals('kiwi', $stack->pop(1));
        $this->assertEquals('grape', $stack->pop(1));
        $this->assertNull($stack->pop(1));

        $this->assertEquals(19, $stack->getTotal());

        $this->assertEquals('tomato', $stack->pop(2));
        $this->assertEquals('artichoke', $stack->pop(2));
        $this->assertEquals('cucumber', $stack->pop(2));
        $this->assertEquals('turnip', $stack->pop(2));
        $this->assertEquals('okra', $stack->pop(2));
        $this->assertEquals('radicchio', $stack->pop(2));
        $this->assertEquals('lettuce', $stack->pop(2));
        $this->assertEquals('beet', $stack->pop(2));
        $this->assertEquals('corn', $stack->pop(2));
        $this->assertEquals('cauliflower', $stack->pop(2));
        $this->assertEquals('broccoli', $stack->pop(2));
        $this->assertEquals('spinach', $stack->pop(2));
        $this->assertEquals('zucchini', $stack->pop(2));
        $this->assertEquals('eggplant', $stack->pop(2));
        $this->assertEquals('cabbage', $stack->pop(2));
        $this->assertEquals('kale', $stack->pop(2));
        $this->assertEquals('celery', $stack->pop(2));
        $this->assertEquals('carrot', $stack->pop(2));
        $this->assertEquals('onion', $stack->pop(2));
        $this->assertNull($stack->pop(2));

        $this->assertEquals(0, $stack->getTotal());
    }

    public function testOverflow() {
        $stack = new ThreeStackArray(3);
        $stack->push(0, 'a');
        $stack->push(1, 'b');
        $stack->push(2, 'c');
        $this->setExpectedException('RuntimeException');
        $stack->push(0, 'd');
    }
}


text:
"use strict";
/* tslint:disable */
var load_themed_styles_1 = require("@microsoft/load-themed-styles");
var styles = {};
load_themed_styles_1.loadStyles([{ "rawString": ".ms-BasicSpinnersExample .ms-Spinner{display:inline-block;margin:10px 0}" }]);
module.exports = styles;
/* tslint:enable */

//# sourceMappingURL=Spinner.Basic.Example.scss.js.map

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" ?>
<xliff version="1.0">
  <file orginal="global" source-language="en" datatype="plaintext">
    <body>
      <trans-unit id="">
        <source>Daily News (Lite)</source>
        <target>デイリーニュース (Lite)</target>
      </trans-unit>
      <trans-unit id="">
        <source>Notification of Friend Birthday (Lite)</source>
        <target>フレンド誕生日お知らせメール (Lite)</target>
      </trans-unit>
    </body>
  </file>
</xliff>


text:
<?php

// Tell header.php to use the admin template
define('PUN_ADMIN_CONSOLE', 1);
// Tell common.php that we don't want output buffering
define('PUN_DISABLE_BUFFERING', 1);

define('PUN_ROOT', dirname(__FILE__).'/');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'include/common_admin.php';

if ($pun_user['g_id'] != PUN_ADMIN)
	message($lang_common['No permission'], false, '403 Forbidden');

// Load the admin_maintenance.php language file
require PUN_ROOT.'lang/'.$admin_language.'/admin_maintenance.php';

$action = isset($_REQUEST['action']) ? pun_trim($_REQUEST['action']) : '';

if ($action == 'rebuild')
{
	$per_page = isset($_GET['i_per_page']) ? intval($_GET['i_per_page']) : 0;
	$start_at = isset($_GET['i_start_at']) ? intval($_GET['i_start_at']) : 0;

	// Check per page is > 0
	if ($per_page < 1)
		message($lang_admin_maintenance['Posts must be integer message']);

	@set_time_limit(0);

	// If this is the first cycle of posts we empty the search index before we proceed
	if (isset($_GET['i_empty_index']))
	{
		// This is the only potentially "dangerous" thing we can do here, so we check the referer
		confirm_referrer('admin_maintenance.php');

		$db->truncate_table('search_matches') or error('Unable to empty search index match table', __FILE__, __LINE__, $db->error());
		$db->truncate_table('search_words') or error('Unable to empty search index words table', __FILE__, __LINE__, $db->error());

		// Reset the sequence for the search words (not needed for SQLite)
		switch ($db_type)
		{
			case 'mysql':
			case 'mysqli':
			case 'mysql_innodb':
			case 'mysqli_innodb':
				$result = $db->query('ALTER TABLE '.$db->prefix.'search_words auto_increment=1') or error('Unable to update table auto_increment', __FILE__, __LINE__, $db->error());
				break;

			case 'pgsql';
				$result = $db->query('SELECT setval(\''.$db->prefix.'search_words_id_seq\', 1, false)') or error('Unable to update sequence', __FILE__, __LINE__, $db->error());
		}
	}

	$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_maintenance['Rebuilding search index']);

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

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo generate_page_title($page_title) ?></title>

<?php echo $lang_admin_maintenance['Rebuilding index info'] ?>

<?php

	$query_str = '';

	require PUN_ROOT.'include/search_idx.php';

	// Fetch posts to process this cycle
	$result = $db->query('SELECT p.id, p.message, t.subject, t.first_post_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id >= '.$start_at.' ORDER BY p.id ASC LIMIT '.$per_page) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());

	$end_at = 0;
	while ($cur_item = $db->fetch_assoc($result))
	{
		echo '
'.sprintf($lang_admin_maintenance['Processing post'], $cur_item['id']).'
'."\n";

		if ($cur_item['id'] == $cur_item['first_post_id'])
			update_search_index('post', $cur_item['id'], $cur_item['message'], $cur_item['subject']);
		else
			update_search_index('post', $cur_item['id'], $cur_item['message']);

		$end_at = $cur_item['id'];
	}

	// Check if there is more work to do
	if ($end_at > 0)
	{
		$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id > '.$end_at.' ORDER BY id ASC LIMIT 1') or error('Unable to fetch next ID', __FILE__, __LINE__, $db->error());

		if ($db->num_rows($result) > 0)
			$query_str = '?action=rebuild&i_per_page='.$per_page.'&i_start_at='.$db->result($result);
	}

	$db->end_transaction();
	$db->close();

	exit('<meta http-equiv="refresh" content="0;url=admin_maintenance.php'.$query_str.'" />

'.sprintf($lang_admin_maintenance['Javascript redirect failed'], ''.$lang_admin_maintenance['Click here'].'').'
');
}

if ($action == 'prune')
{
	$prune_from = pun_trim($_POST['prune_from']);
	$prune_sticky = intval($_POST['prune_sticky']);

	if (isset($_POST['prune_comply']))
	{
		confirm_referrer('admin_maintenance.php');

		$prune_days = intval($_POST['prune_days']);
		$prune_date = ($prune_days) ? time() - ($prune_days * 86400) : -1;

		@set_time_limit(0);

		if ($prune_from == 'all')
		{
			$result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
			$num_forums = $db->num_rows($result);

			for ($i = 0; $i < $num_forums; ++$i)
			{
				$fid = $db->result($result, $i);

				prune($fid, $prune_sticky, $prune_date);
				update_forum($fid);
			}
		}
		else
		{
			$prune_from = intval($prune_from);
			prune($prune_from, $prune_sticky, $prune_date);
			update_forum($prune_from);
		}

		// Locate any "orphaned redirect topics" and delete them
		$result = $db->query('SELECT t1.id FROM '.$db->prefix.'topics AS t1 LEFT JOIN '.$db->prefix.'topics AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect topics', __FILE__, __LINE__, $db->error());
		$num_orphans = $db->num_rows($result);

		if ($num_orphans)
		{
			for ($i = 0; $i < $num_orphans; ++$i)
				$orphans[] = $db->result($result, $i);

			$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $orphans).')') or error('Unable to delete redirect topics', __FILE__, __LINE__, $db->error());
		}

		redirect('admin_maintenance.php', $lang_admin_maintenance['Posts pruned redirect']);
	}

	$prune_days = pun_trim($_POST['req_prune_days']);
	if ($prune_days == '' || preg_match('%[^0-9]%', $prune_days))
		message($lang_admin_maintenance['Days must be integer message']);

	$prune_date = time() - ($prune_days * 86400);

	// Concatenate together the query for counting number of topics to prune
	$sql = 'SELECT COUNT(id) FROM '.$db->prefix.'topics WHERE last_post<'.$prune_date.' AND moved_to IS NULL';

	if ($prune_sticky == '0')
		$sql .= ' AND sticky=0';

	if ($prune_from != 'all')
	{
		$prune_from = intval($prune_from);
		$sql .= ' AND forum_id='.$prune_from;

		// Fetch the forum name (just for cosmetic reasons)
		$result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error());
		$forum = '"'.pun_htmlspecialchars($db->result($result)).'"';
	}
	else
		$forum = $lang_admin_maintenance['All forums'];

	$result = $db->query($sql) or error('Unable to fetch topic prune count', __FILE__, __LINE__, $db->error());
	$num_topics = $db->result($result);

	if (!$num_topics)
		message(sprintf($lang_admin_maintenance['No old topics message'], $prune_days));

	$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Prune']);
	define('PUN_ACTIVE_PAGE', 'admin');
	require PUN_ROOT.'header.php';

	generate_admin_menu('maintenance');

?>

<?php echo $lang_admin_maintenance['Prune head'] ?>

			<form method="post" action="admin_maintenance.php">

					<input type="hidden" name="action" value="prune" />
					<input type="hidden" name="prune_days" value="<?php echo $prune_days ?>" />
					<input type="hidden" name="prune_sticky" value="<?php echo $prune_sticky ?>" />
					<input type="hidden" name="prune_from" value="<?php echo $prune_from ?>" />
					<fieldset>
						<legend><?php echo $lang_admin_maintenance['Confirm prune subhead'] ?></legend>

<?php printf($lang_admin_maintenance['Confirm prune info'], $prune_days, $forum, forum_number_format($num_topics)) ?>

<?php echo $lang_admin_maintenance['Confirm prune warn'] ?>

					</fieldset>

<input type="submit" name="prune_comply" value="<?php echo $lang_admin_common['Prune'] ?>" /><?php echo $lang_admin_common['Go back'] ?>

			</form>

<?php

	require PUN_ROOT.'footer.php';
	exit;
}

// Get the first post ID from the db
$result = $db->query('SELECT id FROM '.$db->prefix.'posts ORDER BY id ASC LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
	$first_id = $db->result($result);

$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Maintenance']);
define('PUN_ACTIVE_PAGE', 'admin');
require PUN_ROOT.'header.php';

generate_admin_menu('maintenance');

?>

<?php echo $lang_admin_maintenance['Maintenance head'] ?>

			<form method="get" action="admin_maintenance.php">

					<input type="hidden" name="action" value="rebuild" />
					<fieldset>
						<legend><?php echo $lang_admin_maintenance['Rebuild index subhead'] ?></legend>

<?php printf($lang_admin_maintenance['Rebuild index info'], ''.$lang_admin_common['Maintenance mode'].'') ?>

									<?php echo $lang_admin_maintenance['Posts per cycle label'] ?>

										<input type="text" name="i_per_page" size="7" maxlength="7" value="300" tabindex="1" />
										<?php echo $lang_admin_maintenance['Posts per cycle help'] ?>

									<?php echo $lang_admin_maintenance['Starting post label'] ?>

										<input type="text" name="i_start_at" size="7" maxlength="7" value="<?php echo (isset($first_id)) ? $first_id : 0 ?>" tabindex="2" />
										<?php echo $lang_admin_maintenance['Starting post help'] ?>

									<?php echo $lang_admin_maintenance['Empty index label'] ?>

										<input type="checkbox" name="i_empty_index" value="1" tabindex="3" checked="checked" />  <?php echo $lang_admin_maintenance['Empty index help'] ?>

<?php echo $lang_admin_maintenance['Rebuild completed info'] ?>

<input type="submit" name="rebuild_index" value="<?php echo $lang_admin_maintenance['Rebuild index'] ?>" tabindex="4" />

					</fieldset>

			</form>

			<form method="post" action="admin_maintenance.php" onsubmit="return process_form(this)">

					<input type="hidden" name="action" value="prune" />
					<fieldset>
						<legend><?php echo $lang_admin_maintenance['Prune subhead'] ?></legend>

									<?php echo $lang_admin_maintenance['Days old label'] ?>

										<input type="text" name="req_prune_days" size="3" maxlength="3" tabindex="5" />
										<?php echo $lang_admin_maintenance['Days old help'] ?>

									<?php echo $lang_admin_maintenance['Prune sticky label'] ?>

										<input type="radio" name="prune_sticky" value="1" tabindex="6" checked="checked" /> <?php echo $lang_admin_common['Yes'] ?>
										<input type="radio" name="prune_sticky" value="0" /> <?php echo $lang_admin_common['No'] ?>
										<?php echo $lang_admin_maintenance['Prune sticky help'] ?>

									<?php echo $lang_admin_maintenance['Prune from label'] ?>

										<select name="prune_from" tabindex="7">
											<option value="all"><?php echo $lang_admin_maintenance['All forums'] ?></option>
<?php

	$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

	$cur_category = 0;
	while ($forum = $db->fetch_assoc($result))
	{
		if ($forum['cid'] != $cur_category) // Are we still in the same category?
		{
			if ($cur_category)
				echo "\t\t\t\t\t\t\t\t\t\t\t".'</optgroup>'."\n";

			echo "\t\t\t\t\t\t\t\t\t\t\t".'<optgroup label="'.pun_htmlspecialchars($forum['cat_name']).'">'."\n";
			$cur_category = $forum['cid'];
		}

		echo "\t\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$forum['fid'].'">'.pun_htmlspecialchars($forum['forum_name']).'</option>'."\n";
	}

?>
											</optgroup>
										</select>
										<?php echo $lang_admin_maintenance['Prune from help'] ?>

<?php printf($lang_admin_maintenance['Prune info'], ''.$lang_admin_common['Maintenance mode'].'') ?>

<input type="submit" name="prune" value="<?php echo $lang_admin_common['Prune'] ?>" tabindex="8" />

					</fieldset>

			</form>

<?php

require PUN_ROOT.'footer.php';


text:
package com.citrix.netscaler.nitro.resource.config.network;

import com.citrix.netscaler.nitro.resource.base.*;
import com.citrix.netscaler.nitro.service.nitro_service;
import com.citrix.netscaler.nitro.service.options;
import com.citrix.netscaler.nitro.util.*;
import com.citrix.netscaler.nitro.exception.nitro_exception;

class nd6_response extends base_response
{
	public nd6[] nd6;
}
/**
* Configuration for nd6 resource.
*/

public class nd6 extends base_resource
{
	private String neighbor;
	private String mac;
	private String ifnum;
	private Integer vlan;
	private Long td;

	//------- Read only Parameter ---------;

	private String state;
	private Long timeout;
	private Long flags;
	private Long channel;
	private Long __count;

	/**
	*

	* Link-local IPv6 address of the adjacent network device to add to the ND6 table.
	*

	*/
	public void set_neighbor(String neighbor) throws Exception{
		this.neighbor = neighbor;
	}

	/**
	*

	* Link-local IPv6 address of the adjacent network device to add to the ND6 table.
	*

	*/
	public String get_neighbor() throws Exception {
		return this.neighbor;
	}

	/**
	*

	* MAC address of the adjacent network device.
	*

	*/
	public void set_mac(String mac) throws Exception{
		this.mac = mac;
	}

	/**
	*

	* MAC address of the adjacent network device.
	*

	*/
	public String get_mac() throws Exception {
		return this.mac;
	}

	/**
	*

	* Interface through which the adjacent network device is available, specified in slot/port notation (for example, 1/3). Use spaces to separate multiple entries.
	*

	*/
	public void set_ifnum(String ifnum) throws Exception{
		this.ifnum = ifnum;
	}

	/**
	*

	* Interface through which the adjacent network device is available, specified in slot/port notation (for example, 1/3). Use spaces to separate multiple entries.
	*

	*/
	public String get_ifnum() throws Exception {
		return this.ifnum;
	}

	/**
	*

	* Integer value that uniquely identifies the VLAN on which the adjacent network device exists.
 Minimum value =  1
 Maximum value =  4094
	*

	*/
	public void set_vlan(int vlan) throws Exception {
		this.vlan = new Integer(vlan);
	}

	/**
	*

	* Integer value that uniquely identifies the VLAN on which the adjacent network device exists.
 Minimum value =  1
 Maximum value =  4094
	*

	*/
	public void set_vlan(Integer vlan) throws Exception{
		this.vlan = vlan;
	}

	/**
	*

	* Integer value that uniquely identifies the VLAN on which the adjacent network device exists.
 Minimum value =  1
 Maximum value =  4094
	*

	*/
	public Integer get_vlan() throws Exception {
		return this.vlan;
	}

	/**
	*

	* Traffic Domain Id.
 Minimum value =  0
 Maximum value =  4094
	*

	*/
	public void set_td(long td) throws Exception {
		this.td = new Long(td);
	}

	/**
	*

	* Traffic Domain Id.
 Minimum value =  0
 Maximum value =  4094
	*

	*/
	public void set_td(Long td) throws Exception{
		this.td = td;
	}

	/**
	*

	* Traffic Domain Id.
 Minimum value =  0
 Maximum value =  4094
	*

	*/
	public Long get_td() throws Exception {
		return this.td;
	}

	/**
	*

	* ND6 state.
 Default value: REACHABLE
 Possible values = INCOMPLETE, REACHABLE, STALE, DELAY, PROBE
	*

	*/
	public String get_state() throws Exception {
		return this.state;
	}

	/**
	*

	* Time elapsed.
	*

	*/
	public Long get_timeout() throws Exception {
		return this.timeout;
	}

	/**
	*

	* flag for static/permanent entry.
	*

	*/
	public Long get_flags() throws Exception {
		return this.flags;
	}

	/**
	*

	* The tunnel that is bound to a netbridge.
	*

	*/
	public Long get_channel() throws Exception {
		return this.channel;
	}

	/**
	*

	* converts nitro response into object and returns the object array in case of get request.
	*

	*/
	protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception{
		nd6_response result = (nd6_response) service.get_payload_formatter().string_to_resource(nd6_response.class, response);
		if(result.errorcode != 0) {
			if (result.errorcode == 444) {
				service.clear_session();
			}
			if(result.severity != null)
			{
				if (result.severity.equals("ERROR"))
					throw new nitro_exception(result.message,result.errorcode);
			}
			else
			{
				throw new nitro_exception(result.message,result.errorcode);
			}
		}
		return result.nd6;
	}

	/**
	*

	* Returns the value of object identifier argument
	*

	*/

	protected String get_object_name() {
		return this.neighbor;
	}

	/**
	* Use this API to add nd6.
	*/
	public static base_response add(nitro_service client, nd6 resource) throws Exception {
		nd6 addresource = new nd6();
		addresource.neighbor = resource.neighbor;
		addresource.mac = resource.mac;
		addresource.ifnum = resource.ifnum;
		addresource.vlan = resource.vlan;
		addresource.td = resource.td;
		return addresource.add_resource(client);
	}

	/**
	* Use this API to add nd6 resources.
	*/
	public static base_responses add(nitro_service client, nd6 resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			nd6 addresources[] = new nd6[resources.length];
			for (int i=0;i<resources.length;i++){
				addresources[i] = new nd6();
				addresources[i].neighbor = resources[i].neighbor;
				addresources[i].mac = resources[i].mac;
				addresources[i].ifnum = resources[i].ifnum;
				addresources[i].vlan = resources[i].vlan;
				addresources[i].td = resources[i].td;
			}
			result = add_bulk_request(client, addresources);
		}
		return result;
	}

	/**
	* Use this API to clear nd6.
	*/
	public static base_response clear(nitro_service client) throws Exception {
		nd6 clearresource = new nd6();
		return clearresource.perform_operation(client,"clear");
	}

	/**
	* Use this API to clear nd6 resources.
	*/
	public static base_responses clear(nitro_service client, nd6 resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			nd6 clearresources[] = new nd6[resources.length];
			for (int i=0;i<resources.length;i++){
				clearresources[i] = new nd6();
			}
			result = perform_operation_bulk_request(client, clearresources,"clear");
		}
		return result;
	}

	/**
	* Use this API to delete nd6 of given name.
	*/
	public static base_response delete(nitro_service client, String neighbor) throws Exception {
		nd6 deleteresource = new nd6();
		deleteresource.neighbor = neighbor;
		return deleteresource.delete_resource(client);
	}

	/**
	* Use this API to delete nd6.
	*/
	public static base_response delete(nitro_service client, nd6 resource) throws Exception {
		nd6 deleteresource = new nd6();
		deleteresource.neighbor = resource.neighbor;
		deleteresource.vlan = resource.vlan;
		deleteresource.td = resource.td;
		return deleteresource.delete_resource(client);
	}

	/**
	* Use this API to delete nd6 resources of given names.
	*/
	public static base_responses delete(nitro_service client, String neighbor[]) throws Exception {
		base_responses result = null;
		if (neighbor != null && neighbor.length > 0) {
			nd6 deleteresources[] = new nd6[neighbor.length];
			for (int i=0;i<neighbor.length;i++){
				deleteresources[i] = new nd6();
				deleteresources[i].neighbor = neighbor[i];
			}
			result = delete_bulk_request(client, deleteresources);
		}
		return result;
	}

	/**
	* Use this API to delete nd6 resources.
	*/
	public static base_responses delete(nitro_service client, nd6 resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			nd6 deleteresources[] = new nd6[resources.length];
			for (int i=0;i<resources.length;i++){
				deleteresources[i] = new nd6();
				deleteresources[i].neighbor = resources[i].neighbor;
				deleteresources[i].vlan = resources[i].vlan;
				deleteresources[i].td = resources[i].td;
			}
			result = delete_bulk_request(client, deleteresources);
		}
		return result;
	}

	/**
	* Use this API to fetch all the nd6 resources that are configured on netscaler.
	*/
	public static nd6[] get(nitro_service service) throws Exception{
		nd6 obj = new nd6();
		nd6[] response = (nd6[])obj.get_resources(service);
		return response;
	}
	/**
	* Use this API to fetch all the nd6 resources that are configured on netscaler.
	*/
	public static nd6[] get(nitro_service service, options option) throws Exception{
		nd6 obj = new nd6();
		nd6[] response = (nd6[])obj.get_resources(service,option);
		return response;
	}
	/**
	* Use this API to fetch a nd6 resource.
	*/
	public static nd6 get(nitro_service service, nd6 obj) throws Exception{
		options option = new options();
		option.set_args(nitro_util.object_to_string_withoutquotes(obj));
		nd6 response = (nd6) obj.get_resource(service,option);
		return response;
	}

	/**
	* Use this API to fetch a nd6 resources.
	*/
	public static nd6[] get(nitro_service service, nd6 obj[]) throws Exception{
		if (obj != null && obj.length > 0) {
			nd6 response[] = new nd6[obj.length];
			for (int i=0;i<obj.length;i++) {
				options option = new options();
				option.set_args(nitro_util.object_to_string_withoutquotes(obj[i]));
				response[i] = (nd6) obj[i].get_resource(service,option);
			}
			return response;
		}
		return null;
	}
	/**
	* Use this API to fetch filtered set of nd6 resources.
	* filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
	*/
	public static nd6[] get_filtered(nitro_service service, String filter) throws Exception{
		nd6 obj = new nd6();
		options option = new options();
		option.set_filter(filter);
		nd6[] response = (nd6[]) obj.getfiltered(service, option);
		return response;
	}

	/**
	* Use this API to fetch filtered set of nd6 resources.
	* set the filter parameter values in filtervalue object.
	*/
	public static nd6[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
		nd6 obj = new nd6();
		options option = new options();
		option.set_filter(filter);
		nd6[] response = (nd6[]) obj.getfiltered(service, option);
		return response;
	}

	/**
	* Use this API to count the nd6 resources configured on NetScaler.
	*/
	public static long count(nitro_service service) throws Exception{
		nd6 obj = new nd6();
		options option = new options();
		option.set_count(true);
		nd6[] response = (nd6[])obj.get_resources(service, option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}

	/**
	* Use this API to count filtered the set of nd6 resources.
	* filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
	*/
	public static long count_filtered(nitro_service service, String filter) throws Exception{
		nd6 obj = new nd6();
		options option = new options();
		option.set_count(true);
		option.set_filter(filter);
		nd6[] response = (nd6[]) obj.getfiltered(service, option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}

	/**
	* Use this API to count the filtered set of nd6 resources.
	* set the filter parameter values in filtervalue object.
	*/
	public static long count_filtered(nitro_service service, filtervalue[] filter) throws Exception{
		nd6 obj = new nd6();
		options option = new options();
		option.set_count(true);
		option.set_filter(filter);
		nd6[] response = (nd6[]) obj.getfiltered(service, option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}

	public static class stateEnum {
		public static final String INCOMPLETE = "INCOMPLETE";
		public static final String REACHABLE = "REACHABLE";
		public static final String STALE = "STALE";
		public static final String DELAY = "DELAY";
		public static final String PROBE = "PROBE";
	}
}


text:
const chai = require('chai');

const expect = chai.expect;

module.exports = { expect };


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ICA_SVP.MachineLearning
{
    public class ClassificationListenerPrinter : IClassificationListener
    {
        public void onClassification(String stimulus,String leftEyeLabel,String rightEyeLabel,int portion)
        {
            Console.WriteLine("WEKA -> " + stimulus + "-> " + leftEyeLabel + ":" + rightEyeLabel + "  ->>>" + portion);
        }
    }
}


text:
package org.kuali.rice.krad.web.form;

import org.kuali.rice.krad.maintenance.MaintenanceDocument;
import org.kuali.rice.krad.uif.UifConstants.ViewType;

/**
 * Form class for MaintenanceView screens
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class MaintenanceForm extends DocumentFormBase {
	private static final long serialVersionUID = -5805825500852498048L;

	protected String dataObjectClassName;
	protected String maintenanceAction;

	public MaintenanceForm() {
		super();
		setViewTypeName(ViewType.MAINTENANCE);
	}

	@Override
	public MaintenanceDocument getDocument() {
		return (MaintenanceDocument) super.getDocument();
	}

	// This is to provide a setter with matching type to
	// public MaintenanceDocument getDocument() so that no
	// issues occur with spring 3.1-M2 bean wrappers
	public void setDocument(MaintenanceDocument document) {
	    super.setDocument(document);
	}

	public String getDataObjectClassName() {
		return this.dataObjectClassName;
	}

	public void setDataObjectClassName(String dataObjectClassName) {
		this.dataObjectClassName = dataObjectClassName;
	}

	public String getMaintenanceAction() {
		return this.maintenanceAction;
	}

	public void setMaintenanceAction(String maintenanceAction) {
		this.maintenanceAction = maintenanceAction;
	}

}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Molarity.Hosting
{
    class HttpNodeInfo
    {
        private readonly Dictionary<string, HttpNodeInfo> _children = new Dictionary<string, HttpNodeInfo>();
        private MolarityService _service;
        public HttpNodeInfo()
        {

        }

        public HttpNodeInfo(string name)
        {
            this.Name = name;
        }
        public string Name { get; private set; }
        public IDictionary<string, HttpNodeInfo> Children { get { return _children; } }

        public MolarityService Service
        {
            get { return _service; }
            set
            {
                if (value != null && _service != null)
                {
                    throw new Exception("Service already set");
                }
                _service = value;
            }
        }
    }
}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/spanner/v1/spanner.proto

namespace Google\Spanner\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
 *
 * Generated from protobuf message google.spanner.v1.BeginTransactionRequest
 */
class BeginTransactionRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The session in which the transaction runs.
     *
     * Generated from protobuf field string session = 1;
     */
    private $session = '';
    /**
     * Required. Options for the new transaction.
     *
     * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2;
     */
    private $options = null;

    public function __construct() {
        \GPBMetadata\Google\Spanner\V1\Spanner::initOnce();
        parent::__construct();
    }

    /**
     * Required. The session in which the transaction runs.
     *
     * Generated from protobuf field string session = 1;
     * @return string
     */
    public function getSession()
    {
        return $this->session;
    }

    /**
     * Required. The session in which the transaction runs.
     *
     * Generated from protobuf field string session = 1;
     * @param string $var
     * @return $this
     */
    public function setSession($var)
    {
        GPBUtil::checkString($var, True);
        $this->session = $var;

        return $this;
    }

    /**
     * Required. Options for the new transaction.
     *
     * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2;
     * @return \Google\Spanner\V1\TransactionOptions
     */
    public function getOptions()
    {
        return $this->options;
    }

    /**
     * Required. Options for the new transaction.
     *
     * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2;
     * @param \Google\Spanner\V1\TransactionOptions $var
     * @return $this
     */
    public function setOptions($var)
    {
        GPBUtil::checkMessage($var, \Google\Spanner\V1\TransactionOptions::class);
        $this->options = $var;

        return $this;
    }

}


text:
package org.apache.hadoop.yarn.server.resourcemanager.reservation.planning;

import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.api.records.ReservationRequest;
import org.apache.hadoop.yarn.api.records.ReservationRequestInterpreter;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.Plan;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationAllocation;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationInterval;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.exceptions.ContractValidationException;
import org.apache.hadoop.yarn.util.resource.Resources;

/**
 * A planning algorithm consisting of two main phases. The algorithm iterates
 * over the job stages in descending order. For each stage, the algorithm: 1.
 * Determines an interval [stageArrivalTime, stageDeadline) in which the stage
 * is allocated. 2. Computes an allocation for the stage inside the interval.
 *
 * For ANY and ALL jobs, phase 1 sets the allocation window of each stage to be
 * [jobArrival, jobDeadline]. For ORDER and ORDER_NO_GAP jobs, the deadline of
 * each stage is set as succcessorStartTime - the starting time of its
 * succeeding stage (or jobDeadline if it is the last stage).
 *
 * The phases are set using the two functions: 1. setAlgEarliestStartTime 2.
 * setAlgComputeStageAllocation
 */
public class IterativePlanner extends PlanningAlgorithm {

  // Modifications performed by the algorithm that are not been reflected in the
  // actual plan while a request is still pending.
  private RLESparseResourceAllocation planModifications;

  // Data extracted from plan
  private Map<Long, Resource> planLoads;
  private Resource capacity;
  private long step;

  // Job parameters
  private ReservationRequestInterpreter jobType;
  private long jobArrival;
  private long jobDeadline;

  // Phase algorithms
  private StageEarliestStart algStageEarliestStart = null;
  private StageAllocator algStageAllocator = null;

  // Constructor
  public IterativePlanner(StageEarliestStart algEarliestStartTime,
      StageAllocator algStageAllocator) {

    setAlgStageEarliestStart(algEarliestStartTime);
    setAlgStageAllocator(algStageAllocator);

  }

  @Override
  public RLESparseResourceAllocation computeJobAllocation(Plan plan,
      ReservationId reservationId, ReservationDefinition reservation)
      throws ContractValidationException {

    // Initialize
    initialize(plan, reservation);

    // If the job has been previously reserved, logically remove its allocation
    ReservationAllocation oldReservation =
        plan.getReservationById(reservationId);
    if (oldReservation != null) {
      ignoreOldAllocation(oldReservation);
    }

    // Create the allocations data structure
    RLESparseResourceAllocation allocations =
        new RLESparseResourceAllocation(plan.getResourceCalculator());

    // Get a reverse iterator for the set of stages
    ListIterator<ReservationRequest> li =
        reservation
            .getReservationRequests()
            .getReservationResources()
            .listIterator(
                reservation.getReservationRequests().getReservationResources()
                    .size());

    // Current stage
    ReservationRequest currentReservationStage;

    // Index, points on the current node
    int index =
        reservation.getReservationRequests().getReservationResources().size();

    // Stage deadlines
    long stageDeadline = stepRoundDown(reservation.getDeadline(), step);
    long successorStartingTime = -1;

    // Iterate the stages in reverse order
    while (li.hasPrevious()) {

      // Get current stage
      currentReservationStage = li.previous();
      index -= 1;

      // Validate that the ReservationRequest respects basic constraints
      validateInputStage(plan, currentReservationStage);

      // Compute an adjusted earliestStart for this resource
      // (we need this to provision some space for the ORDER contracts)
      long stageArrivalTime = reservation.getArrival();
      if (jobType == ReservationRequestInterpreter.R_ORDER
          || jobType == ReservationRequestInterpreter.R_ORDER_NO_GAP) {
        stageArrivalTime =
            computeEarliestStartingTime(plan, reservation, index,
                currentReservationStage, stageDeadline);
      }
      stageArrivalTime = stepRoundUp(stageArrivalTime, step);
      stageArrivalTime = Math.max(stageArrivalTime, reservation.getArrival());

      // Compute the allocation of a single stage
      Map<ReservationInterval, Resource> curAlloc =
          computeStageAllocation(plan, currentReservationStage,
              stageArrivalTime, stageDeadline);

      // If we did not find an allocation, return NULL
      // (unless it's an ANY job, then we simply continue).
      if (curAlloc == null) {

        // If it's an ANY job, we can move to the next possible request
        if (jobType == ReservationRequestInterpreter.R_ANY) {
          continue;
        }

        // Otherwise, the job cannot be allocated
        return null;

      }

      // Get the start & end time of the current allocation
      Long stageStartTime = findEarliestTime(curAlloc.keySet());
      Long stageEndTime = findLatestTime(curAlloc.keySet());

      // If we did find an allocation for the stage, add it
      for (Entry<ReservationInterval, Resource> entry : curAlloc.entrySet()) {
        allocations.addInterval(entry.getKey(), entry.getValue());
      }

      // If this is an ANY clause, we have finished
      if (jobType == ReservationRequestInterpreter.R_ANY) {
        break;
      }

      // If ORDER job, set the stageDeadline of the next stage to be processed
      if (jobType == ReservationRequestInterpreter.R_ORDER
          || jobType == ReservationRequestInterpreter.R_ORDER_NO_GAP) {

        // Verify that there is no gap, in case the job is ORDER_NO_GAP
        if (jobType == ReservationRequestInterpreter.R_ORDER_NO_GAP
            && successorStartingTime != -1
            && successorStartingTime > stageEndTime) {

          return null;

        }

        // Store the stageStartTime and set the new stageDeadline
        successorStartingTime = stageStartTime;
        stageDeadline = stageStartTime;

      }

    }

    // If the allocation is empty, return an error
    if (allocations.isEmpty()) {
      return null;
    }

    return allocations;

  }

  protected void initialize(Plan plan, ReservationDefinition reservation) {

    // Get plan step & capacity
    capacity = plan.getTotalCapacity();
    step = plan.getStep();

    // Get job parameters (type, arrival time & deadline)
    jobType = reservation.getReservationRequests().getInterpreter();
    jobArrival = stepRoundUp(reservation.getArrival(), step);
    jobDeadline = stepRoundDown(reservation.getDeadline(), step);

    // Dirty read of plan load
    planLoads = getAllLoadsInInterval(plan, jobArrival, jobDeadline);

    // Initialize the plan modifications
    planModifications =
        new RLESparseResourceAllocation(plan.getResourceCalculator());

  }

  private Map<Long, Resource> getAllLoadsInInterval(Plan plan, long startTime,
      long endTime) {

    // Create map
    Map<Long, Resource> loads = new HashMap<Long, Resource>();

    // Calculate the load for every time slot between [start,end)
    for (long t = startTime; t < endTime; t += step) {
      Resource load = plan.getTotalCommittedResources(t);
      loads.put(t, load);
    }

    // Return map
    return loads;

  }

  private void ignoreOldAllocation(ReservationAllocation oldReservation) {

    // If there is no old reservation, return
    if (oldReservation == null) {
      return;
    }

    // Subtract each allocation interval from the planModifications
    for (Entry<ReservationInterval, Resource> entry : oldReservation
        .getAllocationRequests().entrySet()) {

      // Read the entry
      ReservationInterval interval = entry.getKey();
      Resource resource = entry.getValue();

      // Find the actual request
      Resource negativeResource = Resources.multiply(resource, -1);

      // Insert it into planModifications as a 'negative' request, to
      // represent available resources
      planModifications.addInterval(interval, negativeResource);

    }

  }

  private void validateInputStage(Plan plan, ReservationRequest rr)
      throws ContractValidationException {

    // Validate concurrency
    if (rr.getConcurrency() < 1) {
      throw new ContractValidationException("Gang Size should be >= 1");
    }

    // Validate number of containers
    if (rr.getNumContainers() <= 0) {
      throw new ContractValidationException("Num containers should be > 0");
    }

    // Check that gangSize and numContainers are compatible
    if (rr.getNumContainers() % rr.getConcurrency() != 0) {
      throw new ContractValidationException(
          "Parallelism must be an exact multiple of gang size");
    }

    // Check that the largest container request does not exceed the cluster-wide
    // limit for container sizes
    if (Resources.greaterThan(plan.getResourceCalculator(), capacity,
        rr.getCapability(), plan.getMaximumAllocation())) {

      throw new ContractValidationException(
          "Individual capability requests should not exceed cluster's " +
          "maxAlloc");

    }

  }

  // Call algEarliestStartTime()
  protected long computeEarliestStartingTime(Plan plan,
      ReservationDefinition reservation, int index,
      ReservationRequest currentReservationStage, long stageDeadline) {

    return algStageEarliestStart.setEarliestStartTime(plan, reservation, index,
        currentReservationStage, stageDeadline);

  }

  // Call algStageAllocator
  protected Map<ReservationInterval, Resource> computeStageAllocation(
      Plan plan, ReservationRequest rr, long stageArrivalTime,
      long stageDeadline) {

    return algStageAllocator.computeStageAllocation(plan, planLoads,
        planModifications, rr, stageArrivalTime, stageDeadline);

  }

  // Set the algorithm: algStageEarliestStart
  public IterativePlanner setAlgStageEarliestStart(StageEarliestStart alg) {

    this.algStageEarliestStart = alg;
    return this; // To allow concatenation of setAlg() functions

  }

  // Set the algorithm: algStageAllocator
  public IterativePlanner setAlgStageAllocator(StageAllocator alg) {

    this.algStageAllocator = alg;
    return this; // To allow concatenation of setAlg() functions

  }

}


text:
import {TargetVersion} from '../../update-tool/target-version';
import {ResolvedResource} from '../../update-tool/component-resource-collector';
import {MigrationRule} from '../../update-tool/migration-rule';
import {findAllSubstringIndices} from '../typescript/literal';
import {RuleUpgradeData} from '../upgrade-data';

/**
 * Rule that walks through every template and reports if there are
 * instances of outdated Angular CDK API that can't be migrated automatically.
 */
export class MiscTemplateRule extends MigrationRule<RuleUpgradeData> {

  // Only enable this rule if the migration targets version 6. The rule
  // currently only includes migrations for V6 deprecations.
  ruleEnabled = this.targetVersion === TargetVersion.V6;

  visitTemplate(template: ResolvedResource): void {
    // Migration for https://github.com/angular/components/pull/10325 (v6)
    findAllSubstringIndices(template.content, 'cdk-focus-trap').forEach(offset => {
      this.failures.push({
        filePath: template.filePath,
        position: template.getCharacterAndLineOfPosition(template.start + offset),
        message: `Found deprecated element selector "cdk-focus-trap" which has been ` +
            `changed to an attribute selector "[cdkTrapFocus]".`
      });
    });
  }
}


text:
@class IMImojiSessionCredentials;
@class IMMutableImojiObject;
@class BFTask;
@class IMImojiSessionStoragePolicy;
@class IMCategoryAttribution;

@interface IMImojiSession (Private)

#pragma mark Static

+ (nonnull IMImojiSessionCredentials *)credentials;

#pragma mark Auth

- (void)renewCredentials:(nonnull IMImojiSessionAsyncResponseCallback)callback;

- (void)readAuthenticationFromDictionary:(nonnull NSDictionary *)authenticationInfo;

- (void)readAuthenticationCredentials;

- (nonnull BFTask *)writeAuthenticationCredentials;

- (nonnull NSOperation *)cancellationTokenOperation;

#pragma mark Network Requests

- (nonnull BFTask *)runPostTaskWithPath:(nonnull NSString *)path headers:(nonnull NSDictionary *)headers andParameters:(nonnull NSDictionary *)parameters;

- (nonnull BFTask *)runValidatedGetTaskWithPath:(nonnull NSString *)path andParameters:(nonnull NSDictionary *)parameters;

- (nonnull BFTask *)runValidatedPutTaskWithPath:(nonnull NSString *)path andParameters:(nonnull NSDictionary *)parameters;

- (nonnull BFTask *)runValidatedPostTaskWithPath:(nonnull NSString *)path andParameters:(nonnull NSDictionary *)parameters;

- (nonnull BFTask *)runValidatedDeleteTaskWithPath:(nonnull NSString *)path andParameters:(nonnull NSDictionary *)parameters;

- (nonnull BFTask *)validateSession;

#pragma mark Network Responses

- (BOOL)validateServerResponse:(nonnull NSDictionary *)results error:(NSError *__nullable *__nullable)error;

- (nonnull NSArray *)convertServerDataSetToImojiArray:(nonnull NSDictionary *)serverResponse;

- (void)handleImojiFetchResponse:(nonnull NSArray *)imojiObjects
               relatedSearchTerm:(nullable NSString *)relatedSearchTerm
               relatedCategories:(nullable NSArray<IMImojiCategoryObject *> *)relatedCategories
               cancellationToken:(nonnull NSOperation *)cancellationToken
          searchResponseCallback:(nullable IMImojiSessionResultSetResponseCallback)searchResponseCallback
           imojiResponseCallback:(nullable IMImojiSessionImojiFetchedResponseCallback)imojiResponseCallback;

- (nonnull BFTask *)downloadImojiImageAsync:(nonnull IMMutableImojiObject *)imoji
                           renderingOptions:(nonnull IMImojiObjectRenderingOptions *)renderingOptions
                                 imojiIndex:(NSUInteger)imojiIndex
                          cancellationToken:(nonnull NSOperation *)cancellationToken;

- (nonnull IMMutableImojiObject *)readImojiObject:(nonnull NSDictionary *)result;

- (nonnull IMCategoryAttribution *)readAttribution:(nonnull NSDictionary *)attributionDictionary;

- (nonnull NSArray<IMImojiCategoryObject *> *)readCategories:(nonnull NSArray *)categories;

- (nonnull BFTask *)uploadImageInBackgroundWithRetries:(nonnull UIImage *)image
                                             uploadUrl:(nonnull NSURL *)uploadUrl
                                            retryCount:(int)retryCount;

#pragma mark Session State Management

- (void)updateImojiState:(IMImojiSessionState)newState;

#pragma mark Imoji Creation

- (nonnull BFTask *)createLocalImojiWithRawImage:(nonnull UIImage *)rawImage
                                   borderedImage:(nonnull UIImage *)borderedImage
                                            tags:(nonnull NSArray *)tags;

- (void)removeLocalImoj:(nonnull IMImojiObject *)imoji;

- (nonnull BFTask *)writeImoji:(nonnull IMImojiObject *)imoji
              renderingOptions:(nonnull IMImojiObjectRenderingOptions *)renderingOptions
                 imageContents:(nonnull NSData *)imageContents
                   synchronous:(BOOL)synchronous;

- (void)removeImoji:(nonnull IMImojiObject *)imoji
   renderingOptions:(nonnull IMImojiObjectRenderingOptions *)renderingOptions;

- (nonnull NSString *)filePathFromImoji:(nonnull IMImojiObject *)imoji
                       renderingOptions:(nonnull IMImojiObjectRenderingOptions *)renderingOptions;

@end


text:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>archive-base</artifactId>
    <groupId>org.sakaiproject</groupId>
    <version>12-SNAPSHOT</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>
  <name>Sakai Announcement Import Handlers</name>
  <groupId>org.sakaiproject</groupId>
  <artifactId>sakai-import-announcement</artifactId>
  <organization>
    <name>Sakai Foundation</name>
    <url>http://sakaiproject.org/</url>
  </organization>
  <inceptionYear>2005</inceptionYear>
  <packaging>jar</packaging>
  <properties>
    <deploy.target />
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.sakaiproject.kernel</groupId>
      <artifactId>sakai-kernel-api</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sakaiproject.common</groupId>
      <artifactId>archive-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sakaiproject.common</groupId>
      <artifactId>import-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sakaiproject.announcement</groupId>
      <artifactId>sakai-announcement-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sakaiproject.message</groupId>
      <artifactId>sakai-message-api</artifactId>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/config</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
      </resource>
    </resources>
<!-- other resources for the jar - properties and xml files-->
  </build>
</project>


text:
xdescribe('Unit : Controller - ContentMediaCtrl', function () {

// load the controller's module
    beforeEach(module('mediaCenterContent'));

    var
        ContentMedia, $rootScope, scope, $timeout, Location, $window, Buildfire, DB, COLLECTIONS, AppConfig, Messaging, EVENTS, PATHS;
    beforeEach(module('mediaCenterContent', function ($provide) {
        $provide.service('Buildfire', function () {
            this.imageLib = jasmine.createSpyObj('imageLib', ['showDialog']);
            this.imageLib.showDialog.and.callFake(function (options, callback) {
                callback(null, {selectedFiles: ['test']});
            });
            this.datastore = jasmine.createSpyObj('datastore', ['get', 'save', 'update']);
            this.datastore.get.and.callFake(function (_tagName, callback) {
                if (_tagName) {
                    callback(null, {
                        data: {
                            design: {
                                itemListLayout: 'layout1',
                                bgImage: ''
                            },
                            content: {
                                images: [{title: 'bg1.png'}]
                            }
                        }
                    });
                } else {
                    callback('Error', null);
                }
            });
            this.datastore.update.and.callFake(function (_tagName, id, data, callback) {
                if (_tagName) {
                    callback(null, {
                        data: {
                            design: {
                                itemListLayout: 'layout1',
                                bgImage: ''
                            },
                            content: {
                                images: [{title: 'bg1.png'}]
                            }
                        }
                    });
                } else {
                    callback('Error', null);
                }
            });
            this.datastore.save.and.callFake(function (options, _tagName, callback) {
                if (_tagName) {
                    callback(null, [{
                        data: {
                            design: {
                                itemListLayout: 'layout1',
                                bgImage: ''
                            },
                            content: {
                                images: [{title: 'bg1.png'}]
                            }
                        }
                    }]);
                } else {
                    callback('Error', null);
                }
            });
            this.components = {
                images: {
                    thumbnail: function () {
                        this.loadbackground = function (url) {
                        };
                        this.onChange = function (url) {
                        };
                        this.onDelete = function (url) {
                        };
                        return this;

                    }
                }
            };
            this.navigation = {
                scrollTop: function () {
                }
            };
            this.history = {
                push: function (label, id) {
                },
                onPop: function (data) {
                },
                pop: function () {

                }
            };
            this.components.actionItems = jasmine.createSpyObj('Buildfire.components.actionItems', ['sortableList', '', '']);
            this.components.actionItems.sortableList.and.callFake(function () {
                return {
                    sortableList: function (id) {
                        console.log("actionItems.sor" +
                            "tableList hasbeen called");
                        return {
                            'loadItems': function (items) {
                            }
                        };
                    }
                };
            });
        });
    }));

    beforeEach(inject(function ($controller, _$rootScope_, _$timeout_, _Location_, _$window_, _Buildfire_, _DB_, _COLLECTIONS_, _AppConfig_, _Messaging_, _EVENTS_, _PATHS_) {
            scope = _$rootScope_.$new();
            $timeout = _$timeout_;
            $rootScope = _$rootScope_;
            DB = _DB_;
            COLLECTIONS = _COLLECTIONS_;
            AppConfig = _AppConfig_;
            Messaging = _Messaging_;
            EVENTS = _EVENTS_;
            PATHS = _PATHS_;
            $window = _$window_;
            Buildfire = _Buildfire_;
            Location = _Location_;
            ContentMedia = $controller('ContentMediaCtrl', {
                $scope: scope,
                $window: $window,
                DB: DB,
                COLLECTIONS: COLLECTIONS,
                Location: Location,
                media: {id: '1', data: {topImage: "ABC.png", image: "abc.png", mediaDate: 1234}},
                Messaging: Messaging,
                EVENTS: EVENTS,
                PATHS: PATHS,
                AppConfig: AppConfig,
                Buildfire: Buildfire,
                $timeout: $timeout
            });
        })
    )
    ;

    describe('Units: units should be Defined', function () {
        it('it should pass if ContentMedia is defined', function () {
            expect(ContentMedia).not.toBeUndefined();
        });
        it('it should pass if DB is defined', function () {
            expect(DB).not.toBeUndefined();
        });
        it('it should pass if COLLECTIONS is defined', function () {
            expect(COLLECTIONS).not.toBeUndefined();
        });
        it('it should pass if AppConfig is defined', function () {
            expect(AppConfig).not.toBeUndefined();
        });
        it('it should pass if Messaging function is defined', function () {
            expect(Messaging).not.toBeUndefined();
        });
        it('it should pass if EVENTS function is defined', function () {
            expect(EVENTS).not.toBeUndefined();
        });
        it('it should pass if PATHS function is defined', function () {
            expect(PATHS).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.item is defined', function () {
            expect(ContentMedia.item).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.linksSortableOptions is defined', function () {
            expect(ContentMedia.linksSortableOptions).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.bodyContentWYSIWYGOptions is defined', function () {
            expect(ContentMedia.bodyContentWYSIWYGOptions).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.selectTopImage function is defined', function () {
            expect(ContentMedia.selectTopImage).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.removeTopImage function is defined', function () {
            expect(ContentMedia.removeTopImage).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.removeTopImage function is executed', function () {
            ContentMedia.item.data.topImage = "demo.png";
            ContentMedia.removeTopImage();
            $rootScope.$digest();
            expect(ContentMedia.item.data.topImage).toEqual("");
        });
        it('it should pass if ContentMedia.selectAudioImage function is defined', function () {
            expect(ContentMedia.selectAudioImage).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.removeAudioImage function is defined', function () {
            expect(ContentMedia.removeAudioImage).not.toBeUndefined();
        });
        it('it should pass if ContentMedia.removeAudioImage function is executed', function () {
            ContentMedia.item.data.image = "demo.png";
            ContentMedia.removeAudioImage();
            $rootScope.$digest();
            expect(ContentMedia.item.data.image).toEqual("");
        });
        it('it should pass if ContentMedia.done function is defined', function () {
            expect(ContentMedia.done).not.toBeUndefined();
        });
    });

    describe('Units: Methods should be working properly', function () {
        var spy;
        beforeEach(inject(function () {
            spy = spyOn(Location, 'goToHome').and.callFake(function () {
            });
        }));
        it('it should pass if ContentMedia.done function call Location.goToHome', function () {
            ContentMedia.done();
            expect(spy).toHaveBeenCalled();
        });
        it('it should pass if ContentMedia.delete function does nothing when ContentMedia.item.id is falsy', function () {
            ContentMedia.item = {id: ''};
            var MediaContent = {
                delete: function () {
                }
            };
            var mediaContentSpy = spyOn(MediaContent, 'delete').and.callFake(function () {
            });
            expect(mediaContentSpy).not.toHaveBeenCalled();
        });
        it('it should pass if ContentMedia.selectTopImage changes ContentMedia.item.data.topImage in success case', function () {
            ContentMedia.selectTopImage();
            expect(ContentMedia.item.data.topImage).toEqual('test');

        });
        it('it should pass if ContentMedia.selectAudioImage changes ContentMedia.item.data.topImage in success case', function () {
            ContentMedia.selectAudioImage();
            expect(ContentMedia.item.data.image).toEqual('test');

        });
        it('it should pass if ContentMedia.selectTopImage changes ContentMedia.item.data.topImage in Error case', function () {
            ContentMedia.selectTopImage();
            expect(ContentMedia.item.data.topImage).toEqual('test');

        });
        it('it should pass if ContentMedia.selectAudioImage changes ContentMedia.item.data.topImage in Error case', function () {
            ContentMedia.selectAudioImage();
            expect(ContentMedia.item.data.image).toEqual('test');

        });
    });

    describe('Unit: ContentMedia.selectAudioImage', function () {

        it('it should call Buildfire.imageLib.showDialog', function () {
            ContentMedia.selectAudioImage('');
            expect(Buildfire.imageLib.showDialog).toHaveBeenCalled();
        });

    });

    describe('Unit: ContentMedia.linkEditor.onAddItems', function () {

        it('it should call data links', function () {
            ContentMedia.item.data.links = [];
            ContentMedia.linkEditor.onAddItems({a: 1});
            expect(ContentMedia.item.data.links.length).toEqual(1);
        });

        it('it should call assign data links if it is null', function () {
            ContentMedia.item.data.links = null;
            ContentMedia.linkEditor.onAddItems({a: 1});
            expect(ContentMedia.item.data.links.length).toEqual(1);
        });

    });

    describe('Unit: ContentMedia.linkEditor.onDeleteItem', function () {

        it('it should call data links', function () {
            ContentMedia.item.data.links = [{a: 1}];
            ContentMedia.linkEditor.onDeleteItem({a: 1}, 0);
            expect(ContentMedia.item.data.links.length).toEqual(0);
        });
    });
    describe('Unit: ContentMedia.linkEditor.onItemChange', function () {

        it('it should call data links', function () {
            ContentMedia.item.data.links = [{a: 1}];
            ContentMedia.linkEditor.onItemChange({a: 2}, 0);
            expect(ContentMedia.item.data.links[0].a).toEqual(2);
        });
    });

    describe('Unit: ContentMedia.linkEditor.onOrderChange', function () {

        it('it should call data links', function () {
            ContentMedia.item.data.links = [{a: 1}, {a: 2}];
            ContentMedia.linkEditor.onOrderChange({a: 1}, 0, 1);
            expect(ContentMedia.item.data.links[0].a).toEqual(2);
        });
    });
    describe('Unit: $watcher', function () {

        it('it should call data links', function () {
            ContentMedia.info = {data: {}};
            $rootScope.$digest();
            ContentMedia.info = {id: '123', data: {design: {}}};
            $rootScope.$digest();
        });
    });

});
xdescribe('Unit : Controller - ContentMediaCtrl Null case', function () {

// load the controller's module
    beforeEach(module('mediaCenterContent'));

    var
        ContentMedia, $rootScope, scope, Location, $window, Buildfire, DB, COLLECTIONS, AppConfig, Messaging, EVENTS, PATHS;
    beforeEach(module('mediaCenterContent', function ($provide) {
        $provide.service('Buildfire', function () {
            this.imageLib = jasmine.createSpyObj('imageLib', ['showDialog']);
            this.imageLib.showDialog.and.callFake(function (options, callback) {
                callback(null, {selectedFiles: ['test']});
            });
            this.datastore = jasmine.createSpyObj('datastore', ['get', 'save', 'update']);
            this.datastore.get.and.callFake(function (_tagName, callback) {
                if (_tagName) {
                    callback(null, {
                        data: {
                            design: {
                                itemListLayout: 'layout1',
                                bgImage: ''
                            },
                            content: {
                                images: [{title: 'bg1.png'}]
                            }
                        }
                    });
                } else {
                    callback('Error', null);
                }
            });
            this.history = {
                push: function (label, id) {
                },
                onPop: function (data) {
                },
                pop: function () {

                }
            };
            this.datastore.update.and.callFake(function (_tagName, id, data, callback) {
                if (_tagName) {
                    callback(null, {
                        data: {
                            design: {
                                itemListLayout: 'layout1',
                                bgImage: ''
                            },
                            content: {
                                images: [{title: 'bg1.png'}]
                            }
                        }
                    });
                } else {
                    callback('Error', null);
                }
            });
            this.datastore.save.and.callFake(function (options, _tagName, callback) {
                if (_tagName) {
                    callback(null, [{
                        data: {
                            design: {
                                itemListLayout: 'layout1',
                                bgImage: ''
                            },
                            content: {
                                images: [{title: 'bg1.png'}]
                            }
                        }
                    }]);
                } else {
                    callback('Error', null);
                }
            });
            this.components = {
                images: {
                    thumbnail: function () {
                        this.loadbackground = function (url) {
                        };
                        this.onChange = function (url) {
                        };
                        this.onDelete = function (url) {
                        };
                        return this;

                    }
                },
                actionItems: {
                    sortableList: function (id) {
                        console.log("actionItems.sor" +
                            "tableList hasbeen called????????????????????????????????????????");
                        return {
                            'loadItems': function (items) {
                                console.log('Items----------------*************************************----in LinkEditor');
                            }
                        };
                    }
                }
            };
            this.navigation = {
                scrollTop: function () {
                }
            };
            /*this.components.actionItems = jasmine.createSpyObj('Buildfire.components.actionItems', ['sortableList', '', '']);
             this.components.actionItems.sortableList.and.callFake(function () {
             return {
             sortableList: function (id) {
             console.log("actionItems.sor" +
             "tableList hasbeen called????????????????????????????????????????");
             return {
             'loadItems':function (items) {
             console.log('Items----------------*************************************----in LinkEditor');
             }
             };
             }
             };
             });*/
        });
    }));

    beforeEach(inject(function ($controller, _$rootScope_, _Location_, _$window_, _Buildfire_, _DB_, _COLLECTIONS_, _AppConfig_, _Messaging_, _EVENTS_, _PATHS_) {
            scope = _$rootScope_.$new();
            $rootScope = _$rootScope_;
            DB = _DB_;
            COLLECTIONS = _COLLECTIONS_;
            AppConfig = _AppConfig_;
            Messaging = _Messaging_;
            EVENTS = _EVENTS_;
            PATHS = _PATHS_;
            $window = _$window_;
            Buildfire = _Buildfire_;
            Location = _Location_;
            ContentMedia = $controller('ContentMediaCtrl', {
                $scope: scope,
                $window: $window,
                DB: DB,
                COLLECTIONS: COLLECTIONS,
                Location: Location,
                media: null,
                Messaging: Messaging,
                EVENTS: EVENTS,
                PATHS: PATHS,
                AppConfig: AppConfig,
                Buildfire: Buildfire
            });
        })
    )
    ;

    describe('Units: ContentMedia.item should be Defined', function () {
        it('it should pass if ContentMedia is defined', function () {
            expect(ContentMedia).not.toBeUndefined();
            expect(ContentMedia.item).not.toBeUndefined();
        });
    });
})
;


text:
package com.microsoft.azure.management.website;

import java.util.List;

/**
 * Cross-Origin Resource Sharing (CORS) settings for the web app.
 */
public class CorsSettings {
    /**
     * Gets or sets the list of origins that should be allowed to make
     * cross-origin
     * calls (for example: http://example.com:12345). Use "*" to
     * allow all.
     */
    private List<String> allowedOrigins;

    /**
     * Get the allowedOrigins value.
     *
     * @return the allowedOrigins value
     */
    public List<String> allowedOrigins() {
        return this.allowedOrigins;
    }

    /**
     * Set the allowedOrigins value.
     *
     * @param allowedOrigins the allowedOrigins value to set
     * @return the CorsSettings object itself.
     */
    public CorsSettings withAllowedOrigins(List<String> allowedOrigins) {
        this.allowedOrigins = allowedOrigins;
        return this;
    }

}


text:
import ALife.Creatur.Universe   (mkSimpleUniverse, store)
import Control.Monad.State.Lazy (evalStateT)
import Tutorial.Chapter5.Rock   (Rock (..))

main :: IO ()
main = do
  let u = mkSimpleUniverse "Chapter5" "chapter5"

  let a = Rock "Rocky" 42
  evalStateT (store a) u

  let b = Rock "Roxie" 99
  evalStateT (store b) u

  return ()


text:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
|==========================================================
| Initialize Variable Parser Class
|==========================================================
|
*/
if ( ! class_exists('_Parser'))
{
	require_once(BASEPATH.'libraries/Parser'.EXT);
	$this->parser = new _Parser();
	$this->ci_is_loaded[] = 'parser';
}

?>


text:
/*******************************************************************************
 *  @file      IUserListModule.h 2014\8\6 15:25:06 $
 *  @author    快刀<kuaidao@mogujie.com>
 *  @brief     组织架构相关模块
 ******************************************************************************/

#ifndef IUSERLISTMODULE_FDBD79FF_2F63_4E0A_8265_A001E2EB5182_H__
#define IUSERLISTMODULE_FDBD79FF_2F63_4E0A_8265_A001E2EB5182_H__

#include "GlobalDefine.h"
#include "Modules/ModuleDll.h"
#include "Modules/IMiscModule.h"
#include "Modules/IUserListModule.h"
#include "Modules/ModuleBase.h"
#include "Modules/IModuleInterface.h"
#include "utility/utilStrCodingAPI.h"
#include "ProtocolBuffer/IM.BaseDefine.pb.h"
#include <string>
#include <list>
/******************************************************************************/
#define		PREFIX_GRAY_AVATAR		_T("gray_")

NAMESPACE_BEGIN(module)
const std::string MODULE_USERLIST_PREFIX = "userlist";
//KEYID
const std::string KEY_USERLIST_UPDATE_DEPARTMENTLIST = MODULE_USERLIST_PREFIX + "DeparmentList"; 		//成功获取到组织架构信息
const std::string KEY_USERLIST_UPDATE_RECENTLIST = MODULE_USERLIST_PREFIX + "RecentList";			//成功获取最近联系人
const std::string KEY_USERLIST_UPDATE_NEWUSESADDED = MODULE_USERLIST_PREFIX + "NewuserAdded";			//新用户更新
const std::string KEY_USERLIST_DOWNAVATAR_SUCC = MODULE_USERLIST_PREFIX + "DownavatarSucc";		//头像下载成功通知
const std::string KEY_USERLIST_ALLUSERLINESTATE = MODULE_USERLIST_PREFIX + "AllUserLineState";		//列表所有用户在线状态通知
const std::string KEY_USERLIST_USERLINESTATE = MODULE_USERLIST_PREFIX + "UserLineState";			//单个用户在线状态通知
const std::string KEY_USERLIST_USERSIGNINFO_CHANGED = MODULE_USERLIST_PREFIX + "UserSignInfoChanged";//用户个性签名更变通知

/**
* The class 部门信息定义
*
*/
struct DepartmentEntity
{
	std::string				dId;				//部门ID
	UInt32					priority;			//排序优先级
	CString					name;				//部门名称
	std::string				parentDepartId;		//上级部门名称
	UInt8					status;				//部门状态  0:正常 1:删除
	UInt32					latestUpdateTime;	//最后更新时间
	std::list<std::string>	members;			//成员列表
};
typedef std::map<std::string, DepartmentEntity> DepartmentMap;

class MODULE_CLASS UserInfoEntity
{
public:
	CString getRealName()const;
	/**
	* 根据在线状态获取头像
	*
	* @return  std::string 头像路径
	* @exception there is no any exception to throw.
	*/
	std::string getAvatarPath()const;
	/**
	 * 获取纯头像,没有在线状态的区分
	 *
	 * @return  std::string 头像路径
	 * @exception there is no any exception to throw.
	 */
	std::string getAvatarPathWithoutOnlineState()const;
	BOOL isOnlne()const;

public:
	UInt8           onlineState = IM::BaseDefine::USER_STATUS_OFFLINE;            //用户在线状态  	USER_STATUS_ONLINE 	= 1,USER_STATUS_OFFLINE	= 2,USER_STATUS_LEAVE	= 3,
	UInt32			avatarHashcode = 0;		//根据avatarUrl计算的hash值
	UInt32			updated = 0;			//最后一次消息更新时间
	UInt32			gender = 1; 			// 用户性别,男:1 女:2 人妖/外星人:0
	CString         csName;                 //用户名
	CString         csNickName;             //用户昵称
	std::string     avatarUrl;              //用户头像地址
	std::string     avatarLocalPath;        //头像下载成功后的存储路径
	std::string     avatarGrayLocalPath;    //灰度处理之后的头像存储路径
	std::string     sId;                    //公司员工id
	std::string		dId;					//部门id
	std::string		department;				//部门名称
	std::string		email;					//邮箱
	std::string     user_domain;			//用户花名拼音
	std::string		telephone;				//电话
    std::string     signature;              //个性签名
	UInt32			status;					//0:在职  1:离职
};
typedef std::map<std::string, UserInfoEntity>    UserInfoEntityMap;
typedef std::vector<std::string>			UserInfoEntityVec;

/**
 * The class 组织架构相关模块
 *
 */
class MODULE_API IUserListModule : public module::ModuleBase
								  ,public module::IPduPacketParse
{
public:
	/**
	* 用户模块初始化处理(加载本地用户数据)
	*
	* @return
	* @exception there is no any exception to throw.
	*/
	virtual BOOL startup() = 0;
	/**
	* 所有部门信息
	*
	* @return  const module::DepartmentMap&
	* @exception there is no any exception to throw.
	*/
	virtual const module::DepartmentMap& getAllDepartments() = 0;
	/**
	* 获取所有人的信息
	*
	* @param   module::UserInfoEntityMap & MapUsers
	* @return  void
	* @exception there is no any exception to throw.
	*/
	virtual void getAllUsersInfo(OUT module::UserInfoEntityMap& MapUsers)const = 0;
	/**
	* 根据用户ID获取个人信息
	*
	* @param   IN std::string sid
	* @param   OUT module::UserInfoEntity & userInfo
	* @return  BOOL
	* @exception there is no any exception to throw.
	*/
	virtual BOOL getUserInfoBySId(IN std::string sid, OUT module::UserInfoEntity& userInfo) = 0;
	/**
	* 清空所有人列表
	*
	* @return  void
	* @exception there is no any exception to throw.
	*/
	virtual void removeAllListInfo() = 0;
	/**
	* 获取自己的信息
	*
	* @return  UInt8
	* @exception there is no any exception to throw.
	*/
	virtual UInt8 getMyLineStatus()= 0;

	/**
	* 获取某个人的在线状态
	*
	* @param   IN const std::string & sId
	* @return  void
	* @exception there is no any exception to throw.
	*/
	virtual void tcpGetUserOnlieStatus(IN const std::string& sId) = 0;
	/**
	* 获取一批人的在线列表,如果列表人数过多,要分批获取
	*
	* @param   const module::VecUserInfoEntity & VecId
	* @return  void
	* @exception there is no any exception to throw.
	*/
	virtual void tcpGetUserOnlieStatus(IN const module::UserInfoEntityVec& VecId) = 0;
	/**
	* tcp获取个人信息
	*
	* @param   IN const std::string & sId
	* @return  void
	* @exception there is no any exception to throw.
	*/
	virtual void tcpGetUserInfo(IN const std::string& sId) = 0;
	/**
	* tcp获取某一批人的信息
	*
	* @param   IN const module::VecUserInfoEntity & VecUnKnowUserInfo
	* @return  void
	* @exception there is no any exception to throw.
	*/
    virtual void tcpChangeMySignInfo(IN const std::string sSignInfo) = 0;//修改自己的个性签名

	virtual void tcpGetUsersInfo(IN const module::UserInfoEntityVec& VecUnKnowUserInfo) = 0;
	/**
	* 获取缺省的个人头像
	*
	* @return  CString
	* @exception there is no any exception to throw.
	*/
	virtual CString getDefaultAvatartPath() = 0;
	/**
	* 获取自己的信息
	*
	* @return BOOL
	* @exception there is no any exception to throw.
	*/
	virtual BOOL getMyInfo(OUT module::UserInfoEntity& myInfo) = 0;

	/**
	 * 根据缩写或者全拼获取搜索的人的名称
	 *
	 * @param   IN const CString & sShortName
	 * @param   OUT std::vector<CString> & nameList
	 * @return  void
	 * @exception there is no any exception to throw.
	 */
	virtual void getSearchUserNameListByShortName(IN const CString& sShortName, OUT	module::UserInfoEntityVec& nameList) = 0;
	virtual void getSearchDepartmentsByShortName(IN const CString& sShortName, OUT	std::vector<std::string>& departmentList) = 0;

	/**
	 * 这个接口目前就是给离线消息、创建登陆者信息用的,创建不考虑替换,如果存在sId了就失败处理
	 *
	 * @param   const std::string & sId
	 * @param   const module::UserInfoEntity & info
	 * @return  BOOL
	 * @exception there is no any exception to throw.
	 */
	virtual BOOL createUserInfo(IN const UserInfoEntity& info) = 0;

	virtual std::string randomGetUser(void) = 0;//随机获取一个异性ID
};

MODULE_API IUserListModule* getUserListModule();

NAMESPACE_END(module)
/******************************************************************************/
#endif// IUSERLISTMODULE_FDBD79FF_2F63_4E0A_8265_A001E2EB5182_H__


text:
#Region "Microsoft.VisualBasic::dc41d00bf94674a2a64e35b817dd3d2d, src\mzmath\TargetedMetabolomics\MRM\QuantitativeAnalysis\MRMPeak.vb"

' Author:
'
'       xieguigang (gg.xie@bionovogene.com, BioNovoGene Co., LTD.)
'
' Copyright (c) 2018 gg.xie@bionovogene.com, BioNovoGene Co., LTD.
'
'
' MIT License
'
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all
' copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.

' /********************************************************************************/

' Summaries:

'     Module MRMPeak
'
'         Function: MRMPeak
'         Enum MRMPeakExtensionMethods
'
'             BaselineMatch, TriangleMatch
'
'
'
'
'
'     Function: MakeBaselineExtension, MakeExtension
'
'
' /********************************************************************************/

#End Region

Imports System.Math
Imports System.Runtime.CompilerServices
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Chromatogram
Imports Microsoft.VisualBasic.ComponentModel.Algorithm.base
Imports Microsoft.VisualBasic.ComponentModel.Ranges
Imports Microsoft.VisualBasic.ComponentModel.Ranges.Model
Imports Microsoft.VisualBasic.Linq
Imports Microsoft.VisualBasic.Math
Imports Microsoft.VisualBasic.Math.LinearAlgebra
Imports Microsoft.VisualBasic.Math.Scripting

Namespace MRM

    Public Module MRMPeak

        ''' <summary>
        ''' Returns time range for the peak where the max intensity was represented.
        ''' </summary>
        ''' <param name="chromatogram">
        ''' Should be order by time asceding.(应该是按照时间升序排序了的)
        ''' </param>
        ''' <param name="threshold">
        ''' Meaning changes base on the <paramref name="method"/> value:
        '''
        ''' + <see cref="MRMPeakExtensionMethods.TriangleMatch"/>: Unit in degree, values in range ``[0-90]``
        ''' + <see cref="MRMPeakExtensionMethods.BaselineMatch"/>: Unit in percentage, value in range ``[0%-100%]``
        ''' </param>
        ''' <returns>The retention time range: ``[rtmin, rtmax]``</returns>
        <Extension>
        Public Function MRMPeak(chromatogram As IVector(Of ChromatogramTick),
                                Optional threshold# = 30%,
                                Optional winSize% = 5,
                                Optional baselineQuantile# = 0.65,
                                Optional method As MRMPeakExtensionMethods = MRMPeakExtensionMethods.BaselineMatch) As DoubleRange

            ' 先找到最高的信号,然后逐步分别往两边延伸
            ' 直到下降的速率小于阈值
            ' 因为MRM方法在一个色谱之中只出一个峰,所以在这里仅仅实现一个非常简单的峰的边界检测的算法

            Dim maxIndex%
            Dim timeRange#()

            ' 2018-1-18 如果事先将基线移除的话,或导致峰的范围扩大
            ' 取消掉
            ' removes all of the ticks that intensity value less than baseline.
            ' chromatogram = chromatogram(chromatogram!Intensity >= chromatogram.Base(baselineQuantile))
            maxIndex = Which.Max(chromatogram!Intensity)

            With chromatogram.ToArray

                If method = MRMPeakExtensionMethods.BaselineMatch Then
                    Dim baselineRange As DoubleRange

                    If threshold > 1 Then
                        ' normalize to 0-1
                        threshold /= 100
                    End If

                    baselineQuantile = chromatogram.Baseline(baselineQuantile)
                    baselineRange = {
                        baselineQuantile - baselineQuantile * threshold,
                        baselineQuantile + baselineQuantile * threshold
                    }
                    ' split
                    timeRange = {
                        .Take(maxIndex).Reverse.ToArray.MakeBaselineExtension(baselineRange, winSize),   ' left
                        .Skip(maxIndex).ToArray.MakeBaselineExtension(baselineRange, winSize)            ' right
                    }
                Else
                    threshold = Cos(threshold.ToRadians)
                    ' split
                    timeRange = {
                        .Take(maxIndex).Reverse.ToArray.MakeExtension(threshold, winSize),   ' left
                        .Skip(maxIndex).ToArray.MakeExtension(threshold, winSize)            ' right
                    }
                End If
            End With

            Return New DoubleRange(timeRange)
        End Function

        Public Enum MRMPeakExtensionMethods As Integer
            BaselineMatch
            TriangleMatch
        End Enum

        ''' <summary>
        ''' Detect a peak by using a slide window, when the average signal intensity is approximately equals to the <paramref name="baseline"/>,
        ''' Then found a peak boundary.
        ''' </summary>
        ''' <param name="chromatogram"></param>
        ''' <param name="baseline#"></param>
        ''' <returns></returns>
        <Extension>
        Private Function MakeBaselineExtension(chromatogram As ChromatogramTick(), baseline As DoubleRange, winSize%) As Double
            ' 构建一个滑窗,如果滑窗的信号量平均值接近于baseline,则认为到达了峰的边界
            Dim windows = chromatogram _
                .SlideWindows(winSize) _
                .ToArray

            For Each block As SlideWindow(Of ChromatogramTick) In windows
                Dim average# = block.IntensityArray.Average

                If average <= baseline.Min OrElse baseline.IsInside(average) Then
                    ' 已经到达边界了,返回时间点
                    Return block.First.Time
                End If
            Next

            ' using the entire area???
            Return chromatogram.Last.Time
        End Function

        ''' <summary>
        ''' Returns the MRM signal peaks' time range boundary: ``t1 -> t2``
        ''' </summary>
        ''' <param name="chromatogram"></param>
        ''' <param name="threshold#">cos value</param>
        ''' <param name="winSize%"></param>
        ''' <returns></returns>
        <Extension>
        Private Function MakeExtension(chromatogram As ChromatogramTick(), threshold#, winSize%) As Double
            Dim vector = chromatogram.Shadows
            Dim timeRange As DoubleRange = vector!Time
            Dim normInto As Vector = vector _
                !Intensity _
                .RangeTransform(timeRange) _
                .AsVector
            Dim windows = chromatogram _
                .Select(Function(c, i)
                            Return New ChromatogramTick With {
                                .Time = c.Time,
                                .Intensity = normInto(i)
                            }
                        End Function) _
                .SlideWindows(winSize) _
                .ToArray

            For Each block As SlideWindow(Of ChromatogramTick) In windows

                '      A
                '     /|
                '    / |
                '   /  |
                '  /   |
                ' ------
                ' t0   t1
                '
                ' cos(threshold) = (t1 - t0) / ( distance((t0, 0), (t1, A)) )
                '

                Dim t10 = block.Shadows!Time.Range.Length
                Dim t1 = block.First
                Dim t0 = block.Last
                Dim A = Abs(t0.Intensity - t1.Intensity)

                Dim C = (t1.Time, A).Distance(t0.Time, 0R)
                Dim cos# = t10 / C

                If threshold <= cos Then
                    Return t1.Time
                End If
            Next

            ' using the entire area???
            Return chromatogram.Last.Time
        End Function
    End Module
End Namespace