text:
#ifdef HAVE_KDBCONFIG_H
#include "kdbconfig.h"
#endif

/* used for asprintf */
#define _GNU_SOURCE

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif

#include <tests_plugin.h>

#include <stdio.h>

static Key * createMergingKey (int i)
{
	char * name;
	char * value;
	char * order;
	if (asprintf (&name, "user/convertkey%d", i) == -1 || asprintf (&value, "meta line %d", i) == -1 ||
	    asprintf (&order, "%i", i) == -1)
	{
		fprintf (stderr, "Unable to create key attributes");
		exit (EXIT_FAILURE);
	}
	Key * key = keyNew (name, KEY_VALUE, value, KEY_META, "order", order, KEY_END);
	elektraFree (name);
	elektraFree (value);
	elektraFree (order);
	return key;
}

// clang-format off
static KeySet* createSimpleTestKeys(void)
{
	/* the keys to be converted are simply appended to the next
	 * or the previous key.
	 */
	return ksNew (20,
			keyNew ("user/normalkey1",
					KEY_META, "order", "10", KEY_END),
			keyNew ("user/convertkey1",
					KEY_VALUE, "testvalue1",
					KEY_META, "order", "20",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "next",
					KEY_END),
			keyNew ("user/normalkey2",
					KEY_META, "order", "30",
					KEY_END),
			keyNew ("user/normalkey3",
					KEY_META, "order", "40",
					KEY_END),
			keyNew ("user/convertkey2",
					KEY_VALUE, "testvalue2",
					KEY_META, "order", "50",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "previous",
					KEY_END),
			keyNew ("user/normalkey1/subkey",
					KEY_VALUE, "testvalue3",
					KEY_META, "order", "60",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "parent",
					KEY_END),
			KS_END);
}

static KeySet* createMergeTestkeys(void)
{
	/* the keys to be converted are merged together
	 * into a single metadata
	 */
	KeySet* ks = ksNew(0, KS_END);
	for (int i = 1; i <= 3; i++)
	{
		Key* key = createMergingKey (i);
		keySetMeta (key, "convert/metaname", "testmeta");
		keySetMeta (key, "convert/append", "next");
		ksAppendKey (ks, key);
	}
	ksAppendKey (ks,
			keyNew ("user/normalkey1", KEY_META, "order", "10", KEY_END));
	ksAppendKey (ks,
			keyNew ("user/normalkey2", KEY_META, "order", "20", KEY_END));
	for (int i = 30; i <= 32; i++)
	{
		Key* key = createMergingKey (i);
		keySetMeta (key, "convert/metaname", "testmeta");
		keySetMeta (key, "convert/append", "previous");
		ksAppendKey (ks, key);
	}
	return ks;
}

static KeySet* createSkipMergeTestKeys(void)
{
	/* the keys to be converted are interweaved with keys
	 * of the other directio
	 */
	return ksNew (20,
			keyNew ("user/normalkey1",
					KEY_META, "order", "10", KEY_END),
			keyNew ("user/convertkey1",
					KEY_VALUE, "meta line1",
					KEY_META, "order", "20",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "previous",
					KEY_END),
			keyNew ("user/convertkey2",
					KEY_VALUE, "meta line2",
					KEY_META, "order", "30",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "next",
					KEY_END),
			keyNew ("user/convertkey3",
					KEY_VALUE, "meta line3",
					KEY_META, "order", "40",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "previous",
					KEY_END),
			keyNew ("user/convertkey4",
					KEY_VALUE, "meta line4",
					KEY_META, "order", "50",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "next",
					KEY_END),
			keyNew ("user/normalkey2",
					KEY_META, "order", "60",
					KEY_END),
			KS_END);
}

static KeySet *createParentTestKeys(void)
{

	/* all keys to be converted are appended to the
	 * parent key of the keyset for any of the possible reasons
	 */
	return ksNew (20,
			keyNew ("user/parentkey1",
					KEY_META, "order", "10", KEY_END),
			keyNew ("user/parentkey1/convertkeydirect",
					KEY_VALUE, "testvalue1",
					KEY_META, "order", "20",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "parent",
					KEY_END),
			keyNew ("user/parentkey2",
					KEY_META, "order", "30", KEY_END),
			keyNew ("user/parentkey2/subparent/convertkeyhole",
					KEY_VALUE, "testvalue2",
					KEY_META, "order", "40",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "parent",
					KEY_END),
			keyNew ("user/parentkey3",
					KEY_META, "order", "50",
					KEY_END),
			keyNew ("user/normalkey1",
					KEY_META, "order", "60",
					KEY_END),
			keyNew ("user/parentkey3/convertkeyprev",
					KEY_VALUE, "testvalue3",
					KEY_META, "order", "70",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "previous",
					KEY_META, "convert/append/samelevel", "",
					KEY_END),
			keyNew ("user/parentkey4",
					KEY_META, "order", "80",
					KEY_END),
			keyNew ("user/parentkey4/convertkeynext",
					KEY_VALUE, "testvalue4",
					KEY_META, "order", "90",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "next",
					KEY_META, "convert/append/samelevel", "",
					KEY_END),
			keyNew ("user/normalkey2",
					KEY_META, "order", "100",
					KEY_END),
			KS_END);
}

static KeySet* createDifferentMetaNameTestKeys(void)
{
	return ksNew (20,
			keyNew ("user/convertkey1",
					KEY_VALUE, "meta line1",
					KEY_META, "order", "10",
					KEY_META, "convert/metaname", "testmeta1",
					KEY_META, "convert/append", "next",
					KEY_END),
			keyNew ("user/convertkey2",
					KEY_VALUE, "meta line2",
					KEY_META, "order", "20",
					KEY_META, "convert/metaname", "testmeta2",
					KEY_META, "convert/append", "next",
					KEY_END),
			keyNew ("user/normalkey1",
					KEY_META, "order", "30",
					KEY_END),
			KS_END);
}

static KeySet* createSameLevelTestKeys(void)
{
	return ksNew (20,
			keyNew ("user/levelkey1",
					KEY_META, "order", "10",
					KEY_END),
			keyNew ("user/levelkey1/convertkey1",
					KEY_VALUE, "convertkey1value",
					KEY_META, "order","20",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "next",
					KEY_META, "convert/append/samelevel", "",
					KEY_END),
			keyNew ("user/levelkey1/childkey1",
					KEY_META, "order", "30",
					KEY_END),
			keyNew ("user/levelkey1/convertkey2",
					KEY_VALUE, "convertkey2value",
					KEY_META, "order", "40",
					KEY_META, "convert/metaname", "testmeta",
					KEY_META, "convert/append", "next",
					KEY_META, "convert/append/samelevel", "",
					KEY_END),
			keyNew ("user/levelkey2",
					KEY_META, "order", "50",
					KEY_END),
			KS_END);
}
// clang-format on

void test_parentAppendMode (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createParentTestKeys ();

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	/* parentkey1 must contain meta information generated from convertkeydirect (via parent) */
	Key * key = ksLookupByName (ks, "user/parentkey1", 0);
	succeed_if (key, "parentkey1 was removed");

	const Key * metaKey1 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey1, "parentkey1 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey1), "testvalue1"), "metakey of parentkey1 contained incorrect data");

	/* parentkey2 must contain meta information generated from convertkeyhole (via parent) */
	key = ksLookupByName (ks, "user/parentkey2", 0);
	succeed_if (key, "parentkey2 was removed");

	const Key * metaKey2 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey2, "parentkey2 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey2), "testvalue2"), "metakey of parentkey2 contained incorrect data");

	/* parentkey3 must contain meta information generated from convertkeyprev
	 * (via previous append samelevel which falls back to parent) */
	key = ksLookupByName (ks, "user/parentkey3", 0);
	succeed_if (key, "parentkey3 was removed");

	const Key * metaKey3 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey3, "parentkey3 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey3), "testvalue3"), "metakey of parentkey3 contained incorrect data");

	/* normalkey1 must not contain metadata */
	key = ksLookupByName (ks, "user/normalkey1", 0);
	succeed_if (key, "normalkey1 was removed");
	succeed_if (!keyGetMeta (key, "testmeta"), "normalkey1 should not contain any metadata");

	/* parentkey4 must contain meta information generated from convertkeynext
	 * (via next append samelevel which falls back to parent) */
	key = ksLookupByName (ks, "user/parentkey4", 0);
	succeed_if (key, "parentkey4 was removed");

	const Key * metaKey4 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey4, "parentkey4 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey4), "testvalue4"), "metakey of parentkey4 contained incorrect data");

	/* normalkey2 must not contain metadata */
	key = ksLookupByName (ks, "user/normalkey2", 0);
	succeed_if (key, "normalkey2 was removed");
	succeed_if (!keyGetMeta (key, "testmeta"), "normalkey2 should not contain any metadata");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

void test_simpleAppendModes (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createSimpleTestKeys ();

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	/* converted keys must be removed from the result */
	succeed_if (!ksLookupByName (ks, "user/convertkey1", 0), "convertkey1 was not converted");
	succeed_if (!ksLookupByName (ks, "user/convertkey2", 0), "convertkey2 was not converted");

	/* normalkey2 must contain meta information generated from convertkey1 (via next) */
	Key * key = ksLookupByName (ks, "user/normalkey2", 0);
	succeed_if (key, "normalkey2 was removed");

	const Key * metaKey1 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey1, "normalkey2 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey1), "testvalue1"), "metakey of normalkey2 contained incorrect data");

	/* normalkey3 must contain meta information generated from convertkey2 (via previous) */
	key = ksLookupByName (ks, "user/normalkey3", 0);
	succeed_if (key, "normalkey3 was removed");

	const Key * metaKey2 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey2, "normalkey3 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey2), "testvalue2"), "metakey of normalkey3 contained incorrect data");

	/* normalkey1 must contain meta information generated from subkey (via parent) */
	key = ksLookupByName (ks, "user/normalkey1", 0);
	succeed_if (key, "normalkey1 was removed");

	const Key * metaKey3 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey3, "normalkey1 contained no metakey");
	succeed_if (!strcmp (keyString (metaKey3), "testvalue3"), "metakey of normalkey1 contained incorrect data");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

void test_metaMerging (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createMergeTestkeys ();
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	Key * key = ksLookupByName (ks, "user/normalkey1", 0);
	succeed_if (key, "normalkey1 was removed");

	const Key * metaKey1 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey1, "normalkey1 contained no metakey");
	const char * expected1 = "meta line 1\nmeta line 2\nmeta line 3";
	succeed_if (!strcmp (keyString (metaKey1), expected1), "metakey of normalkey1 contained incorrect data");

	key = ksLookupByName (ks, "user/normalkey2", 0);
	succeed_if (key, "normalkey2 was removed");

	const Key * metaKey2 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey2, "normalkey2 contained no metakey");
	const char * expected2 = "meta line 30\nmeta line 31\nmeta line 32";
	succeed_if (!strcmp (keyString (metaKey2), expected2), "metakey of normalkey2 contained incorrect data");

	/* change the value of the middle key */
	keySetMeta (key, "testmeta", "meta line 30\nchanged meta line\nmeta line 32");

	succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
	succeed_if (output_error (parentKey), "error in kdbSet");
	succeed_if (output_warnings (parentKey), "warnings in kdbSet");

	key = ksLookupByName (ks, "user/convertkey30", 0);
	succeed_if (key, "convertkey30 was not restored");
	succeed_if (!strcmp (keyString (key), "meta line 30"), "value of convertkey30 was modified");

	key = ksLookupByName (ks, "user/convertkey31", 0);
	succeed_if (key, "convertkey31 was not restored");
	succeed_if (!strcmp (keyString (key), "changed meta line"), "meta information was not written back to convertkey31");

	key = ksLookupByName (ks, "user/convertkey32", 0);
	succeed_if (key, "convertkey32 was not restored");
	succeed_if (!strcmp (keyString (key), "meta line 32"), "value of convertkey32 was modified");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

void test_metaSkipMerge (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createSkipMergeTestKeys ();
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	Key * key = ksLookupByName (ks, "user/normalkey1", 0);
	succeed_if (key, "normalkey1 was removed");

	const Key * metaKey1 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey1, "normalkey1 contained no metakey");
	const char * expected1 = "meta line1\nmeta line3";
	succeed_if (!strcmp (keyString (metaKey1), expected1), "metakey of normalkey1 contained incorrect data");

	key = ksLookupByName (ks, "user/normalkey2", 0);
	succeed_if (key, "normalkey2 was removed");

	const Key * metaKey2 = keyGetMeta (key, "testmeta");
	succeed_if (metaKey2, "normalkey2 contained no metakey");
	const char * expected2 = "meta line2\nmeta line4";
	succeed_if (!strcmp (keyString (metaKey2), expected2), "metakey of normalkey2 contained incorrect data");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

void test_differentMetaNames (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createDifferentMetaNameTestKeys ();
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	Key * key = ksLookupByName (ks, "user/normalkey1", 0);
	succeed_if (key, "normalkey1 was removed");

	const Key * metaKey1 = keyGetMeta (key, "testmeta1");
	succeed_if (metaKey1, "normalkey1 contained no meta testmeta1");
	const char * expected1 = "meta line1";
	succeed_if (!strcmp (keyString (metaKey1), expected1), "metakey testmeta1 of normalkey1 contained incorrect data");

	const Key * metaKey2 = keyGetMeta (key, "testmeta2");
	succeed_if (metaKey2, "normalkey1 contained no meta testmeta1");
	const char * expected2 = "meta line2";
	succeed_if (!strcmp (keyString (metaKey2), expected2), "metakey testmeta1 of normalkey1 contained incorrect data");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

void test_appendSameLevel (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createSameLevelTestKeys ();
	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	/* convertkey1 should be converted to childkey1 as childkey1 is on the same level as requested */
	Key * childKey = ksLookupByName (ks, "user/levelkey1/childkey1", 0);
	succeed_if (childKey, "childkey1 was removed");

	const Key * metaKey1 = keyGetMeta (childKey, "testmeta");
	succeed_if (metaKey1, "childkey1 contained no meta testmeta");
	const char * expected1 = "convertkey1value";
	succeed_if (!strcmp (keyString (metaKey1), expected1), "metakey testmeta of childkey1 contained incorrect data");

	/* convertkey2 should be converted to levelkey as the next key in order is not on the same level */
	Key * levelkey1 = ksLookupByName (ks, "user/levelkey1", 0);
	succeed_if (levelkey1, "levelkey1 was removed");

	const Key * metaKey2 = keyGetMeta (levelkey1, "testmeta");
	succeed_if (metaKey2, "levelkey1 contained no meta testmeta");
	const char * expected2 = "convertkey2value";
	succeed_if (!strcmp (keyString (metaKey2), expected2), "metakey testmeta of levelkey1 contained incorrect data");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

void test_restoreOnSet (void)
{
	Key * parentKey = keyNew ("user/tests/keytometa", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("keytometa");

	KeySet * ks = createSimpleTestKeys ();

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful");
	succeed_if (output_error (parentKey), "error in kdbGet");
	succeed_if (output_warnings (parentKey), "warnings in kdbGet");

	Key * key = ksLookupByName (ks, "user/normalkey2", 0);
	succeed_if (key, "normalkey2 was removed");

	/* change the meta information stored in normalkey2
	 * (was generated from convertkey1)
	 */
	keySetMeta (key, "testmeta", "changedtestvalue");

	/* do not touch the meta information of normalkey3
	 * (was generated from convertkey2)
	 */

	succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful");
	succeed_if (output_error (parentKey), "error in kdbSet");
	succeed_if (output_warnings (parentKey), "warnings in kdbSet");

	key = ksLookupByName (ks, "user/convertkey1", 0);
	succeed_if (key, "convertkey1 was not restored");
	succeed_if (!strcmp (keyString (key), "changedtestvalue"), "meta information was not written back to convertkey1");

	key = ksLookupByName (ks, "user/convertkey2", 0);
	succeed_if (key, "convertkey2 was not restored");
	succeed_if (!strcmp (keyString (key), "testvalue2"), " value of convertkey2 was modified");

	key = ksLookupByName (ks, "user/normalkey1/subkey", 0);
	succeed_if (key, "subkey was not restored");
	succeed_if (!strcmp (keyString (key), "testvalue3"), " value of subkey was modified");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

int main (int argc, char ** argv)
{
	printf ("KEYTOMETA       TESTS\n");
	printf ("==================\n\n");

	init (argc, argv);

	test_simpleAppendModes ();
	test_parentAppendMode ();
	test_metaMerging ();
	test_metaSkipMerge ();
	test_differentMetaNames ();
	test_appendSameLevel ();
	test_restoreOnSet ();

	print_result ("test_keytometa");

	return nbError;
}


text:
package io.protostuff.generator.java;

import io.protostuff.compiler.model.Service;
import io.protostuff.compiler.model.ServiceMethod;
import io.protostuff.generator.Formatter;

/**
 * Custom service properties for java code generator.
 *
 * @author Kostiantyn Shchepanovskyi
 */
public class ServiceUtil {

    private ServiceUtil() {
        throw new IllegalAccessError("Utility class");
    }

    public static String getClassName(Service service) {
        String name = service.getName();
        return Formatter.toPascalCase(name);
    }

    /**
     * Returns java method name for corresponding rpc method.
     */
    public static String getMethodName(ServiceMethod serviceMethod) {
        String name = serviceMethod.getName();
        String formattedName = Formatter.toCamelCase(name);
        if (isReservedKeyword(formattedName)) {
            return formattedName + '_';
        }
        return formattedName;
    }

    private static boolean isReservedKeyword(String formattedName) {
        return JavaConstants.RESERVED_KEYWORDS.contains(formattedName);
    }

}

redpajama_set_name: RedPajamaGithub


text:
describe MindMeisterClient::Requester do
  subject { MindMeisterClient::Requester.new('1625a1388f512a203faa43e8685bcdde', '2d845879a2f2a3b1') }

  describe '#prepare_api_method' do
    it 'prepares mm.maps.getList' do
      expect(subject.prepare_api_method(:maps_get_list)).to eq 'mm.maps.getList'
    end

    it 'prepares mm.auth.getToken' do
      expect(subject.prepare_api_method(:auth_get_token)).to eq 'mm.auth.getToken'
    end

    it 'prepares mm.maps.newFromTemplate' do
      expect(subject.prepare_api_method(:maps_new_from_template)).to eq 'mm.maps.newFromTemplate'
    end
  end

  describe '#api_scope?' do
    describe 'MM API scopes' do
      it 'detects MM API scope for maps_get_list' do
        expect(subject.api_scope?(:maps_get_list)).to be_truthy
      end

      it 'detects MM API scope for auth_get_token' do
        expect(subject.api_scope?(:auth_get_token)).to be_truthy
      end

      it 'detects MM API scope for maps_new_from_template' do
        expect(subject.api_scope?(:maps_new_from_template)).to be_truthy
      end
    end

    describe 'Ruby methods' do
      it 'does not detect MM API scope for each_index' do
        expect(subject.api_scope?(:each_index)).to be_falsey
      end

      it 'does not detect MM API scope for to_i' do
        expect(subject.api_scope?(:to_i)).to be_falsey
      end
    end
  end

  describe '#signed_query_string' do
    it 'creates correct query string' do
      new_params = {
        x: 4,
        h: 6,
        a: 10
      }
      signed_query = subject.signed_query_string(new_params)

      expect(signed_query).to eq 'x=4&h=6&a=10&api_sig=3d9576c5e7068213a40354db62f9fbc3'
    end
  end
end


text:
$(document).ready(function() {
  var searchTerm = '';
  $('.searchbox').keyup(function(event) {
    setTimeout(function() {

      var results = [];
      $('.snippet').html('');
      searchTerm = $('#name').val();
      var $html = '';
      $.ajax({
        method: "GET",
        dataType: 'jsonp',
        url: 'http://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=' + searchTerm,
        success: function(data) {
          var $searchResult = data.query.search;
          for (i = 0; i < $searchResult.length; i++) {
            var $searchTitle = $searchResult[i].title;
            $.ajax({
              method: "GET",
              dataType: 'jsonp',
              url: 'https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&exsentences=3&titles=' + $searchTitle,
              success: function(data1) {
                var $pages = data1.query.pages;
                var $extract = '';
                var $searchTitle = '';

                for (var i in $pages) {
                  var searchObject = new Object();
                  searchObject.title = $pages[i].title;
                  searchObject.description = $pages[i].extract;

                };
                results.push(searchObject);
                console.log(results);
                var $html = "";
                results.forEach(function(a) {

                  $html += "
";
                  $html += "";
                  $html += "
" + a.title + "
";
                  $html += "

";
                  $html += "
" + a.description + "
";
                  $html += "";
                  $html += "
";

                  $('.snippet').html($html);
                });
                $('.wikiEntry').fadeIn(700);
                console.log($html);
                //  $('p').html($html);
              }

            });
          }

        }

      });
    }, 400);
  });

  $('.slideRight').click(function() {
    $('.clickSearch').css('background-color', 'none');

    setTimeout(function() {
      $('.searchbox').fadeIn('slow');
      $('.title1').fadeOut('slow');
      $('#click').fadeOut('slow');
    }, 2000);
    setTimeout(function() {
      $('.title2').fadeIn('slow');}
 , 5000);
  });
});


text:
/*
 * ALMA - Atacama Large Millimiter Array (c) European Southern Observatory, 2007
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
package alma.acsplugins.alarmsystem.gui.toolbar;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
import javax.swing.border.EtchedBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

import alma.acsplugins.alarmsystem.gui.CernSysPanel;
import alma.acsplugins.alarmsystem.gui.sound.AlarmSound;
import alma.acsplugins.alarmsystem.gui.table.AlarmGUIType;
import alma.acsplugins.alarmsystem.gui.table.AlarmTable;
import alma.acsplugins.alarmsystem.gui.table.AlarmTableModel;
import alma.acsplugins.alarmsystem.gui.table.AlarmTableModel.PriorityLabel;
import alma.acs.gui.util.threadsupport.EDTExecutor;

/**
 * The toolbar for the alarm panel
 *
 * @author acaproni
 *
 */
public class Toolbar extends JPanel implements ActionListener, DocumentListener {

	/**
	 * The rendered for the auto acknowledge combo box
	 * This renderer shows each level with it color as defined in CellColor
	 *
	 * @author acaproni
	 *
	 */
	public class ComboBoxRenderer implements ListCellRenderer {

		// The label shown by the combo box (i.e. the text of the
		// selected item)
		private JLabel selectedLabel=new JLabel();

		/**
		 * Constructor
		 */
		public ComboBoxRenderer() {
			selectedLabel.setOpaque(false);
			Dimension d = new Dimension(ComboBoxValues.getWidth(),ComboBoxValues.getHeight());
			selectedLabel.setMinimumSize(d);
		}

		/**
		 * @see ListCellRenderer
		 */
		public Component getListCellRendererComponent(JList list, Object value,
				int index, boolean isSelected, boolean cellHasFocus) {
			if (index==-1) {
				ComboBoxValues val = (ComboBoxValues)value;
				selectedLabel.setText(val.title);
				selectedLabel.setBackground(val.normalRenderer.getBackground());
				selectedLabel.setForeground(val.normalRenderer.getForeground());

				return selectedLabel;
			}
			if (isSelected) {
				return ((ComboBoxValues)value).selectedRenderer;
			} else {
				return ((ComboBoxValues)value).normalRenderer;
			}
		}

	}

	/**
	 * The values  shown in the ComboBox.
	 * It contains the labels to use as renderer for each cell.
	 * One label is for the normal situation and the second one
	 * is used when the cell has focus (inverted colors)
	 *
	 * @author acaproni
	 *
	 */
	public enum ComboBoxValues {
		NONE("None",AlarmGUIType.INACTIVE),
		PRIORITY3(PriorityLabel.LOW.description,AlarmGUIType.PRIORITY_3),
		PRIORITY2(PriorityLabel.MEDIUM.description,AlarmGUIType.PRIORITY_2),
		PRIORITY1(PriorityLabel.HIGH.description,AlarmGUIType.PRIORITY_1);

		/**
		 * The title of the value
		 */
		public final String title;

		/**
		 * Normal renderer
		 */
		public final JLabel normalRenderer;

		/**
		 * Normal renderer
		 */
		public final JLabel selectedRenderer;

		/**
		 * The AlarmGUIType related to this ComboBox value
		 */
		public final AlarmGUIType guiType;

		// Width and height of the label
		// They are calculated from the dimension of the strings
		// to show
		private static int height=0;
		private static int width=0;

		/**
		 * Constructor
		 *
		 * @param title
		 * @param guiType
		 */
		private ComboBoxValues(String title,AlarmGUIType guiType) {
			this.guiType=guiType;
			this.title=title;
			normalRenderer = new JLabel(title);
			normalRenderer.setBackground(guiType.backg);
			normalRenderer.setForeground(guiType.foreg);
			normalRenderer.setHorizontalAlignment(SwingConstants.CENTER);
			normalRenderer.setVerticalAlignment(SwingConstants.CENTER);
			normalRenderer.setOpaque(true);
			Font fnt = normalRenderer.getFont();
			Font newFont = fnt.deriveFont(fnt.getSize()*80/100);
			normalRenderer.setFont(newFont);
			selectedRenderer = new JLabel(title);
			selectedRenderer.setBackground(guiType.foreg);
			selectedRenderer.setForeground(guiType.backg);
			selectedRenderer.setHorizontalAlignment(SwingConstants.CENTER);
			selectedRenderer.setVerticalAlignment(SwingConstants.CENTER);
			selectedRenderer.setFont(newFont);
			selectedRenderer.setOpaque(true);
			selectedRenderer.setBorder(BorderFactory.createLineBorder(guiType.backg));
		}

		/**
		 * Init the sizes of all the labels
		 */
		public static void initSizes() {
			for (ComboBoxValues val: ComboBoxValues.values()) {
				Font f = val.normalRenderer.getFont();
				FontMetrics fm = val.normalRenderer.getFontMetrics(f);
				int h = fm.getHeight()+5;
				int w = fm.charsWidth(val.title.toCharArray(), 0, val.title.length())+10;
				setHeight(h);
				setWidth(w);
			}

			Dimension d = new Dimension(ComboBoxValues.getWidth(),ComboBoxValues.getHeight());
			for (ComboBoxValues val: ComboBoxValues.values()) {
				val.normalRenderer.setPreferredSize(d);
				val.selectedRenderer.setPreferredSize(d);
				val.normalRenderer.setMinimumSize(d);
				val.selectedRenderer.setMinimumSize(d);
			}

			System.out.println(d);
		}

		/**
		 * Return the height of each label
		 *
		 * @return The height of each lable
		 */
		public static int getHeight() {
			return height;
		}

		/**
		 * Return the width of each label
		 *
		 * @return The width of each label
		 */
		public static int getWidth() {
			return width;
		}

		/**
		 * Set the height (static fields can't be
		 * called directly by the constructor)
		 *
		 * @param height The new height
		 */
		private static void setHeight(int height) {
			if (height>ComboBoxValues.height) {
				ComboBoxValues.height = height;
			}
		}

		/**
		 * Set the width (static fields can't be
		 * called directly by the constructor)
		 *
		 * @param width The new width
		 */
		private static void setWidth(int width) {
			if (width>ComboBoxValues.width) {
				ComboBoxValues.width = width;
			}
		}
	}

	/**
	 * The panel showing the toolbar
	 */
	private final CernSysPanel alarmPanel;

	/**
	 * The combo box for auto-acknowledgment of alarms
	 */
	private JComboBox autoAckLevelCB=new JComboBox(ComboBoxValues.values());

	/**
	 * The icon shown in the button when reduction is active
	 */
	private ImageIcon activeReductionIcon;

	/**
	 * The icon shown in the button when reduction is inactive
	 */
	private ImageIcon inactiveReductionIcon;

	/**
	 * The check box to activate/deactivate the reduction of alarms
	 */
	private JToggleButton reductionRulesBtn;

	/**
	 * The icon shown by pauseBtn when the application is paused
	 */
	private ImageIcon pausedIcon = new ImageIcon(Toolbar.class.getResource(AlarmGUIType.iconFolder+"play.png"));

	/**
	 * The icon shown by pauseBtn when the application is not paused
	 */
	private ImageIcon notPausedIcon = new ImageIcon(Toolbar.class.getResource(AlarmGUIType.iconFolder+"pause.png"));

	/**
	 * The icon for the filter button
	 */
	private ImageIcon filterIcon = new ImageIcon(Toolbar.class.getResource(AlarmGUIType.iconFolder+"filters.png"));

	/**
	 * The button to select the alarms matching the content of the searchTF text field
	 */
	private JToggleButton showBtn = new JToggleButton("Show",filterIcon, false);

	/**
	 * The button to hide the alarms matching the content of the searchTF text field
	 */
	private JToggleButton hideBtn = new JToggleButton("Hide",filterIcon, false);

	/**
	 * The button to pause/unpause the application
	 */
	private JButton pauseBtn = new JButton("Pause",notPausedIcon);

	/**
	 * The label box for auto-acknowledgement of alarms
	 */
	private JLabel autoAckLbl = new JLabel("Auto ack: ");

	/**
	 * The text field to write the text to search for in the table
	 */
	private JTextField searchTF = new JTextField(16);

	/**
	 * The button to search for the next item
	 */
	private JButton nextSearchBtn = new JButton(new ImageIcon(Toolbar.class.getResource(AlarmGUIType.iconFolder+"resultset_next.png")));

	/**
	 * The button to search for the next item
	 */
	private JButton prevSearchBtn = new JButton(new ImageIcon(Toolbar.class.getResource(AlarmGUIType.iconFolder+"resultset_previous.png")));

	/**
	 * The table of alarms
	 */
	private final AlarmTable table;

	/**
	 * The table model
	 */
	private final AlarmTableModel model;

	private final SoundWidget soundComponent;

	/**
	 * Constructor
	 *
	 * @param table The table of alarms
	 * @param model The table model
	 * @param alarmSound The object playing audibles
	 * @param reduce true if the reduction rules are applied at startup
	 * @param panel The panel showing the toolbar
	 */
	public Toolbar(AlarmTable table, AlarmTableModel model, AlarmSound alarmSound, boolean reduce, CernSysPanel panel) {
		super();
		if (table==null) {
			throw new IllegalArgumentException("The table can't be null");
		}
		if (model==null) {
			throw new IllegalArgumentException("The model can't be null");
		}
		if (panel==null) {
			throw new IllegalArgumentException("The panel can't be null");
		}
		soundComponent=new SoundWidget(alarmSound);
		this.table=table;
		this.model=model;
		this.alarmPanel=panel;
		initialize(reduce);
	}

	/**
	 * Initialize the toolbar
	 *
	 * @param true if the reduction rules are applied at startup
	 */
	private void initialize(boolean reduce) {
		setLayout(new BoxLayout(this,BoxLayout.LINE_AXIS));
		setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

		// Add the button to inhibit sounds
		add(soundComponent);
		// Add the label and the combobox for auto ack
		Font fnt = autoAckLbl.getFont();
		Font newFont = fnt.deriveFont(fnt.getSize()*80/100);
		autoAckLbl.setFont(newFont);
		add(Box.createHorizontalStrut(2));
		add(autoAckLbl);
		autoAckLevelCB.setFont(newFont);
		autoAckLevelCB.setEditable(false);
		autoAckLevelCB.setOpaque(true);
		// Set the colors of the renderers
		ComboBoxValues.initSizes();
		autoAckLevelCB.setRenderer(new ComboBoxRenderer());
		autoAckLevelCB.setSelectedIndex(ComboBoxValues.NONE.ordinal());
		autoAckLevelCB.setMaximumRowCount(ComboBoxValues.values().length);
		autoAckLevelCB.setEditable(false);
		autoAckLevelCB.addActionListener(this);
		Dimension d = new Dimension(ComboBoxValues.getWidth(),ComboBoxValues.getHeight());
		autoAckLevelCB.setMinimumSize(d);
		add(Box.createHorizontalStrut(5));
		add(autoAckLevelCB);

		activeReductionIcon=new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_in.png"));
		inactiveReductionIcon=new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_out.png"));
		reductionRulesBtn= new JToggleButton("Reduce",activeReductionIcon, reduce);
		reductionRulesBtn.setFont(newFont);
		add(Box.createHorizontalStrut(5));
		add(reductionRulesBtn);
		reductionRulesBtn.addActionListener(this);

		add(Box.createHorizontalStrut(5));
		add(pauseBtn);
		pauseBtn.addActionListener(this);
		pauseBtn.setFont(newFont);

		add(Box.createHorizontalStrut(5));
		add(new JSeparator(JSeparator.VERTICAL));
		add(Box.createHorizontalStrut(5));
		JLabel searchLbl=new JLabel("Search");
		add(searchLbl);
		searchLbl.setFont(newFont);
		add(Box.createHorizontalStrut(5));
		add(searchTF);
		searchTF.setEditable(true);
		searchTF.getDocument().addDocumentListener(this);
		searchTF.setToolTipText("Search");
		add(Box.createHorizontalStrut(3));
		add(prevSearchBtn);
		prevSearchBtn.setToolTipText("Search prev");
		prevSearchBtn.addActionListener(this);
		add(Box.createHorizontalStrut(3));
		add(nextSearchBtn);
		nextSearchBtn.setToolTipText("Search next");
		nextSearchBtn.addActionListener(this);
		add(Box.createHorizontalStrut(3));
		add(showBtn);
		showBtn.setFont(newFont);
		showBtn.setToolTipText("Filter in");
		showBtn.addActionListener(this);

		add(Box.createHorizontalStrut(3));
		add(hideBtn);
		hideBtn.setFont(newFont);
		hideBtn.setToolTipText("Filter out");
		hideBtn.addActionListener(this);
		add(Box.createHorizontalStrut(2));

		ratioSearchBtns();
	}

	/**
	 * Set the auto acknowledge level to the passed priority.
	 *

	 * The priority must be set accordingly to the rules explained in {@link CernSysPanel#AutoAckLevelPropName},
	 * so the only valid values are -1,1,2,3
	 *
	 *
	 * @param newLevel The new priority of the auto acknowledge
	 * @see CernSysPanel#AutoAckLevelPropName
	 */
	public void setAutoAckLevel(int newLevel) {
		ComboBoxValues ackLvl=null;
		switch (newLevel) {
		case 1: {
			ackLvl=ComboBoxValues.PRIORITY1;
			break;
		}
		case 2: {
			ackLvl=ComboBoxValues.PRIORITY2;
			break;
		}
		case 3: {
			ackLvl=ComboBoxValues.PRIORITY3;
			break;
		}
		default: {
			ackLvl=ComboBoxValues.NONE;
		}
		}
		final ComboBoxValues ackLvlToSet=ackLvl;
		EDTExecutor.instance().execute(new Runnable() {
			public void run() {
				// This trigger an ActionEvent too.
				autoAckLevelCB.setSelectedItem(ackLvlToSet);
			}
		});
	}

	/**
	 * @see ActionListener
	 */
	public void actionPerformed(ActionEvent e) {
		if (e.getSource()==autoAckLevelCB) {
			model.setAutoAckLevel((ComboBoxValues)autoAckLevelCB.getSelectedItem());
		} else if (e.getSource()==reductionRulesBtn) {
			model.applyReductions(reductionRulesBtn.isSelected());
			if (reductionRulesBtn.isSelected()) {
				reductionRulesBtn.setIcon(activeReductionIcon);
			} else {
				reductionRulesBtn.setIcon(inactiveReductionIcon);
			}
		} else if (e.getSource()==pauseBtn) {
			try {
				if (pauseBtn.getIcon()==notPausedIcon) {
						alarmPanel.pause();
				} else {
					alarmPanel.resume();
				}
			} catch (Throwable t) {
				t.printStackTrace(System.err);
				JOptionPane.showMessageDialog(this, t.getMessage(), "Error pausing/unpausing", JOptionPane.ERROR_MESSAGE);
			}
		} else if (e.getSource()==prevSearchBtn) {
			table.search(searchTF.getText(), false);
		} else if (e.getSource()==nextSearchBtn) {
			table.search(searchTF.getText(), true);
		} else if (e.getSource()==showBtn) {
			searchTF.setEnabled(!showBtn.isSelected());
			hideBtn.setEnabled(!showBtn.isSelected());
			if (showBtn.isSelected()) {
				table.filter(searchTF.getText(),false);
			} else {
				table.filter(null,false);
			}
		} else if (e.getSource()==hideBtn) {
			searchTF.setEnabled(!hideBtn.isSelected());
			showBtn.setEnabled(!hideBtn.isSelected());
			if (hideBtn.isSelected()) {
				table.filter(searchTF.getText(),true);
			} else {
				table.filter(null,false);
			}
		} else {
			System.err.println("Invalid source of event: "+e.getSource());
		}
	}

	/**
	 * Update the state of the pause button depending on the state
	 * paused/unpaused of the application
	 *

	 * This method is not called directly by actionPerformed when the button
	 * is pressed.
	 * It is executed when the application is started/paused.
	 *
	 * @param paused true if the application is paused
	 */
	public void updatePauseBtn(final boolean paused) {
		EDTExecutor.instance().execute(new Runnable() {
			public void run() {
				if (paused) {
					pauseBtn.setIcon(pausedIcon);
					pauseBtn.setText("Play");
				} else {
					pauseBtn.setIcon(notPausedIcon);
					pauseBtn.setText("Pause");
				}
			}
		});
	}

	/**
	 * The document listener for the text in the search TF
	 *
	 * @see DocumentListener
	 */
	@Override
	public void changedUpdate(DocumentEvent e) {
		ratioSearchBtns();
	}

	/**
	 * The document listener for the text in the search TF
	 *
	 * @see DocumentListener
	 */
	@Override
	public void insertUpdate(DocumentEvent e) {
		ratioSearchBtns();
	}

	/**
	 * The document listener for the text in the search TF
	 *
	 * @see DocumentListener
	 */
	@Override
	public void removeUpdate(DocumentEvent e) {
		ratioSearchBtns();
	}

	/**
	 * Enable/disable the buttons for searching depending
	 * on the content of the text field.
	 *

	 * This is the logic:
	 *

	 *
if the TF is empty the buttons are all disabled
	 *
if the TF contains test, the buttons are all enabled
	 *
if the user filters then the TF is disabled
	 *  	(this is done while catching the filterBtn event)
	 *

	 */
	private void ratioSearchBtns() {
		EDTExecutor.instance().execute(new Runnable() {
			public void run() {
				String text = searchTF.getText();
				prevSearchBtn.setEnabled(text!=null && !text.isEmpty());
				nextSearchBtn.setEnabled(text!=null && !text.isEmpty());
				showBtn.setEnabled(text!=null && !text.isEmpty());
				hideBtn.setEnabled(text!=null && !text.isEmpty());
			}
		});
	}
}


text:
package net.runelite.client.plugins.banktags.tabs;

import com.google.common.base.MoreObjects;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.Getter;
import net.runelite.api.ItemID;
import net.runelite.client.config.ConfigManager;
import static net.runelite.client.plugins.banktags.BankTagsPlugin.CONFIG_GROUP;
import static net.runelite.client.plugins.banktags.BankTagsPlugin.ICON_SEARCH;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.math.NumberUtils;

@Singleton
class TabManager
{
	private static final String TAG_TABS_CONFIG = "tagtabs";

	@Getter
	private final List<TagTab> tabs = new ArrayList<>();
	private final ConfigManager configManager;

	@Inject
	private TabManager(ConfigManager configManager)
	{
		this.configManager = configManager;
	}

	void add(TagTab tagTab)
	{
		if (!contains(tagTab.getTag()))
		{
			tabs.add(tagTab);
		}
	}

	void clear()
	{
		tabs.forEach(t -> t.setHidden(true));
		tabs.clear();
	}

	TagTab find(String tag)
	{
		Optional<TagTab> first = tabs.stream().filter(t -> t.getTag().equals(Text.standardize(tag))).findAny();
		return first.orElse(null);
	}

	List<String> getAllTabs()
	{
		return Text.fromCSV(MoreObjects.firstNonNull(configManager.getConfiguration(CONFIG_GROUP, TAG_TABS_CONFIG), ""));
	}

	TagTab load(String tag)
	{
		TagTab tagTab = find(tag);

		if (tagTab == null)
		{
			tag = Text.standardize(tag);
			String item = configManager.getConfiguration(CONFIG_GROUP, ICON_SEARCH + tag);
			int itemid = NumberUtils.toInt(item, ItemID.SPADE);
			tagTab = new TagTab(itemid, tag);
		}

		return tagTab;
	}

	void move(String tagToMove, String tagDestination)
	{
		tagToMove = Text.standardize(tagToMove);
		tagDestination = Text.standardize(tagDestination);

		if (contains(tagToMove) && contains(tagDestination))
		{
			Collections.swap(tabs, indexOf(tagToMove), indexOf(tagDestination));
		}
	}

	void remove(String tag)
	{
		TagTab tagTab = find(tag);

		if (tagTab != null)
		{
			tagTab.setHidden(true);
			tabs.remove(tagTab);
			removeIcon(tag);
		}
	}

	void save()
	{
		String tags = Text.toCSV(tabs.stream().map(TagTab::getTag).collect(Collectors.toList()));
		configManager.setConfiguration(CONFIG_GROUP, TAG_TABS_CONFIG, tags);
	}

	void removeIcon(final String tag)
	{
		configManager.unsetConfiguration(CONFIG_GROUP, ICON_SEARCH + Text.standardize(tag));
	}

	void setIcon(final String tag, final String icon)
	{
		configManager.setConfiguration(CONFIG_GROUP, ICON_SEARCH + Text.standardize(tag), icon);
	}

	int size()
	{
		return tabs.size();
	}

	private boolean contains(String tag)
	{
		return tabs.stream().anyMatch(t -> t.getTag().equals(tag));
	}

	private int indexOf(TagTab tagTab)
	{
		return tabs.indexOf(tagTab);
	}

	private int indexOf(String tag)
	{
		return indexOf(find(tag));
	}
}


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"
    />
    <link type="image/png" rel="shortcut icon" href="/vivaxy.icon.png" />
    <link type="text/css" rel="stylesheet" href="index.css" />
    <title>Sliding Tiles Puzzle</title>
    <meta name="author" content="vivaxy <xyxuye2007@126.com>" />
    <meta
      name="keywords"
      content="vivaxy,samples,github,demo,playground,sliding-tiles-puzzle,test,sample,demos"
    />
    <meta name="description" content="数字推盘游戏" />

Initial Config

6

4

7

8

5

3

2

1

        <button onclick="start()">Solve</button>
        <button onclick="showSolution()">Show Step</button>

Goal Config

1

2

3

4

5

6

7

8


text:
arch ?= x86_64
target := $(arch)-unknown-linux-gnu
kernel := build/kernel-$(arch).bin
iso := build/os-$(arch).iso

rust_os := target/$(target)/debug/librusty_os.a
linker_script := src/arch/$(arch)/linker.ld
grub_cfg := src/arch/$(arch)/grub.cfg
assembly_source_files := $(wildcard src/arch/$(arch)/*.asm)
assembly_object_files := $(patsubst src/arch/$(arch)/%.asm, \
	build/arch/$(arch)/%.o, $(assembly_source_files))

.PHONY: all clean run iso

all: $(kernel)

clean:
	@cargo clean
	@rm -r build

run: $(iso)
	@qemu-system-x86_64 -cdrom $(iso)

iso: $(iso)

$(iso): $(kernel) $(grub_cfg)
	@mkdir -p build/isofiles/boot/grub
	@cp $(kernel) build/isofiles/boot/kernel.bin
	@cp $(grub_cfg) build/isofiles/boot/grub
	@grub-mkrescue -o $(iso) build/isofiles 2> /dev/null
	@rm -r build/isofiles

$(kernel): cargo $(rust_os) $(assembly_object_files) $(linker_script)
	@ld -n --gc-sections  -T $(linker_script) -o $(kernel) $(assembly_object_files) $(rust_os)

cargo:
	@cargo rustc --target $(target) -- -Z no-landing-pads

# compile assembly files
build/arch/$(arch)/%.0: src/arch/$(arch)/%.asm
	@mkdir -p $(shell dirname $@)
	@nasm -felf64 $< -o $@


text:
package domain

import (
	"time"
)

// AuditData - Audit Data Attached To The Perdidted Data Object
type AuditData struct {
	ID int `json:"id,omitempty"`

	CreatedBy  string    `json:"createdBy,omitempty"`
	CreateOn   time.Time `json:"createdOn,omitempty"`
	ModifiedBy string    `json:"modifiedBy,omitempty"`
	ModifiedOn time.Time `json:"modifiedOn,omitempty"`
	Version    string    `json:"version,omitempty"`
}

// StampData - Stamp The Current Audit Date To Current Time
func (audit AuditData) StampData(userStamp string) {

	if audit.ID == -1 {
		audit.CreatedBy = userStamp
		audit.CreateOn = time.Now()
	}
	audit.ModifiedBy = userStamp
	audit.ModifiedOn = time.Now()
}


text:
require 'spec_helper'

#bundle exec rspec spec
describe Tushare::Stock::Shibor do
  before do
    @stock = Tushare::Stock::Shibor
  end

  describe 'Shibor' do
    it 'can get shibor data' do
      tp @stock.shibor_data
    end

    it 'can get shibor quote data' do
      tp @stock.shibor_quote_data
    end

    it 'can get shibor ma data' do
      tp @stock.shibor_ma_data
    end

    it 'can get LPR data' do
      tp @stock.lpr_data
    end

    it 'can get LPR MA data' do
      tp @stock.lpr_ma_data
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">

  <TextView
      android:id="@+id/menuEntry"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>

  <TextView
      android:id="@+id/contentLevel"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/>

  <Button
      android:id="@+id/goDeeper"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="We need to go deeper"/>
</LinearLayout>


text:
def fibonacci(limit):
    a, b, c = 0, 1, 1
    series = ['1']
    for i in range(1, limit):
        c = a + b
        a, b = b, c
        series.append(str(c))
    return series

def main(limit: ('upper limit for calculations', 'positional', None, int)):
    series = ', '.join(fibonacci(limit))
    print(f'The first {limit} terms are: {series}')

if __name__ == '__main__':
    try:
        import plac

        plac.call(main)
    except KeyboardInterrupt:
        print('\nGoodbye!')


text:
@@include( '../includes/header.tpl', { "site": "mew" } )

 {{tab.name}}

    @@include( '../includes/generateWallet.tpl', { "site": "mew" } )

    @@include( '../includes/viewWalletInfo.tpl', { "site": "mew" } )

    @@include( '../includes/sendTransaction.tpl', { "site": "mew" } )

    @@include( '../includes/offlineTransaction.tpl', { "site": "mew" } )

    @@include( '../includes/help.tpl', { "site": "mew" } )

    @@include( '../includes/bulkGenerate.tpl', { "site": "mew" } )

    @@include( '../includes/print.tpl', { "site": "mew" } )

@@include( '../includes/footer.tpl', { "site": "mew" } )


text:
package com.dieselpoint.cluster.common;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.CompletableFuture;

import com.dieselpoint.buffers.Buffer;
import com.dieselpoint.buffers.ByteArray;
import com.dieselpoint.buffers.ByteUtil;

public class Command implements Message {

	private Buffer commandBytes;
    private CompletableFuture<CommandResponse> future;

	public Command() {
		this.commandBytes = new ByteArray();
	}

	public Command(Buffer commandBytes) {
		this.commandBytes = commandBytes;
	}

	public Buffer getCommandBytes() {
		return commandBytes;
	}

	public void setCommandBytes(ByteArray commandBytes) {
		this.commandBytes = commandBytes;
	}

	@Override
	public void writeTo(OutputStream out) throws IOException {
		ByteUtil.writeBuffer(commandBytes, out);
	}

	@Override
	public void readFrom(InputStream in) throws IOException {
		commandBytes = ByteUtil.readBuffer(in);
	}

	public void writeTo(Buffer buf) {
		ByteUtil.writeBuffer(commandBytes, buf);
	}

	public void readFrom(Buffer buf) {
		commandBytes = ByteUtil.readBuffer(buf);
	}

	public CompletableFuture<CommandResponse> future() {
		if (future == null) {
			future = new CompletableFuture<>();
		}
		return future;
	}

	public void complete(CommandResponse resp) {
		// if future hasn't been created, no need to complete it
		if (future != null) {
			future.complete(resp);
		}
	}

	@Override
	public String toString() {
		return "Command [ commandBytes=" + commandBytes + "]";
	}

	@Override
	public int hashCode() {
		return commandBytes.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Command)) {
			return false;
		}
		Command other = (Command) obj;
		if (commandBytes == null) {
			if (other.commandBytes != null) {
				return false;
			}
		} else if (!commandBytes.equals(other.commandBytes)) {
			return false;
		}
		return true;
	}

}


text:
package org.apache.nifi.parameter;

import org.junit.Test;

import java.util.List;

import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class TestExpressionLanguageAwareParameterParser {

    @Test
    public void testProperReferences() {
        final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
        final ParameterTokenList references = parameterParser.parseTokens("#{foo}");

        for (final ParameterReference reference : references.toReferenceList()) {
            assertEquals("foo", reference.getParameterName());
            assertEquals(0, reference.getStartOffset());
            assertEquals(5, reference.getEndOffset());
            assertEquals("#{foo}", reference.getText());
        }

        List<ParameterReference> referenceList = parameterParser.parseTokens("/#{foo}").toReferenceList();
        assertEquals(1, referenceList.size());

        ParameterReference reference = referenceList.get(0);
        assertEquals("foo", reference.getParameterName());
        assertEquals(1, reference.getStartOffset());
        assertEquals(6, reference.getEndOffset());
        assertEquals("#{foo}", reference.getText());

        referenceList = parameterParser.parseTokens("/#{foo}/").toReferenceList();
        assertEquals(1, referenceList.size());
        reference = referenceList.get(0);
        assertEquals("foo", reference.getParameterName());
        assertEquals(1, reference.getStartOffset());
        assertEquals(6, reference.getEndOffset());
        assertEquals("#{foo}", reference.getText());

        referenceList = parameterParser.parseTokens("/#{foo}/#{bar}#{baz}").toReferenceList();
        assertEquals(3, referenceList.size());

        reference = referenceList.get(0);
        assertEquals("foo", reference.getParameterName());
        assertEquals(1, reference.getStartOffset());
        assertEquals(6, reference.getEndOffset());
        assertEquals("#{foo}", reference.getText());

        reference = referenceList.get(1);
        assertEquals("bar", reference.getParameterName());
        assertEquals(8, reference.getStartOffset());
        assertEquals(13, reference.getEndOffset());
        assertEquals("#{bar}", reference.getText());

        reference = referenceList.get(2);
        assertEquals("baz", reference.getParameterName());
        assertEquals(14, reference.getStartOffset());
        assertEquals(19, reference.getEndOffset());
        assertEquals("#{baz}", reference.getText());
    }

    @Test
    public void testEscapeSequences() {
        final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
        List<ParameterToken> tokenList = parameterParser.parseTokens("#{foo}").toList();
        assertEquals(1, tokenList.size());

        ParameterToken token = tokenList.get(0);
        assertTrue(token.isParameterReference());
        assertEquals("foo", ((ParameterReference) token).getParameterName());
        assertEquals(0, token.getStartOffset());
        assertEquals(5, token.getEndOffset());
        assertEquals("#{foo}", token.getText());
        assertFalse(token.isEscapeSequence());

        tokenList = parameterParser.parseTokens("##{foo}").toList();
        assertEquals(1, tokenList.size());

        token = tokenList.get(0);
        assertFalse(token.isParameterReference());
        assertEquals(0, token.getStartOffset());
        assertEquals(6, token.getEndOffset());
        assertEquals("##{foo}", token.getText());
        assertTrue(token.isEscapeSequence());

        tokenList = parameterParser.parseTokens("###{foo}").toList();
        assertEquals(2, tokenList.size());

        token = tokenList.get(0);
        assertFalse(token.isParameterReference());
        assertEquals(0, token.getStartOffset());
        assertEquals(1, token.getEndOffset());
        assertEquals("##", token.getText());
        assertTrue(token.isEscapeSequence());

        token = tokenList.get(1);
        assertTrue(token.isParameterReference());
        assertEquals("foo", ((ParameterReference) token).getParameterName());
        assertEquals(2, token.getStartOffset());
        assertEquals(7, token.getEndOffset());
        assertFalse(token.isEscapeSequence());

        // Test an escaped # followed by an escaped #{foo}
        tokenList = parameterParser.parseTokens("####{foo}").toList();
        assertEquals(2, tokenList.size());

        token = tokenList.get(0);
        assertFalse(token.isParameterReference());
        assertEquals(0, token.getStartOffset());
        assertEquals(1, token.getEndOffset());
        assertEquals("##", token.getText());
        assertTrue(token.isEscapeSequence());

        token = tokenList.get(1);
        assertFalse(token.isParameterReference());
        assertEquals(2, token.getStartOffset());
        assertEquals(8, token.getEndOffset());
        assertTrue(token.isEscapeSequence());

        // Test multiple escaped # followed by a reference of #{foo}
        tokenList = parameterParser.parseTokens("#####{foo}").toList();
        assertEquals(3, tokenList.size());

        token = tokenList.get(0);
        assertFalse(token.isParameterReference());
        assertEquals(0, token.getStartOffset());
        assertEquals(1, token.getEndOffset());
        assertEquals("##", token.getText());
        assertTrue(token.isEscapeSequence());

        token = tokenList.get(1);
        assertFalse(token.isParameterReference());
        assertEquals(2, token.getStartOffset());
        assertEquals(3, token.getEndOffset());
        assertEquals("##", token.getText());
        assertTrue(token.isEscapeSequence());

        token = tokenList.get(2);
        assertTrue(token.isParameterReference());
        assertEquals("foo", ((ParameterReference) token).getParameterName());
        assertEquals(4, token.getStartOffset());
        assertEquals(9, token.getEndOffset());
        assertFalse(token.isEscapeSequence());
    }

    @Test
    public void testNonReferences() {
        final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();

        for (final String input : new String[] {"#foo", "Some text #{blah foo", "#foo}", "#}foo{", "#f{oo}", "#", "##", "###", "####", "#####", "#{", "##{", "###{"}) {
            assertEquals(0, parameterParser.parseTokens(input).toList().size());
        }
    }

    @Test
    public void testReferenceWithinExpressionLanguage() {
        final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
        final List<ParameterToken> tokens = parameterParser.parseTokens("${#{hello}:toUpper()}").toList();
        assertEquals(0, tokens.size());
    }

    @Test
    public void testReferenceInsideAndOutsideExpressionLanguage() {
        final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
        final List<ParameterToken> tokens = parameterParser.parseTokens("#{hello}${#{hello}:toUpper()}#{hello}").toList();
        assertEquals(2, tokens.size());

        for (final ParameterToken token : tokens) {
            assertEquals("hello", ((ParameterReference) token).getParameterName());
        }
    }

    @Test
    public void testReferenceOutsideExpressionLanguage() {
        final ParameterParser parameterParser = new ExpressionLanguageAwareParameterParser();
        final List<ParameterToken> tokens = parameterParser.parseTokens("#{hello}").toList();
        assertEquals(1, tokens.size());

        for (final ParameterToken token : tokens) {
            assertEquals("hello", ((ParameterReference) token).getParameterName());
        }
    }
}


text:
/**
 * @constant
 * @type Number
 */
cc.TMX_LAYER_ATTRIB_NONE = 1 << 0;
/**
 * @constant
 * @type Number
 */
cc.TMX_LAYER_ATTRIB_BASE64 = 1 << 1;
/**
 * @constant
 * @type Number
 */
cc.TMX_LAYER_ATTRIB_GZIP = 1 << 2;
/**
 * @constant
 * @type Number
 */
cc.TMX_LAYER_ATTRIB_ZLIB = 1 << 3;

/**
 * @constant
 * @type Number
 */
cc.TMX_PROPERTY_NONE = 0;

/**
 * @constant
 * @type Number
 */
cc.TMX_PROPERTY_MAP = 1;

/**
 * @constant
 * @type Number
 */
cc.TMX_PROPERTY_LAYER = 2;

/**
 * @constant
 * @type Number
 */
cc.TMX_PROPERTY_OBJECTGROUP = 3;

/**
 * @constant
 * @type Number
 */
cc.TMX_PROPERTY_OBJECT = 4;

/**
 * @constant
 * @type Number
 */
cc.TMX_PROPERTY_TILE = 5;

/**
 * @constant
 * @type Number
 */
cc.TMX_TILE_HORIZONTAL_FLAG = 0x80000000;

/**
 * @constant
 * @type Number
 */
cc.TMX_TILE_VERTICAL_FLAG = 0x40000000;

/**
 * @constant
 * @type Number
 */
cc.TMX_TILE_DIAGONAL_FLAG = 0x20000000;

/**
 * @constant
 * @type Number
 */
cc.TMX_TILE_FLIPPED_ALL = (cc.TMX_TILE_HORIZONTAL_FLAG | cc.TMX_TILE_VERTICAL_FLAG | cc.TMX_TILE_DIAGONAL_FLAG) >>> 0;

/**
 * @constant
 * @type Number
 */
cc.TMX_TILE_FLIPPED_MASK = (~(cc.TMX_TILE_FLIPPED_ALL)) >>> 0;

// Bits on the far end of the 32-bit global tile ID (GID's) are used for tile flags

/**
 *
cc.TMXLayerInfo contains the information about the layers like:

 * - Layer name

 * - Layer size

 * - Layer opacity at creation time (it can be modified at runtime)

 * - Whether the layer is visible (if it's not visible, then the CocosNode won't be created)

 *

 * This information is obtained from the TMX file.

 * @class
 * @extends cc.Class
 */
cc.TMXLayerInfo = cc.Class.extend(/** @lends cc.TMXLayerInfo# */{
    _properties:null,
    name:"",
    _layerSize:null,
    _tiles:null,
    visible:null,
    _opacity:null,
    ownTiles:true,
    _minGID:100000,
    _maxGID:0,
    offset:null,

    ctor:function () {
        this._properties = [];
        this.name = "";
        this._layerSize = null;
        this._tiles = [];
        this.visible = true;
        this._opacity = 0;
        this.ownTiles = true;
        this._minGID = 100000;
        this._maxGID = 0;
        this.offset = cc.PointZero();
    },

    /**
     * @return {Array}
     */
    getProperties:function () {
        return this._properties;
    },

    /**
     * @param {object} Var
     */
    setProperties:function (Var) {
        this._properties = Var;
    }
});

/**
 *
cc.TMXTilesetInfo contains the information about the tilesets like:

 * - Tileset name

 * - Tileset spacing

 * - Tileset margin

 * - size of the tiles

 * - Image used for the tiles

 * - Image size

 *
 * This information is obtained from the TMX file.

 * @class
 * @extends cc.Class
 */
cc.TMXTilesetInfo = cc.Class.extend(/** @lends cc.TMXTilesetInfo# */{

    /**
     * Tileset name
     */
    name:"",

    /**
     * First grid
     */
    firstGid:0,
    _tileSize:null,

    /**
     * Spacing
     */
    spacing:0,

    /**
     *  Margin
     */
    margin:0,

    /**
     * Filename containing the tiles (should be sprite sheet / texture atlas)
     */
    sourceImage:"",

    /**
     * Size in pixels of the image
     */
    imageSize:null,

    ctor:function () {
        this._tileSize = cc.SizeZero();
        this.imageSize = cc.SizeZero();
    },

    /**
     * @param {Number} gid
     * @return {cc.Rect}
     */
    rectForGID:function (gid) {
        var rect = cc.RectZero();
        rect._size = this._tileSize;
        gid &= cc.TMX_TILE_FLIPPED_MASK;
        gid = gid - parseInt(this.firstGid, 10);
        var max_x = parseInt((this.imageSize.width - this.margin * 2 + this.spacing) / (this._tileSize.width + this.spacing), 10);
        rect._origin.x = parseInt((gid % max_x) * (this._tileSize.width + this.spacing) + this.margin, 10);
        rect._origin.y = parseInt(parseInt(gid / max_x, 10) * (this._tileSize.height + this.spacing) + this.margin, 10);
        return rect;
    }
});

/**
 *
cc.TMXMapInfo contains the information about the map like:

 *- Map orientation (hexagonal, isometric or orthogonal)

 *- Tile size

 *- Map size

 *
 *
And it also contains:

 * - Layers (an array of TMXLayerInfo objects)

 * - Tilesets (an array of TMXTilesetInfo objects)

 * - ObjectGroups (an array of TMXObjectGroupInfo objects)

 *
 *
This information is obtained from the TMX file.

 * @class
 * @extends cc.SAXParser
 */
cc.TMXMapInfo = cc.SAXParser.extend(/** @lends cc.TMXMapInfo# */{
    // map orientation
    _orientation:null,
    _mapSize:null,
    _tileSize:null,
    _layers:null,
    _tileSets:null,
    _objectGroups:null,
    _parentElement:null,
    _parentGID:null,
    _layerAttribs:0,
    _storingCharacters:false,
    _properties:null,
    // tmx filename
    _TMXFileName:null,
    //current string
    _currentString:null,
    // tile properties
    _tileProperties:null,
    _resources:"",
    _currentFirstGID:0,

    ctor:function () {
        this._mapSize = cc.SizeZero();
        this._tileSize = cc.SizeZero();
        this._layers = [];
        this._tileSets = [];
        this._objectGroups = [];
        this._properties = [];
        this._tileProperties = [];

        this._currentFirstGID = 0;
    },
    /**
     * @return {Number}
     */
    getOrientation:function () {
        return this._orientation;
    },

    /**
     * @param {Number} Var
     */
    setOrientation:function (Var) {
        this._orientation = Var;
    },

    /**
     * Map width & height
     * @return {cc.Size}
     */
    getMapSize:function () {
        return cc.size(this._mapSize.width,this._mapSize.height);
    },

    /**
     * @param {cc.Size} Var
     */
    setMapSize:function (Var) {
        this._mapSize.width = Var.width;
        this._mapSize.height = Var.height;
    },

    /**
     * Tiles width & height
     * @return {cc.Size}
     */
    getTileSize:function () {
        return cc.size(this._tileSize.width, this._tileSize.height);
    },

    /**
     * @param {cc.Size} Var
     */
    setTileSize:function (Var) {
        this._tileSize.width = Var.width;
        this._tileSize.height = Var.height;
    },

    /**
     * Layers
     * @return {Array}
     */
    getLayers:function () {
        return this._layers;
    },

    /**
     * @param {cc.TMXLayerInfo} Var
     */
    setLayers:function (Var) {
        this._layers.push(Var);
    },

    /**
     * tilesets
     * @return {Array}
     */
    getTilesets:function () {
        return this._tileSets;
    },

    /**
     * @param {cc.TMXTilesetInfo} Var
     */
    setTilesets:function (Var) {
        this._tileSets.push(Var);
    },

    /**
     * ObjectGroups
     * @return {Array}
     */
    getObjectGroups:function () {
        return this._objectGroups;
    },

    /**
     * @param {cc.TMXObjectGroup} Var
     */
    setObjectGroups:function (Var) {
        this._objectGroups.push(Var);
    },

    /**
     * parent element
     * @return {Number}
     */
    getParentElement:function () {
        return this._parentElement;
    },

    /**
     * @param {Number} Var
     */
    setParentElement:function (Var) {
        this._parentElement = Var;
    },

    /**
     * parent GID
     * @return {Number}
     */
    getParentGID:function () {
        return this._parentGID;
    },

    /**
     * @param {Number} Var
     */
    setParentGID:function (Var) {
        this._parentGID = Var;
    },

    /**
     *  layer attribute
     * @return {Number}
     */
    getLayerAttribs:function () {
        return this._layerAttribs;
    },

    /**
     * @param {Number} Var
     */
    setLayerAttribs:function (Var) {
        this._layerAttribs = Var;
    },

    /**
     * is string characters?
     * @return {Boolean}
     */
    getStoringCharacters:function () {
        return this._storingCharacters;
    },

    /**
     * @param {Boolean} Var
     */
    setStoringCharacters:function (Var) {
        this._storingCharacters = Var;
    },

    /**
     * Properties
     * @return {Array}
     */
    getProperties:function () {
        return this._properties;
    },

    /**
     * @param {object} Var
     */
    setProperties:function (Var) {
        this._properties = Var;
    },

    /**
     * Initializes a TMX format with a  tmx file
     * @param {String} tmxFile
     * @param {String} resourcePath
     * @return {Element}
     */
    initWithTMXFile:function (tmxFile, resourcePath) {
        this._internalInit(tmxFile, resourcePath);
        return this.parseXMLFile(this._TMXFileName);
        //return this.parseXMLFile(cc.FileUtils.getInstance().fullPathForFilename(this._TMXFileName));
    },

    /**
     * initializes a TMX format with an XML string and a TMX resource path
     * @param {String} tmxString
     * @param {String} resourcePath
     * @return {Boolean}
     */
    initWithXML:function (tmxString, resourcePath) {
        this._internalInit(null, resourcePath);
        return this.parseXMLString(tmxString);
    },

    /** Initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file
     * @param {String} tmxFile
     * @param {boolean} [isXmlString=false]
     * @return {Element}
     */
    parseXMLFile:function (tmxFile, isXmlString) {
        isXmlString = isXmlString || false;
        tmxFile = cc.FileUtils.getInstance().fullPathForFilename(tmxFile);
        var mapXML = cc.SAXParser.getInstance().tmxParse(tmxFile, isXmlString);
        var i, j;

        // PARSE <map>
        var map = mapXML.documentElement;

        var version = map.getAttribute('version');
        var orientationStr = map.getAttribute('orientation');

        if (map.nodeName == "map") {
            if (version != "1.0" && version !== null)
                cc.log("cocos2d: TMXFormat: Unsupported TMX version:" + version);

            if (orientationStr == "orthogonal")
                this.setOrientation(cc.TMX_ORIENTATION_ORTHO);
            else if (orientationStr == "isometric")
                this.setOrientation(cc.TMX_ORIENTATION_ISO);
            else if (orientationStr == "hexagonal")
                this.setOrientation(cc.TMX_ORIENTATION_HEX);
            else if (orientationStr !== null)
                cc.log("cocos2d: TMXFomat: Unsupported orientation:" + this.getOrientation());

            var mapSize = cc.size(0, 0);
            mapSize.width = parseFloat(map.getAttribute('width'));
            mapSize.height = parseFloat(map.getAttribute('height'));
            this.setMapSize(mapSize);

            mapSize = cc.size(0, 0);
            mapSize.width = parseFloat(map.getAttribute('tilewidth'));
            mapSize.height = parseFloat(map.getAttribute('tileheight'));
            this.setTileSize(mapSize);

            // The parent element is the map
            var propertyArr = map.querySelectorAll("map > properties >  property");
            if (propertyArr) {
                var aPropertyDict = {};
                for (i = 0; i < propertyArr.length; i++) {
                    aPropertyDict[propertyArr[i].getAttribute('name')] = propertyArr[i].getAttribute('value');
                }
                this.setProperties(aPropertyDict);
            }
        }

        // PARSE <tileset>
        var tilesets = map.getElementsByTagName('tileset');
        if (map.nodeName !== "map") {
            tilesets = [];
            tilesets.push(map);
        }

        for (i = 0; i < tilesets.length; i++) {
            var selTileset = tilesets[i];
            // If this is an external tileset then start parsing that
            var externalTilesetFilename = selTileset.getAttribute('source');
            if (externalTilesetFilename) {
                //this._currentFirstGID = parseInt(selTileset.getAttribute('firstgid'));
                this.parseXMLFile(cc.FileUtils.getInstance().fullPathFromRelativeFile(externalTilesetFilename, isXmlString ? this._resources + "/" : tmxFile));
            } else {
                var tileset = new cc.TMXTilesetInfo();
                tileset.name = selTileset.getAttribute('name') || "";
                //TODO need fix
                //if(this._currentFirstGID === 0){
                tileset.firstGid = parseInt(selTileset.getAttribute('firstgid')) || 0;
                //}else{
                //    tileset.firstGid = this._currentFirstGID;
                //    this._currentFirstGID = 0;
                //}

                tileset.spacing = parseInt(selTileset.getAttribute('spacing')) || 0;
                tileset.margin = parseInt(selTileset.getAttribute('margin')) || 0;

                var tilesetSize = cc.size(0, 0);
                tilesetSize.width = parseFloat(selTileset.getAttribute('tilewidth'));
                tilesetSize.height = parseFloat(selTileset.getAttribute('tileheight'));
                tileset._tileSize = tilesetSize;

                var image = selTileset.getElementsByTagName('image')[0];
                var imagename = image.getAttribute('source');
                var num = -1;
                if(this._TMXFileName)
                    num  = this._TMXFileName.lastIndexOf("/");
                if (num !== -1) {
                    var dir = this._TMXFileName.substr(0, num + 1);
                    tileset.sourceImage = dir + imagename;
                } else {
                    tileset.sourceImage = this._resources + (this._resources ? "/" : "") + imagename;
                }
                this.setTilesets(tileset);
            }
        }

        // PARSE  <tile>
        var tiles = map.querySelectorAll('tile');
        if (tiles) {
            for (i = 0; i < tiles.length; i++) {
                var info = this._tileSets[0];
                var t = tiles[i];
                this.setParentGID(parseInt(info.firstGid) + parseInt(t.getAttribute('id') || 0));
                var tp = t.querySelectorAll("properties > property");
                if (tp) {
                    var dict = {};
                    for (j = 0; j < tp.length; j++) {
                        var name = tp[j].getAttribute('name');
                        var value = tp[j].getAttribute('value');
                        dict[name] = value;
                    }
                    this._tileProperties[this.getParentGID()] = dict;
                }
            }
        }

        // PARSE  <layer>
        var layers = map.getElementsByTagName('layer');
        if (layers) {
            for (i = 0; i < layers.length; i++) {
                var selLayer = layers[i];
                var data = selLayer.getElementsByTagName('data')[0];

                var layer = new cc.TMXLayerInfo();
                layer.name = selLayer.getAttribute('name');

                var layerSize = cc.size(0, 0);
                layerSize.width = parseFloat(selLayer.getAttribute('width'));
                layerSize.height = parseFloat(selLayer.getAttribute('height'));
                layer._layerSize = layerSize;

                var visible = selLayer.getAttribute('visible');
                layer.visible = !(visible == "0");

                var opacity = selLayer.getAttribute('opacity') || 1;

                if (opacity)
                    layer._opacity = parseInt(255 * parseFloat(opacity));
                else
                    layer._opacity = 255;
                layer.offset = cc.p(parseFloat(selLayer.getAttribute('x')) || 0, parseFloat(selLayer.getAttribute('y')) || 0);

                var nodeValue = '';
                for (j = 0; j < data.childNodes.length; j++) {
                    nodeValue += data.childNodes[j].nodeValue
                }
                nodeValue = nodeValue.trim();

                // Unpack the tilemap data
                var compression = data.getAttribute('compression');
                var encoding = data.getAttribute('encoding');
                if(compression && compression !== "gzip" && compression !== "zlib"){
                    cc.log("cc.TMXMapInfo.parseXMLFile(): unsupported compression method");
                    return null;
                }
                switch (compression) {
                    case 'gzip':
                        layer._tiles = cc.unzipBase64AsArray(nodeValue, 4);
                        break;
                    case 'zlib':
                        var inflator = new Zlib.Inflate(cc.Codec.Base64.decodeAsArray(nodeValue, 1));
                        layer._tiles = cc.uint8ArrayToUint32Array(inflator.decompress());
                        break;
                    case null:
                    case '':
                        // Uncompressed
                        if (encoding == "base64")
                            layer._tiles = cc.Codec.Base64.decodeAsArray(nodeValue, 4);
                        else if (encoding === "csv") {
                            layer._tiles = [];
                            var csvTiles = nodeValue.split(',');
                            for (var csvIdx = 0; csvIdx < csvTiles.length; csvIdx++)
                                layer._tiles.push(parseInt(csvTiles[csvIdx]));
                        } else {
                            //XML format
                            var selDataTiles = data.getElementsByTagName("tile");
                            layer._tiles = [];
                            for (var xmlIdx = 0; xmlIdx < selDataTiles.length; xmlIdx++)
                                layer._tiles.push(parseInt(selDataTiles[xmlIdx].getAttribute("gid")));
                        }
                        break;
                    default:
                        if(this.getLayerAttribs() == cc.TMX_LAYER_ATTRIB_NONE)
                            cc.log("cc.TMXMapInfo.parseXMLFile(): Only base64 and/or gzip/zlib maps are supported");
                        break;
                }

                // The parent element is the last layer
                var layerProps = selLayer.querySelectorAll("properties > property");
                if (layerProps) {
                    var layerProp = {};
                    for (j = 0; j < layerProps.length; j++) {
                        layerProp[layerProps[j].getAttribute('name')] = layerProps[j].getAttribute('value');
                    }
                    layer.setProperties(layerProp);
                }
                this.setLayers(layer);
            }
        }

        // PARSE <objectgroup>
        var objectGroups = map.getElementsByTagName('objectgroup');
        if (objectGroups) {
            for (i = 0; i < objectGroups.length; i++) {
                var selGroup = objectGroups[i];
                var objectGroup = new cc.TMXObjectGroup();
                objectGroup.setGroupName(selGroup.getAttribute('name'));
                objectGroup.setPositionOffset(cc.p(parseFloat(selGroup.getAttribute('x')) * this.getTileSize().width || 0,
                    parseFloat(selGroup.getAttribute('y')) * this.getTileSize().height || 0));

                var groupProps = selGroup.querySelectorAll("objectgroup > properties > property");
                if (groupProps) {
                    for (j = 0; j < groupProps.length; j++) {
                        var groupProp = {};
                        groupProp[groupProps[j].getAttribute('name')] = groupProps[j].getAttribute('value');
                        // Add the property to the layer
                        objectGroup.setProperties(groupProp);
                    }
                }

                var objects = selGroup.querySelectorAll('object');
                if (objects) {
                    for (j = 0; j < objects.length; j++) {
                        var selObj = objects[j];
                        // The value for "type" was blank or not a valid class name
                        // Create an instance of TMXObjectInfo to store the object and its properties
                        var objectProp = {};

                        // Set the name of the object to the value for "name"
                        objectProp["name"] = selObj.getAttribute('name') || "";

                        // Assign all the attributes as key/name pairs in the properties dictionary
                        objectProp["type"] = selObj.getAttribute('type') || "";

                        objectProp["x"] = parseInt(selObj.getAttribute('x') || 0) + objectGroup.getPositionOffset().x;
                        var y = parseInt(selObj.getAttribute('y') || 0) + objectGroup.getPositionOffset().y;

                        objectProp["width"] = parseInt(selObj.getAttribute('width')) || 0;
                        objectProp["height"] = parseInt(selObj.getAttribute('height')) || 0;

                        // Correct y position. (Tiled uses Flipped, cocos2d uses Standard)
                        objectProp["y"] = parseInt(this.getMapSize().height * this.getTileSize().height) - y - objectProp["height"];

                        var docObjProps = selObj.querySelectorAll("properties > property");
                        if (docObjProps) {
                            for (var k = 0; k < docObjProps.length; k++)
                                objectProp[docObjProps[k].getAttribute('name')] = docObjProps[k].getAttribute('value');
                        }

                        //polygon
                        var polygonProps = selObj.querySelectorAll("polygon");
                        if(polygonProps && polygonProps.length > 0) {
                            var selPgPointStr = polygonProps[0].getAttribute('points');
                            if(selPgPointStr)
                                objectProp["polygonPoints"] = this._parsePointsString(selPgPointStr);
                        }

                        //polyline
                        var polylineProps = selObj.querySelectorAll("polyline");
                        if(polylineProps && polylineProps.length > 0) {
                            var selPlPointStr = polylineProps[0].getAttribute('points');
                            if(selPlPointStr)
                                objectProp["polylinePoints"] = this._parsePointsString(selPlPointStr);
                        }

                        // Add the object to the objectGroup
                        objectGroup.setObjects(objectProp);
                    }
                }

                this.setObjectGroups(objectGroup);
            }
        }
        return map;
    },

    _parsePointsString:function(pointsString){
         if(!pointsString)
            return null;

        var points = [];
        var pointsStr = pointsString.split(' ');
        for(var i = 0; i < pointsStr.length; i++){
            var selPointStr = pointsStr[i].split(',');
            points.push({'x':selPointStr[0], 'y':selPointStr[1]});
        }
        return points;
    },

    /**
     * initializes parsing of an XML string, either a tmx (Map) string or tsx (Tileset) string
     * @param {String} xmlString
     * @return {Boolean}
     */
    parseXMLString:function (xmlString) {
        return this.parseXMLFile(xmlString, true);
    },

    /**
     * @return {object}
     */
    getTileProperties:function () {
        return this._tileProperties;
    },

    /**
     * @param {object} tileProperties
     */
    setTileProperties:function (tileProperties) {
        this._tileProperties.push(tileProperties);
    },

    /**
     * @return {String}
     */
    getCurrentString:function () {
        return this._currentString;
    },

    /**
     * @param {String} currentString
     */
    setCurrentString:function (currentString) {
        this._currentString = currentString;
    },

    /**
     * @return {String}
     */
    getTMXFileName:function () {
        return this._TMXFileName;
    },

    /**
     * @param {String} fileName
     */
    setTMXFileName:function (fileName) {
        this._TMXFileName = fileName;
    },

    _internalInit:function (tmxFileName, resourcePath) {
        this._tileSets.length = 0;
        this._layers.length = 0;

        //this._TMXFileName = cc.FileUtils.getInstance().fullPathForFilename(tmxFileName);
        this._TMXFileName = tmxFileName;
        if (resourcePath)
            this._resources = resourcePath;

        this._objectGroups.length = 0;
        this._properties.length = 0;
        this._tileProperties.length = 0;

        // tmp vars
        this._currentString = "";
        this._storingCharacters = false;
        this._layerAttribs = cc.TMX_LAYER_ATTRIB_NONE;
        this._parentElement = cc.TMX_PROPERTY_NONE;
        this._currentFirstGID = 0;
    }
});

/**
 * Creates a TMX Format with a tmx file
 * @param {String} tmxFile
 * @param {String} resourcePath
 * @return {cc.TMXMapInfo}
 */
cc.TMXMapInfo.create = function (tmxFile, resourcePath) {
    var ret = new cc.TMXMapInfo();
    if (ret.initWithTMXFile(tmxFile, resourcePath))
        return ret;
    return null;
};

/**
 * creates a TMX Format with an XML string and a TMX resource path
 * @param {String} tmxString
 * @param {String} resourcePath
 * @return {cc.TMXMapInfo}
 */
cc.TMXMapInfo.createWithXML = function (tmxString, resourcePath) {
    var ret = new cc.TMXMapInfo();
    if (ret.initWithXML(tmxString, resourcePath))
        return ret;
    return null;
};


text:
// Requires polyfills in immediate side effect.
import './polyfills';
import {assert} from './asserts';

/**
 * Holds info about a service.
 * - obj: Actual service implementation when available.
 * - promise: Promise for the obj.
 * - resolve: Function to resolve the promise with the object.
 * @typedef {{
 *   obj: (?Object),
 *   promise: (?Promise|undefined),
 *   resolve: (?function(!Object)|undefined),
 * }}
 */
let ServiceHolderDef;

/**
 * Returns a service for the given id and window (a per-window singleton).
 * If the service is not yet available the factory function is invoked and
 * expected to return the service.
 * Users should typically wrap this as a special purpose function (e.g.
 * viewportFor(win)) for type safety and because the factory should not be
 * passed around.
 * @param {!Window} win
 * @param {string} id of the service.
 * @param {function(!Window):!Object=} opt_factory Should create the service
 *     if it does not exist yet. If the factory is not given, it is an error
 *     if the service does not exist yet.
 * @return {*}
 */
export function getService(win, id, opt_factory) {
  const services = getServices(win);
  let s = services[id];
  if (!s) {
    s = services[id] = {
      obj: null,
      promise: null,
      resolve: null,
    };
  }

  if (!s.obj) {
    assert(opt_factory, 'Factory not given and service missing %s', id);
    s.obj = opt_factory(win);
    if (!s.promise) {
      s.promise = Promise.resolve(s.obj);
    }
    // The service may have been requested already, in which case we have a
    // pending promise we need to fulfill.
    if (s.resolve) {
      s.resolve(s.obj);
    }
  }
  return s.obj;
}

/**
 * Returns a promise for a service for the given id and window. Also expects
 * an element that has the actual implementation. The promise resolves when
 * the implementation loaded.
 * Users should typically wrap this as a special purpose function (e.g.
 * viewportFor(win)) for type safety and because the factory should not be
 * passed around.
 * @param {!Window} win
 * @param {string} id of the service.
 * @return {!Promise<*>}
 */
export function getServicePromise(win, id) {
  const services = getServices(win);
  const s = services[id];
  if (s) {
    return s.promise;
  }

  // TODO(@cramforce): Add a check that if the element is eventually registered
  // that the service is actually provided and this promise resolves.
  let resolve;
  const p = new Promise(r => {
    resolve = r;
  });
  services[id] = {
    obj: null,
    promise: p,
    resolve: resolve,
  };

  return p;
}

/**
 * Like getServicePromise but returns null if the service was never registered.
 * @param {!Window} win
 * @param {string} id of the service.
 * @return {?Promise<*>}
 */
export function getServicePromiseOrNull(win, id) {
  const services = getServices(win);
  if (services[id]) {
    return services[id].promise;
  }
  return null;
}

/**
 * Returns the object that holds the services registered in a window.
 * @param {!Window} win
 * @return {!Object<string,!ServiceHolderDef>}
 */
function getServices(win) {
  let services = win.services;
  if (!services) {
    services = win.services = {};
  }
  return services;
}

/**
 * Resets a single service, so it gets recreated on next getService invocation.
 * @param {!Window} win
 * @param {string} id of the service.
 */
export function resetServiceForTesting(win, id) {
  if (win.services) {
    win.services[id] = null;
  }
}


text:
void compile_and_link_test()
{
   TEST_DIST_FUNC(non_central_beta)
}

template class boost::math::non_central_beta_distribution<float, boost::math::policies::policy<> >;
template class boost::math::non_central_beta_distribution<double, boost::math::policies::policy<> >;
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
template class boost::math::non_central_beta_distribution<long double, boost::math::policies::policy<> >;
#endif


text:
package chihane.starrysky;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

public class StarrySky extends ViewGroup {
    public static final int BACKGROUND_COLOR_MIDNIGHT = Color.BLACK;
    public static final int BACKGROUND_COLOR_DAWN = Color.rgb(0x36, 0x3b, 0x74);
    public static final int BACKGROUND_COLOR_DUSK = Color.rgb(0x3d, 0x32, 0x42);

    private StarMaker starMaker = new StarMaker(getContext());

    public StarrySky(Context context) { this(context, null); }
    public StarrySky(Context context, AttributeSet attrs) { this(context, attrs, 0); }
    public StarrySky(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public StarrySky(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        init();
    }

    protected void init() {
        setBackgroundColor(BACKGROUND_COLOR_MIDNIGHT);
    }

    public void dominateBy(StarMaker starMaker) {
        this.starMaker = starMaker;
        refresh();
    }

    public void refresh() {
        requestLayout();
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int width = MeasureSpec.getSize(widthMeasureSpec);
        int height = MeasureSpec.getSize(heightMeasureSpec);
        setMeasuredDimension(width, height);

        generateStarsWithin(width, height);

        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
            if (child instanceof Star) {
                measureChild(child,
                        MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
            }
        }
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
            if (child instanceof Star) {
                Star star = (Star) child;
                star.layout((int) star.longitude, (int) star.latitude, (int) (star.longitude + star.size), (int) (star.latitude + star.size));
            }
        }
    }

    private void generateStarsWithin(int width, int height) {
        removeAllViews();

        List<Star> galaxy = starMaker.星たちよーこの造星者の名のもとにー現れーーー(width, height);
        for (Star star : galaxy) {
            addView(star);
        }
    }
}


text:
namespace Ui {
class ProcessingDialog;
}

class ProcessingDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ProcessingDialog(QWidget *parent = 0);
    ~ProcessingDialog();

private:
    Ui::ProcessingDialog *ui;
};

#endif // PROCESSINGDIALOG_H


text:
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, brackets, window, $, Mustache, navigator */

define(function (require, exports, module) {
    "use strict";

    // Brackets modules
    var PreferencesManager          = brackets.getModule("preferences/PreferencesManager"),
        Commands                    = brackets.getModule("command/Commands"),
        CommandManager              = brackets.getModule("command/CommandManager"),
        ExtensionUtils              = brackets.getModule("utils/ExtensionUtils"),
        Strings                     = brackets.getModule("strings"),
        StringUtils                 = brackets.getModule("utils/StringUtils"),
        Menus                       = brackets.getModule("command/Menus"),
        DefaultDialogs              = brackets.getModule("widgets/DefaultDialogs"),
        Dialogs                     = brackets.getModule("widgets/Dialogs"),
        ExtensionStrings            = require("strings"),
        ExtensionDialogTemplate     = require("text!htmlContent/MyExtensionDialog.html");

    /** @const {string} Extension Command ID */
    // TODO: Change these values so they are unique to your extension
    var MY_COMMANDID                = "extension.command";
    var MY_MENUID                   = "extension-menu";
    var MY_MODULENAME               = "extension-module";

    /* Our extension's preferences */
    var prefs = PreferencesManager.getExtensionPrefs(MY_MODULENAME);

    // Define a preference to keep track of how many times our extension has been ivoked
    prefs.definePreference("runCount", "number", 0);

    /* Cache our module info */
    var _module = module;

    function showMyDialog() {
        // Increment our run count
        var runCount = prefs.get("runCount") || 0;
        prefs.set("runCount", ++runCount);

        // This is input data into the template
        var context = {
            Strings: Strings,
            ExtensionStrings: ExtensionStrings
        };

        // Invoke the dialog from the rendered HTML from the template
        var dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(ExtensionDialogTemplate, context));

        // If you add more buttons and need to know which button was pressed make sure
        //  to use unique ids for each button through the button's data-button-id attribute.
        dialog.done(function (buttonId) {
            if (buttonId === "close") {
                alert("Hello World");
            }
        });
    }

    // Extension init code goes at the bottom
    ExtensionUtils.loadStyleSheet(module, "styles/styles.css");
    // Register the command -- The command and the command title are kept together
    CommandManager.register(ExtensionStrings.MENU_ITEM_LABEL, MY_COMMANDID, showMyDialog);
    // Add a new menu before the help menu.
    //  if you want to modify an existing menu you would use Menus.getMenu -- e.g. Menus.getMenu(Menus.AppMenuBar.FILE_MENU);
    var menu = Menus.addMenu(ExtensionStrings.MENU_LABEL, MY_MENUID, Menus.BEFORE, Menus.AppMenuBar.HELP_MENU);
    // Now add the menu item to invoke it.  Add a keyboard shortcut as well.
    menu.addMenuItem(MY_COMMANDID, "Ctrl-Alt-X");
});


text:
#ifndef UU_SPDR_CLOCK_H
#define UU_SPDR_CLOCK_H

#include "inlines.h"
#include "uu-stdint.h" /* uint64_t */

struct SPDR_Clock;
struct SPDR_Allocator;

extern int clock_init_base(struct SPDR_Clock **clockp,
                           struct SPDR_Allocator *allocator,
                           uint64_t numerator,
                           uint64_t denominator);

extern int clock_init(struct SPDR_Clock **clock,
                      struct SPDR_Allocator *allocator);
extern void clock_deinit(struct SPDR_Clock **clock);
extern uint64_t clock_ticks(struct SPDR_Clock const *clock);
extern uint64_t clock_ticks_to_microseconds(struct SPDR_Clock const *clock,
                                            uint64_t ticks);
extern uint64_t clock_microseconds(struct SPDR_Clock const *clock);

#endif


text:
require 'omf-expctl/application/appDefinition'

a = AppDefinition.create('test:app:itgr')
a.name = "itgr"
a.version(0, 0, 1)
a.shortDescription = "D-ITG Receiver"
a.description = <<TEXT
D-ITG is a traffic generator for TCP and UDP traffic. It contains generators
producing various forms of packet streams and port for sending
these packets via various transports, such as TCP and UDP.
TEXT

# addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil)
#Flow options
a.addProperty('l', 'Log file', ?l, :string, false)

a.addMeasurement("receiverport", nil, [
    ['flow_no', 'int'],
    ['min_delay', Float],
    ['max_delay', Float],
    ['avg_delay', Float],
    ['avg_jitter', Float],
    ['delay_stdev', Float],
    ['avg_throughput', Float],
    ['packet_loss', Float]
 ])

a.path = "/usr/local/bin/ITGRecv"

if $0 == __FILE__
  require 'stringio'
  require 'rexml/document'
  include REXML

  sio = StringIO.new()
  a.to_xml.write(sio, 2)
  sio.rewind
  puts sio.read

  sio.rewind
  doc = Document.new(sio)
  t = AppDefinition.from_xml(doc.root)

  puts
  puts "-------------------------"
  puts
  t.to_xml.write($stdout, 2)

end


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<qualifiedTypeNameHistroy>
<fullyQualifiedTypeName name="android.widget.Button"/>
<fullyQualifiedTypeName name="android.view.View.OnClickListener"/>
<fullyQualifiedTypeName name="android.view.View"/>
<fullyQualifiedTypeName name="android.widget.EditText"/>
<fullyQualifiedTypeName name="com.bgstation0.android.sample.context_.R.id"/>
</qualifiedTypeNameHistroy>


text:
<link rel="import" href="/bower_components/prism-js/prism-js.html">
<template>

Summary

The setMilliseconds() method sets the milliseconds for a specified date according to local time.

Syntax

<var>dateObj</var>.setMilliseconds(<var>millisecondsValue</var>)

Parameters

millisecondsValue

A number between 0 and 999, representing the milliseconds.

Description

If you specify a number outside the expected range, the date information in the Date object is updated accordingly. For example, if you specify 1005, the number of seconds is incremented by 1, and 5 is used for the milliseconds.

Examples

Example: Using setMilliseconds()

<prism-js language="javascript">var theBigDay = new Date();
theBigDay.setMilliseconds(100);
</prism-js>

Specifications

   Specification
   Status
   Comment

   ECMAScript 1st Edition. Implemented in JavaScript 1.3.
   Standard
   Initial definition.

   ECMAScript 5.1 (ECMA-262)
The definition of 'Date.prototype.setMilliseconds' in that specification.
   Standard

   ECMAScript 6 (ECMA-262)
The definition of 'Date.prototype.setMilliseconds' in that specification.
   Draft

See also

Date.prototype.getMilliseconds()

Date.prototype.setUTCMilliseconds()

This page on MDN: Date.prototype.setMilliseconds(), by Mozilla Contributors.
Licensed under the terms of Creative Commons Attribution-ShareAlike.

</template>


text:
import Base from "@patternslib/patternslib/src/core/base";

export default Base.extend({
    name: "discussion",
    trigger: "form#DiscussionSettingsEditForm",

    async init() {
        // Async import implementation to reduce bundle size for controlpanels
        const implementation = (await import("./discussion--implementation")).default;
        const instance = new implementation(this.el);
        instance.init();
    },
});