text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Reflection;

namespace Heine.Mvc.ActionFilters.Services
{
    public class ObfuscaterService : IObfuscaterService
    {
        private readonly int expandDepth;
        private const string HeaderKeyXObfuscate = "X-Obfuscate";

        public ObfuscaterService(int expandDepth, params Assembly[] assemblies)
        {
            this.expandDepth = expandDepth;
            TypeObfuscationGraphs = Initialize(assemblies);
        }

        private IDictionary<Type, IList<string>> Initialize(params Assembly[] assemblies)
        {
            string BuildPropertyName(PropertyInfo propertyInfo)
            {
                var propertyType = propertyInfo.PropertyType;

                if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(ICollection<>))
                    return $"{propertyInfo.Name}[*]";

                return typeof(ICollection).IsAssignableFrom(propertyType)
                    ? $"{propertyInfo.Name}[*]" // Collection
                    : propertyInfo.Name; // Object or scalar value
            }

            Type GetCorrectType(Type type)
            {
                if (type.IsArray)
                    return type.GetElementType();

                if (type.IsGenericType && type.GetInterfaces().Contains(typeof(IEnumerable)))
                    return type.GetGenericArguments().Last();

                return type;
            }

            void AddObfuscateProperties(Type type, ref List<string> properties, List<PropertyInfo> prevPropList,
                int depth)
            {
                if (depth == 0)
                    return;

                // Check if type is already present in list of previous properties.
                // If so it should not be traversed.
                if (prevPropList != null)
                {
                    var typeName = type.FullName;
                    // Support a class referencing itself,
                    // but check for reference loop in other cases.
                    if (!(prevPropList.Count == 1 && typeName == prevPropList.First().DeclaringType?.FullName))
                    {
                        foreach (var prop in prevPropList)
                        {
                            if (prop.DeclaringType?.FullName == typeName)
                            {
                                return;
                            }
                        }
                    }
                }

                foreach (var propertyInfo in type.GetProperties())
                {
                    // Empty all previous properties because method is at root.
                    if (depth == expandDepth)
                    {
                        prevPropList = new List<PropertyInfo>();
                    }

                    // When circling back after a recursive call there will be element/s in list
                    // which should not be present at current depth.
                    // Therefore need to remove all the last elements in list which whould not be at current depth.
                    if (prevPropList.Count > expandDepth - depth)
                    {
                        var numberOfRecordsToDelete = prevPropList.Count - (expandDepth - depth);
                        for (var i = 0; i < numberOfRecordsToDelete; i++)
                        {
                            prevPropList.RemoveAt(prevPropList.Count - 1);
                        }
                    }

                    if (Attribute.IsDefined(propertyInfo, typeof(ObfuscationAttribute)))
                    {
                        if (!prevPropList.Any())
                        {
                            properties.Add(BuildPropertyName(propertyInfo));
                        }
                        else
                        {
                            var jPath = string.Empty;

                            foreach (var prop in prevPropList)
                            {
                                jPath += $"{BuildPropertyName(prop)}.";
                            }

                            properties.Add($"{jPath}{BuildPropertyName(propertyInfo)}");
                        }
                    }
                    else if (propertyInfo.PropertyType.IsClass || propertyInfo.PropertyType.IsInterface)
                    {
                        if (depth - 1 <= 0) continue;
                        var propertyType = GetCorrectType(propertyInfo.PropertyType);

                        prevPropList.Add(propertyInfo);
                        AddObfuscateProperties(propertyType, ref properties, prevPropList, depth - 1);
                    }
                }
            }

            var typeObfuscationGraphs = new Dictionary<Type, IList<string>>();
            foreach (var assembly in assemblies)
            {
                foreach (var type in assembly.GetTypes())
                {
                    var properties = new List<string>();
                    // Obfuscation attribute on class level.
                    if (Attribute.IsDefined(type, typeof(ObfuscationAttribute)))
                    {
                        foreach (var propertyInfo in type.GetProperties())
                        {
                            properties.Add(BuildPropertyName(propertyInfo));
                        }
                    }
                    // Obfuscation attribute on property level.
                    else
                    {
                        AddObfuscateProperties(type, ref properties, null, expandDepth);
                    }

                    if (properties.Any())
                        typeObfuscationGraphs.Add(type, properties);
                }
            }

            return typeObfuscationGraphs;
        }

        public IDictionary<Type, IList<string>> TypeObfuscationGraphs { get; set; }

        public void SetObfuscateHeader(HttpHeaders httpHeaders, params Type[] types)
        {
            if (httpHeaders == null) return;
            foreach (var type in types)
            {
                if (!TypeObfuscationGraphs.ContainsKey(type)) return;
                if (httpHeaders.TryGetValues(HeaderKeyXObfuscate, out var values))
                {
                    if (!httpHeaders.Remove(HeaderKeyXObfuscate)) return;

                    httpHeaders.TryAddWithoutValidation(HeaderKeyXObfuscate,
                        values.Concat(TypeObfuscationGraphs[type]).Distinct());
                }
                else
                {
                    httpHeaders.TryAddWithoutValidation(HeaderKeyXObfuscate, TypeObfuscationGraphs[type].Distinct());
                }
            }
        }
    }
}


text:
using PvcCore;
using System;
using System.IO;
using Edokan.KaiZen.Colors;
using System.Text.RegularExpressions;
using System.Linq;
using Pvc.CLI.Commands;

namespace Pvc.CLI
{
    class Program
    {
        static void Main(string[] args)
        {
            var parseResults = new FlagsParser().Parse(args);
            PvcConsole.Configure(!parseResults.Item2.ContainsKey("ansi"));

            var task = new ArgumentHandler().Parse(parseResults);
            task();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.intel.analytics.bigdl.nn.ops

import com.intel.analytics.bigdl.tensor.{DoubleType, FloatType, IntType, Tensor}
import com.intel.analytics.bigdl.tensor.TensorNumericMath.TensorNumeric

import scala.reflect.ClassTag

class Round[T: ClassTag, D: ClassTag]()(implicit ev: TensorNumeric[T], ev2: TensorNumeric[D])
  extends Operation[Tensor[D], Tensor[D], T]{

  output = Tensor[D]()

  override def updateOutput(input: Tensor[D]): Tensor[D] = {
    output.resizeAs(input)

    output.zipWith[D, D](input, output, (a, b) => {
      ev2.round(a)
    })
    output
  }
}

object Round {
  def apply[T: ClassTag, D: ClassTag]()(implicit ev: TensorNumeric[T], ev2: TensorNumeric[D]):
  Round[T, D] = new Round[T, D]()
}


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

global $CFG;
require_once($CFG->libdir . '/filterlib.php');

/**
 * Test functions that affect filter_active table with contextid = $syscontextid.
 */
class filter_active_global_testcase extends advanced_testcase {

    protected function setUp() {
        global $DB;
        parent::setUp();
        $DB->delete_records('filter_active', array());
        $this->resetAfterTest(false);
    }

    private function assert_only_one_filter_globally($filter, $state) {
        global $DB;
        $recs = $DB->get_records('filter_active');
        $this->assertCount(1, $recs);
        $rec = reset($recs);
        unset($rec->id);
        $expectedrec = new stdClass();
        $expectedrec->filter = $filter;
        $expectedrec->contextid = context_system::instance()->id;
        $expectedrec->active = $state;
        $expectedrec->sortorder = 1;
        $this->assertEquals($expectedrec, $rec);
    }

    private function assert_global_sort_order($filters) {
        global $DB;

        $sortedfilters = $DB->get_records_menu('filter_active',
            array('contextid' => context_system::instance()->id), 'sortorder', 'sortorder,filter');
        $testarray = array();
        $index = 1;
        foreach($filters as $filter) {
            $testarray[$index++] = $filter;
        }
        $this->assertEquals($testarray, $sortedfilters);
    }

    public function test_set_filter_globally_on() {
        // Setup fixture.
        // Exercise SUT.
        filter_set_global_state('name', TEXTFILTER_ON);
        // Validate.
        $this->assert_only_one_filter_globally('name', TEXTFILTER_ON);
    }

    public function test_set_filter_globally_off() {
        // Setup fixture.
        // Exercise SUT.
        filter_set_global_state('name', TEXTFILTER_OFF);
        // Validate.
        $this->assert_only_one_filter_globally('name', TEXTFILTER_OFF);
    }

    public function test_set_filter_globally_disabled() {
        // Setup fixture.
        // Exercise SUT.
        filter_set_global_state('name', TEXTFILTER_DISABLED);
        // Validate.
        $this->assert_only_one_filter_globally('name', TEXTFILTER_DISABLED);
    }

    /**
     * @expectedException coding_exception
     * @return void
     */
    public function test_global_config_exception_on_invalid_state() {
        filter_set_global_state('name', 0);
    }

    public function test_auto_sort_order() {
        // Setup fixture.
        // Exercise SUT.
        filter_set_global_state('one', TEXTFILTER_DISABLED);
        filter_set_global_state('two', TEXTFILTER_DISABLED);
        // Validate.
        $this->assert_global_sort_order(array('one', 'two'));
    }

    public function test_auto_sort_order_enabled() {
        // Setup fixture.
        // Exercise SUT.
        filter_set_global_state('one', TEXTFILTER_ON);
        filter_set_global_state('two', TEXTFILTER_OFF);
        // Validate.
        $this->assert_global_sort_order(array('one', 'two'));
    }

    public function test_update_existing_dont_duplicate() {
        // Setup fixture.
        // Exercise SUT.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_global_state('name', TEXTFILTER_OFF);
        // Validate.
        $this->assert_only_one_filter_globally('name', TEXTFILTER_OFF);
    }

    public function test_update_reorder_down() {
        // Setup fixture.
        filter_set_global_state('one', TEXTFILTER_ON);
        filter_set_global_state('two', TEXTFILTER_ON);
        filter_set_global_state('three', TEXTFILTER_ON);
        // Exercise SUT.
        filter_set_global_state('two', TEXTFILTER_ON, -1);
        // Validate.
        $this->assert_global_sort_order(array('two', 'one', 'three'));
    }

    public function test_update_reorder_up() {
        // Setup fixture.
        filter_set_global_state('one', TEXTFILTER_ON);
        filter_set_global_state('two', TEXTFILTER_ON);
        filter_set_global_state('three', TEXTFILTER_ON);
        filter_set_global_state('four', TEXTFILTER_ON);
        // Exercise SUT.
        filter_set_global_state('two', TEXTFILTER_ON, 1);
        // Validate.
        $this->assert_global_sort_order(array('one', 'three', 'two', 'four'));
    }

    public function test_auto_sort_order_change_to_enabled() {
        // Setup fixture.
        filter_set_global_state('one', TEXTFILTER_ON);
        filter_set_global_state('two', TEXTFILTER_DISABLED);
        filter_set_global_state('three', TEXTFILTER_DISABLED);
        // Exercise SUT.
        filter_set_global_state('three', TEXTFILTER_ON);
        // Validate.
        $this->assert_global_sort_order(array('one', 'three', 'two'));
    }

    public function test_auto_sort_order_change_to_disabled() {
        // Setup fixture.
        filter_set_global_state('one', TEXTFILTER_ON);
        filter_set_global_state('two', TEXTFILTER_ON);
        filter_set_global_state('three', TEXTFILTER_DISABLED);
        // Exercise SUT.
        filter_set_global_state('one', TEXTFILTER_DISABLED);
        // Validate.
        $this->assert_global_sort_order(array('two', 'one', 'three'));
    }

    public function test_filter_get_global_states() {
        // Setup fixture.
        filter_set_global_state('one', TEXTFILTER_ON);
        filter_set_global_state('two', TEXTFILTER_OFF);
        filter_set_global_state('three', TEXTFILTER_DISABLED);
        // Exercise SUT.
        $filters = filter_get_global_states();
        // Validate.
        $this->assertEquals(array(
            'one' => (object) array('filter' => 'one', 'active' => TEXTFILTER_ON, 'sortorder' => 1),
            'two' => (object) array('filter' => 'two', 'active' => TEXTFILTER_OFF, 'sortorder' => 2),
            'three' => (object) array('filter' => 'three', 'active' => TEXTFILTER_DISABLED, 'sortorder' => 3)
        ), $filters);
    }
}

/**
 * Test functions that affect filter_active table with contextid = $syscontextid.
 */
class filter_active_local_testcase extends advanced_testcase {

    protected function setUp() {
        global $DB;
        parent::setUp();
        $DB->delete_records('filter_active', array());
        $this->resetAfterTest(false);
    }

    private function assert_only_one_local_setting($filter, $contextid, $state) {
        global $DB;
        $recs = $DB->get_records('filter_active');
        $this->assertEquals(1, count($recs), 'More than one record returned %s.');
        $rec = reset($recs);
        unset($rec->id);
        unset($rec->sortorder);
        $expectedrec = new stdClass();
        $expectedrec->filter = $filter;
        $expectedrec->contextid = $contextid;
        $expectedrec->active = $state;
        $this->assertEquals($expectedrec, $rec);
    }

    private function assert_no_local_setting() {
        global $DB;
        $this->assertEquals(0, $DB->count_records('filter_active'));
    }

    public function test_local_on() {
        // Exercise SUT.
        filter_set_local_state('name', 123, TEXTFILTER_ON);
        // Validate.
        $this->assert_only_one_local_setting('name', 123, TEXTFILTER_ON);
    }

    public function test_local_off() {
        // Exercise SUT.
        filter_set_local_state('name', 123, TEXTFILTER_OFF);
        // Validate.
        $this->assert_only_one_local_setting('name', 123, TEXTFILTER_OFF);
    }

    public function test_local_inherit() {
        // Exercise SUT.
        filter_set_local_state('name', 123, TEXTFILTER_INHERIT);
        // Validate.
        $this->assert_no_local_setting();
    }

    /**
     * @expectedException coding_exception
     * @return void
     */
    public function test_local_invalid_state_throws_exception() {
        // Exercise SUT.
        filter_set_local_state('name', 123, -9999);
    }

    /**
     * @expectedException coding_exception
     * @return void
     */
    public function test_throws_exception_when_setting_global() {
        // Exercise SUT.
        filter_set_local_state('name', context_system::instance()->id, TEXTFILTER_INHERIT);
    }

    public function test_local_inherit_deletes_existing() {
        // Setup fixture.
        filter_set_local_state('name', 123, TEXTFILTER_INHERIT);
        // Exercise SUT.
        filter_set_local_state('name', 123, TEXTFILTER_INHERIT);
        // Validate.
        $this->assert_no_local_setting();
    }
}

/**
 * Test functions that use just the filter_config table.
 */
class filter_config_testcase extends advanced_testcase {

    protected function setUp() {
        global $DB;
        parent::setUp();
        $DB->delete_records('filter_config', array());
        $this->resetAfterTest(false);
    }

    private function assert_only_one_config($filter, $context, $name, $value) {
        global $DB;
        $recs = $DB->get_records('filter_config');
        $this->assertEquals(1, count($recs), 'More than one record returned %s.');
        $rec = reset($recs);
        unset($rec->id);
        $expectedrec = new stdClass();
        $expectedrec->filter = $filter;
        $expectedrec->contextid = $context;
        $expectedrec->name = $name;
        $expectedrec->value = $value;
        $this->assertEquals($expectedrec, $rec);
    }

    public function test_set_new_config() {
        // Exercise SUT.
        filter_set_local_config('name', 123, 'settingname', 'An arbitrary value');
        // Validate.
        $this->assert_only_one_config('name', 123, 'settingname', 'An arbitrary value');
    }

    public function test_update_existing_config() {
        // Setup fixture.
        filter_set_local_config('name', 123, 'settingname', 'An arbitrary value');
        // Exercise SUT.
        filter_set_local_config('name', 123, 'settingname', 'A changed value');
        // Validate.
        $this->assert_only_one_config('name', 123, 'settingname', 'A changed value');
    }

    public function test_filter_get_local_config() {
        // Setup fixture.
        filter_set_local_config('name', 123, 'setting1', 'An arbitrary value');
        filter_set_local_config('name', 123, 'setting2', 'Another arbitrary value');
        filter_set_local_config('name', 122, 'settingname', 'Value from another context');
        filter_set_local_config('other', 123, 'settingname', 'Someone else\'s value');
        // Exercise SUT.
        $config = filter_get_local_config('name', 123);
        // Validate.
        $this->assertEquals(array('setting1' => 'An arbitrary value', 'setting2' => 'Another arbitrary value'), $config);
    }
}

class filter_get_active_available_in_context_testcase extends advanced_testcase {
    private static $syscontext;
    private static $childcontext;
    private static $childcontext2;

    public static function setUpBeforeClass() {
        parent::setUpBeforeClass();

        $course = self::getDataGenerator()->create_course(array('category'=>1));

        self::$childcontext = context_coursecat::instance(1);
        self::$childcontext2 = context_course::instance($course->id);
        self::$syscontext = context_system::instance();
    }

    protected function setUp() {
        global $DB;
        parent::setUp();

        $DB->delete_records('filter_active', array());
        $DB->delete_records('filter_config', array());
        $this->resetAfterTest(false);
    }

    private function assert_filter_list($expectedfilters, $filters) {
        $this->assertEquals($expectedfilters, array_keys($filters), '', 0, 10, true);
    }

    public function test_globally_on_is_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$syscontext);
        // Validate.
        $this->assert_filter_list(array('name'), $filters);
        // Check no config returned correctly.
        $this->assertEquals(array(), $filters['name']);
    }

    public function test_globally_off_not_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_OFF);
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext2);
        // Validate.
        $this->assert_filter_list(array(), $filters);
    }

    public function test_globally_off_overridden() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_OFF);
        filter_set_local_state('name', self::$childcontext->id, TEXTFILTER_ON);
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext2);
        // Validate.
        $this->assert_filter_list(array('name'), $filters);
    }

    public function test_globally_on_overridden() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_state('name', self::$childcontext->id, TEXTFILTER_OFF);
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext2);
        // Validate.
        $this->assert_filter_list(array(), $filters);
    }

    public function test_globally_disabled_not_overridden() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_DISABLED);
        filter_set_local_state('name', self::$childcontext->id, TEXTFILTER_ON);
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$syscontext);
        // Validate.
        $this->assert_filter_list(array(), $filters);
    }

    public function test_single_config_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_config('name', self::$childcontext->id, 'settingname', 'A value');
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext);
        // Validate.
        $this->assertEquals(array('settingname' => 'A value'), $filters['name']);
    }

    public function test_multi_config_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_config('name', self::$childcontext->id, 'settingname', 'A value');
        filter_set_local_config('name', self::$childcontext->id, 'anothersettingname', 'Another value');
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext);
        // Validate.
        $this->assertEquals(array('settingname' => 'A value', 'anothersettingname' => 'Another value'), $filters['name']);
    }

    public function test_config_from_other_context_not_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_config('name', self::$childcontext->id, 'settingname', 'A value');
        filter_set_local_config('name', self::$childcontext2->id, 'anothersettingname', 'Another value');
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext2);
        // Validate.
        $this->assertEquals(array('anothersettingname' => 'Another value'), $filters['name']);
    }

    public function test_config_from_other_filter_not_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_config('name', self::$childcontext->id, 'settingname', 'A value');
        filter_set_local_config('other', self::$childcontext->id, 'anothersettingname', 'Another value');
        // Exercise SUT.
        $filters = filter_get_active_in_context(self::$childcontext);
        // Validate.
        $this->assertEquals(array('settingname' => 'A value'), $filters['name']);
    }

    protected function assert_one_available_filter($filter, $localstate, $inheritedstate, $filters) {
        $this->assertEquals(1, count($filters), 'More than one record returned %s.');
        $rec = $filters[$filter];
        unset($rec->id);
        $expectedrec = new stdClass();
        $expectedrec->filter = $filter;
        $expectedrec->localstate = $localstate;
        $expectedrec->inheritedstate = $inheritedstate;
        $this->assertEquals($expectedrec, $rec);
    }

    public function test_available_in_context_localoverride() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_state('name', self::$childcontext->id, TEXTFILTER_OFF);
        // Exercise SUT.
        $filters = filter_get_available_in_context(self::$childcontext);
        // Validate.
        $this->assert_one_available_filter('name', TEXTFILTER_OFF, TEXTFILTER_ON, $filters);
    }

    public function test_available_in_context_nolocaloverride() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_state('name', self::$childcontext->id, TEXTFILTER_OFF);
        // Exercise SUT.
        $filters = filter_get_available_in_context(self::$childcontext2);
        // Validate.
        $this->assert_one_available_filter('name', TEXTFILTER_INHERIT, TEXTFILTER_OFF, $filters);
    }

    public function test_available_in_context_disabled_not_returned() {
        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_DISABLED);
        filter_set_local_state('name', self::$childcontext->id, TEXTFILTER_ON);
        // Exercise SUT.
        $filters = filter_get_available_in_context(self::$childcontext);
        // Validate.
        $this->assertEquals(array(), $filters);
    }

    /**
     * @expectedException coding_exception
     * @return void
     */
    public function test_available_in_context_exception_with_syscontext() {
        // Exercise SUT.
        filter_get_available_in_context(self::$syscontext);
    }
}

class filter_preload_activities_testcase extends advanced_testcase {
    private static $syscontext;
    private static $catcontext;
    private static $coursecontext;
    private static $course;
    private static $activity1context;
    private static $activity2context;

    public static function setUpBeforeClass() {
        parent::setUpBeforeClass();

        self::$syscontext = context_system::instance();
        self::$catcontext = context_coursecat::instance(1);
        self::$course = self::getDataGenerator()->create_course(array('category'=>1));
        self::$coursecontext = context_course::instance(self::$course->id);
        $page1 =  self::getDataGenerator()->create_module('page', array('course'=>self::$course->id));
        self::$activity1context = context_module::instance($page1->cmid);
        $page2 =  self::getDataGenerator()->create_module('page', array('course'=>self::$course->id));
        self::$activity2context = context_module::instance($page2->cmid);
    }

    protected function setUp() {
        global $DB;
        parent::setUp();

        $DB->delete_records('filter_active', array());
        $DB->delete_records('filter_config', array());
        $this->resetAfterTest(false);
    }

    private function assert_matches($modinfo) {
        global $FILTERLIB_PRIVATE, $DB;

        // Use preload cache...
        $FILTERLIB_PRIVATE = new stdClass();
        filter_preload_activities($modinfo);

        // Get data and check no queries are made
        $before = $DB->perf_get_reads();
        $plfilters1 = filter_get_active_in_context(self::$activity1context);
        $plfilters2 = filter_get_active_in_context(self::$activity2context);
        $after = $DB->perf_get_reads();
        $this->assertEquals($before, $after);

        // Repeat without cache and check it makes queries now
        $FILTERLIB_PRIVATE = new stdClass;
        $before = $DB->perf_get_reads();
        $filters1 = filter_get_active_in_context(self::$activity1context);
        $filters2 = filter_get_active_in_context(self::$activity2context);
        $after = $DB->perf_get_reads();
        $this->assertTrue($after > $before);

        // Check they match
        $this->assertEquals($plfilters1, $filters1);
        $this->assertEquals($plfilters2, $filters2);
    }

    public function test_preload() {
        // Get course and modinfo
        $modinfo = new course_modinfo(self::$course, 2);

        // Note: All the tests in this function check that the result from the
        // preloaded cache is the same as the result from calling the standard
        // function without preloading.

        // Initially, check with no filters enabled
        $this->assert_matches($modinfo);

        // Enable filter globally, check
        filter_set_global_state('name', TEXTFILTER_ON);
        $this->assert_matches($modinfo);

        // Disable for activity 2
        filter_set_local_state('name', self::$activity2context->id, TEXTFILTER_OFF);
        $this->assert_matches($modinfo);

        // Disable at category
        filter_set_local_state('name', self::$catcontext->id, TEXTFILTER_OFF);
        $this->assert_matches($modinfo);

        // Enable for activity 1
        filter_set_local_state('name', self::$activity1context->id, TEXTFILTER_ON);
        $this->assert_matches($modinfo);

        // Disable globally
        filter_set_global_state('name', TEXTFILTER_DISABLED);
        $this->assert_matches($modinfo);

        // Add another 2 filters
        filter_set_global_state('frog', TEXTFILTER_ON);
        filter_set_global_state('zombie', TEXTFILTER_ON);
        $this->assert_matches($modinfo);

        // Disable random one of these in each context
        filter_set_local_state('zombie', self::$activity1context->id, TEXTFILTER_OFF);
        filter_set_local_state('frog', self::$activity2context->id, TEXTFILTER_OFF);
        $this->assert_matches($modinfo);

        // Now do some filter options
        filter_set_local_config('name', self::$activity1context->id, 'a', 'x');
        filter_set_local_config('zombie', self::$activity1context->id, 'a', 'y');
        filter_set_local_config('frog', self::$activity1context->id, 'a', 'z');
        // These last two don't do anything as they are not at final level but I
        // thought it would be good to have that verified in test
        filter_set_local_config('frog', self::$coursecontext->id, 'q', 'x');
        filter_set_local_config('frog', self::$catcontext->id, 'q', 'z');
        $this->assert_matches($modinfo);
    }
}

class filter_delete_config_testcase extends advanced_testcase {
    protected function setUp() {
        global $DB;
        parent::setUp();

        $DB->delete_records('filter_active', array());
        $DB->delete_records('filter_config', array());
        $this->resetAfterTest(false);
    }

    public function test_filter_delete_all_for_filter() {
        global $DB;

        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_global_state('other', TEXTFILTER_ON);
        filter_set_local_config('name', context_system::instance()->id, 'settingname', 'A value');
        filter_set_local_config('other', context_system::instance()->id, 'settingname', 'Other value');
        set_config('configname', 'A config value', 'filter_name');
        set_config('configname', 'Other config value', 'filter_other');
        // Exercise SUT.
        filter_delete_all_for_filter('name');
        // Validate.
        $this->assertEquals(1, $DB->count_records('filter_active'));
        $this->assertTrue($DB->record_exists('filter_active', array('filter' => 'other')));
        $this->assertEquals(1, $DB->count_records('filter_config'));
        $this->assertTrue($DB->record_exists('filter_config', array('filter' => 'other')));
        $expectedconfig = new stdClass;
        $expectedconfig->configname = 'Other config value';
        $this->assertEquals($expectedconfig, get_config('filter_other'));
        $this->assertEquals(get_config('filter_name'), new stdClass());
    }

    public function test_filter_delete_all_for_context() {
        global $DB;

        // Setup fixture.
        filter_set_global_state('name', TEXTFILTER_ON);
        filter_set_local_state('name', 123, TEXTFILTER_OFF);
        filter_set_local_config('name', 123, 'settingname', 'A value');
        filter_set_local_config('other', 123, 'settingname', 'Other value');
        filter_set_local_config('other', 122, 'settingname', 'Other value');
        // Exercise SUT.
        filter_delete_all_for_context(123);
        // Validate.
        $this->assertEquals(1, $DB->count_records('filter_active'));
        $this->assertTrue($DB->record_exists('filter_active', array('contextid' => context_system::instance()->id)));
        $this->assertEquals(1, $DB->count_records('filter_config'));
        $this->assertTrue($DB->record_exists('filter_config', array('filter' => 'other')));
    }
}

class filter_filter_set_applies_to_strings extends advanced_testcase {
    protected $origcfgstringfilters;
    protected $origcfgfilterall;

    protected function setUp() {
        global $DB, $CFG;
        parent::setUp();

        $DB->delete_records('filter_active', array());
        $DB->delete_records('filter_config', array());
        $this->resetAfterTest(false);

        // Store original $CFG;
        $this->origcfgstringfilters = $CFG->stringfilters;
        $this->origcfgfilterall = $CFG->filterall;
    }

    protected function tearDown() {
        global $CFG;
        $CFG->stringfilters = $this->origcfgstringfilters;
        $CFG->filterall = $this->origcfgfilterall;

        parent::tearDown();
    }

    public function test_set() {
        global $CFG;
        // Setup fixture.
        $CFG->filterall = 0;
        $CFG->stringfilters = '';
        // Exercise SUT.
        filter_set_applies_to_strings('name', true);
        // Validate.
        $this->assertEquals('name', $CFG->stringfilters);
        $this->assertEquals(1, $CFG->filterall);
    }

    public function test_unset_to_empty() {
        global $CFG;
        // Setup fixture.
        $CFG->filterall = 1;
        $CFG->stringfilters = 'name';
        // Exercise SUT.
        filter_set_applies_to_strings('name', false);
        // Validate.
        $this->assertEquals('', $CFG->stringfilters);
        $this->assertEquals('', $CFG->filterall);
    }

    public function test_unset_multi() {
        global $CFG;
        // Setup fixture.
        $CFG->filterall = 1;
        $CFG->stringfilters = 'name,other';
        // Exercise SUT.
        filter_set_applies_to_strings('name', false);
        // Validate.
        $this->assertEquals('other', $CFG->stringfilters);
        $this->assertEquals(1, $CFG->filterall);
    }
}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ParticipantListActivity$DummySectionFragment" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignLeft="@android:id/list"
        android:layout_alignParentTop="true"
        android:orientation="vertical" >

        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1" >
        </ListView>

        <Button
            android:id="@+id/new_participant_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />

    </LinearLayout>

</RelativeLayout>


text:
package ravtrix.backpackerbuddy.activities.discussion.editdiscussion;

import ravtrix.backpackerbuddy.retrofit.retrofitinterfaces.OnFinishedListenerRetrofit;

/**
 * Created by Ravinder on 1/20/17.
 */

interface IEditDiscussionInteractor {

    /**
     * Edit discussion post
     * @param discussionID                  - the discussionID unique to discussion
     * @param newDiscussion                 - the new discussion post
     * @param onFinishedListenerRetrofit    - the callback after retrofit completed
     */
    void editDiscussionInteractor(int discussionID, String newDiscussion, String countryTag, OnFinishedListenerRetrofit onFinishedListenerRetrofit);
}


text:
<resources>
    <string name="app_name">MultiPaneStream</string>
</resources>


text:
'use srict';

var isAgentMobile = {
  Android: function() {
    return navigator.userAgent.match(/Android/i);
  },
  BlackBerry: function() {
    return navigator.userAgent.match(/BlackBerry/i);
  },
  iOS: function() {
    return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  },
  Opera: function() {
    return navigator.userAgent.match(/Opera Mini/i);
  },
  Windows: function() {
    return navigator.userAgent.match(/IEMobile/i);
  },
  any: function() {
    return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
  }
};

function yePlatform($window) {
  return {
    isTouchScreen: (!!('ontouchstart' in $window) || !!('onmsgesturechange' in $window))
  }
}

var platform = require('angular')
  .module('platformEnviroment', [])
  .factory('yePlatform', yePlatform);

module.exports = platform;


text:
#ifndef tomvizMatchInfo_h
#define tomvizMatchInfo_h

#include <QList>

namespace tomviz {

struct CapGroup
{
  CapGroup(const QString& name_, const QString& text)
    : name(name_), capturedText(text)
  {
  }
  QString name;
  QString capturedText;
};

struct MatchInfo
{
  bool matched;
  QList<CapGroup> groups;
};
}

#endif


text:
%   Created by Axel Hackbarth, UC Berkeley VDL / TU-Harburg MuM

classdef Sensor < SimulationObject & Plottable
    %SENSOR Most general form of a sensor
    %   Detailed explanation goes here

    properties
        Agent
        CameraPicture
        CameraTime
        GridSize  = [20;20]      % [discretization steps]
        DiscretizationError = .5 % std deviation on ground [m]
        LensError = .3/10        % std dev on ground [m] / distance [m]
        FieldOfView = 10*[-1,1;-1,1] % on ground [m]
        VarianceMap
        DetectedTargets
        PlotStyle = '-b'
    end

    properties (Dependent = true)
    end

    events
        DetectedTarget
        NewMeasurement
    end

    methods (Access = public)
        function this = Sensor(varargin)
            this = this@SimulationObject(varargin{:});

            this.VarianceMap = this.createVarianceMap;

            if ~isempty(this.Environment)
                notify(this.Environment,'addedSensor',EventWithHandle(this));
                addlistener(this.Environment,'useSensors',...
                    @(src,evdata)this.useSensor);
                addlistener(this.Environment,'updatePlots',...
                    @(src,evdata)this.updatePlot);
                for regobs = [this.Environment.RegionEstimators{:}]
                    addlistener(this,'NewMeasurement',...
                        @(src,evdata)regobs.placeSensorFootprint(src,evdata));
                end
            end
        end
    end

    methods (Access = private)
        function useSensor(this)
            notify(this,'NewMeasurement');
            this.checkForTargets;
        end

        function checkForTargets(this)
            this.DetectedTargets = [];
            for k = 1:length(this.Environment.Targets)
                target = this.Environment.Targets{k};
                if this.inFieldOfView(target.Position)
                    this.DetectedTargets{end+1} = target;
                    tpos = target.Position;
                    variance = [1;1] * this.getSensorVariance(tpos);
                    tpos = tpos + randn(2,1) .* sqrt(variance);
                    notify(this,'DetectedTarget',...
                        DetectedTargetData(target,tpos,variance));
                end
            end
        end

        function varmap = createVarianceMap(this)
            FoV = this.FieldOfView;
            sx = linspace(FoV(1,1),FoV(1,2),this.GridSize(1));
            sy = linspace(FoV(2,1),FoV(2,2),this.GridSize(2));
            [SX,SY] = meshgrid(sx,sy);

            varmap = this.DiscretizationError.^2 + this.LensError^2 * (SX.^2 + SY.^2);
%             1./(this.GaussianAmp * ...
%                 fspecial('gaussian',this.GaussianSize,this.GaussianSigma));
        end

        function var = getSensorVariance(this,position)
            FoV = this.FieldOfView + this.Agent.Position * [1 1];
            varmap = this.VarianceMap;
            sx = linspace(FoV(1,1),FoV(1,2),size(varmap,1));
            sy = linspace(FoV(2,1),FoV(2,2),size(varmap,2));
            [SX,SY] = meshgrid(sx,sy);
            var = interp2(SX,SY,varmap,position(1),position(2));
        end

        function inside = inFieldOfView(this, position)
            %inFieldOfView reports if a point / position is in the field of
            %view
            % position is a cartesian coordinate position
            % inside is a boolean returning if position is inside FOV or
            % not
            FoV = this.FieldOfView + this.Agent.Position * [1 1];
            distanceFromBounds = FoV - position * [1 1];
            inside = all(all([-1 1;-1 1] .* distanceFromBounds > 0));
        end

    end

    methods % plot methods
        function registerPlot(this)
            f = this.FieldOfView;
            x = this.Agent.Position * ones(1,5) + ...
                [f(:,1) [f(1,1);f(2,2)] f(:,2) [f(1,2);f(2,1)] f(:,1)];
            hold on
            this.PlotHandle{end+1} = ...
                plot(x(1,:),x(2,:),this.PlotStyle);
            hold off
        end

        function updatePlot(this)
            f = this.FieldOfView;
            x = this.Agent.Position * ones(1,5) + ...
                [f(:,1) [f(1,1);f(2,2)] f(:,2) [f(1,2);f(2,1)] f(:,1)];
            for i=1:length(this.PlotHandle)
                set(this.PlotHandle{i},'XData',x(1,:),'YData',x(2,:));
            end
        end
    end % plot methods
end % classdef


text:
<?php

namespace DNADesign\Elemental\Forms;

use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\TextField;

class TextCheckboxGroupField extends CompositeField
{
    protected $schemaComponent = 'TextCheckboxGroupField';

    /**
     * Set the composite's title to that of the first child
     *
     * @param string|null $title
     */
    public function __construct($title = null)
    {
        if (!$title) {
            $title = _t(__CLASS__ . '.Title', 'Title');
        }

        $fields = [
            TextField::create('Title', $title),
            CheckboxField::create('ShowTitle', _t(__CLASS__ . '.ShowTitleLabel', 'Displayed'))
        ];

        parent::__construct($fields);

        $this->setTitle($title);
    }

    /**
     * Don't use the custom template for readonly states
     *
     * {@inheritDoc}
     */
    public function performReadonlyTransformation()
    {
        $field = $this;

        if (!$this->readonly) {
            $field = parent::performReadonlyTransformation();

            $field->setTemplate(CompositeField::class);
            $field->setTitle('Title');

            $titleField = $field->fieldByName('Title');
            if ($titleField) {
                $field->replaceField('Title', LiteralField::create(
                    'Title',
                    $titleField->Value()
                ));
            }

            $displayedText = _t(__CLASS__ . '.DISPLAYED', 'Displayed');
            $notDisplayedText = _t(__CLASS__ . '.NOT_DISPLAYED', 'Not displayed');
            $showTitle = $field->fieldByName('ShowTitle');
            if ($showTitle) {
                $field->replaceField('ShowTitle', LiteralField::create(
                    'ShowTitle',
                    $showTitle->Value() === 'Yes' ? $displayedText : $notDisplayedText
                )->addExtraClass('show-title'));
            }
        }

        return $field;
    }
}


text:
package org.zstack.sdk;

public class ListVMsFromKVMHostResult {
    public java.util.List inventories;
    public void setInventories(java.util.List inventories) {
        this.inventories = inventories;
    }
    public java.util.List getInventories() {
        return this.inventories;
    }

    public java.lang.String libvirtVersion;
    public void setLibvirtVersion(java.lang.String libvirtVersion) {
        this.libvirtVersion = libvirtVersion;
    }
    public java.lang.String getLibvirtVersion() {
        return this.libvirtVersion;
    }

    public java.lang.String qemuVersion;
    public void setQemuVersion(java.lang.String qemuVersion) {
        this.qemuVersion = qemuVersion;
    }
    public java.lang.String getQemuVersion() {
        return this.qemuVersion;
    }

    public java.util.Map v2vCaps;
    public void setV2vCaps(java.util.Map v2vCaps) {
        this.v2vCaps = v2vCaps;
    }
    public java.util.Map getV2vCaps() {
        return this.v2vCaps;
    }

}


text:
//package org.w3c.domts.level2.core;
package dom.detailed.w3c;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.w3c.domts.level2.core.*;

    /**
    *  Test suite
    *  @author W3C DOM Test Working Group
    **/
    public class ibmtests extends TestCase{

    public static Test suite() {
       TestSuite sink= new TestSuite();
     // sink.addTestSuite(attrgetownerelement01.class);
      sink.addTestSuite(attrgetownerelement02.class);
      sink.addTestSuite(attrgetownerelement03.class);
     // sink.addTestSuite(attrgetownerelement04.class);
      sink.addTestSuite(attrgetownerelement05.class);
      sink.addTestSuite(documentcreateattributeNS01.class);
      sink.addTestSuite(documentcreateattributeNS02.class);
      sink.addTestSuite(documentcreateattributeNS03.class);
      sink.addTestSuite(documentcreateattributeNS04.class);
      sink.addTestSuite(documentcreateattributeNS05.class);
      sink.addTestSuite(documentcreateattributeNS06.class);
      sink.addTestSuite(documentcreateattributeNS07.class);
      sink.addTestSuite(documentcreateelementNS01.class);
      sink.addTestSuite(documentcreateelementNS02.class);
      sink.addTestSuite(documentcreateelementNS05.class);
      sink.addTestSuite(documentcreateelementNS06.class);
      sink.addTestSuite(domimplementationcreatedocument03.class);
      sink.addTestSuite(domimplementationcreatedocument04.class);
      sink.addTestSuite(domimplementationcreatedocument05.class);
      sink.addTestSuite(domimplementationcreatedocument07.class);
      sink.addTestSuite(domimplementationcreatedocumenttype02.class);
      sink.addTestSuite(domimplementationcreatedocumenttype04.class);
      sink.addTestSuite(domimplementationhasfeature01.class);
      sink.addTestSuite(domimplementationhasfeature02.class);
  //    sink.addTestSuite(documentgetelementbyid01.class);
      sink.addTestSuite(documentgetelementsbytagnameNS01.class);
      sink.addTestSuite(documentgetelementsbytagnameNS02.class);
      sink.addTestSuite(documentgetelementsbytagnameNS03.class);
      sink.addTestSuite(documentgetelementsbytagnameNS04.class);
      sink.addTestSuite(documentgetelementsbytagnameNS05.class);
      sink.addTestSuite(documentimportnode01.class);
  //    sink.addTestSuite(documentimportnode02.class);
      sink.addTestSuite(documentimportnode03.class);
   //   sink.addTestSuite(documentimportnode04.class);
      sink.addTestSuite(documentimportnode05.class);
      sink.addTestSuite(documentimportnode06.class);
     // sink.addTestSuite(documentimportnode07.class);
      sink.addTestSuite(documentimportnode08.class);
      sink.addTestSuite(documentimportnode09.class);
   //   sink.addTestSuite(documentimportnode10.class);
      sink.addTestSuite(documentimportnode11.class);
      sink.addTestSuite(documentimportnode12.class);
      sink.addTestSuite(documentimportnode13.class);
      sink.addTestSuite(documentimportnode14.class);
      sink.addTestSuite(documentimportnode15.class);
      sink.addTestSuite(documentimportnode17.class);
      sink.addTestSuite(documentimportnode18.class);
   //   sink.addTestSuite(documentimportnode19.class);
    //  sink.addTestSuite(documentimportnode20.class);
    //  sink.addTestSuite(documentimportnode21.class);
     // sink.addTestSuite(documentimportnode22.class);
  //    sink.addTestSuite(documenttypeinternalSubset01.class);
   //   sink.addTestSuite(documenttypepublicid01.class);
   //   sink.addTestSuite(documenttypesystemid01.class);
      sink.addTestSuite(elementgetattributens02.class);
      sink.addTestSuite(elementgetattributenodens01.class);
      sink.addTestSuite(elementgetattributenodens02.class);
      sink.addTestSuite(elementgetattributenodens03.class);
      sink.addTestSuite(elementgetelementsbytagnamens02.class);
      sink.addTestSuite(elementgetelementsbytagnamens04.class);
      sink.addTestSuite(elementgetelementsbytagnamens05.class);
      sink.addTestSuite(elementhasattribute01.class);
      sink.addTestSuite(elementhasattribute02.class);
      sink.addTestSuite(elementhasattribute03.class);
      sink.addTestSuite(elementhasattribute04.class);
      sink.addTestSuite(elementhasattributens01.class);
      sink.addTestSuite(elementhasattributens02.class);
      sink.addTestSuite(elementhasattributens03.class);
      sink.addTestSuite(elementremoveattributens01.class);
      sink.addTestSuite(elementsetattributens01.class);
      sink.addTestSuite(elementsetattributens02.class);
      sink.addTestSuite(elementsetattributens03.class);
      sink.addTestSuite(elementsetattributens04.class);
      sink.addTestSuite(elementsetattributens05.class);
      sink.addTestSuite(elementsetattributens08.class);
      sink.addTestSuite(elementsetattributenodens01.class);
      sink.addTestSuite(elementsetattributenodens02.class);
      sink.addTestSuite(elementsetattributenodens03.class);
      sink.addTestSuite(elementsetattributenodens04.class);
      sink.addTestSuite(elementsetattributenodens05.class);
      sink.addTestSuite(elementsetattributenodens06.class);
      sink.addTestSuite(namednodemapgetnameditemns01.class);
      sink.addTestSuite(namednodemapgetnameditemns02.class);
      sink.addTestSuite(namednodemapgetnameditemns03.class);
      sink.addTestSuite(namednodemapgetnameditemns04.class);
      sink.addTestSuite(namednodemapgetnameditemns05.class);
      sink.addTestSuite(namednodemapgetnameditemns06.class);
      sink.addTestSuite(namednodemapsetnameditemns01.class);
      sink.addTestSuite(namednodemapsetnameditemns02.class);
      sink.addTestSuite(namednodemapsetnameditemns03.class);
      sink.addTestSuite(namednodemapsetnameditemns04.class);
      sink.addTestSuite(namednodemapsetnameditemns05.class);
      sink.addTestSuite(namednodemapsetnameditemns06.class);
      sink.addTestSuite(namednodemapsetnameditemns07.class);
      sink.addTestSuite(namednodemapsetnameditemns08.class);
      sink.addTestSuite(namednodemapsetnameditemns09.class);
      sink.addTestSuite(namednodemapsetnameditemns10.class);
      sink.addTestSuite(namednodemapremovenameditemns01.class);
      sink.addTestSuite(namednodemapremovenameditemns02.class);
      sink.addTestSuite(namednodemapremovenameditemns03.class);
      sink.addTestSuite(namednodemapremovenameditemns04.class);
      sink.addTestSuite(namednodemapremovenameditemns05.class);
      sink.addTestSuite(namednodemapremovenameditemns06.class);
      sink.addTestSuite(namednodemapremovenameditemns07.class);
      sink.addTestSuite(namednodemapremovenameditemns08.class);
      sink.addTestSuite(namednodemapremovenameditemns09.class);
      sink.addTestSuite(nodegetlocalname03.class);
      sink.addTestSuite(nodegetnamespaceuri03.class);
      sink.addTestSuite(nodegetownerdocument01.class);
      sink.addTestSuite(nodegetownerdocument02.class);
      sink.addTestSuite(nodegetprefix03.class);
      sink.addTestSuite(nodesetprefix01.class);
      sink.addTestSuite(nodesetprefix02.class);
      sink.addTestSuite(nodesetprefix03.class);
      sink.addTestSuite(nodesetprefix04.class);
      sink.addTestSuite(nodesetprefix05.class);
      sink.addTestSuite(nodesetprefix06.class);
      sink.addTestSuite(nodesetprefix07.class);
      sink.addTestSuite(nodesetprefix08.class);
      sink.addTestSuite(nodesetprefix09.class);
      sink.addTestSuite(nodehasattributes01.class);
      sink.addTestSuite(nodehasattributes02.class);
      sink.addTestSuite(nodehasattributes03.class);
      sink.addTestSuite(nodehasattributes04.class);
      sink.addTestSuite(nodeissupported01.class);
      sink.addTestSuite(nodeissupported02.class);
      sink.addTestSuite(nodeissupported03.class);
      sink.addTestSuite(nodeissupported04.class);
      sink.addTestSuite(nodeissupported05.class);

       return sink;
   }

}


text:
package org.apache.geode.management;

import static org.apache.geode.test.junit.assertions.ClusterManagementListResultAssert.assertManagementListResult;
import static org.apache.geode.test.junit.rules.gfsh.GfshRule.startLocatorCommand;

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.cluster.client.ClusterManagementServiceBuilder;
import org.apache.geode.management.configuration.Deployment;
import org.apache.geode.test.compiler.JarBuilder;
import org.apache.geode.test.junit.categories.BackwardCompatibilityTest;
import org.apache.geode.test.junit.rules.gfsh.GfshExecution;
import org.apache.geode.test.junit.rules.gfsh.GfshRule;
import org.apache.geode.test.junit.rules.gfsh.GfshScript;
import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
import org.apache.geode.test.version.TestVersion;
import org.apache.geode.test.version.VersionManager;

@Category({BackwardCompatibilityTest.class})
@RunWith(Parameterized.class)
@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
public class DeploymentManagementUpgradeTest {
  private final String oldVersion;

  @Parameterized.Parameters(name = "{0}")
  public static Collection<String> data() {
    List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
    result.removeIf(s -> TestVersion.compare(s, "1.10.0") < 0);
    return result;
  }

  public DeploymentManagementUpgradeTest(String version) {
    oldVersion = version;
    oldGfsh = new GfshRule(oldVersion);
  }

  @Rule
  public GfshRule oldGfsh;

  @Rule
  public GfshRule gfsh = new GfshRule();

  @ClassRule
  public static TemporaryFolder tempFolder = new TemporaryFolder();
  private static File stagingDir, clusterJar;

  @BeforeClass
  public static void beforeClass() throws Exception {
    // prepare the jars to be deployed
    stagingDir = tempFolder.newFolder("staging");
    clusterJar = new File(stagingDir, "cluster.jar");
    JarBuilder jarBuilder = new JarBuilder();
    jarBuilder.buildJarFromClassNames(clusterJar, "Class1");
  }

  @Test
  public void newLocatorCanReadOldConfigurationData() throws IOException {
    int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
    int httpPort = ports[0];
    int locatorPort = ports[1];
    int jmxPort = ports[2];
    GfshExecution execute =
        GfshScript.of(startLocatorCommand("test", "localhost", locatorPort, jmxPort, httpPort, 0))
            .and("deploy --jar=" + clusterJar.getAbsolutePath())
            .and("shutdown --include-locators")
            .execute(oldGfsh);

    // use the latest gfsh to start the locator in the same working dir
    GfshScript.of(startLocatorCommand("test", "localhost", locatorPort, jmxPort, httpPort, 0))
        .execute(gfsh, execute.getWorkingDir());

    ClusterManagementService cms = new ClusterManagementServiceBuilder()
        .setPort(httpPort)
        .build();
    assertManagementListResult(cms.list(new Deployment())).isSuccessful()
        .hasConfigurations().hasSize(1);
  }
}


text:
<?php

namespace HMLB\PHPUnit\Listener;

use HMLB\VW\SecretSoftware;
use PHPUnit_Framework_AssertionFailedError;
use PHPUnit_Framework_TestListener;
use PHPUnit_Framework_Test;
use PHPUnit_Framework_TestCase;
use PHPUnit_Framework_TestSuite;
use Exception;

/**
 * This Listener makes your failing test cases pass continuous integration scrutiny.
 *
 * Uses a piece of secret software for automatic test environment detection.
 * Now you can break rules too.
 *
 * @author Hugues Maignol <hugues@hmlb.fr>
 */
class VWListener implements PHPUnit_Framework_TestListener
{
    /**
     * @var SecretSoftware
     */
    private $secretSoftware;

    /**
     * @param array $options
     */
    public function __construct(array $options = array())
    {
        $additionalEnvVariables = array();
        if (array_key_exists('additionalEnvVariables', $options)) {
            $additionalEnvVariables = $options['additionalEnvVariables'];
        }

        $this->secretSoftware = new SecretSoftware($additionalEnvVariables);
    }

    /**
     * {@inheritdoc}
     */
    public function startTest(PHPUnit_Framework_Test $test)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function endTest(PHPUnit_Framework_Test $test, $time)
    {
        if (!$test instanceof PHPUnit_Framework_TestCase) {
            return;
        }
        if ($this->secretSoftware->underScrutiny()) {
            $this->secretSoftware->force($test);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
    {
    }
}


text:
<!doctype html>

    <title>Example 07 - Sprites recycling</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../../styles.css" type="text/css">
    <link rel="stylesheet" href="../examples.css" type="text/css">

07 - Sprite recycling

‹ Back


text:
SHELL := /bin/bash  # necessary to use the source command, which is not on sh, Makefile's default shell ;)

help:
	@echo -e " make env      - Load the environment variables."
	@echo -e " make bash     - Run a bash session."
	@echo -e " make psql     - Log on the postgresql instance on psql."
	@echo -e " make backup   - Make a backup of postgresql data."
	@echo -e " make restore  - Restore to the most recent database backup."
	@echo -e " make stop     - Stop the container."
	@echo -e " make remove   - Remove (delete) the container."
	@echo -e " make start    - Start the container. If there is another instance of it running, it will be killed and removed first."
	@echo -e " make setupdb  - Setup database credentials and default encoding to be ready for a django app."

env:
	source postgres.env

bash:
	docker exec -it $$(docker ps | grep postgres | awk '{print $$1}') bash

psql: env
	docker exec -it $$(docker ps | grep postgres | awk '{print $$1}') psql -U notepy notepy

backup: env
	docker exec -i $$(docker ps | grep postgres | awk '{print $$1}') /utils/dump.sh

restore: env
	docker exec -i $$(docker ps | grep postgres | awk '{print $$1}') /utils/restore.sh

stop:
	sudo docker-compose stop

remove: stop
	sudo docker-compose rm -f

start: remove
	sudo docker-compose up -d
	@echo -e "IMPORTANT: If this is the first time you start this container, run: \n    $ make setupdb"

setupdb: env start
	docker exec -i $$(docker ps | grep postgres | awk '{print $$1}') /utils/setup.sh


text:
package com.krishagni.rbac.repository;

import java.util.List;

import com.krishagni.catissueplus.core.common.repository.Dao;
import com.krishagni.rbac.domain.Permission;

public interface PermissionDao extends Dao<Permission> {
	public Permission getPermission(Long permissionId);

	public Permission getPermission(String resourceName, String operationName);

	public List<Permission> getPermissions(PermissionListCriteria listCriteria);
}


text:
namespace FactoryGirlCore
{
    public interface IDefinable
    {
        void Define();
    }
}


text:
define({
  "searchTabTitle": "Cari pengaturan sumber",
  "routeTabTitle": "Pengaturan rute",
  "add": "Tambahkan sumber pencarian",
  "addGeocoder": "Tambahkan geocoder",
  "geocoder": "Geocoder",
  "setLayerSource": "Atur sumber layer",
  "setGeocoderURL": "Atur URL geocoder",
  "searchableLayer": "Feature layer",
  "name": "Nama",
  "countryCode": "Kode negara atau wilayah",
  "countryCodeEg": "mis., ",
  "countryCodeHint": "Membiarkan nilai ini kosong berarti akan mencari semua negara dan wilayah",
  "showInfoWindowOnSelect": "Tampilkan pop-up untuk fitur atau lokasi yang ditemukan",
  "showInfoWindowOnSelect2": "Tampilkan pop-up jika fitur atau lokasi ditemukan.",
  "searchInCurrentMapExtent": "Cari hanya dalam jangkauan peta saat ini",
  "setSearchFields": "Atur kolom pencarian",
  "set": "Atur",
  "fieldSearchable": "dapat dicari",
  "zoomScale": "Skala zoom",
  "locatorUrl": "URL Geocoder",
  "locatorName": "Nama geocoder",
  "locatorExample": "Contoh",
  "locatorWarning": "Versi layanan geocoding tidak didukung. Widget mendukung layanan geocoding 10.1 dan di atasnya.",
  "locatorTips": "Saran tidak tersedia karena layanan geocoding tidak mendukung kemampuan saran.",
  "layerSource": "Sumber layer",
  "searchLayerTips": "Saran tidak tersedia karena feature service tidak mendukung kemampuan penomoran halaman.",
  "placeholderText": "Teks placeholder",
  "searchFields": "Kolom pencarian",
  "displayField": "Kolom tampilan",
  "exactMatch": "Benar-benar cocok",
  "maxSuggestions": "Saran maksimum",
  "maxResults": "Hasil maksimum",
  "enableLocalSearch": "Aktifkan pencarian lokal",
  "minScale": "Skala min",
  "minScaleHint": "Apabila skala peta lebih besar daripada skala ini, pencarian lokal akan diterapkan",
  "radius": "Radius",
  "radiusHint": "Menentukan radius dari area di sekitar pusat peta saat ini yang digunakan untuk mendorong peringkat calon geocoding sehingga calon yang terdekat dengan lokasi akan dimunculkan terlebih dahulu",
  "invalidUrlTip": "URL ${URL} tidak valid atau tidak dapat diakses.",
  "routeUrl": "URL Rute",
  "geocoderOptions": "Opsi Geocoder",
  "autoComplete": "Selesaikan otomatis",
  "maximumSuggestions": "Saran maksimal",
  "minCharacters": "Karakter minimal",
  "searchDelay": "Cari penangguhan",
  "placeholder": "Placeholder",
  "routeOptions": "Opsi rute",
  "directionsLanguage": "Bahasa arahan",
  "directionsLengthUnits": "Unit panjang arahan",
  "directionsOutputType": "Tipe output arahan",
  "impedanceAttribute": "Atribut impedansi",
  "kilometers": "Kilometer",
  "miles": "Mil",
  "meters": "Meter",
  "feet": "Kaki",
  "yards": "Yard",
  "nauticalMiles": "Mil laut",
  "parametersTip": "Harap tetapkan parameter dengan benar !",
  "complete": "Selesai",
  "completeNoEvents": "Tidak Menyelesaikan Acara",
  "instructionsOnly": "Khusus instruksi",
  "standard": "Standar",
  "summaryOnly": "Khusus ringkasan",
  "travelModesUrl": "URL mode perjalanan",
  "searchPlaceholder": "Temukan alamat atau tempat",
  "trafficLayerUrl": "URL layer lalu lintas",
  "barrierLayerUrl": "URL layer penghalang",
  "presetDestinations": "Perhentian prasetel",
  "startPoint": "Titik mulai",
  "endPoint": "Titik selesai",
  "destinationHolder": "Alamat atau kordinat",
  "optional": "Opsional.",
  "barrierLayers": "Layer Penghalang",
  "pointBarrier": "Penghalang titik",
  "lineBarrier": "Penghalang garis",
  "polygonBarrier": "Penghalang poligon",
  "noPointBarrier": "Pilih penghalang titik",
  "noLineBarrier": "Pilih penghalang garis",
  "noPolygonBarrier": "Pilih penghalang poligon"
});


text:
import { shallowMount } from '@vue/test-utils';
import StepGroup from 'semantic-ui-vue/elements/Step/StepGroup';

describe('StepGroup', () => {
  it('should have class "three" when pass number/string', () => {
    const stepGroup = shallowMount(StepGroup, { propsData: { stepNumber: 3 } });
    const stepGroup2 = shallowMount(StepGroup, {
      propsData: { stepNumber: 'three' },
    });
    expect(stepGroup.classes()).toContain('three');
    expect(stepGroup2.classes()).toContain('three');
  });
});


text:
package io.lattengineer.LattEngineerAPI.gson.internal.bind;

import java.io.IOException;
import java.sql.Time;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import io.lattengineer.LattEngineerAPI.gson.Gson;
import io.lattengineer.LattEngineerAPI.gson.JsonSyntaxException;
import io.lattengineer.LattEngineerAPI.gson.TypeAdapter;
import io.lattengineer.LattEngineerAPI.gson.TypeAdapterFactory;
import io.lattengineer.LattEngineerAPI.gson.internal.reflect.TypeToken;
import io.lattengineer.LattEngineerAPI.gson.stream.JsonReader;
import io.lattengineer.LattEngineerAPI.gson.stream.JsonToken;
import io.lattengineer.LattEngineerAPI.gson.stream.JsonWriter;

/**
 * Adapter for Time. Although this class appears stateless, it is not.
 * DateFormat captures its time zone and locale when it is created, which gives
 * this class state. DateFormat isn't thread safe either, so this class has
 * to synchronize its read and write methods.
 */
public final class TimeTypeAdapter extends TypeAdapter<Time> {
  public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {
    @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
      return typeToken.getRawType() == Time.class ? (TypeAdapter<T>) new TimeTypeAdapter() : null;
    }
  };

  private final DateFormat format = new SimpleDateFormat("hh:mm:ss a");

  @Override public synchronized Time read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
      in.nextNull();
      return null;
    }
    try {
      Date date = format.parse(in.nextString());
      return new Time(date.getTime());
    } catch (ParseException e) {
      throw new JsonSyntaxException(e);
    }
  }

  @Override public synchronized void write(JsonWriter out, Time value) throws IOException {
    out.value(value == null ? null : format.format(value));
  }
}


text:
from collections import deque

class CircularBuffer:

    def __init__(self, capacity):
        self.capacity = capacity
        self.buffer = deque([], capacity)

    def read(self):
        if self.empty():
            raise BufferEmptyException
        return self.buffer.popleft()

    def write(self, data):
        if self.full():
            raise BufferFullException
        self.buffer.append(data)

    def overwrite(self, data):
        if self.full():
            self.buffer.popleft()
        self.buffer.append(data)

    def clear(self):
        self.buffer.clear()

    def empty(self):
        return len(self.buffer) == 0

    def full(self):
        return len(self.buffer) == self.capacity

class BufferFullException(Exception):
    pass

class BufferEmptyException(Exception):
    pass


text:
package org.apache.hadoop.hive.ql.exec.vector.ptf;

import org.apache.hadoop.hive.ql.exec.vector.ColumnVector.Type;
import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef;

/**
 * This class evaluates rank() for a PTF group.
 *
 * Rank starts at 1; the same rank is streamed to the output column as repeated; after the last
 * group row, the rank is increased by the number of group rows.
 */
public class VectorPTFEvaluatorRank extends VectorPTFEvaluatorBase {

  private long rank;
  private int groupCount;

  public VectorPTFEvaluatorRank(WindowFrameDef windowFrameDef, int outputColumnNum) {
    super(windowFrameDef, outputColumnNum);
    resetEvaluator();
  }

  @Override
  public void evaluateGroupBatch(VectorizedRowBatch batch)
      throws HiveException {

    // We don't evaluate input columns...

    /*
     * Do careful maintenance of the outputColVector.noNulls flag.
     */
    LongColumnVector longColVector = (LongColumnVector) batch.cols[outputColumnNum];
    longColVector.isRepeating = true;
    longColVector.isNull[0] = false;
    longColVector.vector[0] = rank;
    groupCount += batch.size;
  }

  @Override
  public void doLastBatchWork() {
    rank += groupCount;
    groupCount = 0;
  }

  @Override
  public boolean streamsResult() {
    // No group value.
    return true;
  }

  @Override
  public boolean isGroupResultNull() {
    return false;
  }

  @Override
  public Type getResultColumnVectorType() {
    return Type.LONG;
  }

  @Override
  public Object getGroupResult() {
    return rank;
  }

  @Override
  public void resetEvaluator() {
    rank = 1;
    groupCount = 0;
  }
}


text:
using AngularAzureSearch.WebAPI.Entities.Trails;

namespace AngularAzureSearch.WebAPI.Repositories
{
    /// <summary>
    /// Add custom members here.
    /// </summary>
    public interface ITrailRepository : IRepository<Trail>
    {
    }
}


text:
<?php

/**
 * Oxd RP config
 *
 * Class Oxd_RP_config, setting all configuration
 *
 * @package		Gluu-oxd-library
 * @subpackage	Libraries
 * @category	Base class for all protocols
 * @author		Vlad Karapetyan
 * @author		vlad.karapetyan.1988@mail.ru
 */

class Oxd_RP_config
{
    /**
     * @static
     * @var string $oxd_host_ip        Socket connection ip
     */
    public static $oxd_host_ip;
    /**
     * @static
     * @var int $oxd_host_port        Socket connection port
     */
    public static $oxd_host_port;
    /**
     * @static
     * @var string $authorization_redirect_uri        Site authorization redirect uri
     */
    public static $authorization_redirect_uri;
    /**
     * @static
     * @var string $logout_redirect_uri        Site logout redirect uri
     */
    public static $logout_redirect_uri;
    /**
     * @static
     * @var array $scope        For getting needed scopes from gluu-server
     */
    public static $scope;
    /**
     * @static
     * @var string $application_type        web or mobile
     */
    public static $application_type;
    /**
     * @static
     * @var array $redirect_uris        Site redirect uris after login or logout
     */
    public static $redirect_uris;
    /**
     * @static
     * @var array $response_types        OpenID Authentication response types
     */
    public static $response_types;
    /**
     * @static
     * @var string $grant_types        OpenID Token Request type
     */
    public static $grant_types;

    /**
     * @static
     * @var array $acr_values        Gluu login acr type, can be basic, duo, u2f, gplus and etc.
     */
    public static $acr_values;
}


text:
package org.apache.nifi.csv;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.QuoteMode;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.nifi.components.AllowableValue;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.PropertyValue;
import org.apache.nifi.context.PropertyContext;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.processor.util.StandardValidators;

public class CSVUtils {

    public static final AllowableValue CUSTOM = new AllowableValue("custom", "Custom Format",
        "The format of the CSV is configured by using the properties of this Controller Service, such as Value Separator");
    public static final AllowableValue RFC_4180 = new AllowableValue("rfc-4180", "RFC 4180", "CSV data follows the RFC 4180 Specification defined at https://tools.ietf.org/html/rfc4180");
    public static final AllowableValue EXCEL = new AllowableValue("excel", "Microsoft Excel", "CSV data follows the format used by Microsoft Excel");
    public static final AllowableValue TDF = new AllowableValue("tdf", "Tab-Delimited", "CSV data is Tab-Delimited instead of Comma Delimited");
    public static final AllowableValue INFORMIX_UNLOAD = new AllowableValue("informix-unload", "Informix Unload", "The format used by Informix when issuing the UNLOAD TO file_name command");
    public static final AllowableValue INFORMIX_UNLOAD_CSV = new AllowableValue("informix-unload-csv", "Informix Unload Escape Disabled",
        "The format used by Informix when issuing the UNLOAD TO file_name command with escaping disabled");
    public static final AllowableValue MYSQL = new AllowableValue("mysql", "MySQL Format", "CSV data follows the format used by MySQL");

    public static final PropertyDescriptor CSV_FORMAT = new PropertyDescriptor.Builder()
        .name("CSV Format")
        .description("Specifies which \"format\" the CSV data is in, or specifies if custom formatting should be used.")
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .allowableValues(CUSTOM, RFC_4180, EXCEL, TDF, MYSQL, INFORMIX_UNLOAD, INFORMIX_UNLOAD_CSV)
        .defaultValue(CUSTOM.getValue())
        .required(true)
        .build();
    public static final PropertyDescriptor VALUE_SEPARATOR = new PropertyDescriptor.Builder()
        .name("Value Separator")
        .description("The character that is used to separate values/fields in a CSV Record")
        .addValidator(CSVValidators.UNESCAPED_SINGLE_CHAR_VALIDATOR)
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .defaultValue(",")
        .required(true)
        .build();
    public static final PropertyDescriptor QUOTE_CHAR = new PropertyDescriptor.Builder()
        .name("Quote Character")
        .description("The character that is used to quote values so that escape characters do not have to be used")
        .addValidator(new CSVValidators.SingleCharacterValidator())
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .defaultValue("\"")
        .required(true)
        .build();
    public static final PropertyDescriptor FIRST_LINE_IS_HEADER = new PropertyDescriptor.Builder()
        .name("Skip Header Line")
        .displayName("Treat First Line as Header")
        .description("Specifies whether or not the first line of CSV should be considered a Header or should be considered a record. If the Schema Access Strategy "
            + "indicates that the columns must be defined in the header, then this property will be ignored, since the header must always be "
            + "present and won't be processed as a Record. Otherwise, if 'true', then the first line of CSV data will not be processed as a record and if 'false',"
            + "then the first line will be interpreted as a record.")
        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .allowableValues("true", "false")
        .defaultValue("false")
        .required(true)
        .build();
    public static final PropertyDescriptor IGNORE_CSV_HEADER = new PropertyDescriptor.Builder()
        .name("ignore-csv-header")
        .displayName("Ignore CSV Header Column Names")
        .description("If the first line of a CSV is a header, and the configured schema does not match the fields named in the header line, this controls how "
            + "the Reader will interpret the fields. If this property is true, then the field names mapped to each column are driven only by the configured schema and "
            + "any fields not in the schema will be ignored. If this property is false, then the field names found in the CSV Header will be used as the names of the "
            + "fields.")
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .allowableValues("true", "false")
        .defaultValue("false")
        .required(false)
        .build();
    public static final PropertyDescriptor COMMENT_MARKER = new PropertyDescriptor.Builder()
        .name("Comment Marker")
        .description("The character that is used to denote the start of a comment. Any line that begins with this comment will be ignored.")
        .addValidator(new CSVValidators.SingleCharacterValidator())
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .required(false)
        .build();
    public static final PropertyDescriptor ESCAPE_CHAR = new PropertyDescriptor.Builder()
        .name("Escape Character")
        .description("The character that is used to escape characters that would otherwise have a specific meaning to the CSV Parser.")
        .addValidator(new CSVValidators.SingleCharacterValidator())
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .defaultValue("\\")
        .required(true)
        .build();
    public static final PropertyDescriptor NULL_STRING = new PropertyDescriptor.Builder()
        .name("Null String")
        .description("Specifies a String that, if present as a value in the CSV, should be considered a null field instead of using the literal value.")
        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .required(false)
        .build();
    public static final PropertyDescriptor TRIM_FIELDS = new PropertyDescriptor.Builder()
        .name("Trim Fields")
        .description("Whether or not white space should be removed from the beginning and end of fields")
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .allowableValues("true", "false")
        .defaultValue("true")
        .required(true)
        .build();
    public static final PropertyDescriptor CHARSET = new PropertyDescriptor.Builder()
        .name("csvutils-character-set")
        .displayName("Character Set")
        .description("The Character Encoding that is used to encode/decode the CSV file")
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .addValidator(StandardValidators.CHARACTER_SET_VALIDATOR)
        .defaultValue("UTF-8")
        .required(true)
        .build();

    // CSV Format fields for writers only
    public static final AllowableValue QUOTE_ALL = new AllowableValue("ALL", "Quote All Values", "All values will be quoted using the configured quote character.");
    public static final AllowableValue QUOTE_MINIMAL = new AllowableValue("MINIMAL", "Quote Minimal",
        "Values will be quoted only if they are contain special characters such as newline characters or field separators.");
    public static final AllowableValue QUOTE_NON_NUMERIC = new AllowableValue("NON_NUMERIC", "Quote Non-Numeric Values", "Values will be quoted unless the value is a number.");
    public static final AllowableValue QUOTE_NONE = new AllowableValue("NONE", "Do Not Quote Values",
        "Values will not be quoted. Instead, all special characters will be escaped using the configured escape character.");

    public static final PropertyDescriptor QUOTE_MODE = new PropertyDescriptor.Builder()
        .name("Quote Mode")
        .description("Specifies how fields should be quoted when they are written")
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .allowableValues(QUOTE_ALL, QUOTE_MINIMAL, QUOTE_NON_NUMERIC, QUOTE_NONE)
        .defaultValue(QUOTE_MINIMAL.getValue())
        .required(true)
        .build();
    public static final PropertyDescriptor TRAILING_DELIMITER = new PropertyDescriptor.Builder()
        .name("Include Trailing Delimiter")
        .description("If true, a trailing delimiter will be added to each CSV Record that is written. If false, the trailing delimiter will be omitted.")
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .allowableValues("true", "false")
        .defaultValue("false")
        .required(true)
        .build();
    public static final PropertyDescriptor RECORD_SEPARATOR = new PropertyDescriptor.Builder()
        .name("Record Separator")
        .description("Specifies the characters to use in order to separate CSV Records")
        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
        .expressionLanguageSupported(ExpressionLanguageScope.NONE)
        .defaultValue("\\n")
        .required(true)
        .build();
    public static final PropertyDescriptor INCLUDE_HEADER_LINE = new PropertyDescriptor.Builder()
        .name("Include Header Line")
        .description("Specifies whether or not the CSV column names should be written out as the first line.")
        .allowableValues("true", "false")
        .defaultValue("true")
        .required(true)
        .build();

    public static CSVFormat createCSVFormat(final PropertyContext context) {
        final String formatName = context.getProperty(CSV_FORMAT).getValue();
        if (formatName.equalsIgnoreCase(CUSTOM.getValue())) {
            return buildCustomFormat(context);
        }
        if (formatName.equalsIgnoreCase(RFC_4180.getValue())) {
            return CSVFormat.RFC4180;
        } else if (formatName.equalsIgnoreCase(EXCEL.getValue())) {
            return CSVFormat.EXCEL;
        } else if (formatName.equalsIgnoreCase(TDF.getValue())) {
            return CSVFormat.TDF;
        } else if (formatName.equalsIgnoreCase(MYSQL.getValue())) {
            return CSVFormat.MYSQL;
        } else if (formatName.equalsIgnoreCase(INFORMIX_UNLOAD.getValue())) {
            return CSVFormat.INFORMIX_UNLOAD;
        } else if (formatName.equalsIgnoreCase(INFORMIX_UNLOAD_CSV.getValue())) {
            return CSVFormat.INFORMIX_UNLOAD_CSV;
        } else {
            return CSVFormat.DEFAULT;
        }
    }

    private static char getUnescapedChar(final PropertyContext context, final PropertyDescriptor property) {
        return StringEscapeUtils.unescapeJava(context.getProperty(property).getValue()).charAt(0);
    }

    private static char getChar(final PropertyContext context, final PropertyDescriptor property) {
        return CSVUtils.unescape(context.getProperty(property).getValue()).charAt(0);
    }

    private static CSVFormat buildCustomFormat(final PropertyContext context) {
        final char valueSeparator = getUnescapedChar(context, VALUE_SEPARATOR);
        CSVFormat format = CSVFormat.newFormat(valueSeparator)
            .withAllowMissingColumnNames()
            .withIgnoreEmptyLines();

        final PropertyValue skipHeaderPropertyValue = context.getProperty(FIRST_LINE_IS_HEADER);
        if (skipHeaderPropertyValue.getValue() != null && skipHeaderPropertyValue.asBoolean()) {
            format = format.withFirstRecordAsHeader();
        }

        format = format.withQuote(getChar(context, QUOTE_CHAR));
        format = format.withEscape(getChar(context, ESCAPE_CHAR));
        format = format.withTrim(context.getProperty(TRIM_FIELDS).asBoolean());

        if (context.getProperty(COMMENT_MARKER).isSet()) {
            format = format.withCommentMarker(getChar(context, COMMENT_MARKER));
        }
        if (context.getProperty(NULL_STRING).isSet()) {
            format = format.withNullString(CSVUtils.unescape(context.getProperty(NULL_STRING).getValue()));
        }

        final PropertyValue quoteValue = context.getProperty(QUOTE_MODE);
        if (quoteValue != null) {
            final QuoteMode quoteMode = QuoteMode.valueOf(quoteValue.getValue());
            format = format.withQuoteMode(quoteMode);
        }

        final PropertyValue trailingDelimiterValue = context.getProperty(TRAILING_DELIMITER);
        if (trailingDelimiterValue != null) {
            final boolean trailingDelimiter = trailingDelimiterValue.asBoolean();
            format = format.withTrailingDelimiter(trailingDelimiter);
        }

        final PropertyValue recordSeparator = context.getProperty(RECORD_SEPARATOR);
        if (recordSeparator != null) {
            final String separator = unescape(recordSeparator.getValue());
            format = format.withRecordSeparator(separator);
        }

        return format;
    }

    public static String unescape(final String input) {
        if (input == null) {
            return input;
        }

        return input.replace("\\t", "\t")
            .replace("\\n", "\n")
            .replace("\\r", "\r");
    }
}


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>VPGATHERDQ/VPGATHERQQ — Gather Packed Qword Values Using Signed Dword/Qword Indices </title>

VPGATHERDQ/VPGATHERQQ — Gather Packed Qword Values Using Signed Dword/Qword Indices

Opcode/Instruction
Op/En
64/32 -bit Mode
CPUID Feature Flag
Description

VEX.DDS.128.66.0F38.W1 90 /r

VPGATHERDQ xmm1, vm32x, xmm2

RMV
V/V
AVX2
Using dword indices specified in vm32x, gather qword val-ues from memory conditioned on mask specified by xmm2. Conditionally gathered elements are merged into xmm1.

VEX.DDS.128.66.0F38.W1 91 /r

VPGATHERQQ xmm1, vm64x, xmm2

RMV
V/V
AVX2
Using qword indices specified in vm64x, gather qword val-ues from memory conditioned on mask specified by xmm2. Conditionally gathered elements are merged into xmm1.

VEX.DDS.256.66.0F38.W1 90 /r

VPGATHERDQ ymm1, vm32x, ymm2

RMV
V/V
AVX2
Using dword indices specified in vm32x, gather qword val-ues from memory conditioned on mask specified by ymm2. Conditionally gathered elements are merged into ymm1.

VEX.DDS.256.66.0F38.W1 91 /r

VPGATHERQQ ymm1, vm64y, ymm2

RMV
V/V
AVX2
Using qword indices specified in vm64y, gather qword val-ues from memory conditioned on mask specified by ymm2. Conditionally gathered elements are merged into ymm1.

Instruction Operand Encoding

Op/En
Operand 1
Operand 2
Operand 3
Operand 4

A
ModRM:reg (r,w)

BaseReg (R): VSIB:base,

VectorReg(R): VSIB:index

VEX.vvvv (r, w)
NA

Description

The instruction conditionally loads up to 2 or 4 qword values from memory addresses specified by the memory operand (the second operand) and using qword indices. The memory operand uses the VSIB form of the SIB byte to specify a general purpose register operand as the common base, a vector register for an array of indices relative to the base and a constant scale factor.

The mask operand (the third operand) specifies the conditional load operation from each memory address and the corresponding update of each data element of the destination operand (the first operand). Conditionality is speci-fied by the most significant bit of each data element of the mask register. If an element's mask bit is not set, the corresponding element of the destination register is left unchanged. The width of data element in the destination register and mask register are identical. The entire mask register will be set to zero by this instruction unless the instruction causes an exception.

Using dword indices in the lower half of the mask register, the instruction conditionally loads up to 2 or 4 qword values from the VSIB addressing memory operand, and updates the destination register.

This instruction can be suspended by an exception if at least one element is already gathered (i.e., if the exception is triggered by an element other than the rightmost one with its mask bit set).  When this happens, the destination register and the mask operand are partially updated; those elements that have been gathered are placed into the destination register and have their mask bits set to zero.  If any traps or interrupts are pending from already gath-ered elements, they will be delivered in lieu of the exception; in this case, EFLAG.RF is set to one so an instruction breakpoint is not re-triggered when the instruction is continued.

If the data size and index size are different, part of the destination register and part of the mask register do not correspond to any elements being gathered.  This instruction sets those parts to zero.  It may do this to one or both of those registers even if the instruction triggers an exception, and even if the instruction triggers the exception before gathering any elements.

VEX.128 version: The instruction will gather two qword values.  For dword indices, only the lower two indices in the vector index register are used.

VEX.256 version: The instruction will gather four qword values.  For dword indices, only the lower four indices in the vector index register are used.

Note that:

Operation

DEST ← SRC1;
BASE_ADDR: base register encoded in VSIB addressing;
VINDEX: the vector index register encoded by VSIB addressing;
SCALE: scale factor encoded by SIB:[7:6];
DISP: optional 1, 4 byte displacement;
MASK ← SRC3;

VPGATHERDQ (VEX.128 version)

FOR j← 0 to 1
    i ← j * 64;
    IF MASK[63+i] THEN
         MASK[i +63:i] ← FFFFFFFF_FFFFFFFFH; // extend from most significant bit
    ELSE
         MASK[i +63:i] ← 0;
    FI;
ENDFOR
FOR j← 0 to 1
    k ← j * 32;
    i ← j * 64;
    DATA_ADDR ← BASE_ADDR + (SignExtend(VINDEX[k+31:k])*SCALE + DISP;
    IF MASK[63+i] THEN
         DEST[i +63:i] ← FETCH_64BITS(DATA_ADDR); // a fault exits the instruction
    FI;
    MASK[i +63:i] ← 0;
ENDFOR
MASK[VLMAX-1:128] ← 0;
DEST[VLMAX-1:128] ← 0;
(non-masked elements of the mask register have the content of respective element  cleared)

VPGATHERQQ (VEX.128 version)

FOR j← 0 to 1
    i ← j * 64;
    IF MASK[63+i] THEN
         MASK[i +63:i] ← FFFFFFFF_FFFFFFFFH; // extend from most significant bit
    ELSE
         MASK[i +63:i] ← 0;
    FI;
ENDFOR
FOR j← 0 to 1
    i ←j * 64;
    DATA_ADDR ← BASE_ADDR + (SignExtend(VINDEX1[i+63:i])*SCALE + DISP;
    IF MASK[63+i] THEN
         DEST[i +63:i] ← FETCH_64BITS(DATA_ADDR); // a fault exits the instruction
    FI;
    MASK[i +63:i] ← 0;
ENDFOR
MASK[VLMAX-1:128] ← 0;
DEST[VLMAX-1:128] ← 0;
(non-masked elements of the mask register have the content of respective element  cleared)

VPGATHERQQ (VEX.256 version)

FOR j← 0 to 3
    i ← j * 64;
    IF MASK[63+i] THEN
         MASK[i +63:i] ← FFFFFFFF_FFFFFFFFH; // extend from most significant bit
    ELSE
         MASK[i +63:i] ← 0;
    FI;
ENDFOR
FOR j← 0 to 3
    i ← j * 64;
    DATA_ADDR ← BASE_ADDR + (SignExtend(VINDEX1[i+63:i])*SCALE + DISP;
    IF MASK[63+i] THEN
         DEST[i +63:i] ← FETCH_64BITS(DATA_ADDR); // a fault exits the instruction
    FI;
    MASK[i +63:i] ← 0;
ENDFOR
(non-masked elements of the mask register have the content of respective element  cleared)

VPGATHERDQ (VEX.256 version)

FOR j← 0 to 3
    i ← j * 64;
    IF MASK[63+i] THEN
         MASK[i +63:i] ← FFFFFFFF_FFFFFFFFH; // extend from most significant bit
    ELSE
         MASK[i +63:i] ← 0;
    FI;
ENDFOR
FOR j← 0 to 3
    k ← j * 32;
    i ← j * 64;
    DATA_ADDR ← BASE_ADDR + (SignExtend(VINDEX1[k+31:k])*SCALE + DISP;
    IF MASK[63+i] THEN
         DEST[i +63:i] ← FETCH_64BITS(DATA_ADDR); // a fault exits the instruction
    FI;
    MASK[i +63:i] ← 0;
ENDFOR
(non-masked elements of the mask register have the content of respective element  cleared)

Intel C/C++ Compiler Intrinsic Equivalent

VPGATHERDQ: __m128i _mm_i32gather_epi64 (int64 const * base, __m128i index, const int scale);

VPGATHERDQ: __m128i _mm_mask_i32gather_epi64 (__m128i src, int64 const * base, __m128i index, __m128i mask, const int scale);

VPGATHERDQ: __m256i _mm256_i32gather_epi64 ( int64 const * base, __m128i index, const int scale);

VPGATHERDQ: __m256i _mm256_mask_i32gather_epi64 (__m256i src, int64 const * base, __m128i index, __m256i mask, const int scale);

VPGATHERQQ: __m128i _mm_i64gather_epi64 (int64 const * base, __m128i index, const int scale);

VPGATHERQQ: __m128i _mm_mask_i64gather_epi64 (__m128i src, int64 const * base, __m128i index, __m128i mask, const int scale);

VPGATHERQQ: __m256i _mm256_i64gather_epi64 (int64 const * base, __m256i index, const int scale);

VPGATHERQQ: __m256i _mm256_mask_i64gather_epi64 (__m256i src, int64 const * base, __m256i index, __m256i mask, const int scale);

SIMD Floating-Point Exceptions

None

Other Exceptions

See Exceptions Type 12