text:
<?php

/** Internally used classes */
require_once 'Zend/Pdf/Element.php';
require_once 'Zend/Pdf/Element/Array.php';
require_once 'Zend/Pdf/Element/Numeric.php';
require_once 'Zend/Pdf/Element/String.php';

/** Zend_Pdf_Outline */
require_once 'Zend/Pdf/Outline.php';

/**
 * Traceable PDF outline representation class
 *
 * Instances of this class trace object update uperations. That allows to avoid outlines PDF tree update
 * which should be performed at each document update otherwise.
 *
 * @package    Zend_Pdf
 * @subpackage Outlines
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Pdf_Outline_Loaded extends Zend_Pdf_Outline
{
    /**
     * Outline dictionary object
     *
     * @var Zend_Pdf_Element_Dictionary|Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference
     */
    protected $_outlineDictionary;

    /**
     * original array of child outlines
     *
     * @var array
     */
    protected $_originalChildOutlines = array();

    /**
     * Get outline title.
     *
     * @return string
     * @throws Zend_Pdf_Exception
     */
    public function getTitle()
    {
        if ($this->_outlineDictionary->Title === null) {
            require_once 'Zend/Pdf/Exception.php';
            throw new Zend_Pdf_Exception('Outline dictionary Title entry is required.');
        }
        return $this->_outlineDictionary->Title->value;
    }

    /**
     * Set outline title
     *
     * @param string $title
     * @return Zend_Pdf_Outline
     */
    public function setTitle($title)
    {
        $this->_outlineDictionary->Title->touch();
        $this->_outlineDictionary->Title = new Zend_Pdf_Element_String($title);
        return $this;
    }

    /**
     * Sets 'isOpen' outline flag
     *
     * @param boolean $isOpen
     * @return Zend_Pdf_Outline
     */
    public function setIsOpen($isOpen)
    {
        parent::setIsOpen($isOpen);

        if ($this->_outlineDictionary->Count === null) {
            // Do Nothing.
            return this;
        }

        $childrenCount = $this->_outlineDictionary->Count->value;
        $isOpenCurrentState = ($childrenCount > 0);
        if ($isOpen != $isOpenCurrentState) {
            $this->_outlineDictionary->Count->touch();
            $this->_outlineDictionary->Count->value = ($isOpen? 1 : -1)*abs($childrenCount);
        }

        return $this;
    }

    /**
     * Returns true if outline item is displayed in italic
     *
     * @return boolean
     */
    public function isItalic()
    {
        if ($this->_outlineDictionary->F === null) {
            return false;
        }
        return $this->_outlineDictionary->F->value & 1;
    }

    /**
     * Sets 'isItalic' outline flag
     *
     * @param boolean $isItalic
     * @return Zend_Pdf_Outline
     */
    public function setIsItalic($isItalic)
    {
        if ($this->_outlineDictionary->F === null) {
            $this->_outlineDictionary->touch();
            $this->_outlineDictionary->F = new Zend_Pdf_Element_Numeric($isItalic? 1 : 0);
        } else {
            $this->_outlineDictionary->F->touch();
            if ($isItalic) {
                $this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | 1;
            } else {
                $this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | ~1;
            }
        }
        return $this;
    }

    /**
     * Returns true if outline item is displayed in bold
     *
     * @return boolean
     */
    public function isBold()
    {
        if ($this->_outlineDictionary->F === null) {
            return false;
        }
        return $this->_outlineDictionary->F->value & 2;
    }

    /**
     * Sets 'isBold' outline flag
     *
     * @param boolean $isBold
     * @return Zend_Pdf_Outline
     */
    public function setIsBold($isBold)
    {
        if ($this->_outlineDictionary->F === null) {
            $this->_outlineDictionary->touch();
            $this->_outlineDictionary->F = new Zend_Pdf_Element_Numeric($isBold? 2 : 0);
        } else {
            $this->_outlineDictionary->F->touch();
            if ($isBold) {
                $this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | 2;
            } else {
                $this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | ~2;
            }
        }
        return $this;
    }

    /**
     * Get outline text color.
     *
     * @return Zend_Pdf_Color_Rgb
     */
    public function getColor()
    {
        if ($this->_outlineDictionary->C === null) {
            return null;
        }

        $components = $this->_outlineDictionary->C->items;

        require_once 'Zend/Pdf/Color/Rgb.php';
        return new Zend_Pdf_Color_Rgb($components[0], $components[1], $components[2]);
    }

    /**
     * Set outline text color.
     * (null means default color which is black)
     *
     * @param Zend_Pdf_Color_Rgb $color
     * @return Zend_Pdf_Outline
     */
    public function setColor(Zend_Pdf_Color_Rgb $color)
    {
        $this->_outlineDictionary->touch();

        if ($color === null) {
            $this->_outlineDictionary->C = null;
        } else {
            $components = $color->getComponents();
            $colorComponentElements = array(new Zend_Pdf_Element_Numeric($components[0]),
                                            new Zend_Pdf_Element_Numeric($components[1]),
                                            new Zend_Pdf_Element_Numeric($components[2]));
            $this->_outlineDictionary->C = new Zend_Pdf_Element_Array($colorComponentElements);
        }

        return $this;
    }

    /**
     * Get outline target.
     *
     * @return Zend_Pdf_Target
     * @throws Zend_Pdf_Exception
     */
    public function getTarget()
    {
        if ($this->_outlineDictionary->Dest !== null) {
            if ($this->_outlineDictionary->A !== null) {
                require_once 'Zend/Pdf/Exception.php';
                throw new Zend_Pdf_Exception('Outline dictionary may contain Dest or A entry, but not both.');
            }

            require_once 'Zend/Pdf/Destination.php';
            return Zend_Pdf_Destination::load($this->_outlineDictionary->Dest);
        } else if ($this->_outlineDictionary->A !== null) {
            require_once 'Zend/Pdf/Action.php';
            return Zend_Pdf_Action::load($this->_outlineDictionary->A);
        }

        return null;
    }

    /**
     * Set outline target.
     * Null means no target
     *
     * @param Zend_Pdf_Target|string $target
     * @return Zend_Pdf_Outline
     * @throws Zend_Pdf_Exception
     */
    public function setTarget($target = null)
    {
        $this->_outlineDictionary->touch();

        if (is_string($target)) {
            require_once 'Zend/Pdf/Destination/Named.php';
            $target = Zend_Pdf_Destination_Named::create($target);
        }

        if ($target === null) {
            $this->_outlineDictionary->Dest = null;
            $this->_outlineDictionary->A    = null;
        } else if ($target instanceof Zend_Pdf_Destination) {
            $this->_outlineDictionary->Dest = $target->getResource();
            $this->_outlineDictionary->A    = null;
        } else if ($target instanceof Zend_Pdf_Action) {
            $this->_outlineDictionary->Dest = null;
            $this->_outlineDictionary->A    = $target->getResource();
        } else {
            require_once 'Zend/Pdf/Exception.php';
            throw new Zend_Pdf_Exception('Outline target has to be Zend_Pdf_Destination or Zend_Pdf_Action object or string');
        }

        return $this;
    }

    /**
     * Set outline options
     *
     * @param array $options
     * @return Zend_Pdf_Actions_Traceable
     * @throws Zend_Pdf_Exception
     */
    public function setOptions(array $options)
    {
        parent::setOptions($options);

        return $this;
    }

    /**
     * Create PDF outline object using specified dictionary
     *
     * @internal
     * @param Zend_Pdf_Element $dictionary (It's actually Dictionary or Dictionary Object or Reference to a Dictionary Object)
     * @param Zend_Pdf_Action  $parentAction
     * @param SplObjectStorage $processedOutlines  List of already processed Outline dictionaries,
     *                                             used to avoid cyclic references
     * @return Zend_Pdf_Action
     * @throws Zend_Pdf_Exception
     */
    public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedDictionaries = null)
    {
        if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
            require_once 'Zend/Pdf/Exception.php';
            throw new Zend_Pdf_Exception('$dictionary mast be an indirect dictionary object.');
        }

        if ($processedDictionaries === null) {
            $processedDictionaries = new SplObjectStorage();
        }
        $processedDictionaries->attach($dictionary);

        $this->_outlineDictionary = $dictionary;

        if ($dictionary->Count !== null) {
            if ($dictionary->Count->getType() != Zend_Pdf_Element::TYPE_NUMERIC) {
                require_once 'Zend/Pdf/Exception.php';
                throw new Zend_Pdf_Exception('Outline dictionary Count entry must be a numeric element.');
            }

            $childOutlinesCount = $dictionary->Count->value;
            if ($childOutlinesCount > 0) {
                $this->_open = true;
            }
            $childOutlinesCount = abs($childOutlinesCount);

            $childDictionary = $dictionary->First;

            $children = new SplObjectStorage();
            while ($childDictionary !== null) {
                // Check children structure for cyclic references
                if ($children->contains($childDictionary)) {
                    require_once 'Zend/Pdf/Exception.php';
                    throw new Zend_Pdf_Exception('Outline childs load error.');
                }

                if (!$processedDictionaries->contains($childDictionary)) {
                    $this->childOutlines[] = new Zend_Pdf_Outline_Loaded($childDictionary, $processedDictionaries);
                }

                $childDictionary = $childDictionary->Next;
            }

            $this->_originalChildOutlines = $this->childOutlines;
        }
    }

    /**
     * Dump Outline and its child outlines into PDF structures
     *
     * Returns dictionary indirect object or reference
     *
     * @internal
     * @param Zend_Pdf_ElementFactory    $factory object factory for newly created indirect objects
     * @param boolean $updateNavigation  Update navigation flag
     * @param Zend_Pdf_Element $parent   Parent outline dictionary reference
     * @param Zend_Pdf_Element $prev     Previous outline dictionary reference
     * @param SplObjectStorage $processedOutlines  List of already processed outlines
     * @return Zend_Pdf_Element
     * @throws Zend_Pdf_Exception
     */
    public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory,
                                                                  $updateNavigation,
                                                 Zend_Pdf_Element $parent,
                                                 Zend_Pdf_Element $prev = null,
                                                 SplObjectStorage $processedOutlines = null)
    {
        if ($processedOutlines === null) {
            $processedOutlines = new SplObjectStorage();
        }
        $processedOutlines->attach($this);

        if ($updateNavigation) {
            $this->_outlineDictionary->touch();

            $this->_outlineDictionary->Parent = $parent;
            $this->_outlineDictionary->Prev   = $prev;
            $this->_outlineDictionary->Next   = null;
        }

        $updateChildNavigation = false;
        if (count($this->_originalChildOutlines) != count($this->childOutlines)) {
            // If original and current children arrays have different size then children list was updated
            $updateChildNavigation = true;
        } else if ( !(array_keys($this->_originalChildOutlines) === array_keys($this->childOutlines)) ) {
            // If original and current children arrays have different keys (with a glance to an order) then children list was updated
            $updateChildNavigation = true;
        } else {
            foreach ($this->childOutlines as $key => $childOutline) {
                if ($this->_originalChildOutlines[$key] !== $childOutline) {
                    $updateChildNavigation = true;
                    break;
                }
            }
        }

        $lastChild = null;
        if ($updateChildNavigation) {
            $this->_outlineDictionary->touch();
            $this->_outlineDictionary->First = null;

            foreach ($this->childOutlines as $childOutline) {
                if ($processedOutlines->contains($childOutline)) {
                    require_once 'Zend/Pdf/Exception.php';
                    throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
                }

                if ($lastChild === null) {
                    // First pass. Update Outlines dictionary First entry using corresponding value
                    $lastChild = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, null, $processedOutlines);
                    $this->_outlineDictionary->First = $lastChild;
                } else {
                    // Update previous outline dictionary Next entry (Prev is updated within dumpOutline() method)
                    $childOutlineDictionary = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, $lastChild, $processedOutlines);
                    $lastChild->Next = $childOutlineDictionary;
                    $lastChild       = $childOutlineDictionary;
                }
            }

            $this->_outlineDictionary->Last  = $lastChild;

            if (count($this->childOutlines) != 0) {
                $this->_outlineDictionary->Count = new Zend_Pdf_Element_Numeric(($this->isOpen()? 1 : -1)*count($this->childOutlines));
            } else {
                $this->_outlineDictionary->Count = null;
            }
        } else {
            foreach ($this->childOutlines as $childOutline) {
                if ($processedOutlines->contains($childOutline)) {
                    require_once 'Zend/Pdf/Exception.php';
                    throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
                }
                $lastChild = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, $lastChild, $processedOutlines);
            }
        }

        return $this->_outlineDictionary;
    }

    public function dump($level = 0)
    {
        printf(":%3d:%s:%s:%s%s  :\n", count($this->childOutlines),$this->isItalic()? 'i':' ', $this->isBold()? 'b':' ', str_pad('', 4*$level), $this->getTitle());

        if ($this->isOpen()  ||  true) {
            foreach ($this->childOutlines as $child) {
                $child->dump($level + 1);
            }
        }
    }
}


text:
var myApp = angular.module('myApp', ['ngRoute']);

myApp.config(function ($routeProvider) {
    $routeProvider
        .when('/', {
            templateUrl: 'pages/main.html',
            controller: 'mainController'
        })

        .when('/second', {
            templateUrl: 'pages/second.html',
            controller: 'secondController'
        })

        .when('/second/:num', {
            templateUrl: 'pages/second.html',
            controller: 'secondController'
        })
});

myApp.directive("searchResult", function () {
    return {
        restrict: 'AECM',
        template: '
Doe, John

555 Main St., New York, NY 11111
',
        replace: true
    }
});

myApp.controller('mainController', ['$scope', '$log', function ($scope, $log) {

}]);

myApp.controller('secondController', ['$scope', '$log', '$routeParams', function ($scope, $log, $routeParams) {

}]);

myApp.controller('xmainController', ['$scope', '$filter', function ($scope, $filter) {

    $scope.handle = '';

    // digets loop is looping through
    $scope.lowercasehandle = function () {
        return $filter('lowercase')($scope.handle);
    };

    // add variable to scope called characters
    $scope.characters = 5;

    // standard
    //  var rulesrequest = new XMLHttpRequest();
    // rulesrequest.onreadystatechange = function () {
    //     $scope.$apply(function () {
    //         if (rulesrequest.readyState == 4 && rulesrequest.status == 200) {
    //             $scope.rules = JSON.parse(rulesrequest.responseText);
    //         }
    //     });
    // }
    // rulesrequest.open("GET", "http://localhost:54765/api", true);
    // rulesrequest.send();

    $scope.rules = [
        { rulename: "Must be 5 characters" },
        { rulename: "Must not be used elsewhere" },
        { rulename: "Must be cool" }
    ]

    // test
    // watch the variable handle
    $scope.$watch('handle', function (newValue, oldValue) {
        //when digest cycle is happening

        //console.info('Changed!');
        //console.log('Old:' + oldValue);
        //console.log('New:' + newValue);

        // every time typing a letter it is running a digest cycle
        // entire digest cycle completes , and updates the DOM

        // angular is taking care of all the manual stuff

        // limitation
    });

    // or pass in  $timeout
    // $timeout(function() { ....    })
    // stick with angular built in stuff and not have to add the manual scope apply

    // javascript timeout fx
    //setTimeout(function(){

    // new thread is started and 3 seconds later

    // $scope.$apply(function () {
    // inside  scope apply  , telling angular to be sure to running
    // normal process
    // without this, it won't update the DOM
    //$scope.handle = "newtwitterhandler";
    //console.log("scope changed");

    //most of time angular wraps scope apply
    // in this case it needs it manually

    // })

    //}, 3000);

}]);

redpajama_set_name: RedPajamaGithub


text:
package jp.fkmsoft.libs.kiilib.entities;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class KiiClause {

    public static KiiClause all() {
        return new KiiClause(TYPE_ALL);
    }

    public static <T> KiiClause equals(String field, T value) {
        KiiClause clause = new KiiClause(TYPE_EQUAL);
        try {
            clause.json.put(FIELD_FIELD, field);
            clause.json.put(FIELD_VALUE, value);
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    public static <T> KiiClause greaterThan(String field, T value, boolean included) {
        KiiClause clause = new KiiClause(TYPE_RANGE);
        try {
            clause.json.put(FIELD_FIELD, field);
            clause.json.put(FIELD_LOWER_LIMIT, value);
            clause.json.put(FIELD_LOWER_INCLUDED, included);
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    public static <T> KiiClause lessThan(String field, T value, boolean included) {
        KiiClause clause = new KiiClause(TYPE_RANGE);
        try {
            clause.json.put(FIELD_FIELD, field);
            clause.json.put(FIELD_UPPER_LIMIT, value);
            clause.json.put(FIELD_UPPER_INCLUDED, included);
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    public static KiiClause geoBox(String field, double nwLat, double nwLon, double seLat, double seLon) {
        KiiClause clause = new KiiClause(TYPE_GEO_BOX);
        try {
            clause.json.put(FIELD_FIELD, field);
            clause.json.put(FIELD_BOX, createBox(createPoint(nwLat, nwLon), createPoint(seLat, seLon)));
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    public static KiiClause geoDistance(String field, double centerLat, double centerLon, double radius) {
        KiiClause clause = new KiiClause(TYPE_GEO_DISTANCE);
        try {
            clause.json.put(FIELD_FIELD, field);
            clause.json.put(FIELD_CENTER, createPoint(centerLat, centerLon));
            clause.json.put(FIELD_RADIUS, radius);
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    private static JSONObject createBox(JSONObject northWest, JSONObject southEast) {
        JSONObject json = new JSONObject();
        try {
            json.put(FIELD_NORTH_WEST, northWest);
            json.put(FIELD_SOUTH_EAST, southEast);
        } catch (JSONException e) {
            // nop
        }

        return json;
    }

    private static JSONObject createPoint(double latitude, double longitude) {
        JSONObject json = new JSONObject();
        try {
            json.put("_type", "point");
            json.put(FIELD_LATITUDE, latitude);
            json.put(FIELD_LONGITUDE, longitude);
        } catch (JSONException e) {
            // nop
        }
        return json;
    }

    public static KiiClause and(KiiClause... clauses) {
        KiiClause clause = new KiiClause(TYPE_AND);

        try {
            clause.json.put(FIELD_CLAUSES, toClauseArray(clauses));
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    public static KiiClause or(KiiClause... clauses) {
        KiiClause clause = new KiiClause(TYPE_OR);

        try {
            clause.json.put(FIELD_CLAUSES, toClauseArray(clauses));
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    private static JSONArray toClauseArray(KiiClause[] clauses) {
        JSONArray array = new JSONArray();
        for (KiiClause item : clauses) {
            array.put(item.toJson());
        }
        return array;
    }

    public static KiiClause in(String field, String... values) {
        KiiClause clause = new KiiClause(TYPE_IN);

        try {
            JSONArray array = new JSONArray();
            for (String value : values) {
                array.put(value);
            }

            clause.json.put(FIELD_FIELD, field);
            clause.json.put(FIELD_VALUES, array);
        } catch (JSONException e) {
            // nop
        }

        return clause;
    }

    private static final String FIELD_TYPE = "type";
    private static final String FIELD_FIELD = "field";
    private static final String FIELD_VALUE = "value";
    private static final String FIELD_VALUES = "values";
    private static final String FIELD_LOWER_LIMIT = "lowerLimit";
    private static final String FIELD_LOWER_INCLUDED = "lowerIncluded";
    private static final String FIELD_UPPER_LIMIT = "upperLimit";
    private static final String FIELD_UPPER_INCLUDED = "upperIncluded";
    private static final String FIELD_BOX = "box";
    private static final String FIELD_NORTH_WEST = "nw";
    private static final String FIELD_SOUTH_EAST = "se";
    private static final String FIELD_CENTER = "center";
    private static final String FIELD_RADIUS = "radius";
    private static final String FIELD_LATITUDE = "lat";
    private static final String FIELD_LONGITUDE = "lon";
    private static final String FIELD_CLAUSES = "clauses";

    private static final String TYPE_ALL = "all";
    private static final String TYPE_EQUAL = "eq";
    private static final String TYPE_AND = "and";
    private static final String TYPE_OR = "or";
    private static final String TYPE_IN = "in";
    private static final String TYPE_RANGE = "range";
    private static final String TYPE_GEO_BOX = "geobox";
    private static final String TYPE_GEO_DISTANCE = "geodistance";

    private final JSONObject json = new JSONObject();

    private KiiClause(String type) {
        try {
            json.put(FIELD_TYPE, type);
        } catch (JSONException e) {
            /* nop */
        }
    }

    public JSONObject toJson() {
        return json;
    }
}


text:
using System;
using System.Collections.Generic;
using Itinero.Logging;
using Itinero.Optimization.Models.Mapping;
using Itinero.Optimization.Solvers.TSP.EAX;

namespace Itinero.Optimization.Solvers.TSP
{
    /// <summary>
    /// Hooks the TSP solvers into the solver registry.
    /// </summary>
    internal static class TSPSolverHook
    {
        /// <summary>
        /// The default solver hook for the TSP.
        /// </summary>
        public static readonly SolverRegistry.SolverHook Default = new SolverRegistry.SolverHook()
        {
            Name = "TSP",
            TrySolve = TSPSolverHook.Solve
        };

        private static Result<IEnumerable<(int vehicle, IEnumerable<int> tour)>> Solve(MappedModel model,
            Action<IEnumerable<(int vehicle, IEnumerable<int>)>> intermediateResult)
        {
            var tsp = model.TryToTSP();
            if (tsp.IsError)
            {
                return tsp.ConvertError<IEnumerable<(int vehicle, IEnumerable<int> tour)>>();
            }

            // use a default solver to solve the TSP here.
            try
            {
                var solution = EAXSolver.Default.Search(tsp.Value);
                return new Result<IEnumerable<(int vehicle, IEnumerable<int> tour)>>(
                    (new (int vehicle, IEnumerable<int> tour) [] { (0, solution.Solution) }));
            }
            catch (Exception ex)
            {
                Logger.Log($"{typeof(TSPSolverHook)}.{nameof(Solve)}", TraceEventType.Critical, $"Unhandled exception: {ex.ToString()}.");
                return new Result<IEnumerable<(int vehicle, IEnumerable<int> tour)>>($"Unhandled exception: {ex.ToString()}.");
            }
        }

        /// <summary>
        /// Converts the given abstract model to a TSP.
        /// </summary>
        internal static Result<TSProblem> TryToTSP(this MappedModel model)
        {
            if (!model.IsTSP(out var reasonWhenFailed))
            {
                return new Result<TSProblem>($"Model is not a TSP: {reasonWhenFailed}");
            }

            var vehicle = model.VehiclePool.Vehicles[0];
            var metric = vehicle.Metric;
            if (!model.TryGetTravelCostsForMetric(metric, out var weights))
            {
                throw new Exception("Travel costs not found but model was declared valid.");
            }
            var first = 0;
            int? last = null;
            if (vehicle.Departure.HasValue)
            {
                first = vehicle.Departure.Value;
            }
            if (vehicle.Arrival.HasValue)
            {
                last = vehicle.Arrival.Value;
            }
            return new Result<TSProblem>(new TSProblem(first, last, weights.Costs));
        }

        private static bool IsTSP(this MappedModel model, out string reasonIfNot)
        {
            if (model.VehiclePool.Reusable ||
                model.VehiclePool.Vehicles.Length > 1)
            {
                reasonIfNot = "More than one vehicle or vehicle reusable.";
                return false;
            }
            var vehicle = model.VehiclePool.Vehicles[0];
            if (vehicle.TurnPentalty != 0)
            {
                reasonIfNot = "Turning penalty, this is a directed problem.";
                return false;
            }
            if (vehicle.CapacityConstraints != null &&
                vehicle.CapacityConstraints.Length > 0)
            {
                reasonIfNot = "At least one capacity constraint was found.";
                return false;
            }
            foreach (var visit in model.Visits)
            {
                if (visit.TimeWindow == null || visit.TimeWindow.IsEmpty) continue;
                reasonIfNot = "Timewindows detected.";
                return false;
            }

            reasonIfNot = string.Empty;
            return true;
        }
    }
}


text:
/**
 * This file is the main entrypoint for the web application and is used to
 * render the 'root' element of index.html.
 */

import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
import * as serviceWorker from './serviceWorker';

import App from './components/App';
import './styles/style.css';

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();


text:
package com.barentine.totalconnect.ws;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="GetPartnerVideoURLResult" type="{https://services.alarmnet.com/TC2/}GetPartnerVideoURLResult" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "getPartnerVideoURLResult"
})
@XmlRootElement(name = "GetPartnerVideoURLResponse")
public class GetPartnerVideoURLResponse {

    @XmlElement(name = "GetPartnerVideoURLResult")
    protected GetPartnerVideoURLResult getPartnerVideoURLResult;

    /**
     * Gets the value of the getPartnerVideoURLResult property.
     *
     * @return
     *     possible object is
     *     {@link GetPartnerVideoURLResult }
     *
     */
    public GetPartnerVideoURLResult getGetPartnerVideoURLResult() {
        return getPartnerVideoURLResult;
    }

    /**
     * Sets the value of the getPartnerVideoURLResult property.
     *
     * @param value
     *     allowed object is
     *     {@link GetPartnerVideoURLResult }
     *
     */
    public void setGetPartnerVideoURLResult(GetPartnerVideoURLResult value) {
        this.getPartnerVideoURLResult = value;
    }

}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>App Engine Python SDK: google.appengine._internal.graphy.common.DataSeries Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="common.css" rel="stylesheet" type="text/css"/>

App Engine Python SDK
    v1.6.9 rev.445

The Python runtime is available as an experimental Preview feature.

google

appengine

_internal

graphy

common

DataSeries

Public Member Functions |
Public Attributes |
Properties |
List of all members

google.appengine._internal.graphy.common.DataSeries Class Reference

Inheritance diagram for google.appengine._internal.graphy.common.DataSeries:

  <map id="google.appengine._internal.graphy.common.DataSeries_map" name="google.appengine._internal.graphy.common.DataSeries_map">
<area href="classgoogle_1_1appengine_1_1__internal_1_1graphy_1_1pie__chart_1_1_segment.html" alt="google.appengine._internal.graphy.pie_chart.Segment" shape="rect" coords="0,112,326,136"/>
</map>

Public Member Functions

def 	__init__

Public Attributes

 	data

 	style

 	markers

 	label

Properties

 	color = property(_GetColor, _SetColor)

Detailed Description

Represents one data series for a chart (both data & presentation
information).

Object attributes:
  points:  List of numbers representing y-values (x-values are not specified
           because the Google Chart API expects even x-value spacing).
  label:   String with the series' label in the legend.  The chart will only
           have a legend if at least one series has a label.  If some series
           do not have a label then they will have an empty description in
           the legend.  This is currently a limitation in the Google Chart
           API.
  style:   A chart-type-specific style object.  (LineStyle for LineChart,
           BarsStyle for BarChart, etc.)
  markers: List of (x, m) tuples where m is a Marker object and x is the
           x-axis value to place it at.

           The "fill" markers ('r' & 'b') are a little weird because they
           aren't a point on a line.  For these, you can fake it by
           passing slightly weird data (I'd like a better API for them at
           some point):
             For 'b', you attach the marker to the starting series, and set x
             to the index of the ending line.  Size is ignored, I think.

             For 'r', you can attach to any line, specify the starting
             y-value for x and the ending y-value for size.  Y, in this case,
             is becase 0.0 (bottom) and 1.0 (top).
  color:   DEPRECATED

Constructor & Destructor Documentation

          def google.appengine._internal.graphy.common.DataSeries.__init__
          (

          self,

          points,

          label = None,

          style = None,

          markers = None,

          color = None

          )

Construct a DataSeries.  See class docstring for details on args.

The documentation for this class was generated from the following file:

code/googleappengine-read-only/python/google/appengine/_internal/graphy/common.py

<address class="footer">
    Maintained by tzmartin
</address>


text:
<?php
namespace phootwork\collection\tests\fixtures;

class DummyIteratorClass implements \Iterator {

	private $collection;

	public function __construct($contents = []) {
		$this->collection = $contents;
	}

	/**
	 * @internal
	 */
	public function rewind() {
		return reset($this->collection);
	}

	/**
	 * @internal
	 */
	public function current() {
		return current($this->collection);
	}

	/**
	 * @internal
	 */
	public function key() {
		return key($this->collection);
	}

	/**
	 * @internal
	 */
	public function next() {
		return next($this->collection);
	}

	/**
	 * @internal
	 */
	public function valid() {
		return key($this->collection) !== null;
	}
}


text:
import { thumbnail, tileViewport, getStyle } from "../src/styles";
import { ImageExtended } from "../src";

const baseItem: ImageExtended = {
  src: "",
  isSelected: false,
  width: 100,
  height: 100,
  scaledWidth: 100,
  scaledHeight: 100,
  marginLeft: 0,
  viewportWidth: 100,
};

describe("styles", () => {
  describe("thumbnail", () => {
    it("should add transform property based on item.orientation", () => {
      const item = { ...baseItem, orientation: 3 };

      const result = thumbnail({ item });

      expect(result.transform).toEqual("rotate(180deg)");
    });

    it("should return styles when image is not selected", () => {
      const result = thumbnail({ item: baseItem });

      expect(result).toEqual({
        cursor: "pointer",
        maxWidth: "none",
        height: 100,
        marginLeft: 0,
        marginTop: 0,
        width: 100,
      });
    });

    it("should return styles when image is horizontal and selected", () => {
      const item = {
        ...baseItem,
        scaledWidth: 200,
        viewportWidth: 200,
        isSelected: true,
      };

      const result = thumbnail({ item });

      expect(result).toEqual({
        cursor: "pointer",
        maxWidth: "none",
        height: 84,
        marginLeft: 0,
        marginTop: -8,
        width: 168,
      });
    });

    it("should return styles when image is vertical and selected", () => {
      const item = {
        ...baseItem,
        scaledWidth: 50,
        viewportWidth: 50,
        isSelected: true,
      };

      const result = thumbnail({ item });

      expect(result).toEqual({
        cursor: "pointer",
        maxWidth: "none",
        height: 68,
        marginLeft: -8,
        marginTop: 0,
        width: 34,
      });
    });
  });

  describe("tileViewport", () => {
    it("should add background properties based on item.nano", () => {
      const item = { ...baseItem, nano: "data:image/png;base64" };

      const result = tileViewport({ item });

      expect(result).toEqual(
        expect.objectContaining({
          background: "url(data:image/png;base64)",
          backgroundSize: "cover",
          backgroundPosition: "center center",
        })
      );
    });

    it("should return styles when item is not selected", () => {
      const result = tileViewport({ item: baseItem });

      expect(result).toEqual({
        height: 100,
        overflow: "hidden",
        width: 100,
      });
    });

    it("should return styles when item is selected", () => {
      const item = { ...baseItem, isSelected: true };

      const result = tileViewport({ item });

      expect(result).toEqual({
        height: 68,
        margin: 16,
        overflow: "hidden",
        width: 68,
      });
    });
  });

  describe("getStyle", () => {
    it("should return styles provided by style prop function", () => {
      const styleProp = () => ({ display: "flex" });
      const fallback = () => ({ display: "none" });

      const style = getStyle(styleProp, fallback, { item: baseItem });

      expect(style).toEqual({ display: "flex" });
    });

    it("should return styles provided by style prop object", () => {
      const styleProp = { display: "flex" };
      const fallback = () => ({ display: "none" });

      const style = getStyle(styleProp, fallback, { item: baseItem });

      expect(style).toEqual({ display: "flex" });
    });

    it("should return styles provided by style fallback function", () => {
      const fallback = () => ({ display: "none" });

      const style = getStyle(undefined, fallback, { item: baseItem });

      expect(style).toEqual({ display: "none" });
    });
  });
});


text:
<?php

use Sunlight\Page\Page;
use Sunlight\Util\Form;

defined('SL_ROOT') or exit;

$type = Page::GROUP;
require SL_ROOT . 'admin/action/modules/include/page-editscript-init.php';

if ($continue) {
    $custom_settings = '

<input type="checkbox" name="var1" value="1"' . Form::activateCheckbox($query['var1']) . '> ' . _lang('admin.content.form.showinfo') . '

  ';
    $custom_save_array = [
        'var1' => ['type' => 'bool', 'nullable' => false],
    ];
}

require SL_ROOT . 'admin/action/modules/include/page-editscript.php';


text:
package com.abroad.uc.vo;

import java.io.Serializable;

import com.abroad.common.vo.OperateVO;

/**
* @ClassName: RoleVO
* @Description: TODO(这里用一句话描述这个类的作用)
* @author: mengxr
* @date 2017年4月21日 下午4:40:02
*/
public class RoleVO implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;//角色主键
	private String code;//角色编码
	private String name;//角色名称
	private Short type;//角色类型
	private Long groupId;//用户所在集团
	private Long orgId;//用户所在组织
	private String note;//备注
	private OperateVO ope;//操作VO
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Short getType() {
		return type;
	}
	public void setType(Short type) {
		this.type = type;
	}
	public Long getGroupId() {
		return groupId;
	}
	public void setGroupId(Long groupId) {
		this.groupId = groupId;
	}
	public Long getOrgId() {
		return orgId;
	}
	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	public OperateVO getOpe() {
		return ope;
	}
	public void setOpe(OperateVO ope) {
		this.ope = ope;
	}
}


text:
package core

// Plugin interface defines plugin's basic life-cycle methods.
type Plugin interface {
	// Init is called in the agent`s startup phase.
	Init() error
	// Close is called in the agent`s cleanup phase.
	Close() error
}

// PostInit interface defines an optional method for plugins with complex initialization.
type PostInit interface {
	// AfterInit is called once Init() of all plugins have returned without error.
	AfterInit() error
}


text:
'use strict';

// Configuring the Articles module
angular.module('projects').run(['Menus',
	function(Menus) {
		// Set top bar menu items
		Menus.addMenuItem('topbar', 'Projects', 'projects');

	}
]);


text:
package io.scif;

import org.scijava.service.Service;

/**
 * Exception thrown when there is an object instantiation error or error
 * processing dependencies.
 *
 * @author Chris Allan
 */
public class DependencyException extends Exception {

	/** Serial for this version. */
	public static final long serialVersionUID = -7836244849086491562L;

	/** The class that was used in a failed instantiation. */
	private Class<? extends Service> failureClass;

	/**
	 * Default constructor.
	 *
	 * @param message Error message.
	 */
	public DependencyException(final String message) {
		super(message);
	}

	/**
	 * Default constructor.
	 *
	 * @param message Error message.
	 * @param klass Failed instantiation class.
	 */
	public DependencyException(final String message,
		final Class<? extends Service> klass)
	{
		super(message);
		this.failureClass = klass;
	}

	/**
	 * Default constructor.
	 *
	 * @param message Error message.
	 * @param klass Failed instantiation class.
	 * @param cause Upstream exception.
	 */
	public DependencyException(final String message,
		final Class<? extends Service> klass, final Throwable cause)
	{
		super(message, cause);
		this.failureClass = klass;
	}

	/**
	 * Default constructor.
	 *
	 * @param cause Upstream exception.
	 */
	public DependencyException(final Throwable cause) {
		super(cause);
	}

	/**
	 * Returns the class that was used during a failed instantiation.
	 *
	 * @return See above.
	 */
	public Class<? extends Service> getFailureClass() {
		return failureClass;
	}

	@Override
	public String toString() {
		if (failureClass == null) {
			return getMessage();
		}
		return getMessage() + " for " + failureClass;
	}
}


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.5
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package rhcad.touchvg.core;

public final class MgContextAction {
  public final static MgContextAction kMgActionInvalid = new MgContextAction("kMgActionInvalid", 0);
  public final static MgContextAction kMgActionSelAll = new MgContextAction("kMgActionSelAll", 1);
  public final static MgContextAction kMgActionSelReset = new MgContextAction("kMgActionSelReset", 2);
  public final static MgContextAction kMgActionDraw = new MgContextAction("kMgActionDraw", 3);
  public final static MgContextAction kMgActionCancel = new MgContextAction("kMgActionCancel", 4);
  public final static MgContextAction kMgActionDelete = new MgContextAction("kMgActionDelete", 5);
  public final static MgContextAction kMgActionClone = new MgContextAction("kMgActionClone", 6);
  public final static MgContextAction kMgActionFixedLength = new MgContextAction("kMgActionFixedLength", 7);
  public final static MgContextAction kMgActionFreeLength = new MgContextAction("kMgActionFreeLength", 8);
  public final static MgContextAction kMgActionLocked = new MgContextAction("kMgActionLocked", 9);
  public final static MgContextAction kMgActionUnlocked = new MgContextAction("kMgActionUnlocked", 10);
  public final static MgContextAction kMgActionEditVertex = new MgContextAction("kMgActionEditVertex", 11);
  public final static MgContextAction kMgActionHideVertex = new MgContextAction("kMgActionHideVertex", 12);
  public final static MgContextAction kMgActionClosed = new MgContextAction("kMgActionClosed", 13);
  public final static MgContextAction kMgActionOpened = new MgContextAction("kMgActionOpened", 14);
  public final static MgContextAction kMgActionAddVertex = new MgContextAction("kMgActionAddVertex", 15);
  public final static MgContextAction kMgActionDelVertex = new MgContextAction("kMgActionDelVertex", 16);
  public final static MgContextAction kMgActionGroup = new MgContextAction("kMgActionGroup", 17);
  public final static MgContextAction kMgActionUngroup = new MgContextAction("kMgActionUngroup", 18);
  public final static MgContextAction kMgActionOverturn = new MgContextAction("kMgActionOverturn", 19);
  public final static MgContextAction kMgActionCustomized = new MgContextAction("kMgActionCustomized", 100);

  public final int swigValue() {
    return swigValue;
  }

  public String toString() {
    return swigName;
  }

  public static MgContextAction swigToEnum(int swigValue) {
    if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
      return swigValues[swigValue];
    for (int i = 0; i < swigValues.length; i++)
      if (swigValues[i].swigValue == swigValue)
        return swigValues[i];
    throw new IllegalArgumentException("No enum " + MgContextAction.class + " with value " + swigValue);
  }

  private MgContextAction(String swigName) {
    this.swigName = swigName;
    this.swigValue = swigNext++;
  }

  private MgContextAction(String swigName, int swigValue) {
    this.swigName = swigName;
    this.swigValue = swigValue;
    swigNext = swigValue+1;
  }

  private MgContextAction(String swigName, MgContextAction swigEnum) {
    this.swigName = swigName;
    this.swigValue = swigEnum.swigValue;
    swigNext = this.swigValue+1;
  }

  private static MgContextAction[] swigValues = { kMgActionInvalid, kMgActionSelAll, kMgActionSelReset, kMgActionDraw, kMgActionCancel, kMgActionDelete, kMgActionClone, kMgActionFixedLength, kMgActionFreeLength, kMgActionLocked, kMgActionUnlocked, kMgActionEditVertex, kMgActionHideVertex, kMgActionClosed, kMgActionOpened, kMgActionAddVertex, kMgActionDelVertex, kMgActionGroup, kMgActionUngroup, kMgActionOverturn, kMgActionCustomized };
  private static int swigNext = 0;
  private final int swigValue;
  private final String swigName;
}


text:
package net.liftweb
package util

import javax.mail.internet.{MimeMessage, MimeMultipart}

import org.specs2.mutable.Specification

import common._

/**
 * Systems under specification for Lift Mailer.
 */
object MailerSpec extends Specification {
  "Mailer Specification".title
  sequential

  MyMailer.touch()

  import MyMailer._

  private def doNewMessage(f: => Unit): MimeMessage = {
    lastMessage = Empty

    val ignore = f

    MailerSpec.this.synchronized {
      while (lastMessage.isEmpty) {
        MailerSpec.this.wait(100)
      }
      lastMessage.open_!
    }
  }

  "A Mailer" should {

    "deliver simple messages as simple messages" in {
      val msg = doNewMessage {
        sendMail(
          From("sender@nowhere.com"),
          Subject("This is a simple email"),
          To("recipient@nowhere.com"),
          PlainMailBodyType("Here is some plain text.")
        )
      }

      msg.getContent match {
        case s: String => true must_== true
        case x => failure("The simple message has content type of " + x.getClass.getName)
      }
    }

    "deliver multipart messages as multipart" in {
      val msg = doNewMessage {
        sendMail(
          From("sender@nowhere.com"),
          Subject("This is a multipart email"),
          To("recipient@nowhere.com"),
          PlainMailBodyType("Here is some plain text."),
          PlainMailBodyType("Here is some more plain text.")
        )
      }

      msg.getContent match {
        case mp: MimeMultipart => true must_== true
        case x => failure("The complex message has content type of " + x.getClass.getName)
      }
    }

    "deliver rich messages as multipart" in {
      val msg = doNewMessage {
        sendMail(
          From("sender@nowhere.com"),
          Subject("This is a rich email"),
          To("recipient@nowhere.com"),
          XHTMLMailBodyType(<html> <body>Here is some rich text</body> </html>)
        )
      }

      msg.getContent match {
        case mp: MimeMultipart => true must_== true
        case x => failure("The complex message has content type of " + x.getClass.getName)
      }
    }
  }
}

object MyMailer extends Mailer {
    @volatile var lastMessage: Box[MimeMessage] = Empty

   testModeSend.default.set((msg: MimeMessage) => {
     lastMessage = Full(msg)
//     MailerSpec.this.notifyAll()
   })

  def touch() {
    Props.testMode
    Thread.sleep(10)
  } // do nothing, but force initialization of this class
}


text:
'use strict';

/* jasmine specs for controllers go here */

describe('controllers', function(){
  beforeEach(module('myApp.controllers'));

  it('should ....', inject(function($controller) {
    //spec body
    var myCtrl1 = $controller('MyCtrl1', { $scope: {} });
    expect(myCtrl1).toBeDefined();
  }));

  it('should ....', inject(function($controller) {
    //spec body
    var myCtrl2 = $controller('MyCtrl2', { $scope: {} });
    expect(myCtrl2).toBeDefined();
  }));
});


text:
class GitHubSearch
  include PageObject

  page_url 'github.com/search'
  expected_title 'Search · GitHub'

  # Form fields
  text_field :search_box, name: 'q'
  button :search, text: 'Search'
  select_list :type, name: 'type'
  select_list :language, id: 'language'

  def search_for(query)
    self.search_box = query
    search
  end
end


text:
The [libinput library provise software button debouncing](
https://wayland.freedesktop.org/libinput/doc/latest/button-debouncing.html)
on Linux. However, this can sometimes cause issues when running macros on
devices. It's possible do disable this feature for a device using [device
quirks](https://wayland.freedesktop.org/libinput/doc/latest/device-quirks.html).

To disable software debouncing on a keyplus device create, create the file
[`/etc/libinput/local-overrides.quirks`](../host-software/etc/libinput)
with the following contents.

```
[keyplus mouse]
MatchUdevType=mouse
MatchBus=usb
MatchVendor=0x1209
MatchProduct=0xBB00
ModelBouncingKeys=1

[keyplus keyboard]
MatchUdevType=keyboard
MatchBus=usb
MatchVendor=0x1209
MatchProduct=0xBB00
ModelBouncingKeys=1
```

Then run `sudo udevadm hwdb --update` and reboot the system for the settings
to take effect.


text:
(function($) {

	/**
	 * There is no constructor function for me.input.
	 * @namespace me.input
	 * @memberOf me
	 */
	me.input = (function() {

		// hold public stuff in our singleton
		var obj = {};

		/*---------------------------------------------

			PRIVATE STUFF

		  ---------------------------------------------*/

		// list of binded keys
		var KeyBinding = {};

		// corresponding actions
		var keyStatus = {};

		// lock enable flag for keys
		var keyLock = {};
		// actual lock status of each key
		var keyLocked = {};

		// some usefull flags
		var keyboardInitialized = false;
		var mouseInitialized = false;
		var accelInitialized = false;

	    // list of supported mouse & touch events
		var mouseEventList = [  'mousewheel',   'mousemove',        'mousedown',    'mouseup',      'click',    'dblclick'];
		var touchEventList = [  undefined,      'touchmove',        'touchstart',   'touchend',     'tap' ,     'dbltap'];
		var pointerEventList = [undefined,      'MSPointerMove',    'MSPointerDown', 'MSPointerUp', 'MSGestureTap']

		/**
		 * enable keyboard event
		 * @ignore
		 */

		function enableKeyboardEvent() {
			if (!keyboardInitialized) {
				$.addEventListener('keydown', keydown, false);
				$.addEventListener('keyup', keyup, false);
				keyboardInitialized = true;
			}
		}

		/**
		 * enable mouse event
		 * @ignore
		 */
		function enableMouseEvent() {
			if (!mouseInitialized) {
				// initialize mouse pos (0,0)
				obj.touches.push({ x: 0, y: 0 });
				obj.mouse.pos = new me.Vector2d(0,0);
				// get relative canvas position in the page
				obj.mouse.offset = me.video.getPos();

			    // MSPointer can hold Mouse & Touch events
				if (window.navigator.msPointerEnabled) {
				    me.video.getScreenCanvas().addEventListener('MSPointerMove', onMSPointerMove, false);
				    for (var x = 2; x < pointerEventList.length; ++x) {
				        me.video.getScreenCanvas().addEventListener(pointerEventList[x], onMSPointerEvent, false);
				    }
                    // Add MSGesture support.
				    var Gesture = new MSGesture();
				    Gesture.target = me.video.getScreenCanvas();
				    me.video.getScreenCanvas().addEventListener("MSGestureTap", onMSPointerEvent, false);
				} else {
                    // Regular events for non-ms devices
				    if (me.sys.touch) {
				        me.video.getScreenCanvas().addEventListener('touchmove', onMouseMove, false);
				        for (var x = 2; x < touchEventList.length; ++x) {
				            me.video.getScreenCanvas().addEventListener(touchEventList[x], onTouchEvent, false);
				        }
				    } else {
				        me.video.getScreenCanvas().addEventListener('mousemove', onMouseMove, false);
				        $.addEventListener('mousewheel', onMouseWheel, false);
				        for (var x = 2; x < mouseEventList.length; ++x) {
				            me.video.getScreenCanvas().addEventListener(mouseEventList[x], onMouseEvent, false);
				        }
				    }
				}
				mouseInitialized = true;
			}
		}

		/**
		 * prevent event propagation
		 * @ignore
		 */
		function preventDefault(e) {
			// stop event propagation
			if (e.stopPropagation) {
				e.stopPropagation();
			}
			else {
				e.cancelBubble = true;
			}
			// stop event default processing
			if (e.preventDefault)  {
				e.preventDefault();
			}
			else  {
				e.returnValue = false;
			}

			return false;
		}

		/**
		 * key down event
		 * @ignore
		 */
		function keydown(e, keyCode) {

			var action = KeyBinding[keyCode || e.keyCode || e.which];

			if (action) {
				if (!keyLocked[action]) {
					keyStatus[action] = true;
					// lock the key if requested
					keyLocked[action] = keyLock[action];

					// publish a message for keydown event
					me.event.publish(me.event.KEYDOWN, [ action ]);
				}
				// prevent event propagation
				return preventDefault(e);
			}

			return true;
		}

		/**
		 * key up event
		 * @ignore
		 */
		function keyup(e, keyCode) {

			var action = KeyBinding[keyCode || e.keyCode || e.which];

			if (action) {

				keyStatus[action] = false;
				keyLocked[action] = false;

				// publish message for keyup event
				me.event.publish(me.event.KEYUP, [ action ]);

				// prevent the event propagation
				return preventDefault(e);
			}

			return true;
		}

		/**
		 * propagate mouse event to registed object
		 * @ignore
		 */
		function dispatchMouseEvent(e) {
			var handled = false;
			var handlers = obj.mouse.handlers[e.type];
			if (handlers) {
				var vpos = me.game.viewport.pos;
				var map_pos = me.game.currentLevel.pos;
				for(var t=0, l=obj.touches.length; t<l; t++) {
					// cache the x/y coordinates
					var x = obj.touches[t].x;
					var y = obj.touches[t].y;
					for (var i = handlers.length, handler; i--, handler = handlers[i];) {
						// adjust to world coordinates if not a floating object
						if (handler.floating===false) {
							var v = {x: x + vpos.x - map_pos.x, y: y + vpos.y - map_pos.y };
						} else {
							var v = {x: x, y: y};
						}
						// call the defined handler
						if ((handler.rect === null) || handler.rect.containsPoint(v)) {
							// trigger the corresponding callback
							if (handler.cb(e) === false) {
								// stop propagating the event if return false
								handled = true;
								break;
							}
						}
					}
				}
			}

			return handled;
		}

		/**
		 * translate Mouse Coordinates
		 * @ignore
		 */
		function updateCoordFromEvent(e) {

			// reset the touch array cache
			obj.touches.length=0;
			// non touch event (mouse)
			if (!e.touches) {
				var offset = obj.mouse.offset;
				var x = e.pageX - offset.x;
				var y = e.pageY - offset.y;
				var scale = me.sys.scale;
				if (scale.x != 1.0 || scale.y != 1.0) {
					x/=scale.x;
					y/=scale.y;
				}
				obj.touches.push({ x: x, y: y, id: 0});
			}
			// touch event
			else {
				var offset = obj.mouse.offset;
				for(var i=0, l=e.changedTouches.length; i<l; i++) {
					var t = e.changedTouches[i];
					var x = t.clientX - offset.x;
					var y = t.clientY - offset.y;
					var scale = me.sys.scale;
					if (scale.x != 1.0 || scale.y != 1.0) {
						x/=scale.x;
						y/=scale.y;
					}
					obj.touches.push({ x: x, y: y, id: t.identifier });
				}
			}
			obj.mouse.pos.set(obj.touches[0].x,obj.touches[0].y);
		}

		/**
		 * mouse event management (mousewheel)
		 * @ignore
		 */
		function onMouseWheel(e) {
			if (e.target == me.video.getScreenCanvas()) {
				// dispatch mouse event to registered object
				if (dispatchMouseEvent(e)) {
					// prevent default action
					return preventDefault(e);
				}
			}

			return true;
		}

		/**
		 * mouse event management (mousemove)
		 * @ignore
		 */
		function onMouseMove(e) {
			// update position
			updateCoordFromEvent(e);
			// dispatch mouse event to registered object
			if (dispatchMouseEvent(e)) {
				// prevent default action
				return preventDefault(e);
			}

			return true;
		}

		/**
		 * mouse event management (mousedown, mouseup)
		 * @ignore
		 */
		function onMouseEvent(e) {
			// dispatch event to registered objects
			if (dispatchMouseEvent(e)) {
				// prevent default action
				return preventDefault(e);
			}

			// in case of touch event button is undefined
			var keycode = obj.mouse.bind[e.button || 0];

			// check if mapped to a key
			if (keycode) {
				if (e.type === 'mousedown' || e.type === 'touchstart')
					return keydown(e, keycode);
				else // 'mouseup' or 'touchend'
					return keyup(e, keycode);
			}

			return true;
		}

		/**
		 * mouse event management (touchstart, touchend)
		 * @ignore
		 */
		function onTouchEvent(e) {
			// update the new touch position
			updateCoordFromEvent(e);
			// reuse the mouse event function
			return onMouseEvent(e);
		}

		function onMSPointerEvent(e) {
		    if (e.pointerType == e.MSPOINTER_TYPE_TOUCH)
		        return onTouchEvent(e);
		    return onMouseEvent(e);
		}

		function onMSPointerMove(e) {
		    return onMouseMove(e);
		}

		/**
		 * event management (Accelerometer)
		 * http://www.mobilexweb.com/samples/ball.html
		 * http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
		 * @ignore
		 */
		function onDeviceMotion(e) {
			// Accelerometer information
			obj.accel = e.accelerationIncludingGravity;
		}

		/*---------------------------------------------

			PUBLIC STUFF

		  ---------------------------------------------*/

		/**
		 * Accelerometer information

		 * properties : x, y, z
		 * @public
		 * @enum {number}
		 * @name accel
		 * @memberOf me.input
		 */
		obj.accel = {
			x: 0,
			y: 0,
			z: 0
		};

		/**
		 * Mouse information

		 * properties :

		 * pos (me.Vector2d) : pointer position (in screen coordinates)

		 * LEFT : constant for left button

		 * MIDDLE : constant for middle button

		 * RIGHT : constant for right button

		 * @public
		 * @enum {number}
		 * @name mouse
		 * @memberOf me.input
		 */
		 obj.mouse = {
			// mouse position
			pos : null,
			// canvas offset
			offset : null,
			// button constants (W3C)
			LEFT:	0,
			MIDDLE: 1,
			RIGHT:	2,
			// bind list for mouse buttons
			bind: [ 0, 0, 0 ],
			handlers:{}
		};

		/**
		 * Array of object containing touch information

		 * properties :

		 * x : x position of the touch event in the canvas (screen coordinates)

		 * y : y position of the touch event in the canvas (screen coordinates)

		 * id : unique finger identifier

		 * @public
		 * @type Array
		 * @name touches
		 * @memberOf me.input
		 */
		obj.touches = [];

		/**
		 * list of mappable keys :
		 * LEFT, UP, RIGHT, DOWN, ENTER, SHIFT, CTRL, ALT, PAUSE, ESC, ESCAPE, [0..9], [A..Z]
		 * @public
		 * @enum {number}
		 * @name KEY
		 * @memberOf me.input
		 */
		obj.KEY = {
			'LEFT' : 37,
			'UP' : 38,
			'RIGHT' : 39,
			'DOWN' : 40,
			'ENTER' : 13,
			'SHIFT' : 16,
			'CTRL' : 17,
			'ALT' : 18,
			'PAUSE' : 19,
			'ESC' : 27,
			'SPACE' : 32,
			'NUM0' : 48,
			'NUM1' : 49,
			'NUM2' : 50,
			'NUM3' : 51,
			'NUM4' : 52,
			'NUM5' : 53,
			'NUM6' : 54,
			'NUM7' : 55,
			'NUM8' : 56,
			'NUM9' : 57,
			'A' : 65,
			'B' : 66,
			'C' : 67,
			'D' : 68,
			'E' : 69,
			'F' : 70,
			'G' : 71,
			'H' : 72,
			'I' : 73,
			'J' : 74,
			'K' : 75,
			'L' : 76,
			'M' : 77,
			'N' : 78,
			'O' : 79,
			'P' : 80,
			'Q' : 81,
			'R' : 82,
			'S' : 83,
			'T' : 84,
			'U' : 85,
			'V' : 86,
			'W' : 87,
			'X' : 88,
			'Y' : 89,
			'Z' : 90
		};

		/**
		 * return the key press status of the specified action
		 * @name isKeyPressed
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {String} action user defined corresponding action
		 * @return {boolean} true if pressed
		 * @example
		 * if (me.input.isKeyPressed('left'))
		 * {
		 *    //do something
		 * }
		 * else if (me.input.isKeyPressed('right'))
		 * {
		 *    //do something else...
		 * }
		 *
		 */

		obj.isKeyPressed = function(action) {
			if (keyStatus[action]) {
				if (keyLock[action]) {
					keyLocked[action] = true;
					// "eat" the event
					keyStatus[action] = false;
				}
				return true;
			}
			return false;
		};

		/**
		 * return the key status of the specified action
		 * @name keyStatus
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {String} action user defined corresponding action
		 * @return {boolean} down (true) or up(false)
		 */

		obj.keyStatus = function(action) {
			return (keyLocked[action] === true) ? true : keyStatus[action];
		};

		/**
		 * trigger the specified key (simulated) event

		 * @name triggerKeyEvent
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {me.input#KEY} keycode
		 * @param {boolean} true to trigger a key press, or false for key release
		 * @example
		 * // trigger a key press
		 * me.input.triggerKeyEvent(me.input.KEY.LEFT, true);
		 */

		obj.triggerKeyEvent = function(keycode, status) {
			if (status) {
				keydown({}, keycode);
			}
			else {
				keyup({}, keycode);
			}
		};

		/**
		 * associate a user defined action to a keycode
		 * @name bindKey
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {me.input#KEY} keycode
		 * @param {String} action user defined corresponding action
		 * @param {boolean} lock cancel the keypress event once read
		 * @example
		 * // enable the keyboard
		 * me.input.bindKey(me.input.KEY.LEFT,  "left");
		 * me.input.bindKey(me.input.KEY.RIGHT, "right");
		 * me.input.bindKey(me.input.KEY.X,     "jump", true);
		 */
		obj.bindKey = function(keycode, action, lock) {
			// make sure the keyboard is enable
			enableKeyboardEvent();

			KeyBinding[keycode] = action;

			keyStatus[action] = false;
			keyLock[action] = lock ? lock : false;
			keyLocked[action] = false;
		};

		/**
		 * unlock a key manually
		 * @name unlockKey
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {String} action user defined corresponding action
		 * @example
		 * // Unlock jump when touching the ground
		 * if(!this.falling && !this.jumping) {
		 * me.input.unlockKey("jump");
		 * }
		 */
		obj.unlockKey = function(action) {
			keyLocked[action] = false;
		};

		/**
		 * unbind the defined keycode
		 * @name unbindKey
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {me.input#KEY} keycode
		 * @example
		 * me.input.unbindKey(me.input.KEY.LEFT);
		 */
		obj.unbindKey = function(keycode) {
			// clear the event status
			keyStatus[KeyBinding[keycode]] = false;
			keyLock[KeyBinding[keycode]] = false;
			// remove the key binding
			KeyBinding[keycode] = null;
		};

		/**
		 * Associate a mouse (button) action to a keycode
		 * Left button – 0
		 * Middle button – 1
		 * Right button – 2
		 * @name bindMouse
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {Integer} button (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
		 * @param {me.input#KEY} keyCode
		 * @example
		 * // enable the keyboard
		 * me.input.bindKey(me.input.KEY.X, "shoot");
		 * // map the left button click on the X key
		 * me.input.bindMouse(me.input.mouse.LEFT, me.input.KEY.X);
		 */
		obj.bindMouse = function (button, keyCode)
		{
			// make sure the mouse is initialized
			enableMouseEvent();

			// throw an exception if no action is defined for the specified keycode
			if (!KeyBinding[keyCode])
			  throw "melonJS : no action defined for keycode " + keyCode;
			// map the mouse button to the keycode
			obj.mouse.bind[button] = keyCode;
		};
		/**
		 * unbind the defined keycode
		 * @name unbindMouse
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {Integer} button (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
		 * @example
		 * me.input.unbindMouse(me.input.mouse.LEFT);
		 */
		obj.unbindMouse = function(button) {
			// clear the event status
			obj.mouse.bind[button] = null;
		};

		/**
		 * Associate a touch action to a keycode
		 * @name bindTouch
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {me.input#KEY} keyCode
		 * @example
		 * // enable the keyboard
		 * me.input.bindKey(me.input.KEY.X, "shoot");
		 * // map the touch event on the X key
		 * me.input.bindTouch(me.input.KEY.X);
		 */
		obj.bindTouch = function (keyCode)
		{
			// reuse the mouse emulation stuff
			// where left mouse button is map to touch event
			obj.bindMouse(me.input.mouse.LEFT, keyCode);
		};

		/**
		 * unbind the defined touch binding
		 * @name unbindTouch
		 * @memberOf me.input
		 * @public
		 * @function
		 * @example
		 * me.input.unbindTouch();
		 */
		obj.unbindTouch = function() {
			// clear the key binding
			obj.unbindMouse(me.input.mouse.LEFT);
		};

		/**
		 * register on a mouse event for a given region
		 * note : on a touch enabled device mouse event will automatically be converted to touch event
		 * @name registerMouseEvent
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {String} eventType ('mousemove','mousedown','mouseup','mousewheel','touchstart','touchmove','touchend')
		 * @param {me.Rect} rect (object must inherits from me.Rect)
		 * @param {Function} callback
		 * @param {Boolean} [floating="floating property of the given object"] specify if the object is a floating object (if yes, screen coordinates are used, if not mouse/touch coordinates will be converted to world coordinates)
		 * @example
		 * // register on the 'mousemove' event
		 * me.input.registerMouseEvent('mousemove', this.collisionBox, this.mouseMove.bind(this));
		 */
		obj.registerMouseEvent = function (eventType, rect, callback, floating) {
		    // make sure the mouse is initialized
		    enableMouseEvent();

		    // convert the mouse event into a touch event
		    // If MS Pointers are available
		    if (window.navigator.msPointerEnabled && (mouseEventList.indexOf(eventType) !== -1)) {
		        eventType = pointerEventList[mouseEventList.indexOf(eventType)];
		    } else if (me.sys.touch && (mouseEventList.indexOf(eventType) !== -1)) {
                // If we are on touch device
		        eventType = touchEventList[mouseEventList.indexOf(eventType)];
		    }
		    // check if this is supported event
		    if (eventType && ((mouseEventList.indexOf(eventType) !== -1) ||
				(touchEventList.indexOf(eventType) !== -1) ||
                (pointerEventList.indexOf(eventType !== -1)))) {

		        // register the event
		        if (!obj.mouse.handlers[eventType]) {
		            obj.mouse.handlers[eventType] = [];
		        }
		        // check if this is a floating object or not
		        var _float = rect.floating === true ? true : false;
		        // check if there is a given parameter
		        if (floating) {
		            // ovveride the previous value
		            _float = floating === true ? true : false;
		        }
		        // initialize the handler
		        obj.mouse.handlers[eventType].push({ rect: rect || null, cb: callback, floating: _float });
		        return;
		    }
		    throw "melonJS : invalid event type : " + eventType;
		};

		/**
		 * release the previously registered mouse event callback
		 * note : on a touch enabled device mouse event will automatically be converted to touch event
		 * @name releaseMouseEvent
		 * @memberOf me.input
		 * @public
		 * @function
		 * @param {String} eventType ('mousemove', 'mousedown', 'mouseup', 'mousewheel', 'click', 'dblclick', 'touchstart', 'touchmove', 'touchend', 'tap', 'dbltap')
		 * @param {me.Rect} region
		 * @example
		 * // release the registered callback on the 'mousemove' event
		 * me.input.releaseMouseEvent('mousemove', this.collisionBox);
		 */
		obj.releaseMouseEvent = function(eventType, rect) {
			// convert the mouse event into a touch event
			// if we are on a touch device
			if ( me.sys.touch && (mouseEventList.indexOf(eventType) !== -1)) {
				eventType = touchEventList[mouseEventList.indexOf(eventType)];
			}
			// check if this is supported event
			if (eventType && ((mouseEventList.indexOf(eventType) !== -1) ||
				(touchEventList.indexOf(eventType) !== -1))) {

				// unregister the event
				if (!obj.mouse.handlers[eventType]) {
					obj.mouse.handlers[eventType] = [];
 				}
				var handlers = obj.mouse.handlers[eventType];
				if (handlers) {
					for (var i = handlers.length, handler; i--, handler = handlers[i];) {
						if (handler.rect === rect) {
							// make sure all references are null
							handler.rect = handler.cb = handler.floating = null;
							obj.mouse.handlers[eventType].splice(i, 1);
						}
					}
				}
				return;
			}
			throw "melonJS : invalid event type : " + eventType;
		};

		/**
		 * watch Accelerator event
		 * @name watchAccelerometer
		 * @memberOf me.input
		 * @public
		 * @function
		 * @return {boolean} false if not supported by the device
		 */
		obj.watchAccelerometer = function() {
			if ($.sys.gyro) {
				if (!accelInitialized) {
					// add a listener for the mouse
					$.addEventListener('devicemotion', onDeviceMotion, false);
					accelInitialized = true;
				}
				return true;
			}
			return false;
		};

		/**
		 * unwatch Accelerometor event
		 * @name unwatchAccelerometer
		 * @memberOf me.input
		 * @public
		 * @function
		 */
		obj.unwatchAccelerometer = function() {
			if (accelInitialized) {
				// add a listener for the mouse
				$.removeEventListener('devicemotion', onDeviceMotion, false);
				accelInitialized = false;
			}
		};

		// return our object
		return obj;

	})();

	/*---------------------------------------------------------*/
	// END END END
	/*---------------------------------------------------------*/
})(window);


text:
package org.kie.internal.builder;

import java.util.Properties;

import org.kie.api.KieBase;
import org.kie.api.Service;

/**
 * KnowledgeBuilderFactoryService is used by the KnowledgeBuilderFactory to "provide" it's concrete implementation.
 *
 * This class is not considered stable and may change, the user is protected from this change by using
 * the Factory api, which is considered stable.
 */
public interface KnowledgeBuilderFactoryService  extends Service {
    /**
     * Instantiate and return a new KnowledgeBuilderConfiguration
     * @return
     *     the KnowledgeBuilderConfiguration
     */
    KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration();

    /**
     * Instantiate and return a new KnowledgeBuilderConfiguration
     *
     * @param properties
     *     Properties file to process, can be null;
     * @param classLoader
     *     Provided ClassLoader, can be null and then ClassLoader defaults to Thread.currentThread().getContextClassLoader()
     * @return
     */
    KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties, ClassLoader... classLoader);

    /**
     * DecisionTables need to take a configuration of the InputType and XLS based
     * ones can also take a Worksheet name.
     *
     * @return
     *     The DecisionTableConfiguration
     */
    DecisionTableConfiguration newDecisionTableConfiguration();

    /**
     * Score Cards need to take a configuration of Worksheet name.
     *
     * @return
     *     The ScoreCardConfiguration
     */
    ScoreCardConfiguration newScoreCardConfiguration();

    /**
     * Instantiate and return a new KnowledgeBuilder using the default KnowledgeBuilderConfiguration
     *
     * @return
     *     The KnowledgeBuilder
     */
    KnowledgeBuilder newKnowledgeBuilder();

    /**
     * Instantiate and return a new KnowledgeBuilder using the given KnowledgeBuilderConfiguration
     *
     * @param conf
     *     The KnowledgeBuilderConfiguration
     * @return
     *     The KnowledgeBuilder
     */
    KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf);

    KnowledgeBuilder newKnowledgeBuilder(KieBase kbase);

    KnowledgeBuilder newKnowledgeBuilder(KieBase kbase, KnowledgeBuilderConfiguration conf);
}


text:
// DOM selector, returns as array so can forEach etc.
function $(selector) {
    return Array.apply(null, document.querySelectorAll(selector));
}

// Utility DOM functions
var DOM = {
    toggleClass: function (el, className, on) {
        var currentClassName = el.className;
        var newClassName = currentClassName.replace(new RegExp('\\b' + className + '\\b', 'g'), '').replace(/^\s+/g, '').replace(/\s+$/g, '');
        if(on) {
            if(newClassName) {
                newClassName += ' ';
            }
            newClassName += className;
        }

        if(newClassName != currentClassName) {
            el.className = newClassName;
        }
    }
}

// Function to process the stylesheet
// Assumes pseudo :where() classes have already been re-written as standard classes in the form .where-style-comparator-value, e.g. .where-width-lt-500px
// For each condition, build a lookup (conditions) from this class name to the function which evaluates the condition on an element
// Store a lookup (rules) to these conditions from all CSS selectors which select the elements that need this condition applying
function parseStylesheet() {

    // create object containing data about parsed stylesheet to be returned from function
    var conditions = {};

    var noMatch = function(el) { return false; };
    var comparers = {
        eq: function(v1, v2){ return parseInt(v1) == parseInt(v2); },
        lt: function(v1, v2){ return parseInt(v1) < parseInt(v2); },
        gt: function(v1, v2){ return parseInt(v1) > parseInt(v2); },
        lteq: function(v1, v2){ return parseInt(v1) <= parseInt(v2); },
        gteq: function(v1, v2){ return parseInt(v1) >= parseInt(v2); }
    };

    // parse condition into a function that can be run on an element to evaluate the condition
    function createMatchMethod(condition) {
        var items = condition.split('-');
        if(items.length == 3) {
            // assume of form 'style-comparator-value'
            var style = items[0],
                comparer = comparers[items[1]],
                value = items[2];

            if(comparer == null) {
                return noMatch;
            }

            return function(el) { return comparer(getComputedStyle(el)[items[0]], items[2]); };
        }
        return noMatch;
    }

    // process selector, building up conditions and rules and adding to returned data
    function processSelector(selector) {

        // build up an array of all conditions at each level of the selector
        var conditionLevels = [];

        // map each selector level to one without conditions
        var selectorLevels = selector.split(' ').map(function (level, i) {
            var conditions = [];
            conditionLevels.push(conditions);

            // remove the conditions from each level, storing the conditions as we go
            return level.replace(/\.where-([^\s\.\:\#]*)/g, function(match, condition, index, str) {
                conditions.push(condition);
                return '';
            });
        });

        // combine information
        selectorLevels.forEach(function(level, i){
            // create the selector up to this level
            var selector = selectorLevels.slice(0, i + 1).join(' ');

            // loop through all conditions at this level and get/create the match method for this condition
            conditionLevels[i].forEach(function(condition){
                var conditionClass = 'where-' + condition;
                var data = conditions[conditionClass];
                if(data == null) {
                    conditions[conditionClass] = data = {match: createMatchMethod(condition), selectors: []};
                }

                // add the current selector (up to this level) to the list of selectors for this condition
                data.selectors.push(selector);
            });
        });
    }

    // iterate through stylesheets processing each selector
    for(var i = 0; i < document.styleSheets.length; i++) {
        var styleSheet = document.styleSheets[i];
        for(var j = 0; j < styleSheet.cssRules.length; j++) {
            var cssRule = styleSheet.cssRules[j];
            var selectors = cssRule.selectorText.split(', ');
            for(var k = 0; k < selectors.length; k++) {
                processSelector(selectors[k]);
            }
        }
    }

    return conditions;
}

// Processor to update class names on specified elements according to whether the conditions are met
function processor(conditions) {

    return function process() {
        for(var conditionClass in conditions) {
            if(conditions.hasOwnProperty(conditionClass)) {
                var data = conditions[conditionClass];
                $(data.selectors.join(', ')).forEach(function(el){
                    DOM.toggleClass(el, conditionClass, data.match(el));
                });
            }
        }
    }
}

// Really need to listen for changes on the element, but for now we'll just regularly update
setInterval(processor(parseStylesheet()), 400);


text:
<?php

namespace Illuminate\Foundation\Testing\Constraints;

class IsChecked extends FormFieldConstraint
{
    /**
     * Create a new constraint instance.
     *
     * @param  string  $selector
     * @return void
     */
    public function __construct($selector)
    {
        $this->selector = $selector;
    }

    /**
     * Get the valid elements.
     *
     * @return string
     */
    protected function validElements()
    {
        return "input[type='checkbox']";
    }

    /**
     * Determine if the checkbox is checked.
     *
     * @param  \Symfony\Component\DomCrawler\Crawler|string  $crawler
     * @return bool
     */
    public function matches($crawler)
    {
        $crawler = $this->crawler($crawler);

        return $this->field($crawler)->attr('checked') !== null;
    }

    /**
     * Return the description of the failure.
     *
     * @return string
     */
    protected function getFailureDescription()
    {
        return "the checkbox [{$this->selector}] is checked";
    }
}


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TheBlueAlliance.Models;

namespace TheBlueAlliance.Test
{
    [TestClass]
    public class EventsUnitTests
    {
        [TestMethod]
        public void GetEventInformation_TestMethod()
        {
            Event.EventInformation actualEventInformation = Events.GetEventInformation("2015onto");

            const string expectedKey = "2015onto";
            const string expectedWebsite = "http://www.firstroboticscanada.org";
            const bool expectedOfficial = true;
            const string expectedEndDate = "2015-03-14";
            const string expectedName = "Greater Toronto East Regional";
            const string expectedShortName = "Greater Toronto East";
            const object expectedFaceBookEid = null;
            const object expectedEventDistrictString = null;
            const string expectedVenueAddress = "University of Ontario Institute of Technology / Durham College\n2000 Simcoe Street North\nOshawa, ON L1H 7K4\nCanada";
            const int expectedEventDistrict = 0;
            const string expectedLocation = "Oshawa, ON, Canada";
            const string expectedEventCode = "onto";
            const int expectedYear = 2015;
            const string expectedWebcasts = "livestream";
            const string expectedAlliances = "frc2056";
            const string expectedEventTypeString = "Regional";
            const string expectedStartDate = "2015-03-11";
            const int expectedEventType = 0;

            Assert.AreEqual(expectedKey, actualEventInformation.key, "Event Keys Are Not As Expected");
            Assert.AreEqual(expectedWebsite, actualEventInformation.website, "Websites Are Not As Expected");
            Assert.AreEqual(expectedOfficial, actualEventInformation.official, "Is Official Are Not As Expected");
            Assert.AreEqual(expectedEndDate, actualEventInformation.end_date, " Are Not As Expected");
            Assert.AreEqual(expectedName, actualEventInformation.name, "Event Names Are Not As Expected");
            Assert.AreEqual(expectedShortName, actualEventInformation.short_name, "Short Names Are Not As Expected");
            Assert.AreEqual(expectedFaceBookEid, actualEventInformation.facebook_eid, "Facebook EID Are Not As Expected");
            Assert.AreEqual(expectedEventDistrictString, actualEventInformation.event_district_string, "Event District Strings Are Not As Expected");
            Assert.AreEqual(expectedVenueAddress, actualEventInformation.venue_address, "Venue Addresses Are Not As Expected");
            Assert.AreEqual(expectedEventDistrict, actualEventInformation.event_district, "Event Districts Are Not As Expected");
            Assert.AreEqual(expectedLocation, actualEventInformation.location, "Locations Are Not As Expected");
            Assert.AreEqual(expectedEventCode, actualEventInformation.event_code, "Event Codes Are Not As Expected");
            Assert.AreEqual(expectedYear, actualEventInformation.year, "Years Are Not As Expected");
            Assert.AreEqual(expectedWebcasts, actualEventInformation.webcast[0].type, "Webcasts Are Not As Expected");
            Assert.AreEqual(expectedAlliances, actualEventInformation.alliances[0].picks[0], "Alliances Are Not As Expected");
            Assert.AreEqual(expectedEventTypeString, actualEventInformation.event_type_string, "Event Type Strings Are Not As Expected");
            Assert.AreEqual(expectedStartDate, actualEventInformation.start_date, "Start Dates Are Not As Expected");
            Assert.AreEqual(expectedEventType, actualEventInformation.event_type, "Event Types Are Not As Expected");
        }

        [TestMethod]
        public void GetEventAwards_TestMethod()
        {
            EventAwards.Award[] actualAwardsInformation = Events.GetEventAwards("2015onto");

            string actualEventKey = actualAwardsInformation[0].event_key;
            int actualAwardType = actualAwardsInformation[0].award_type;
            string actualAwardName = actualAwardsInformation[0].name;
            int actualAwardRecipientListTeamNumber = actualAwardsInformation[0].recipient_list[0].team_number;
            object actualAwardRecipientListAwardee = actualAwardsInformation[0].recipient_list[0].awardee;
            int actualYear = actualAwardsInformation[0].year;

            const string expectedEventKey = "2015onto";
            const int expectedAwardType = 0;
            const string expectedAwardName = "Regional Chairman's Award";
            const int expectedAwardRecipientListTeamNumber = 1325;
            const object expectedAwardRecipientListAwardee = null;
            const int expectedYear = 2015;

            Assert.AreEqual(expectedEventKey, actualEventKey, "Event Keys Are Not As Expected");
            Assert.AreEqual(expectedAwardType, actualAwardType, "Award Types Are Not As Expected");
            Assert.AreEqual(expectedAwardName, actualAwardName, "Event Awards Are Not As Expected");
            Assert.AreEqual(expectedAwardRecipientListTeamNumber, actualAwardRecipientListTeamNumber, "Award Team Numbers Are Not As Expected");
            Assert.AreEqual(expectedAwardRecipientListAwardee, actualAwardRecipientListAwardee, "Recipient List Awardee Are Not As Expected");
            Assert.AreEqual(expectedYear, actualYear, "Years Are Not As Expected");
        }

        [TestMethod]
        public void GetEventMatches_TestMethod()
        {
            EventMatches.Match[] actualEventMatches = Events.GetEventMatches("2015onto");

            const string expectedCompLevel = "f";
            const int expectedMatchNumber = 1;
            const string expectedTimeString = null;
            const int expectedSetNumber = 1;
            const string expectedKey = "2015onto_f1m1";
            const int expectedTime = 1426358280;
            const int expectedScoreBreakdownBlueAuto = 0;
            const int expectedAlliancesBlueScore = 155;
            const string expectedAllianceBlueTeam1 = "frc1241";

            Assert.AreEqual(expectedCompLevel, actualEventMatches[0].comp_level, "Comp Levels Are Not As Expected");
            Assert.AreEqual(expectedMatchNumber, actualEventMatches[0].match_number, "Match Numbers Are Not As Expected");
            Assert.AreEqual(expectedTimeString, actualEventMatches[0].time_string, "Time Strings Are Not As Expected");
            Assert.AreEqual(expectedSetNumber, actualEventMatches[0].set_number, "Set Numbers Are Not As Expected");
            Assert.AreEqual(expectedKey, actualEventMatches[0].key, "Keys Are Not As Expected");
            Assert.AreEqual(expectedTime, actualEventMatches[0].time, "Times Are Not As Expected");
            Assert.AreEqual(expectedScoreBreakdownBlueAuto, actualEventMatches[0].score_breakdown.blue.auto, "Score Breakdowns Are Not As Expected");
            Assert.AreEqual(expectedAlliancesBlueScore, actualEventMatches[0].alliances.blue.score, "Scores Are Not As Expected");
            Assert.AreEqual(expectedAllianceBlueTeam1, actualEventMatches[0].alliances.blue.teams[0], "Alliance Teams Are Not As Expected");
        }

        [TestMethod]
        public void GetEventRankings_TestMethod()
        {
            EventRankings.Team[] actualEventRankings = Events.GetEventRankings("2015onto");

            const int expectedRank = 1;
            const int expectedTeam = 2056;
            const double expectedQualAverage = 124.5;
            const int expectedAuto = 146;
            const int expectedContainer = 488;
            const int expectedCoopertition = 160;
            const int expectedLitter = 131;
            const int expectedTote = 338;
            const int expectedPlayed = 10;

            Assert.AreEqual(expectedRank, actualEventRankings[0].Rank, "Ranks Are Not As Expected");
            Assert.AreEqual(expectedTeam, actualEventRankings[0].Team_Number, "Team Numbers Are Not As Expected");
            Assert.AreEqual(expectedQualAverage, actualEventRankings[0].Qual_Average, "Qualification Averages Are Not As Expected");
            Assert.AreEqual(expectedAuto, actualEventRankings[0].Auto, "Auto Points Are Not As Expected");
            Assert.AreEqual(expectedContainer, actualEventRankings[0].Container, "Container Points Are Not As Expected");
            Assert.AreEqual(expectedCoopertition, actualEventRankings[0].Coopertition, "Coopertition Points Are Not As Expected");
            Assert.AreEqual(expectedLitter, actualEventRankings[0].Litter, "Litter Points Are Not As Expected");
            Assert.AreEqual(expectedTote, actualEventRankings[0].Tote, "Tote Points Are Not As Expected");
            Assert.AreEqual(expectedPlayed, actualEventRankings[0].Played, "Matches Played Are Not As Expected");
        }

        [TestMethod]
        public void GetEvents_TestMethod()
        {
            Models.Events.Event[] actualEvents = Events.GetEvents(2015);

            const string expectedKey = "2015abca";
            const string expectedWebsite = "http://frcwest.com/";
            const bool expectedOfficial = true;
            const string expectedEndDate = "2015-04-04";
            const string expectedName = "Western Canada Regional";
            const string expectedShortName = "Western Canada";
            const object expectedFaceBookEid = null;
            const object expectedEventDistrictString = null;
            const string expectedVenueAddress = "Ernest Manning High School\n20 Springborough Blvd SW\nCalgary, AB T3H 0N7\nCanada";
            const int expectedEventDistrict = 0;
            const string expectedLocation = "Calgary, AB, Canada";
            const string expectedEventCode = "abca";
            const int expectedYear = 2015;
            const string expectedAlliances0Pick1 = "frc4719";
            const string expectedEventTypeString = "Regional";
            const string expectedStartDate = "2015-04-01";
            const int expectedEventType = 0;

            Assert.AreEqual(expectedKey, actualEvents[0].key, "Event Keys Are Not As Expected");
            Assert.AreEqual(expectedWebsite, actualEvents[0].website, "Websites Are Not As Expected");
            Assert.AreEqual(expectedOfficial, actualEvents[0].official, "Is Official Are Not As Expected");
            Assert.AreEqual(expectedEndDate, actualEvents[0].end_date, "End Dates Are Not As Expected");
            Assert.AreEqual(expectedName, actualEvents[0].name, "Names Are Not As Expected");
            Assert.AreEqual(expectedShortName, actualEvents[0].short_name, "Short Name Are Not As Expected");
            Assert.AreEqual(expectedFaceBookEid, actualEvents[0].facebook_eid, "Facebook EIDs Are Not As Expected");
            Assert.AreEqual(expectedEventDistrictString, actualEvents[0].event_district_string, "District Strings Are Not As Expected");
            Assert.AreEqual(expectedVenueAddress, actualEvents[0].venue_address, "Venue Addresses Are Not As Expected");
            Assert.AreEqual(expectedEventDistrict, actualEvents[0].event_district, "Event Districts Are Not As Expected");
            Assert.AreEqual(expectedLocation, actualEvents[0].location, "Locations Are Not As Expected");
            Assert.AreEqual(expectedEventCode, actualEvents[0].event_code, "Event Codes Are Not As Expected");
            Assert.AreEqual(expectedYear, actualEvents[0].year, "Years Are Not As Expected");
            Assert.AreEqual(expectedAlliances0Pick1, actualEvents[0].alliances[0].picks[0], "Alliance Picks Are Not As Expected");
            Assert.AreEqual(expectedEventTypeString, actualEvents[0].event_type_string, "Event Type Strings Are Not As Expected");
            Assert.AreEqual(expectedStartDate, actualEvents[0].start_date, "Start Dates Are Not As Expected");
            Assert.AreEqual(expectedEventType, actualEvents[0].event_type, "Event Types Are Not As Expected");
        }

        [TestMethod]
        public void GetEventTeamsList_TestMethod()
        {
            EventTeams.Team[] actualTeamList = Events.GetEventTeamsList("2015onto");
        }
    }
}