text:
var StringChecker = require('../../lib/string-checker');
var assert = require('assert');
var sinon = require('sinon');
var fs = require('fs');

describe('modules/string-checker', function() {
    var checker;
    beforeEach(function() {
        checker = new StringChecker();
        checker.registerDefaultRules();
    });

    describe('checkString', function() {
        describe('line starting with hash', function() {
            it('should ignore lines starting with #!', function() {
                assert(checker.checkString(
                    '#! random stuff\n' +
                    '#! 1234\n' +
                    'var a = 5;\n'
                ).isEmpty());
            });

            it('should ignore ios instruments style import', function() {
                assert(checker.checkString(
                    '#import "abc.js"\n' +
                    '#import abc.js\n' +
                    'var a = 5;\n'
                ).isEmpty());
            });

            it('should not replace when not beginning of line', function() {
                checker.configure({ disallowMultipleLineStrings: true });
                assert(checker.checkString(
                    '#import "abc.js"\n' +
                    'var b="#import \\\n abc.js";\n' +
                    'var a = 5;\n'
                ).getErrorCount() === 1);
            });

            it('should report error in the correct location when first line starts with #!', function() {
                checker.configure({ disallowMultipleLineBreaks: true });
                var error = checker.checkString('#!/usr/bin/env node\n\n\nx = 1;').getErrorList()[0];
                assert.equal(error.line, 1);
                assert.equal(error.column, 19);
            });
        });

        it('should not check empty string (#1354)', function() {
            var spy = sinon.spy(StringChecker.prototype, '_checkJsFile');

            assert(checker.checkString('').isEmpty());

            assert(spy.called === false);
            spy.restore();
        });

        it('should report parse issues as errors', function() {
            var errors = checker.checkString('this is not javascript');
            assert(errors.getErrorCount() === 1);

            var error = errors.getErrorList()[0];
            assert(error.rule === 'parseError');
            assert(error.message === 'Unexpected identifier');
            assert(error.line === 1);
            assert(error.column === 6);
        });

        describe('maxErrors', function() {
            beforeEach(function() {
                checker.configure({
                    requireSpaceBeforeBinaryOperators: ['='],
                    maxErrors: 1
                });
            });

            it('should allow a maximum number of reported errors to be set', function() {
                var errors = checker.checkString('var foo=1;\n var bar=2;').getErrorList();
                assert(errors.length === 1);
            });

            it('should not report more than the maximum errors across multiple checks', function() {
                var errors = checker.checkString('var foo=1;\n var bar=2;').getErrorList();
                var errors2 = checker.checkString('var baz=1;\n var qux=2;').getErrorList();
                assert(errors.length === 1);
                assert(errors2.length === 0);
            });

            it('should not be used when not a number', function() {
                var errors;
                checker.configure({
                    requireSpaceBeforeBinaryOperators: ['='],
                    maxErrors: NaN
                });

                errors = checker.checkString('var foo=1;\n var bar=2;').getErrorList();
                assert(errors.length > 0);
            });
        });
    });

    describe('configure', function() {
        it('should not process the rule if it is equals to null (#203)', function() {
            try {
                checker.configure({
                    preset: 'jquery',
                    requireCurlyBraces: null
                });
                assert(true);
            } catch (_) {
                assert(false);
            }
        });

        it('should throw if preset does not exist', function() {
            try {
                checker.configure({
                    preset: 'not-exist'
                });

                assert(false);
            } catch (e) {
                assert.equal(e.toString(), 'AssertionError: Preset "not-exist" does not exist');
            }
        });

        it('should set verbose option', function() {
            checker.configure({
                verbose: true,
                requireSpaceBeforeBinaryOperators: ['=']
            });

            var errors = checker.checkString('var foo=1;\n var bar=2;').getErrorList();
            assert(errors[0].message.indexOf('requireSpaceBeforeBinaryOperators') > -1);
        });

        describe('rules registration', function() {
            it('should report rules in config which don\'t match any registered rules', function() {
                checker.configure({ doesNotExist: true, noSuchRule: true });
                var errors = checker.checkString('var foo = 1;').getErrorList();

                assert(errors.length === 2);
                assert.equal(errors[0].message, 'Unsupported rule: doesNotExist');
                assert.equal(errors[1].message, 'Unsupported rule: noSuchRule');
            });

            it('should not report rules in config which match registered rules', function() {
                var error;
                try {
                    checker.configure({ disallowMultipleLineBreaks: true, disallowMultipleVarDecl: true });
                } catch (e) {
                    error = e;
                }
                assert(error === undefined);
            });

            it('should not report "excludeFiles" rule as unregistered', function() {
                var error;
                try {
                    checker.configure({ excludeFiles: [] });
                } catch (e) {
                    error = e;
                }
                assert(error === undefined);
            });
        });
    });

    describe('fixString', function() {
        it('should return unfixable errors', function() {
            checker.configure({ disallowImplicitTypeConversion: ['boolean'] });
            var result = checker.fixString('x = !!x;');
            assert.equal(result.errors.getErrorCount(), 1);
            assert.equal(result.errors.getErrorList()[0].message, 'Implicit boolean conversion');
        });

        it('should process parse error', function() {
            checker.configure({});
            var result = checker.fixString('x =');
            assert.equal(result.errors.getErrorCount(), 1);
            assert.equal(result.errors.getErrorList()[0].message, 'Unexpected end of input');
            assert.equal(result.output, 'x =');
        });

        it('should accept file name', function() {
            checker.configure({});
            var result = checker.fixString('x = 1;', '1.js');
            assert.equal(result.errors.getFilename(), '1.js');
        });

        describe('space rules', function() {
            it('should apply fixes to the specified string', function() {
                checker.configure({ requireSpaceBeforeBinaryOperators: true });
                var result = checker.fixString('x=1+2;');
                assert(result.errors.isEmpty());
                assert.equal(result.output, 'x =1 +2;');
            });

            it('should apply multiple fixes to the specified string', function() {
                checker.configure({ requireSpaceBeforeBinaryOperators: true, requireSpaceAfterBinaryOperators: true });
                var result = checker.fixString('x=1+2;');
                assert(result.errors.isEmpty());
                assert.equal(result.output, 'x = 1 + 2;');
            });
        });
    });

    describe('esprima version', function() {
        var customDescription = 'in no way a real error message';
        var customEsprima = {
            parse: function() {
                var error = new Error();
                error.description = customDescription;
                error.lineNumber = 1;
                error.column = 0;

                throw error;
            }
        };

        it('uses a custom esprima when provided to the constructor', function() {
            checker = new StringChecker({ esprima: customEsprima });
            checker.registerDefaultRules();

            var errors = checker.checkString('import { foo } from "bar";');
            var error = errors.getErrorList()[0];

            assert(error.rule === 'parseError');
            assert(error.message === customDescription);
        });

        it('uses a custom esprima when both esprima and esnext are provided to the constructor', function() {
            checker = new StringChecker({ esprima: customEsprima, esnext: true });
            checker.registerDefaultRules();

            var errors = checker.checkString('import { foo } from "bar";');
            var error = errors.getErrorList()[0];

            assert(error.rule === 'parseError');
            assert(error.message === customDescription);
        });

        it('uses the harmony esprima when true is provided to the constructor', function() {
            checker = new StringChecker({ esnext: true });
            checker.registerDefaultRules();

            var errors = checker.checkString('import { foo } from "bar";');
            assert(errors.isEmpty());
        });

        it('uses the harmony esprima when esnext is set to true in the config', function() {
            checker = new StringChecker();
            checker.registerDefaultRules();
            checker.configure({ esnext: true });

            var errors = checker.checkString('import { foo } from "bar";');
            // Make sure that multiple checks don't fail
            var errors2 = checker.checkString('import { bar } from "foo";');
            assert(errors.isEmpty());
            assert(errors2.isEmpty());
        });

        it('uses the default esprima when falsely or no argument is provided to the constructor', function() {
            checker = new StringChecker();
            checker.registerDefaultRules();

            var errors = checker.checkString('import { foo } from "bar";');
            var error = errors.getErrorList()[0];

            assert(error.rule === 'parseError');
            assert(error.message !== customDescription);
        });
    });

    describe('esprima options', function() {
        var code = 'import { foo } from "bar";';
        var customEsprima = {
            parse: function() {
                return {tokens: [], comments: []};
            }
        };

        beforeEach(function() {
            checker = new StringChecker({ esprima: customEsprima });
            checker.registerDefaultRules();

            sinon.spy(customEsprima, 'parse');
        });
        afterEach(function() {
            customEsprima.parse.restore();
        });

        it('sets the "tolerant" esprima option to true by default', function() {
            checker.checkString(code);

            assert(customEsprima.parse.calledOnce);
            assert(customEsprima.parse.calledWith(code, {
                tolerant: true,
                loc: true,
                range: true,
                comment: true,
                tokens: true,
                sourceType: 'module'
            }));
        });

        it('allows the "tolerant" esprima option to be overridden', function() {
            checker.configure({ esprimaOptions: { tolerant: false } });

            checker.checkString(code);

            assert(customEsprima.parse.calledOnce);
            assert(customEsprima.parse.calledWith(code, {
                tolerant: false,
                loc: true,
                range: true,
                comment: true,
                tokens: true,
                sourceType: 'module'
            }));
        });

        it('uses custom esprima options when set in the config', function() {
            checker.configure({ esprimaOptions: { foobar: 'qux', barbaz: 'fred' } });

            checker.checkString(code);

            assert(customEsprima.parse.calledOnce);
            assert(customEsprima.parse.calledWith(code, {
                foobar: 'qux',
                barbaz: 'fred',
                tolerant: true,
                loc: true,
                range: true,
                comment: true,
                tokens: true,
                sourceType: 'module'
            }));
        });

        it('does not override required esprima options', function() {
            checker.configure({ esprimaOptions: {
                loc: false,
                range: false,
                comment: false,
                tokens: false,
                sourceType: 'script'
            }});

            checker.checkString(code);

            assert(customEsprima.parse.calledOnce);
            assert(customEsprima.parse.calledWith(code, {
                tolerant: true, // not required
                loc: true,
                range: true,
                comment: true,
                tokens: true,
                sourceType: 'module'
            }));
        });
    });

    describe('error filter', function() {
        beforeEach(function() {
            checker = new StringChecker();
            checker.registerDefaultRules();
        });

        it('should accept a path to a filter function to filter out errors', function() {
            checker.configure({
                disallowQuotedKeysInObjects: true,
                errorFilter: require(__dirname + '/../data/error-filter.js')
            });

            var errors = checker.checkString('var x = { "a": 1 }');

            assert.ok(errors.isEmpty());
        });
    });

    describe('throwing rules', function() {
        function _beforeEach(_verbose) {
            checker = new StringChecker({verbose: _verbose});
            // register rule that throw
            checker.registerRule({
                configure: function() {},
                getOptionName: function() { return 'thrower'; },
                check: function() {
                    throw Error('Here we are!');
                }
            });
            checker.configure({thrower: true});
        }

        it('should be handled internally with verbose', function() {
            _beforeEach(true);

            var errs = checker.checkString('var a');
            assert.equal(errs.getErrorCount(), 1);

            var err = errs.getErrorList()[0];
            assert.equal(err.rule, 'thrower');
            assert.ok(err.message.indexOf('Error running rule thrower:') !== -1);
            assert.ok(err.message.indexOf('Error: Here we are!') !== -1);
        });
    });

    describe('presets', function() {
        testPreset('airbnb');
        testPreset('crockford');
        testPreset('google');
        testPreset('grunt');
        testPreset('jquery');
        testPreset('mdcs');
        testPreset('node-style-guide');
        testPreset('wikimedia');
        testPreset('wordpress');
        testPreset('yandex');

        /**
         * Helper to test a given preset's configuration against its test file
         *
         * Expects the given preset to have a configuration in /presets
         * and real code taken from that project in /test/data/options/preset
         *
         * @example testPreset('google')
         * @param  {String} presetName
         */
        function testPreset(presetName) {
            it('preset ' + presetName + ' should not report any errors from the sample file', function() {
                var checker = new StringChecker();

                checker.registerDefaultRules();
                checker.configure({
                    preset: presetName
                });

                var filename = '../data/options/preset/' + presetName + '.js';
                var content = fs.readFileSync(__dirname + '/' + filename, 'utf8');
                assert(checker.checkString(content, filename).isEmpty());
            });
        }
    });
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Court of the University of Edinburgh (UofE) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The UofE licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
 -->
<binding xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding"
 xmlns="http://www.castor.org/SourceGenerator/Binding">

   <!-- elementBinding name="/complexType:DrawingNodeAttributeType/Location">
      <java-class name="DrawingNodeLocation"/>
   </elementBinding-->

   <!-- elementBinding name="/complexType:LinkTerminusType/Location">
      <java-class name="TerminusLocation"/>
   </elementBinding-->

   <!-- elementBinding name="/complexType:ShapeAttributeType/LineColour">
   		<java-class name="ShapeLineColour"/>
   </elementBinding-->

   <!-- elementBinding name="/complexType:LinkAttributeType/LineColour">
   		<java-class name="LinkLineColour"/>
   </elementBinding-->
</binding>

redpajama_set_name: RedPajamaGithub


text:
namespace ManyToManyRelation.Data
{
    using ManyToManyRelation.Models;
    using Microsoft.EntityFrameworkCore;

    public class ApplicationDbContext : DbContext
    {
        public DbSet<Student> Students { get; set; }

        public DbSet<Course> Courses { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder
                .UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=TestDb;Integrated Security=True;");

            base.OnConfiguring(optionsBuilder);
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder
                .Entity<CourseStudent>()
                .HasKey(sc => new { sc.StudentId, sc.CourseId });

            modelBuilder
                .Entity<Course>()
                .HasMany(c => c.Students)
                .WithOne(s => s.Course)
                .HasForeignKey(cs => cs.CourseId)
                .OnDelete(DeleteBehavior.Restrict);

            modelBuilder
                .Entity<Student>()
                .HasMany(s => s.Courses)
                .WithOne(cs => cs.Student)
                .HasForeignKey(cs => cs.StudentId)
                .OnDelete(DeleteBehavior.Restrict);

            base.OnModelCreating(modelBuilder);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="me.masm11.contextplayer.ui.MainActivity">

  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin">

    <!-- カテゴリ名 -->
    <TextView
	android:id="@+id/context_name"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:paddingTop="15dp"
	android:paddingBottom="15dp"
	android:background="@drawable/border_ripple"
	android:transitionName="transit_cat"
	android:textIsSelectable="false"/>

    <!-- 曲名等 -->
    <LinearLayout
	android:layout_width="match_parent"
	android:layout_height="0dp"
	android:layout_weight="1"
	android:gravity="center"
	android:transitionName="transit_title"
	android:orientation="vertical">

      <LinearLayout
	  android:id="@+id/playing_info"
	  android:layout_width="match_parent"
	  android:layout_height="wrap_content"
	  android:paddingTop="15dp"
	  android:paddingBottom="15dp"
	  android:background="@drawable/border_ripple"
	  android:orientation="vertical">

	<me.masm11.contextplayer.ui.PathView
	    android:id="@+id/playing_filename"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:textIsSelectable="false"/>
	<TextView
	    android:id="@+id/playing_title"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:textAppearance="?android:attr/textAppearanceLarge"
	    android:textIsSelectable="false"/>
	<TextView
	    android:id="@+id/playing_artist"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:textIsSelectable="false"/>

      </LinearLayout>

    </LinearLayout>

    <!-- volumebar -->
    <LinearLayout
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:orientation="horizontal"
	android:paddingBottom="@dimen/activity_vertical_margin">

      <ImageView
	  android:layout_width="wrap_content"
	  android:layout_height="wrap_content"
	  android:layout_gravity="bottom"
	  android:src="@drawable/ic_volume_down_white_24px"/>

      <LinearLayout
	  android:layout_width="0dp"
	  android:layout_weight="1"
	  android:layout_height="wrap_content"
	  android:orientation="vertical">

	<LinearLayout
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:orientation="horizontal">

	  <TextView
	      android:layout_width="wrap_content"
	      android:layout_height="wrap_content"
	      android:text="50%"
	      android:textIsSelectable="false"/>

	  <View
	      android:layout_width="0dp"
	      android:layout_weight="1"
	      android:layout_height="1px"/>

	  <TextView
	      android:layout_width="wrap_content"
	      android:layout_height="wrap_content"
	      android:text="100%"
	      android:textIsSelectable="false"/>

	</LinearLayout>

	<SeekBar
	    android:id="@+id/volume"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"/>

      </LinearLayout>

      <ImageView
	  android:layout_width="wrap_content"
	  android:layout_height="wrap_content"
	  android:layout_gravity="bottom"
	  android:src="@drawable/ic_volume_up_white_24px"/>

    </LinearLayout>

    <!-- seekbar -->
    <LinearLayout
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:orientation="horizontal"
	android:paddingBottom="@dimen/activity_vertical_margin">

      <ImageView
	  android:layout_width="wrap_content"
	  android:layout_height="wrap_content"
	  android:layout_gravity="bottom"
	  android:src="@drawable/ic_fast_rewind_white_24px"/>

      <LinearLayout
	  android:layout_width="0dp"
	  android:layout_weight="1"
	  android:layout_height="wrap_content"
	  android:orientation="vertical">

	<LinearLayout
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:orientation="horizontal">

	  <TextView
	      android:id="@+id/playing_curtime"
	      android:layout_width="wrap_content"
	      android:layout_height="wrap_content"
	      android:text="@string/initial_time"
	      android:textIsSelectable="false"/>

	  <View
	      android:layout_width="0dp"
	      android:layout_weight="1"
	      android:layout_height="1px"/>

	  <TextView
	      android:id="@+id/playing_maxtime"
	      android:layout_width="wrap_content"
	      android:layout_height="wrap_content"
	      android:text="@string/initial_time"
	      android:textIsSelectable="false"/>

	</LinearLayout>

	<SeekBar
	    android:id="@+id/playing_pos"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"/>

      </LinearLayout>

      <ImageView
	  android:layout_width="wrap_content"
	  android:layout_height="wrap_content"
	  android:layout_gravity="bottom"
	  android:src="@drawable/ic_fast_forward_white_24px"/>

    </LinearLayout>

    <!-- panel -->
    <fragment
	class="me.masm11.contextplayer.ui.OperationFragment"
	android:id="@+id/op_frag"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:transitionName="transit_op"/>

  </LinearLayout>
</LinearLayout>


text:
using System;
using CSJ2K.j2k.decoder;
using CSJ2K.j2k.image;
namespace CSJ2K.j2k.wavelet.synthesis
{

	///  This class provides default implementation of the methods in the 'InvWT'
	/// interface. The source is always a 'MultiResImgData', which is a
	/// multi-resolution image. The default implementation is just to return the
	/// value of the source at the current image resolution level, which is set by
	/// the 'setImgResLevel()' method.
	///
	///
This abstract class can be used to facilitate the development of other
	/// classes that implement the 'InvWT' interface, because most of the trivial
	/// methods are already implemented.

	///
	///
If the default implementation of a method provided in this class does
	/// not suit a particular implementation of the 'InvWT' interface, the method
	/// can be overriden to implement the proper behaviour.

	///
	///
If the 'setImgResLevel()' method is overriden then it is very important
	/// that the one of this class is called from the overriding method, so that
	/// the other methods in this class return the correct values.

	///
	///
	/// <seealso cref="InvWT">
	///
	/// </seealso>
	public abstract class InvWTAdapter : InvWT
	{
		///  Sets the image reconstruction resolution level. A value of 0 means
		/// reconstruction of an image with the lowest resolution (dimension)
		/// available.
		///
		///
Note: Image resolution level indexes may differ from tile-component
		/// resolution index. They are indeed indexed starting from the lowest
		/// number of decomposition levels of each component of each tile.

		///
		///
Example: For an image (1 tile) with 2 components (component 0 having
		/// 2 decomposition levels and component 1 having 3 decomposition levels),
		/// the first (tile-) component has 3 resolution levels and the second one
		/// has 4 resolution levels, whereas the image has only 3 resolution levels
		/// available.

		///
		///
		/// <param name="rl">The image resolution level.
		///
		/// </param>
		/// <returns> The vertical coordinate of the image origin in the canvas
		/// system, on the reference grid.
		///
		/// </returns>
		virtual public int ImgResLevel
		{
			set
			{
				if (value < 0)
				{
					throw new System.ArgumentException("Resolution level index " + "cannot be negative.");
				}
				reslvl = value;
			}

		}
		///  Returns the overall width of the current tile in pixels. This is the
		/// tile's width without accounting for any component subsampling. This is
		/// also referred as the reference grid width in the current tile.
		///
		///
This default implementation returns the value of the source at the
		/// current reconstruction resolution level.

		///
		///
		/// <returns> The total current tile's width in pixels.
		///
		/// </returns>
		virtual public int TileWidth
		{
			get
			{
				// Retrieves the tile maximum resolution level index and request the
				// width from the source module.
				int tIdx = TileIdx;
				int rl = 10000;
				int mrl;
				int nc = mressrc.NumComps;
				for (int c = 0; c < nc; c++)
				{
					mrl = mressrc.getSynSubbandTree(tIdx, c).resLvl;
					if (mrl < rl)
						rl = mrl;
				}
				return mressrc.getTileWidth(rl);
			}

		}
		///  Returns the overall height of the current tile in pixels. This
		/// is the tile's height without accounting for any component
		/// subsampling. This is also referred as the reference grid height
		/// in the current tile.
		///
		///
This default implementation returns the value of the source at the
		/// current reconstruction resolution level.

		///
		///
		/// <returns> The total current tile's height in pixels.
		///
		/// </returns>
		virtual public int TileHeight
		{
			get
			{
				// Retrieves the tile maximum resolution level index and request the
				// height from the source module.
				int tIdx = TileIdx;
				int rl = 10000;
				int mrl;
				int nc = mressrc.NumComps;
				for (int c = 0; c < nc; c++)
				{
					mrl = mressrc.getSynSubbandTree(tIdx, c).resLvl;
					if (mrl < rl)
						rl = mrl;
				}
				return mressrc.getTileHeight(rl);
			}

		}
		/// Returns the nominal width of tiles
		virtual public int NomTileWidth
		{
			get
			{
				return mressrc.NomTileWidth;
			}

		}
		/// Returns the nominal height of tiles
		virtual public int NomTileHeight
		{
			get
			{
				return mressrc.NomTileHeight;
			}

		}
		///  Returns the overall width of the image in pixels. This is the
		/// image's width without accounting for any component subsampling
		/// or tiling.
		///
		///
		/// <returns> The total image's width in pixels.
		///
		/// </returns>
		virtual public int ImgWidth
		{
			get
			{
				return mressrc.getImgWidth(reslvl);
			}

		}
		///  Returns the overall height of the image in pixels. This is the
		/// image's height without accounting for any component subsampling
		/// or tiling.
		///
		///
		/// <returns> The total image's height in pixels.
		///
		/// </returns>
		virtual public int ImgHeight
		{
			get
			{
				return mressrc.getImgHeight(reslvl);
			}

		}
		///  Returns the number of components in the image.
		///
		///
		/// <returns> The number of components in the image.
		///
		/// </returns>
		virtual public int NumComps
		{
			get
			{
				return mressrc.NumComps;
			}

		}
		///  Returns the index of the current tile, relative to a standard scan-line
		/// order.
		///
		///
This default implementation returns the value of the source.

		///
		///
		/// <returns> The current tile's index (starts at 0).
		///
		/// </returns>
		virtual public int TileIdx
		{
			get
			{
				return mressrc.TileIdx;
			}

		}
		///  Returns the horizontal coordinate of the image origin, the top-left
		/// corner, in the canvas system, on the reference grid.
		///
		///
This default implementation returns the value of the source at the
		/// current reconstruction resolution level.

		///
		///
		/// <returns> The horizontal coordinate of the image origin in the canvas
		/// system, on the reference grid.
		///
		/// </returns>
		virtual public int ImgULX
		{
			get
			{
				return mressrc.getImgULX(reslvl);
			}

		}
		///  Returns the vertical coordinate of the image origin, the top-left
		/// corner, in the canvas system, on the reference grid.
		///
		///
This default implementation returns the value of the source at the
		/// current reconstruction resolution level.

		///
		///
		/// <returns> The vertical coordinate of the image origin in the canvas
		/// system, on the reference grid.
		///
		/// </returns>
		virtual public int ImgULY
		{
			get
			{
				return mressrc.getImgULY(reslvl);
			}

		}
		/// Returns the horizontal tile partition offset in the reference grid
		virtual public int TilePartULX
		{
			get
			{
				return mressrc.TilePartULX;
			}

		}
		/// Returns the vertical tile partition offset in the reference grid
		virtual public int TilePartULY
		{
			get
			{
				return mressrc.TilePartULY;
			}

		}

		/// The decoder specifications
		protected internal DecoderSpecs decSpec;

		/// The 'MultiResImgData' source
		protected internal MultiResImgData mressrc;

		/// The resquested image resolution level for reconstruction.
		protected internal int reslvl;

		/// The maximum available image resolution level
		protected internal int maxImgRes;

		///  Instantiates the 'InvWTAdapter' object using the specified
		/// 'MultiResImgData' source. The reconstruction resolution level is set to
		/// full resolution (i.e. the maximum resolution level).
		///
		///
		/// <param name="src">From where to obtain the values to return
		///
		/// </param>
		/// <param name="decSpec">The decoder specifications
		///
		/// </param>
		protected internal InvWTAdapter(MultiResImgData src, DecoderSpecs decSpec)
		{
			mressrc = src;
			this.decSpec = decSpec;
			maxImgRes = decSpec.dls.Min;
		}

		///  Returns the component subsampling factor in the horizontal
		/// direction, for the specified component. This is, approximately,
		/// the ratio of dimensions between the reference grid and the
		/// component itself, see the 'ImgData' interface desription for
		/// details.
		///
		///
		/// <param name="c">The index of the component (between 0 and N-1).
		///
		/// </param>
		/// <returns> The horizontal subsampling factor of component 'c'.
		///
		/// </returns>
		/// <seealso cref="jj2000.j2k.image.ImgData">
		///
		/// </seealso>
		public virtual int getCompSubsX(int c)
		{
			return mressrc.getCompSubsX(c);
		}

		///  Returns the component subsampling factor in the vertical
		/// direction, for the specified component. This is, approximately,
		/// the ratio of dimensions between the reference grid and the
		/// component itself, see the 'ImgData' interface desription for
		/// details.
		///
		///
		/// <param name="c">The index of the component (between 0 and N-1).
		///
		/// </param>
		/// <returns> The vertical subsampling factor of component 'c'.
		///
		/// </returns>
		/// <seealso cref="jj2000.j2k.image.ImgData">
		///
		/// </seealso>
		public virtual int getCompSubsY(int c)
		{
			return mressrc.getCompSubsY(c);
		}

		///  Returns the width in pixels of the specified tile-component
		///
		///
		/// <param name="t">Tile index
		///
		/// </param>
		/// <param name="c">The index of the component, from 0 to N-1.
		///
		/// </param>
		/// <returns> The width in pixels of component <tt>n</tt> in tile <tt>t</tt>.
		///
		/// </returns>
		public virtual int getTileCompWidth(int t, int c)
		{
			// Retrieves the tile-component maximum resolution index and gets the
			// width from the source.
			int rl = mressrc.getSynSubbandTree(t, c).resLvl;
			return mressrc.getTileCompWidth(t, c, rl);
		}

		///  Returns the height in pixels of the specified tile-component.
		///
		///
This default implementation returns the value of the source at the
		/// current reconstruction resolution level.

		///
		///
		/// <param name="t">The tile index.
		///
		/// </param>
		/// <param name="c">The index of the component, from 0 to N-1.
		///
		/// </param>
		/// <returns> The height in pixels of component <tt>n</tt> in tile
		/// <tt>t</tt>.
		///
		/// </returns>
		public virtual int getTileCompHeight(int t, int c)
		{
			// Retrieves the tile-component maximum resolution index and gets the
			// height from the source.
			int rl = mressrc.getSynSubbandTree(t, c).resLvl;
			return mressrc.getTileCompHeight(t, c, rl);
		}

		///  Returns the width in pixels of the specified component in the overall
		/// image.
		///
		///
		/// <param name="c">The index of the component, from 0 to N-1.
		///
		/// </param>
		/// <returns> The width in pixels of component <tt>c</tt> in the overall
		/// image.
		///
		/// </returns>
		public virtual int getCompImgWidth(int c)
		{
			// Retrieves the component maximum resolution index and gets the width
			// from the source module.
			int rl = decSpec.dls.getMinInComp(c);
			return mressrc.getCompImgWidth(c, rl);
		}

		///  Returns the height in pixels of the specified component in the overall
		/// image.
		///
		///
This default implementation returns the value of the source at the
		/// current reconstruction resolution level.

		///
		///
		/// <param name="c">The index of the component, from 0 to N-1.
		///
		/// </param>
		/// <returns> The height in pixels of component <tt>n</tt> in the overall
		/// image.
		///
		/// </returns>
		public virtual int getCompImgHeight(int c)
		{
			// Retrieves the component maximum resolution index and gets the
			// height from the source module.
			int rl = decSpec.dls.getMinInComp(c);
			return mressrc.getCompImgHeight(c, rl);
		}

		///  Changes the current tile, given the new indices. An
		/// IllegalArgumentException is thrown if the coordinates do not correspond
		/// to a valid tile.
		///
		///
This default implementation calls the same method on the source.

		///
		///
		/// <param name="x">The horizontal index of the tile.
		///
		/// </param>
		/// <param name="y">The vertical index of the new tile.
		///
		/// </param>
		public virtual void  setTile(int x, int y)
		{
			mressrc.setTile(x, y);
		}

		///  Advances to the next tile, in standard scan-line order (by rows then
		/// columns). An NoNextElementException is thrown if the current tile is
		/// the last one (i.e. there is no next tile).
		///
		///
This default implementation calls the same method on the source.

		///
		///
		public virtual void  nextTile()
		{
			mressrc.nextTile();
		}

		///  Returns the indixes of the current tile. These are the horizontal and
		/// vertical indexes of the current tile.
		///
		///
This default implementation returns the value of the source.

		///
		///
		/// <param name="co">If not null this object is used to return the information. If
		/// null a new one is created and returned.
		///
		/// </param>
		/// <returns> The current tile's indices (vertical and horizontal indexes).
		///
		/// </returns>
		public virtual Coord getTile(Coord co)
		{
			return mressrc.getTile(co);
		}

		///  Returns the horizontal coordinate of the upper-left corner of the
		/// specified component in the current tile.
		///
		///
		/// <param name="c">The component index.
		///
		/// </param>
		public virtual int getCompULX(int c)
		{
			// Find tile-component maximum resolution index and gets information
			// from the source module.
			int tIdx = TileIdx;
			int rl = mressrc.getSynSubbandTree(tIdx, c).resLvl;
			return mressrc.getResULX(c, rl);
		}

		///  Returns the vertical coordinate of the upper-left corner of the
		/// specified component in the current tile.
		///
		///
		/// <param name="c">The component index.
		///
		/// </param>
		public virtual int getCompULY(int c)
		{
			// Find tile-component maximum resolution index and gets information
			// from the source module.
			int tIdx = TileIdx;
			int rl = mressrc.getSynSubbandTree(tIdx, c).resLvl;
			return mressrc.getResULY(c, rl);
		}

		///  Returns the number of tiles in the horizontal and vertical directions.
		///
		///
This default implementation returns the value of the source.

		///
		///
		/// <param name="co">If not null this object is used to return the information. If
		/// null a new one is created and returned.
		///
		/// </param>
		/// <returns> The number of tiles in the horizontal (Coord.x) and vertical
		/// (Coord.y) directions.
		///
		/// </returns>
		public virtual Coord getNumTiles(Coord co)
		{
			return mressrc.getNumTiles(co);
		}

		///  Returns the total number of tiles in the image.
		///
		///
This default implementation returns the value of the source.

		///
		///
		/// <returns> The total number of tiles in the image.
		///
		/// </returns>
		public virtual int getNumTiles()
		{
			return mressrc.getNumTiles();
		}

		///  Returns the specified synthesis subband tree
		///
		///
		/// <param name="t">Tile index.
		///
		/// </param>
		/// <param name="c">Component index.
		///
		/// </param>
		public virtual SubbandSyn getSynSubbandTree(int t, int c)
		{
			return mressrc.getSynSubbandTree(t, c);
		}
		public abstract bool isReversible(int param1, int param2);
		public abstract int getNomRangeBits(int param1);
		public abstract int getImplementationType(int param1);
	}
}


text:
<img src="https://rawgit.com/lvillani/vagrant-metadata/master/logo.svg" align="right" width="200" height="200"/>

_Creates and updates Vagrant box metadata files (metadata.json)_

[![Build Status](https://dev.azure.com/EuRLdC3BDg/vagrant-metadata/_apis/build/status/lvillani.vagrant-metadata?branchName=master)](https://dev.azure.com/EuRLdC3BDg/vagrant-metadata/_build/latest?definitionId=8&branchName=master)
[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/)

--------------------------------------------------------------------------------

An utility program which creates and updates Vagrant
[box metadata files](http://docs.vagrantup.com/v2/boxes/format.html). This program is meant for
small-scale deployment and versioning of Vagrant base boxes to private servers. For large scale
deployment it always better to just use [Atlas](https://atlas.hashicorp.com/).

## Usage

### Installation

This program requires Python 2.7 and can be installed via PIP:

    pip install vagrant-metadata

### Publishing Your First Box

Now, let's suppose you have a base box called `precise64` in two flavors: one for Virtualbox and
the other for VMWare. `vagrant-metadata` follows the "convention over configuration" principle and
it expects a certain directory layout to do its magic. Let's start by creating the required
directory structure:

    mkdir -p precise64/1.0.0/virtualbox
    mkdir -p precise64/1.0.0/vmware_desktop

At this point you should have a directory tree like this:

    .
    └── precise64
        └── 1.0.0
            ├── virtualbox
            └── vmware_desktop

Now you should copy your boxes to their appropriate directory and end up with something like this:

    .
    └── precise64
        └── 1.0.0
            ├── virtualbox
            │   └── precise64.box
            └── vmware_desktop
                └── precise64.box

Now let's go into the `precise64` directory:

    cd precise64

Since this is the first time we run `vagrant-metadata` we'll have to tell it something about the
base box such as its URL, name and description:

    vagrant-metadata --name="lvillani/precise64" --description="Ubuntu 12.04 64-bit" \
        --baseurl="http://lorenzo.villani.me/vagrant/precise64"

After a while, when `vagrant-metadata` exits, you will find a fresh `metadata.json` file which
contains all the box metadata. At this point you can publish the whole `precise64` directory
somewhere.

### Updating a Box

Updating a box is easier than preparing a new one for publication. Let's suppose we want to
publish version `2.0.0` of the `precise64` box described before: create a new `2.0.0` directory
with the same layout as before and copy your boxes there ending up with something like:

    .
    └── precise64
        ├── 1.0.0
        │   ├── virtualbox
        │   │   └── precise64.box
        │   └── vmware_desktop
        │       └── precise64.box
        ├── 2.0.0
        │   ├── virtualbox
        │   │   └── precise64.box
        │   └── vmware_desktop
        │       └── precise64.box
        └── metadata.json

At this point go to the `precise64` directory and run `vagrant-metadata`:

    cd precise64
    vagrant-metadata

Notice that we don't even have to specify the box name, description or base URL.

Sync this directory with your remote server and you are done.

If you don't have all box files downloaded locally, and want to add new version
to existing metadata.json simply add `--append` (`-a`) option to only add new
version box to existing metadata


text:
set -e
set -x

copy_files() {
  local image="$1"
  local outdir="$2"
  local tmpdir="$(mktemp -d)"

  id=$(docker create "${image}")
  docker cp "${id}:/packages/" "${tmpdir}"
  mv "$tmpdir"/packages/* "$outdir"
  echo "Built packages in $outdir"
}

docker build -f Dockerfile -t "pjameson/fbcode:latest" -t "pjameson/fbcode:$(date "+%Y%m%d")" .

outdir="build/packages/ubuntu/dists/xenial/binary-amd64"
mkdir -p "$outdir"
docker build -f Dockerfile.package.ubuntu_16_04 -t "pjameson/fbcode_ubuntu_16_04" .
copy_files "pjameson/fbcode_ubuntu_16_04" "$outdir"

outdir="build/packages/centos/7/x86_64"
mkdir -p "$outdir"
docker build -f Dockerfile.package.centos_7 -t "pjameson/fbcode_centos_7" .
copy_files "pjameson/fbcode_centos_7" "${outdir}"


text:
"""
WWW: http://4suite.com/4DOM         e-mail: support@4suite.com

Copyright (c) 2000 Fourthought Inc, USA.   All Rights Reserved.
See  http://4suite.com/COPYRIGHT  for license and copyright information
"""

import string
from xml.dom import Node
from xml.dom.html.HTMLElement import HTMLElement

class HTMLBaseElement(HTMLElement):

    def __init__(self, ownerDocument, nodeName="BASE"):
        HTMLElement.__init__(self, ownerDocument, nodeName)

    ### Attribute Methods ###

    def _get_href(self):
        return self.getAttribute("HREF")

    def _set_href(self, value):
        self.setAttribute("HREF", value)

    def _get_target(self):
        return self.getAttribute("TARGET")

    def _set_target(self, value):
        self.setAttribute("TARGET", value)

    ### Attribute Access Mappings ###

    _readComputedAttrs = HTMLElement._readComputedAttrs.copy()
    _readComputedAttrs.update({
        "href" : _get_href,
        "target" : _get_target
        })

    _writeComputedAttrs = HTMLElement._writeComputedAttrs.copy()
    _writeComputedAttrs.update({
        "href" : _set_href,
        "target" : _set_target
        })

    _readOnlyAttrs = filter(lambda k,m=_writeComputedAttrs: not m.has_key(k),
                     HTMLElement._readOnlyAttrs + _readComputedAttrs.keys())


text:
https://www.codewars.com/kata/reverse-it-quickly

Typically, reversing an array is a pretty straightforward task even for novice programmers. But not when a crowd of angry zombies scratching your door, looking for a fresh brains. In this case even skilled ninja-geek probably prefer to quickly push his code on github to have enough time to find a chainsaw. So there's two obstacles:

1. Your code needs to be as short as possible, in fact not longer than 28
   characters
1. Because you are scared and stressed you have forgotten how to use the
   standard reverse() method

Input: an array containing data of any types. Ex: [1,2,3,'a','b','c',[]]

Output: [[],'c','b','a',3,2,1]


text:
Counter = {};
Counter.collection = new Meteor.Collection('counters-collection');

Counter.get = function(name) {
  var doc = Counter.collection.findOne(name);
  if(doc) {
    return doc.count;
  } else {
    return 0;
  }
};


text:
Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] I have read the CONTRIBUTING document.
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.


text:
namespace llvm {
class Region;
} // namespace llvm

namespace polly {

/// Get the location of a region from the debug info.
///
/// @param R The region to get debug info for.
/// @param LineBegin The first line in the region.
/// @param LineEnd The last line in the region.
/// @param FileName The filename where the region was defined.
void getDebugLocation(const llvm::Region *R, unsigned &LineBegin,
                      unsigned &LineEnd, std::string &FileName);
} // namespace polly

#endif // POLLY_SCOP_LOCATION_H


text:
.class Landroid/widget/ProgressBar$RefreshProgressRunnable;
.super Ljava/lang/Object;
.source "ProgressBar.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/widget/ProgressBar;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "RefreshProgressRunnable"
.end annotation

# instance fields
.field final synthetic this$0:Landroid/widget/ProgressBar;

# direct methods
.method private constructor <init>(Landroid/widget/ProgressBar;)V
    .locals 0

    .prologue
    .line 1158
    iput-object p1, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Landroid/widget/ProgressBar;Landroid/widget/ProgressBar$1;)V
    .locals 0
    .param p1, "x0"    # Landroid/widget/ProgressBar;
    .param p2, "x1"    # Landroid/widget/ProgressBar$1;

    .prologue
    .line 1158
    invoke-direct {p0, p1}, Landroid/widget/ProgressBar$RefreshProgressRunnable;-><init>(Landroid/widget/ProgressBar;)V

    return-void
.end method

# virtual methods
.method public run()V
    .locals 10

    .prologue
    .line 1160
    iget-object v9, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    monitor-enter v9

    .line 1161
    :try_start_0
    iget-object v0, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    # getter for: Landroid/widget/ProgressBar;->mRefreshData:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/widget/ProgressBar;->access$100(Landroid/widget/ProgressBar;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v6

    .line 1162
    .local v6, "count":I
    const/4 v7, 0x0

    .local v7, "i":I
    :goto_0
    if-ge v7, v6, :cond_0

    .line 1163
    iget-object v0, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    # getter for: Landroid/widget/ProgressBar;->mRefreshData:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/widget/ProgressBar;->access$100(Landroid/widget/ProgressBar;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0, v7}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Landroid/widget/ProgressBar$RefreshData;

    .line 1164
    .local v8, "rd":Landroid/widget/ProgressBar$RefreshData;
    iget-object v0, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    iget v1, v8, Landroid/widget/ProgressBar$RefreshData;->id:I

    iget v2, v8, Landroid/widget/ProgressBar$RefreshData;->progress:F

    iget-boolean v3, v8, Landroid/widget/ProgressBar$RefreshData;->fromUser:Z

    const/4 v4, 0x1

    iget-boolean v5, v8, Landroid/widget/ProgressBar$RefreshData;->animate:Z

    # invokes: Landroid/widget/ProgressBar;->doRefreshProgress(IFZZZ)V
    invoke-static/range {v0 .. v5}, Landroid/widget/ProgressBar;->access$200(Landroid/widget/ProgressBar;IFZZZ)V

    .line 1165
    invoke-virtual {v8}, Landroid/widget/ProgressBar$RefreshData;->recycle()V

    .line 1162
    add-int/lit8 v7, v7, 0x1

    goto :goto_0

    .line 1167
    .end local v8    # "rd":Landroid/widget/ProgressBar$RefreshData;
    :cond_0
    iget-object v0, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    # getter for: Landroid/widget/ProgressBar;->mRefreshData:Ljava/util/ArrayList;
    invoke-static {v0}, Landroid/widget/ProgressBar;->access$100(Landroid/widget/ProgressBar;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V

    .line 1168
    iget-object v0, p0, Landroid/widget/ProgressBar$RefreshProgressRunnable;->this$0:Landroid/widget/ProgressBar;

    const/4 v1, 0x0

    # setter for: Landroid/widget/ProgressBar;->mRefreshIsPosted:Z
    invoke-static {v0, v1}, Landroid/widget/ProgressBar;->access$302(Landroid/widget/ProgressBar;Z)Z

    .line 1169
    monitor-exit v9

    .line 1170
    return-void

    .line 1169
    .end local v6    # "count":I
    .end local v7    # "i":I
    :catchall_0
    move-exception v0

    monitor-exit v9
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


text:
"""Tests for manipulating VolumeTargets via the DB API"""

from oslo_utils import uuidutils

from ironic.common import exception
from ironic.tests.unit.db import base
from ironic.tests.unit.db import utils as db_utils

class DbVolumeTargetTestCase(base.DbTestCase):

    def setUp(self):
        # This method creates a volume_target for every test.
        super(DbVolumeTargetTestCase, self).setUp()
        self.node = db_utils.create_test_node()
        self.target = db_utils.create_test_volume_target(node_id=self.node.id)

    def test_create_volume_target(self):
        info = {'uuid': uuidutils.generate_uuid(),
                'node_id': self.node.id,
                'boot_index': 1,
                'volume_type': 'iscsi',
                'volume_id': '12345678'}

        target = self.dbapi.create_volume_target(info)
        self.assertEqual(info['uuid'], target.uuid)
        self.assertEqual(info['node_id'], target.node_id)
        self.assertEqual(info['boot_index'], target.boot_index)
        self.assertEqual(info['volume_type'], target.volume_type)
        self.assertEqual(info['volume_id'], target.volume_id)
        self.assertIsNone(target.properties)
        self.assertIsNone(target.extra)

    def test_create_volume_target_duplicated_nodeid_and_bootindex(self):
        self.assertRaises(exception.VolumeTargetBootIndexAlreadyExists,
                          db_utils.create_test_volume_target,
                          uuid=uuidutils.generate_uuid(),
                          node_id=self.target.node_id,
                          boot_index=self.target.boot_index)

    def test_create_volume_target_duplicated_uuid(self):
        self.assertRaises(exception.VolumeTargetAlreadyExists,
                          db_utils.create_test_volume_target,
                          uuid=self.target.uuid,
                          node_id=self.node.id,
                          boot_index=100)

    def test_get_volume_target_by_id(self):
        res = self.dbapi.get_volume_target_by_id(self.target.id)
        self.assertEqual(self.target.volume_type, res.volume_type)
        self.assertEqual(self.target.properties, res.properties)
        self.assertEqual(self.target.boot_index, res.boot_index)

        self.assertRaises(exception.VolumeTargetNotFound,
                          self.dbapi.get_volume_target_by_id,
                          100)

    def test_get_volume_target_by_uuid(self):
        res = self.dbapi.get_volume_target_by_uuid(self.target.uuid)
        self.assertEqual(self.target.id, res.id)

        self.assertRaises(exception.VolumeTargetNotFound,
                          self.dbapi.get_volume_target_by_uuid,
                          '11111111-2222-3333-4444-555555555555')

    def _create_list_of_volume_targets(self, num):
        uuids = [str(self.target.uuid)]
        for i in range(1, num):
            volume_target = db_utils.create_test_volume_target(
                uuid=uuidutils.generate_uuid(),
                node_id=self.node.id,
                properties={"target_iqn": "iqn.test-%s" % i},
                boot_index=i)
            uuids.append(str(volume_target.uuid))
        return uuids

    def test_get_volume_target_list(self):
        uuids = self._create_list_of_volume_targets(6)
        res = self.dbapi.get_volume_target_list()
        res_uuids = [r.uuid for r in res]
        self.assertCountEqual(uuids, res_uuids)

    def test_get_volume_target_list_sorted(self):
        uuids = self._create_list_of_volume_targets(5)
        res = self.dbapi.get_volume_target_list(sort_key='uuid')
        res_uuids = [r.uuid for r in res]
        self.assertEqual(sorted(uuids), res_uuids)

        self.assertRaises(exception.InvalidParameterValue,
                          self.dbapi.get_volume_target_list, sort_key='foo')

    def test_get_volume_targets_by_node_id(self):
        node2 = db_utils.create_test_node(uuid=uuidutils.generate_uuid())
        target2 = db_utils.create_test_volume_target(
            uuid=uuidutils.generate_uuid(), node_id=node2.id)
        self._create_list_of_volume_targets(2)
        res = self.dbapi.get_volume_targets_by_node_id(node2.id)
        self.assertEqual(1, len(res))
        self.assertEqual(target2.uuid, res[0].uuid)

    def test_get_volume_targets_by_node_id_that_does_not_exist(self):
        self.assertEqual([], self.dbapi.get_volume_targets_by_node_id(99))

    def test_get_volume_targets_by_volume_id(self):
        # Create two volume_targets. They'll have the same volume_id.
        uuids = self._create_list_of_volume_targets(2)
        res = self.dbapi.get_volume_targets_by_volume_id('12345678')
        res_uuids = [r.uuid for r in res]
        self.assertEqual(uuids, res_uuids)

    def test_get_volume_targets_by_volume_id_that_does_not_exist(self):
        self.assertEqual([], self.dbapi.get_volume_targets_by_volume_id('dne'))

    def test_update_volume_target(self):
        old_boot_index = self.target.boot_index
        new_boot_index = old_boot_index + 1

        res = self.dbapi.update_volume_target(self.target.id,
                                              {'boot_index': new_boot_index})
        self.assertEqual(new_boot_index, res.boot_index)

        res = self.dbapi.update_volume_target(self.target.id,
                                              {'boot_index': old_boot_index})
        self.assertEqual(old_boot_index, res.boot_index)

    def test_update_volume_target_uuid(self):
        self.assertRaises(exception.InvalidParameterValue,
                          self.dbapi.update_volume_target,
                          self.target.id,
                          {'uuid': uuidutils.generate_uuid()})

    def test_update_volume_target_fails_invalid_id(self):
        self.assertRaises(exception.VolumeTargetNotFound,
                          self.dbapi.update_volume_target,
                          99,
                          {'boot_index': 6})

    def test_update_volume_target_duplicated_nodeid_and_bootindex(self):
        t = db_utils.create_test_volume_target(uuid=uuidutils.generate_uuid(),
                                               boot_index=1,
                                               node_id=self.node.id)
        self.assertRaises(exception.VolumeTargetBootIndexAlreadyExists,
                          self.dbapi.update_volume_target,
                          t.uuid,
                          {'boot_index': self.target.boot_index,
                           'node_id': self.target.node_id})

    def test_destroy_volume_target(self):
        self.dbapi.destroy_volume_target(self.target.id)
        self.assertRaises(exception.VolumeTargetNotFound,
                          self.dbapi.get_volume_target_by_id,
                          self.target.id)

        # Ensure that destroy_volume_target returns the expected exception.
        self.assertRaises(exception.VolumeTargetNotFound,
                          self.dbapi.destroy_volume_target,
                          self.target.id)


text:
<?php
namespace Sluggard\Models;

use Sluggard\Lib\Db;
use Sluggard\SluggardApp;

class CCPData {
    private $db;
    private $app;

    function __construct(SluggardApp &$app) {
        $this->app = $app;
        $this->db = new Db($app, "sqlite", "ccpData");
    }

    public function query($query, $parameters = array()) {
        return $this->db->query($query, $parameters);
    }

    public function queryField($query, $field, $parameters = array()) {
        return $this->db->queryField($query, $field, $parameters);
    }

    public function queryRow($query, $parameters = array()) {
        return $this->db->queryRow($query, $parameters);
    }

    public function execute($query, $parameters = array(), $returnID = false) {
        return $this->db->execute($query, $parameters, $returnID);
    }
}


text: package poddisruptionbudget


text:
package net.tridentsdk.reflect;

import com.esotericsoftware.reflectasm.ConstructorAccess;

/**
 * Instance creator using ASM
 *
 * @author The TridentSDK Team
 */
public class FastConstructor {
    private final ConstructorAccess access;

    /**
     * Creates a new instance accessor to assemble bytecode for fast class creation
     *
     * @param access the underlying access to the construction ASM facilities
     */
    public FastConstructor(ConstructorAccess access) {
        this.access = access;
    }

    /**
     * Creates a new instance of the constructor's class
     *
     * @param <T> the class type
     * @return the instance of T
     */
    public <T> T newInstance() {
        return (T) this.access.newInstance();
    }
}


text:
import requests
from bs4 import BeautifulSoup

def get_area_url():
    #获取所有未过滤所有地区url列表
    data = []
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',}
    site = 'http://alexa.chinaz.com/Country/index.html'
    req = requests.get(site, headers=headers)
    req.encoding = 'utf-8'
    status = req.status_code
    soup = BeautifulSoup(req.text, 'lxml')
    urls = soup.select(' div > div > a ')
    return urls

#print (get_area_url())

def get_urls():
    #获得所有地区request url
    sum = []
    dic = {}
    for area_name in get_area_url():# 过滤非国家列表,并截取最后的字段存入字典
        if 'index_' in str(area_name):
            dic[area_name.text] = area_name.get('href').split('/')[2].split('.')[0]
    return dic
#print(get_urls())
#get_urls()

area_urls='''
/Country/index_CN.html
/Country/index_US.html
/Country/index_FR.html
/Country/index_FR.html
/Country/index_DE.html
/Country/index_JP.html
/Country/index_KR.html
/Country/index_SE.html
/Country/index_CH.html
/Country/index_HK.html
/Country/index_MO.html
/Country/index_TW.html
/Country/index_TH.html
/Country/index_BH.html
/Country/index_BR.html
/Country/index_CL.html
/Country/index_DK.html
/Country/index_EG.html
/Country/index_GH.html
/Country/index_GR.html
/Country/index_IS.html
/Country/index_IN.html
/Country/index_FI.html
/Country/index_JO.html
/Country/index_MM.html
/Country/index_IR.html
/Country/index_NO.html
/Country/index_OM.html
/Country/index_NL.html
/Country/index_PE.html
/Country/index_PL.html
/Country/index_ZA.html
/Country/index_VN.html
/Country/index_YE.html
/Country/index_AR.html
/Country/index_AT.html
/Country/index_BA.html
/Country/index_BE.html
/Country/index_KH.html
/Country/index_CA.html
/Country/index_HU.html
/Country/index_IQ.html
/Country/index_IE.html
/Country/index_IL.html
/Country/index_IT.html
/Country/index_JM.html
/Country/index_KE.html
/Country/index_KW.html
/Country/index_MA.html
/Country/index_NP.html
/Country/index_NZ.html
/Country/index_LT.html
/Country/index_LU.html
/Country/index_PA.html
/Country/index_PY.html
/Country/index_MK.html
/Country/index_MT.html
/Country/index_MX.html
/Country/index_PH.html
/Country/index_PT.html
/Country/index_QA.html
/Country/index_SG.html
/Country/index_RU.html
/Country/index_TN.html
/Country/index_TR.html
/Country/index_UA.html
/Country/index_UY.html
/Country/index_ES.html
/Country/index_AM.html
/Country/index_AU.html
/Country/index_AZ.html
/Country/index_BD.html
/Country/index_BB.html
/Country/index_BY.html
/Country/index_BO.html
/Country/index_BG.html
/Country/index_CO.html
/Country/index_HR.html
/Country/index_CY.html
/Country/index_EC.html
/Country/index_SV.html
/Country/index_SV.html
/Country/index_GT.html
/Country/index_HN.html
/Country/index_GE.html
/Country/index_MY.html
/Country/index_LV.html
/Country/index_NI.html
/Country/index_NG.html
/Country/index_MQ.html
/Country/index_MU.html
/Country/index_MD.html
/Country/index_PK.html
/Country/index_PS.html
/Country/index_PR.html
/Country/index_RE.html
/Country/index_RO.html
/Country/index_VE.html
/Country/index_RS.html
/Country/index_SK.html
/Country/index_LK.html
/Country/index_AL.html
/Country/index_DZ.html
/Country/index_CR.html
/Country/index_CZ.html
/Country/index_GP.html
/Country/index_ID.html
/Country/index_KZ.html
/Country/index_MG.html
/Country/index_ME.html
/Country/index_SA.html
/Country/index_SI.html
/Country/index_KG.html
/Country/index_UZ.html
/Country/index_DO.html
/Country/index_TT.html
/Country/index_AE.html
/Country/index_BA.html
'''


text:
package edu.northwestern.bioinformatics.studycalendar.restlets;

import edu.northwestern.bioinformatics.studycalendar.core.Fixtures;
import edu.northwestern.bioinformatics.studycalendar.dao.ActivityTypeDao;
import edu.northwestern.bioinformatics.studycalendar.dao.SourceDao;
import edu.northwestern.bioinformatics.studycalendar.domain.Source;
import edu.northwestern.bioinformatics.studycalendar.service.ActivityService;
import edu.northwestern.bioinformatics.studycalendar.service.SourceService;
import org.restlet.data.Method;

import static edu.northwestern.bioinformatics.studycalendar.security.authorization.PscRole.*;

/**
 * @author Rhett Sutphin
 */
public class ActivitySourceResourceTest extends AuthorizedResourceTestCase<ActivitySourceResource> {
    public static final String SOURCE_NAME = "House of Activities";
    public static final String SOURCE_NAME_ENCODED = "House%20of%20Activities";

    private SourceDao sourceDao;

    private Source source;

    private SourceService sourceService;
    private ActivityService activityService;
    private ActivityTypeDao activityTypeDao;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        sourceDao = registerDaoMockFor(SourceDao.class);
        activityTypeDao = registerDaoMockFor(ActivityTypeDao.class);
        sourceService = registerMockFor(SourceService.class);
        activityService = registerMockFor(ActivityService.class);
        request.getAttributes().put(UriTemplateParameters.ACTIVITY_SOURCE_NAME.attributeName(), SOURCE_NAME_ENCODED);

        source = Fixtures.createNamedInstance(SOURCE_NAME, Source.class);
    }

    @Override
    protected ActivitySourceResource createAuthorizedResource() {
        ActivitySourceResource resource = new ActivitySourceResource();
        resource.setSourceDao(sourceDao);
        resource.setXmlSerializer(xmlSerializer);
        resource.setSourceService(sourceService);
        resource.setActivityService(activityService);
        resource.setActivityTypeDao(activityTypeDao);
        return resource;
    }

    public void testGetAndPutAllowed() throws Exception {
        assertAllowedMethods("PUT", "GET");
    }

    public void testGetWithAuthorizedRoles() {
        assertRolesAllowedForMethod(Method.GET,
            STUDY_CALENDAR_TEMPLATE_BUILDER,
            BUSINESS_ADMINISTRATOR,
            DATA_READER);
    }

    public void testPutWithAuthorizedRoles() {
        assertRolesAllowedForMethod(Method.PUT,
            BUSINESS_ADMINISTRATOR);
    }
}


text:
[![](https://images.microbadger.com/badges/image/ajhaydock/texstudio.svg)](https://microbadger.com/images/ajhaydock/texstudio "Get your own image badge on microbadger.com")

# TeXstudio
LaTeX editing environment inside Docker.

```bash
function texstudio(){
  docker run -d \
    --cap-drop=all \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e DISPLAY=unix$DISPLAY \
    -v $HOME/GitLab:/home/user/Documents \
    -v $HOME/.config/texstudio:/home/user/.config/texstudio \
    --name texstudio \
    ajhaydock/texstudio
}
```


text:
package com.impetus.kundera.configure.schema;

import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * The Class ColumnInfo holds column related information.
 *
 * @author Kuldeep.Kumar
 */
public class ColumnInfo
{

    /** The is indexable variable for indexing the column. */
    private boolean isIndexable = false;

    /** The column name variable . */
    private String columnName;

    /** The column order by variable . */
    private String order;

    /** The type variable. */
    private Class type;

    /**
     * Instantiates a new column info.
     */
    public ColumnInfo()
    {

    }

    /**
     * Equals method compare two object of columnInfo on the basis of their
     * name.
     *
     * @param Object
     *            instance.
     *
     * @return boolean value.
     */
    @Override
    public boolean equals(Object obj)
    {

        // / if object's class and column name matches then return true;

        return obj != null && obj instanceof ColumnInfo && ((ColumnInfo) obj).columnName != null ? this.columnName != null
                && this.columnName.equals(((ColumnInfo) obj).columnName)
                : false;

    }

    @Override
    /**
     * returns the hash code for object.
     *
     */
    public int hashCode()
    {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    /**
     * returns the string representation of object .
     *
     */
    public String toString()
    {
        StringBuilder strBuilder = new StringBuilder("type:==> ");
        strBuilder.append(type);
        strBuilder.append(" | columnName: ==>");
        strBuilder.append(columnName);
        strBuilder.append(" | isIndexable: ==>");
        strBuilder.append(isIndexable);
        strBuilder.append(" | orderby: ==>");
        strBuilder.append(order);
        return strBuilder.toString();
    }

    /**
     * Gets the column name.
     *
     * @return the columnName
     */
    public String getColumnName()
    {
        return columnName;
    }

    /**
     * Sets the column name.
     *
     * @param columnName
     *            the columnName to set
     */
    public void setColumnName(String columnName)
    {
        this.columnName = columnName;
    }

    /**
     * Checks if is indexable.
     *
     * @return the isIndexable
     */
    public boolean isIndexable()
    {
        return isIndexable;
    }

    /**
     * Sets the indexable.
     *
     * @param isIndexable
     *            the isIndexable to set
     */
    public void setIndexable(boolean isIndexable)
    {
        this.isIndexable = isIndexable;
    }

    /**
     * @return the type
     */
    public Class getType()
    {
        return type;
    }

    /**
     * @param type
     *            the type to set
     */
    public void setType(Class type)
    {
        this.type = type;
    }

    public void setOrderBy(String order)
    {
        this.order = order;
    }

    public String getOrderBy()
    {
        return order;
    }
}


text:
package eu.smartenit.unada.db.dto;

import java.io.Serializable;
import java.util.List;

/**
 * The ProviderReply class.
 *
 * @authors George Petropoulos
 * @version 2.0
 *
 */
public class ProviderReply implements Serializable{

	/**
	 *
	 */
	private static final long serialVersionUID = 5430712218671478099L;

	public ProviderReply() {

	}

	private String type;
    private String replyAddress;
    private int replyPort;
    private long contentID;
    private List<UnadaInfo> providers;

	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getReplyAddress() {
		return replyAddress;
	}
	public void setReplyAddress(String replyAddress) {
		this.replyAddress = replyAddress;
	}
	public int getReplyPort() {
		return replyPort;
	}
	public void setReplyPort(int replyPort) {
		this.replyPort = replyPort;
	}
	public long getContentID() {
		return contentID;
	}
	public void setContentID(long contentID) {
		this.contentID = contentID;
	}
	public List<UnadaInfo> getProviders() {
		return providers;
	}
	public void setProviders(List<UnadaInfo> providers) {
		this.providers = providers;
	}

	@Override
	public String toString() {
		return "ProviderReply [type=" + type + ", replyAddress=" + replyAddress
				+ ", replyPort=" + replyPort + ", contentID=" + contentID
				+ ", providers=" + providers + "]";
	}

}


text:
package wolfogre.khtd4;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnTouchListener {

	GestureDetector gestureDetector;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				((BoardView) findViewById(R.id.view)).restart();
				Toast.makeText(MainActivity.this, "Restart!", Toast.LENGTH_SHORT).show();
			}
		});

		View activity = findViewById(R.id.activity);
		activity.setOnTouchListener(this);
		activity.setFocusable(true);
		activity.setClickable(true);
		activity.setLongClickable(true);

		gestureDetector = new GestureDetector( new GestureDetector.OnGestureListener() {
			@Override
			public boolean onDown(MotionEvent e) {
				return false;
			}

			@Override
			public void onShowPress(MotionEvent e) {

			}

			@Override
			public boolean onSingleTapUp(MotionEvent e) {
				return false;
			}

			@Override
			public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
				return false;
			}

			@Override
			public void onLongPress(MotionEvent e) {

			}

			@Override
			public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
				((BoardView) findViewById(R.id.view)).changeDirection(velocityX, velocityY);
				return false;
			}
		});
	}

	@Override
	public boolean onTouch(View v, MotionEvent event) {
		return gestureDetector.onTouchEvent(event);
	}

}


text:
package org.zsy.repository.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.zsy.repository.model.AppUserDrawType;
import org.zsy.repository.model.AppUserDrawTypeExample;

public interface AppUserDrawTypeMapper {
    long countByExample(AppUserDrawTypeExample example);

    int deleteByExample(AppUserDrawTypeExample example);

    int deleteByPrimaryKey(@Param("drawId") String drawId, @Param("code") String code);

    int insert(AppUserDrawType record);

    int insertSelective(AppUserDrawType record);

    List<AppUserDrawType> selectByExample(AppUserDrawTypeExample example);

    AppUserDrawType selectByPrimaryKey(@Param("drawId") String drawId, @Param("code") String code);

    int updateByExampleSelective(@Param("record") AppUserDrawType record, @Param("example") AppUserDrawTypeExample example);

    int updateByExample(@Param("record") AppUserDrawType record, @Param("example") AppUserDrawTypeExample example);

    int updateByPrimaryKeySelective(AppUserDrawType record);

    int updateByPrimaryKey(AppUserDrawType record);
}


text:
A library of interesting structs for the adventurous

#License

   . MIT License


text:
package com.thesett.aima.logic.fol.interpreter;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import com.thesett.aima.attribute.impl.IdAttribute;
import com.thesett.aima.logic.fol.Clause;
import com.thesett.aima.logic.fol.Functor;
import com.thesett.aima.logic.fol.FunctorName;
import com.thesett.aima.logic.fol.LinkageException;
import com.thesett.aima.logic.fol.LogicCompiler;
import com.thesett.aima.logic.fol.LogicCompilerObserver;
import com.thesett.aima.logic.fol.OpSymbol;
import com.thesett.aima.logic.fol.Parser;
import com.thesett.aima.logic.fol.Resolver;
import com.thesett.aima.logic.fol.Sentence;
import com.thesett.aima.logic.fol.Term;
import com.thesett.aima.logic.fol.Variable;
import com.thesett.aima.logic.fol.VariableAndFunctorInterner;
import com.thesett.aima.logic.fol.isoprologparser.Token;
import com.thesett.aima.logic.fol.isoprologparser.TokenSource;
import com.thesett.common.parsing.SourceCodeException;
import com.thesett.common.util.Filterator;
import com.thesett.common.util.Function;
import com.thesett.common.util.Source;

/**
 * ResolutionEngine combines together a logic {@link Parser}, a {@link VariableAndFunctorInterner} that acts as a symbol
 * table, a {@link LogicCompiler} and a {@link Resolver}, into a single unit.
 *
 *

CRC Card

 *
 Responsibilities  Collaborations
 *

 *
 * @param  <S> The source term type that the parser produces.
 * @param  <T> The compiled program type that the compiler produces.
 * @param  <Q> The compiled query type that the compiler produces.
 *
 * @author Rupert Smith
 */
public abstract class ResolutionEngine<S extends Clause, T, Q> implements VariableAndFunctorInterner, Parser<S, Token>,
    LogicCompiler<S, T, Q>, Resolver<T, Q>
{
    /** Holds the parser. */
    protected Parser<S, Token> parser;

    /** Holds the variable and functor symbol table. */
    protected VariableAndFunctorInterner interner;

    /** Holds the compiler. */
    protected LogicCompiler<S, T, Q> compiler;

    /** Holds the resolver. */
    protected Resolver<T, Q> resolver;

    /** Holds the observer for compiler outputs. */
    protected ChainedCompilerObserver chainedObserver = new ChainedCompilerObserver();

    /**
     * Builds an logical resolution engine from a parser, interner, compiler and resolver.
     *
     * @param parser   The parser.
     * @param interner The interner.
     * @param compiler The compiler.
     * @param resolver The resolver.
     */
    public ResolutionEngine(Parser<S, Token> parser, VariableAndFunctorInterner interner,
        LogicCompiler<S, T, Q> compiler, Resolver<T, Q> resolver)
    {
        this.parser = parser;
        this.interner = interner;
        this.compiler = compiler;
        this.resolver = resolver;

        compiler.setCompilerObserver(chainedObserver);
    }

    /**
     * Non-initializing constructor for the engine. This is provided so that engine implementations that cannot easily
     * set up their components in the call the the super constructor, can create the engine with this constructor and
     * take responsibility for setting up the components themselves.
     */
    protected ResolutionEngine()
    {
    }

    /**
     * Resets the engine to its default state. This will typically load any bootstrapping libraries of built-ins that
     * the engine requires, but otherwise set its domain to empty.
     */
    public abstract void reset();

    /**
     * Provides the resolution engines parser.
     *
     * @return The resolution engines parser.
     */
    public Parser<S, Token> getParser()
    {
        return parser;
    }

    /**
     * Provides the resolution engines interner.
     *
     * @return The resolution engines interner.
     */
    public VariableAndFunctorInterner getInterner()
    {
        return interner;
    }

    /**
     * Provides the resolution engines compiler.
     *
     * @return The resolution engines compiler.
     */
    public LogicCompiler<S, T, Q> getCompiler()
    {
        return compiler;
    }

    /**
     * Provides the resolution engines resolver.
     *
     * @return The resolution engines resolver.
     */
    public Resolver<T, Q> getResolver()
    {
        return resolver;
    }

    /**
     * Consults an input stream, reading first order logic clauses from it, and inserting them into the resolvers
     * knowledge base.
     *
     * @param  stream The input stream to consult.
     *
     * @throws SourceCodeException If any code read from the input stream fails to parse, compile or link.
     */
    public void consultInputStream(InputStream stream) throws SourceCodeException
    {
        // Create a token source to read from the specified input stream.
        Source<Token> tokenSource = TokenSource.getTokenSourceForInputStream(stream);
        getParser().setTokenSource(tokenSource);

        // Consult the type checking rules and add them to the knowledge base.
        while (true)
        {
            Sentence<S> sentence = getParser().parse();

            if (sentence == null)
            {
                break;
            }

            getCompiler().compile(sentence);
        }
    }

    /**
     * Prints all of the logic variables in the results of a query.
     *
     * @param  solution An iterable over the variables in the solution.
     *
     * @return All the variables printed as a string, one per line.
     */
    public String printSolution(Iterable<Variable> solution)
    {
        String result = "";

        for (Variable var : solution)
        {
            result += printVariableBinding(var) + "\n";
        }

        return result;
    }

    /**
     * Prints all of the logic variables in the results of a query.
     *
     * @param  variables An iterable over the variables in the solution.
     *
     * @return All the variables printed as a string, one per line.
     */
    public String printSolution(Map<String, Variable> variables)
    {
        String result = "";

        for (Map.Entry<String, Variable> entry : variables.entrySet())
        {
            result += printVariableBinding(entry.getValue()) + "\n";
        }

        return result;
    }

    /**
     * Prints a variable binding in the form 'Var = value'.
     *
     * @param  var The variable to print.
     *
     * @return The variable binding in the form 'Var = value'.
     */
    public String printVariableBinding(Term var)
    {
        return var.toString(getInterner(), true, false) + " = " + var.getValue().toString(getInterner(), false, true);
    }

    /**
     * Transforms an iterator over sets of variable bindings, resulting from a query, to an iterator over a map from the
     * string name of variables to their bindings, for the same sequence of query solutions.
     *
     * @param  solutions The resolution solutions to convert to map form.
     *
     * @return An iterator over a map from the string name of variables to their bindings, for the solutions.
     */
    public Iterable<Map<String, Variable>> expandResultSetToMap(Iterator<Set<Variable>> solutions)
    {
        return new Filterator<Set<Variable>, Map<String, Variable>>(solutions,
            new Function<Set<Variable>, Map<String, Variable>>()
            {
                public Map<String, Variable> apply(Set<Variable> variables)
                {
                    Map<String, Variable> results = new HashMap<String, Variable>();

                    for (Variable var : variables)
                    {
                        String varName = getInterner().getVariableName(var.getName());
                        results.put(varName, var);
                    }

                    return results;
                }
            });
    }

    /** {@inheritDoc} */
    public IdAttribute.IdAttributeFactory<String> getVariableInterner()
    {
        return interner.getVariableInterner();
    }

    /** {@inheritDoc} */
    public IdAttribute.IdAttributeFactory<FunctorName> getFunctorInterner()
    {
        return interner.getFunctorInterner();
    }

    /** {@inheritDoc} */
    public int internFunctorName(String name, int numArgs)
    {
        return interner.internFunctorName(name, numArgs);
    }

    /** {@inheritDoc} */
    public int internFunctorName(FunctorName name)
    {
        return interner.internFunctorName(name);
    }

    /** {@inheritDoc} */
    public int internVariableName(String name)
    {
        return interner.internVariableName(name);
    }

    /** {@inheritDoc} */
    public String getVariableName(int name)
    {
        return interner.getVariableName(name);
    }

    /** {@inheritDoc} */
    public String getVariableName(Variable variable)
    {
        return interner.getVariableName(variable);
    }

    /** {@inheritDoc} */
    public FunctorName getDeinternedFunctorName(int name)
    {
        return interner.getDeinternedFunctorName(name);
    }

    /** {@inheritDoc} */
    public String getFunctorName(int name)
    {
        return interner.getFunctorName(name);
    }

    /** {@inheritDoc} */
    public int getFunctorArity(int name)
    {
        return interner.getFunctorArity(name);
    }

    /** {@inheritDoc} */
    public FunctorName getFunctorFunctorName(Functor functor)
    {
        return interner.getFunctorFunctorName(functor);
    }

    /** {@inheritDoc} */
    public String getFunctorName(Functor functor)
    {
        return interner.getFunctorName(functor);
    }

    /** {@inheritDoc} */
    public int getFunctorArity(Functor functor)
    {
        return interner.getFunctorArity(functor);
    }

    /** {@inheritDoc} */
    public void setTokenSource(Source<Token> tokenSource)
    {
        parser.setTokenSource(tokenSource);
    }

    /** {@inheritDoc} */
    public Sentence<S> parse() throws SourceCodeException
    {
        return parser.parse();
    }

    /** {@inheritDoc} */
    public void setOperator(String operatorName, int priority, OpSymbol.Associativity associativity)
    {
        parser.setOperator(operatorName, priority, associativity);
    }

    /** {@inheritDoc} */
    public void compile(Sentence<S> sentence) throws SourceCodeException
    {
        compiler.compile(sentence);
    }

    /** {@inheritDoc} */
    public void addToDomain(T term) throws LinkageException
    {
        resolver.addToDomain(term);
    }

    /** {@inheritDoc} */
    public void setQuery(Q query) throws LinkageException
    {
        resolver.setQuery(query);
    }

    /** {@inheritDoc} */
    public Set<Variable> resolve()
    {
        return resolver.resolve();
    }

    /** {@inheritDoc} */
    public Iterator<Set<Variable>> iterator()
    {
        return resolver.iterator();
    }

    /** {@inheritDoc} */
    public void setCompilerObserver(LogicCompilerObserver<T, Q> observer)
    {
        chainedObserver.setCompilerObserver(observer);
    }

    /** {@inheritDoc} */
    public void endScope() throws SourceCodeException
    {
        compiler.endScope();
    }

    /**
     * ChainedCompilerObserver implements the compiler observer for this resolution engine. Compiled programs are added
     * to the resolvers domain. Compiled queries are executed.
     *
     *
If a chained observer is set up, all compiler outputs are forwarded onto it.
     */
    private class ChainedCompilerObserver implements LogicCompilerObserver<T, Q>
    {
        /** Holds the chained observer for compiler outputs. */
        private LogicCompilerObserver<T, Q> observer;

        /**
         * Sets the chained observer for compiler outputs.
         *
         * @param observer The chained observer.
         */
        public void setCompilerObserver(LogicCompilerObserver<T, Q> observer)
        {
            this.observer = observer;
        }

        /** {@inheritDoc} */
        public void onCompilation(Sentence<T> sentence) throws SourceCodeException
        {
            if (observer != null)
            {
                observer.onCompilation(sentence);
            }

            getResolver().addToDomain(sentence.getT());
        }

        /** {@inheritDoc} */
        public void onQueryCompilation(Sentence<Q> sentence) throws SourceCodeException
        {
            if (observer != null)
            {
                observer.onQueryCompilation(sentence);
            }

            getResolver().setQuery(sentence.getT());
        }
    }
}


text:
doc:
	doxygen doxyDocu

coverage:
	g++ --coverage ex1.cpp -o ex1
	./ex1 ../ex100.dat
	lcov --capture --directory ../ --output-file coverage.info
	genhtml coverage.info --output-directory out
	firefox out/index.html

check:
	cppcheck ex1.cpp

run:
	g++ ex1.cpp -o ex1
	./ex1 ../ex100.dat


text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.util.PsiModificationTracker;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * The main entry point for accessing the PSI services for a project.
 */
public abstract class PsiManager extends UserDataHolderBase {
  /**
   * Returns the PSI manager instance for the specified project.
   *
   * @param project the project for which the PSI manager is requested.
   * @return the PSI manager instance.
   */
  @NotNull
  public static PsiManager getInstance(@NotNull Project project) {
    return project.getService(PsiManager.class);
  }

  /**
   * Returns the project with which the PSI manager is associated.
   *
   * @return the project instance.
   */
  @NotNull
  public abstract Project getProject();

  /**
   * Returns the PSI file corresponding to the specified virtual file.
   *
   * @param file the file for which the PSI is requested.
   * @return the PSI file, or {@code null} if {@code file} is a directory, an invalid virtual file,
   * or the current project is a dummy or default project.
   */
  @Nullable
  public abstract PsiFile findFile(@NotNull VirtualFile file);

  @Nullable
  public abstract FileViewProvider findViewProvider(@NotNull VirtualFile file);

  /**
   * Returns the PSI directory corresponding to the specified virtual file system directory.
   *
   * @param file the directory for which the PSI is requested.
   * @return the PSI directory, or {@code null} if there is no PSI for the specified directory in this project.
   */
  @Nullable
  public abstract PsiDirectory findDirectory(@NotNull VirtualFile file);

  /**
   * Checks if the specified two PSI elements (possibly invalid) represent the same source element
   * or can are considered equivalent for resolve purposes.
   *

   * Can be used to match two versions of the PSI tree with each other after a reparse.
   *

   * For example, Java classes with the same fully-qualified name are equivalent, which is useful when working
   * with both library source and class roots. Source and compiled classes are definitely different ({@code equals()} returns {@code false}),
   * but for reference resolve or inheritance checks, they're equivalent.
   *
   * @param element1 the first element to check for equivalence
   * @param element2 the second element to check for equivalence
   * @return {@code true} if the elements are equivalent, {@code false} if the elements are different or
   * it was not possible to determine the equivalence
   */
  public abstract boolean areElementsEquivalent(@Nullable PsiElement element1, @Nullable PsiElement element2);

  /**
   * Reloads the contents of the specified PSI file and its associated document (if any) from the disk.
   *
   * @param file the PSI file to reload.
   */
  public abstract void reloadFromDisk(@NotNull PsiFile file);   //todo: move to FileDocumentManager

  /**
   * Adds a listener for receiving notifications about all changes in the PSI tree of the project.
   *
   * @param listener the listener instance.
   */
  public abstract void addPsiTreeChangeListener(@NotNull PsiTreeChangeListener listener);

  /**
   * Adds a listener for receiving notifications about all changes in the PSI tree of the project.
   *
   * @param listener         the listener instance.
   * @param parentDisposable object, after whose disposing the listener should be removed
   */
  public abstract void addPsiTreeChangeListener(@NotNull PsiTreeChangeListener listener, @NotNull Disposable parentDisposable);

  /**
   * Removes a listener for receiving notifications about all changes in the PSI tree of the project.
   *
   * @param listener the listener instance.
   */
  public abstract void removePsiTreeChangeListener(@NotNull PsiTreeChangeListener listener);

  /**
   * Returns the modification tracker for the project, which can be used to get the PSI
   * modification count value.
   *
   * @return the modification tracker instance.
   */
  @NotNull
  public abstract PsiModificationTracker getModificationTracker();

  /**
   * Notifies the PSI manager that a batch operation sequentially processing multiple files
   * is starting. Memory occupied by cached PSI trees is released more eagerly during such a
   * batch operation.
   */
  public abstract void startBatchFilesProcessingMode();

  /**
   * Notifies the PSI manager that a batch operation sequentially processing multiple files
   * is finishing. Memory occupied by cached PSI trees is released more eagerly during such a
   * batch operation.
   */
  public abstract void finishBatchFilesProcessingMode();

  /**
   * Checks if the PSI manager has been disposed and the PSI for this project can no
   * longer be used.
   *
   * @return {@code true} if the PSI manager is disposed, {@code false} otherwise.
   */
  public abstract boolean isDisposed();

  /**
   * Clears the resolve caches of the PSI manager. Can be used to reduce memory consumption
   * in batch operations sequentially processing multiple files. Can be invoked from any thread.
   */
  public abstract void dropResolveCaches();

  /**
   * Clears all {@link com.intellij.psi.util.CachedValue} depending on {@link PsiModificationTracker#MODIFICATION_COUNT} and resolve caches.
   * Can be used to reduce memory consumption in batch operations sequentially processing multiple files. Should be invoked on Swing thread.
   */
  public abstract void dropPsiCaches();

  /**
   * Checks if the specified PSI element belongs to the sources of the project.
   *
   * @param element the element to check.
   * @return {@code true} if the element belongs to the sources of the project, {@code false} otherwise.
   */
  public abstract boolean isInProject(@NotNull PsiElement element);
}


text:
const assert = require('assert');
const TypeCheck = require('js-typecheck');
const Action = require('./Action');
const Input = require('./Input');
const Handler = require('./Handler');

/**
 * Generic registration, can be used for {@link Input}, {@link Action} and {@link Handler}
 *
 * @param {...args} args - arguments passed to the registration
 * @return {function}
 */
function register(...args){
  return (target) => {
    target.register(target, ...args);
  };
}

/**
 * Allows the action to be executed through the handler
 *
 * @param {string} handlerName - name of the handler
 * @param {...args} args - arguments passed to the registration
 * @return {function}
 */
function grant(handlerName, ...args){
  return (target) => {
    assert(TypeCheck.isSubClassOf(target, Action), 'grant decorator requires an action');
    const registeredActionName = Action.registeredActionName(target);
    Handler.grantAction(handlerName, registeredActionName, ...args);
  };
}

/**
 * Registers a property to an input
 *
 * @param {string} propertyName - property name to be registered
 * @returns {function}
 */
function property(propertyName, ...args){
  return (target) => {
    assert(TypeCheck.isSubClassOf(target, Input), 'property decorator requires an input');

    Input.registerProperty(target, propertyName, ...args);
  };
}

module.exports.register = register;
module.exports.grant = grant;
module.exports.property = property;