text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

function files_tree_build() {
    $("#files_tree").empty();
    $('#files_tree').tree({
        url:'files_tree?action=build',
        //url:'/files/data.json',
        method:'get',
        loadFilter:lazeloadfilestree
    });
    function lazeloadfilestree(data, parent){
        var state = $.data(this, 'tree');

        function setData(){
            var serno = 1;
            var todo = [];
            for(var i=0; i<data.length; i++){
                todo.push(data[i]);
            }
            while(todo.length){
                var node = todo.shift();
                if (node.id == undefined){
                    node.id = '_node_' + (serno++);
                }
                if (node.children){
                    node.state = 'closed';
                    node.children1 = node.children;
                    node.children = undefined;
                    todo = todo.concat(node.children1);
                }
            }
            state.tdata = data;
        }
        function find(id){
            var data = state.tdata;
            var cc = [data];
            while(cc.length){
                var c = cc.shift();
                for(var i=0; i<c.length; i++){
                    var node = c[i];
                    if (node.id == id){
                        return node;
                    } else if (node.children1){
                        cc.push(node.children1);
                    }
                }
            }
            return null;
        }

        setData();

        var t = $(this);
        var opts = t.tree('options');
        opts.onBeforeExpand = function(node){
            var n = find(node.id);
            if (n.children && n.children.length){return}
            if (n.children1){
                var filter = opts.loadFilter;
                opts.loadFilter = function(data){return data;};
                t.tree('append',{
                    parent:node.target,
                    data:n.children1
                });
                opts.loadFilter = filter;
                n.children = n.children1;
            }
        };
        return data;
    }

    $('#files_tree').tree({
        onClick: function(node){
            if(!$('#files_tree').tree('isLeaf',node.target)) {
                $('#files_tree').tree(node.state === "closed" ? "expand" : "collapse", node.target);
            }
            else {
                openFiles(node.text, node.attributes.path, node.attributes.id);
                //alert(node.attributes.path);
            }
        }
    });
}

function add_folder_dlg_open() {
    $('#add_folder_dlg').dialog('open').dialog('center').dialog('setTitle','Add Folder');
    $('#add_folder_dlg_folder_path').textbox('clear');
}

function add_folder_dlg_close() {
    $('#add_folder_dlg_folder_path').textbox('clear');
    $('#add_folder_dlg').dialog('close');
}

function folder_add_request() {
    path = $('#add_folder_dlg_folder_path').textbox("getText");
    path_en = base64_encode(path);
    $.get("files_tree", {"action":"add", "param":path_en},
        function(data){
        console.log(data);
    }, "json");

    files_tree_build();
    $('#add_folder_dlg').dialog('close')
}

function folder_reload() {
    files_tree_build();
}

function folder_remove() {
    var node = $('#files_tree').tree('getSelected');
    if (node){
        path_en = base64_encode(node.attributes.path);
         $.get("files_tree", {"action":"remove", "param":path_en},
            function(data){
            console.log(data);
        }, "json");
    }
    files_tree_build();
}


text:
'use strict';

//------------------------------------------------------------------------------
// Requires
//------------------------------------------------------------------------------

const id = require('./util/id');
const post = require('./util/post');
const async = require('async');

//------------------------------------------------------------------------------
// Data
//------------------------------------------------------------------------------

const endpointDiscoveryHostname = 'api.nutshell.com';
const endpointDiscoveryPath = '/v1/json';

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

exports.getApiEndpointForUser = function (username, cb) {
  const postData = {
    method : 'getApiForUsername',
    params : { username },
    id     : id.create()
  };
  let discoveryOptions = {
    hostname : endpointDiscoveryHostname,
    path     : endpointDiscoveryPath,
    method   : 'POST'
  };
  post(discoveryOptions, JSON.stringify(postData), function (err, res, data) {
    if (err) {
      console.error(err);
      return;
    }
    cb(null, JSON.parse(data).result.api);
  });
};

async.memoize(exports.getApiEndpointForUser);

redpajama_set_name: RedPajamaGithub


text:
<?php
include "MySqlConnect.php";
include "setSelectionLists.php";
//let's start the session
/*session_start();
//finally, let's store our posted values in the session variables
$_SESSION['name'] = $_POST['name'];
$_SESSION['password'] = $_POST['email_address'];
        ....(from log IN)
*/
?>
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Material Login Form</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="css/reset.css">

    <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900'>
    <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>
    <link rel="stylesheet" href="css/style.css">

Rerun Pen

Create your own Network

        <form id="createNetwork_form" method="post" action="session.php">

                    Model:

                    <select class="form-control" name="selModel" id="selModel">
                        <?php
                        foreach ($conn->query($sqlModel) as $rowModel) {
                            print "<option>" .  $rowModel['title'] . "</option>";
                        }
                        ?>
                    </select>

                Training Algorithm:

                <select class="form-control" name="selAlgorithm" id="selAlgorithm">
                    <?php
                    foreach ($conn->query($sqlTAlgorithm) as $rowTAlgorithm) {
                        print "<option>" .  $rowTAlgorithm['title'] . "</option>";
                    }
                    ?>
                </select>

                Training Set:

                <select class="form-control" name="selTrainSet" id="selTrainSet">
                    <?php
                    foreach ($conn->query($sqlTrain) as $rowTrain) {
                        print "<option>" .  $rowTrain['title'] . "</option>";
                    }
                    ?>
                </select>

                Testing Set:

                <select class="form-control" name="selTestSet" id="selTestSet">
                    <?php
                    foreach ($conn->query($sqlTest) as $rowTest) {
                        print "<option>" .  $rowTest['title'] . "</option>";
                    }
                    ?>
                </select>

                <button type="submit">Next</button>

        </form>


text:
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Crypto.PubKey.RSA.Types
    ( Error(..)
    , Blinder(..)
    , PublicKey(..)
    , PrivateKey(..)
    , KeyPair(..)
    , toPublicKey
    , toPrivateKey
    , private_size
    , private_n
    , private_e
    ) where

import           Data.Data
import           Crypto.Internal.Imports

-- | Blinder which is used to obfuscate the timing
-- of the decryption primitive (used by decryption and signing).
data Blinder = Blinder !Integer !Integer
             deriving (Show,Eq)

-- | error possible during encryption, decryption or signing.
data Error =
      MessageSizeIncorrect -- ^ the message to decrypt is not of the correct size (need to be == private_size)
    | MessageTooLong       -- ^ the message to encrypt is too long
    | MessageNotRecognized -- ^ the message decrypted doesn't have a PKCS15 structure (0 2 .. 0 msg)
    | SignatureTooLong     -- ^ the message's digest is too long
    | InvalidParameters    -- ^ some parameters lead to breaking assumptions.
    deriving (Show,Eq)

-- | Represent a RSA public key
data PublicKey = PublicKey
    { public_size :: Int      -- ^ size of key in bytes
    , public_n    :: Integer  -- ^ public p*q
    , public_e    :: Integer  -- ^ public exponent e
    } deriving (Show,Read,Eq,Data)

instance NFData PublicKey where
    rnf (PublicKey sz n e) = rnf n `seq` rnf e `seq` sz `seq` ()

-- | Represent a RSA private key.
--
-- Only the pub, d fields are mandatory to fill.
--
-- p, q, dP, dQ, qinv are by-product during RSA generation,
-- but are useful to record here to speed up massively
-- the decrypt and sign operation.
--
-- implementations can leave optional fields to 0.
--
data PrivateKey = PrivateKey
    { private_pub  :: PublicKey -- ^ public part of a private key (size, n and e)
    , private_d    :: Integer   -- ^ private exponent d
    , private_p    :: Integer   -- ^ p prime number
    , private_q    :: Integer   -- ^ q prime number
    , private_dP   :: Integer   -- ^ d mod (p-1)
    , private_dQ   :: Integer   -- ^ d mod (q-1)
    , private_qinv :: Integer   -- ^ q^(-1) mod p
    } deriving (Show,Read,Eq,Data)

instance NFData PrivateKey where
    rnf (PrivateKey pub d p q dp dq qinv) =
        rnf pub `seq` rnf d `seq` rnf p `seq` rnf q `seq` rnf dp `seq` rnf dq `seq` qinv `seq` ()

-- | get the size in bytes from a private key
private_size :: PrivateKey -> Int
private_size = public_size . private_pub

-- | get n from a private key
private_n :: PrivateKey -> Integer
private_n = public_n . private_pub

-- | get e from a private key
private_e :: PrivateKey -> Integer
private_e = public_e . private_pub

-- | Represent RSA KeyPair
--
-- note the RSA private key contains already an instance of public key for efficiency
newtype KeyPair = KeyPair PrivateKey
    deriving (Show,Read,Eq,Data,NFData)

-- | Public key of a RSA KeyPair
toPublicKey :: KeyPair -> PublicKey
toPublicKey (KeyPair priv) = private_pub priv

-- | Private key of a RSA KeyPair
toPrivateKey :: KeyPair -> PrivateKey
toPrivateKey (KeyPair priv) = priv


text:
from __future__ import absolute_import

from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision

class Inception_v3(nn.Module):
    def __init__(self, pretrained=True, cut_at_pooling=False,
                 num_features=0, norm=False, dropout=0, num_classes=0):
        super(Inception_v3, self).__init__()

        self.pretrained = pretrained
        self.cut_at_pooling = cut_at_pooling

        # Construct base (pretrained) resnet
        self.base = torchvision.models.inception_v3(pretrained=pretrained)

        if not self.cut_at_pooling:
            self.num_features = num_features
            self.norm = norm
            self.dropout = dropout
            self.has_embedding = num_features > 0
            self.num_classes = num_classes

            out_planes = self.base.fc.in_features

            # Append new layers
            if self.has_embedding:
                self.feat = nn.Linear(out_planes, self.num_features)
                self.feat_bn = nn.BatchNorm1d(self.num_features)
                init.kaiming_normal(self.feat.weight, mode='fan_out')
                init.constant(self.feat.bias, 0)
                init.constant(self.feat_bn.weight, 1)
                init.constant(self.feat_bn.bias, 0)
            else:
                # Change the num_features to CNN output channels
                self.num_features = out_planes
            if self.dropout > 0:
                self.drop = nn.Dropout(self.dropout)
            if self.num_classes > 0:
                self.classifier = nn.Linear(
                    self.num_features, self.num_classes)
                init.normal(self.classifier.weight, std=0.001)
                init.constant(self.classifier.bias, 0)

        if not self.pretrained:
            self.init_params()

    def forward(self, x):
        for name, module in self.base._modules.items():
            if name == 'fc':
                break
            x = module(x)

        if self.cut_at_pooling:
            return x

        if self.has_embedding:
            x = self.feat(x)
            x = self.feat_bn(x)
        if self.norm:
            x = F.normalize(x)
        elif self.has_embedding:
            x = F.relu(x)
        if self.dropout > 0:
            x = self.drop(x)
        if self.num_classes > 0:
            x = self.classifier(x)
        return x

    def init_params(self):
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                init.kaiming_normal(m.weight, mode='fan_out')
                if m.bias is not None:
                    init.constant(m.bias, 0)
            elif isinstance(m, nn.BatchNorm2d):
                init.constant(m.weight, 1)
                init.constant(m.bias, 0)
            elif isinstance(m, nn.Linear):
                init.normal(m.weight, std=0.001)
                if m.bias is not None:
                    init.constant(m.bias, 0)


text:
export default [
  'permanent',
  'dismissible',
  'modal',
  'permanentBelowTopAppBar',
  'dismissibleBelowTopAppBar',
  'permanentToModal',
];


text:
module Pageflow
  module VideoFilesHelper
    def mobile_poster_image_div(config = {})
      classes = ['background', 'background_image']
      position = {x: 50, y: 50}

      if config['mobile_poster_image_id']
        classes << "image_#{config['mobile_poster_image_id']}"
        position[:x] = config['mobile_poster_image_x'] || 50
        position[:y] = config['mobile_poster_image_y'] || 50
      elsif config['poster_image_id']
        classes << "image_#{config['poster_image_id']}"
        position[:x] = config['poster_image_x'] || 50
        position[:y] = config['poster_image_y'] || 50
      elsif config['video_file_id']
        classes << "video_poster_#{config['video_file_id']}"
        position[:x] = config['video_file_x'] || 50
        position[:y] = config['video_file_y'] || 50
      else
        classes << 'video_poster_none'
      end

      content_tag(:div, '',
                  class: classes.join(' '),
                  style: "background-position: #{position[:x]}% #{position[:y]}%;")
    end

    def poster_image_tag(video_id, poster_image_id, options = {})
      video_file = VideoFile.find_by_id(video_id)
      poster = ImageFile.find_by_id(poster_image_id)

      if poster
        options = options.merge('data-src' => poster.attachment.url(:medium))
        options = options.merge('data-printsrc' => poster.attachment.url(:print))
      elsif video_file
        options = options.merge('data-src' => video_file.poster.url(:medium))
        options = options.merge('data-printsrc' => video_file.poster.url(:print))
      end

      image_tag('', options)
    end

    def video_file_video_tag(video_file, options = {})
      defaults = {
        class: [
          'player video-js video-viewport vjs-default-skin',
          options.delete(:class)
        ].compact * ' ',
        preload:  options.delete(:preload) ? 'metadata' : 'none'
      }

      options.reverse_merge! defaults
      url_options = {unique_id: options.delete(:unique_id)}

      poster = ImageFile.find_by_id(options.delete(:poster_image_id))
      mobile_poster = ImageFile.find_by_id(options.delete(:mobile_poster_image_id))

      options[:data] = {}

      if mobile_poster
        options[:data][:mobile_poster] = mobile_poster.attachment.url(:medium)
        options[:data][:mobile_large_poster] = mobile_poster.attachment.url(:large)
      end

      if poster
        options[:data][:poster] = poster.attachment.url(:medium)
        options[:data][:large_poster] = poster.attachment.url(:large)
      elsif video_file
        options[:data][:poster] = video_file.poster.url(:medium)
        options[:data][:large_poster] = video_file.poster.url(:large)
      end

      if video_file && video_file.width.present? && video_file.height.present?
        options[:data][:width] = video_file.width
        options[:data][:height] = video_file.height
      end

      render('pageflow/video_files/video_tag',
             video_file: video_file,
             options: options,
             url_options: url_options)
    end

    # @deprecated
    def lookup_video_tag(video_id, poster_image_id, options = {})
      video_file_script_tag(video_id, options.merge(poster_image_id: poster_image_id))
    end

    def video_file_script_tag(video_id, options = {})
      video_file = VideoFile.find_by_id(video_id)

      script_tag_data = {template: 'video'}

      if video_file && video_file.width.present? && video_file.height.present?
        script_tag_data[:video_width] = video_file.width
        script_tag_data[:video_height] = video_file.height
      end

      render('pageflow/video_files/script_tag',
             script_tag_data: script_tag_data,
             video_file: video_file,
             options: options)
    end

    def video_file_non_js_link(entry, video_file_id)
      if (video_file = VideoFile.find_by_id(video_file_id))
        link_to(t('pageflow.public.play_video'),
                short_video_file_path(entry, video_file),
                class: 'hint')
      end
    end

    def video_file_sources(video_file, options = {})
      [
        {
          type: 'application/x-mpegURL',
          src: video_file.hls_playlist.url(options),
          high_src: video_file.hls_playlist.url(options)
        },
        {
          type: 'video/mp4',
          src: video_file.mp4_medium.url(options),
          high_src: video_file.mp4_high.url(options)
        }
      ]
    end
  end
end


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

namespace Castle_Windsor_AOP.Interceptors.Attributes
{
    public class DoNotPerformPermissionCheck : Attribute
    {
    }
}


text:
base_path = ../../..
PROG = disque_cluster
include ../../Makefile.in


text:
{% import "bootstrap/wtf.html" as wtf%}
{% extends "admin/_base.html" %}

{% block content %}
{% include "admin/_messages.html" %}

Edit Tag

    {{ wtf.quick_form(form) }}

{% endblock content %}


text:
<?php

namespace ZendTest\Http\Header;

use Zend\Http\Header\ContentType;

class ContentTypeTest extends \PHPUnit_Framework_TestCase
{
    public function testContentTypeFromStringCreatesValidContentTypeHeader()
    {
        $contentTypeHeader = ContentType::fromString('Content-Type: xxx');
        $this->assertInstanceOf('Zend\Http\Header\HeaderInterface', $contentTypeHeader);
        $this->assertInstanceOf('Zend\Http\Header\ContentType', $contentTypeHeader);
    }

    public function testContentTypeGetFieldNameReturnsHeaderName()
    {
        $contentTypeHeader = new ContentType();
        $this->assertEquals('Content-Type', $contentTypeHeader->getFieldName());
    }

    public function testContentTypeGetFieldValueReturnsProperValue()
    {
        $header = ContentType::fromString('Content-Type: application/json');
        $this->assertEquals('application/json', $header->getFieldValue());
    }

    public function testContentTypeToStringReturnsHeaderFormattedString()
    {
        $header = new ContentType();
        $header->setMediaType('application/atom+xml')
               ->setCharset('ISO-8859-1');

        $this->assertEquals('Content-Type: application/atom+xml; charset=ISO-8859-1', $header->toString());
    }

    /** Implementation specific tests here */

    public function wildcardMatches()
    {
        return [
            'wildcard' => ['*/*'],
            'wildcard-format' => ['*/*+*'],
            'wildcard-type-subtype-fixed-format' => ['*/*+json'],
            'wildcard-type-partial-wildcard-subtype-fixed-format' => ['*/vnd.*+json'],
            'wildcard-type-format-subtype' => ['*/json'],
            'fixed-type-wildcard-subtype' => ['application/*'],
            'fixed-type-wildcard-subtype-fixed-format' => ['application/*+json'],
            'fixed-type-format-subtype' => ['application/json'],
            'fixed-type-fixed-subtype-wildcard-format' => ['application/vnd.foobar+*'],
            'fixed-type-partial-wildcard-subtype-fixed-format' => ['application/vnd.*+json'],
            'fixed' => ['application/vnd.foobar+json'],
            'fixed-mixed-case' => ['APPLICATION/vnd.FooBar+json'],
        ];
    }

    /**
     * @dataProvider wildcardMatches
     */
    public function testMatchWildCard($matchAgainst)
    {
        $header = ContentType::fromString('Content-Type: application/vnd.foobar+json');
        $result = $header->match($matchAgainst);
        $this->assertEquals(strtolower($matchAgainst), $result);
    }

    public function invalidMatches()
    {
        return [
            'format' => ['application/vnd.foobar+xml'],
            'wildcard-subtype' => ['application/vendor.*+json'],
            'subtype' => ['application/vendor.foobar+json'],
            'type' => ['text/vnd.foobar+json'],
            'wildcard-type-format' => ['*/vnd.foobar+xml'],
            'wildcard-type-wildcard-subtype' => ['*/vendor.*+json'],
            'wildcard-type-subtype' => ['*/vendor.foobar+json'],
        ];
    }

    /**
     * @dataProvider invalidMatches
     */
    public function testFailedMatches($matchAgainst)
    {
        $header = ContentType::fromString('Content-Type: application/vnd.foobar+json');
        $result = $header->match($matchAgainst);
        $this->assertFalse($result);
    }

    public function multipleCriteria()
    {
        $criteria = [
            'application/vnd.foobar+xml',
            'application/vnd.*+json',
            'application/vendor.foobar+xml',
            '*/vnd.foobar+json',
        ];
        return [
            'array' => [$criteria],
            'string' => [implode(',', $criteria)],
        ];
    }

    /**
     * @dataProvider multipleCriteria
     */
    public function testReturnsMatchingMediaTypeOfFirstCriteriaToValidate($criteria)
    {
        $header = ContentType::fromString('Content-Type: application/vnd.foobar+json');
        $result = $header->match($criteria);
        $this->assertEquals('application/vnd.*+json', $result);
    }

    public function contentTypeParameterExamples()
    {
        return [
            'no-quotes' => ['Content-Type: foo/bar; param=baz', 'baz'],
            'with-quotes' => ['Content-Type: foo/bar; param="baz"', 'baz'],
            'with-equals' => ['Content-Type: foo/bar; param=baz=bat', 'baz=bat'],
            'with-equals-and-quotes' => ['Content-Type: foo/bar; param="baz=bat"', 'baz=bat'],
        ];
    }

    /**
     * @dataProvider contentTypeParameterExamples
     */
    public function testContentTypeParsesParametersCorrectly($headerString, $expectedParameterValue)
    {
        $contentTypeHeader = ContentType::fromString($headerString);

        $parameters = $contentTypeHeader->getParameters();

        $this->assertArrayHasKey('param', $parameters);
        $this->assertSame($expectedParameterValue, $parameters['param']);
    }

    /**
     * @see http://en.wikipedia.org/wiki/HTTP_response_splitting
     * @group ZF2015-04
     */
    public function testPreventsCRLFAttackViaFromString()
    {
        $this->setExpectedException('Zend\Http\Header\Exception\InvalidArgumentException');
        $header = ContentType::fromString("Content-Type: foo/bar;\r\n\r\nevilContent");
    }

    /**
     * @see http://en.wikipedia.org/wiki/HTTP_response_splitting
     * @group ZF2015-04
     */
    public function testPreventsCRLFAttackViaConstructor()
    {
        $this->setExpectedException('Zend\Http\Header\Exception\InvalidArgumentException');
        $header = new ContentType("foo/bar\r\n\r\nevilContent");
    }
}


text:
namespace IronJS.Tests.UnitTests.Sputnik.Conformance.NativeECMAScriptObjects.StringObjects.PropertiesOfTheStringPrototypeObject
{
    using System;
    using NUnit.Framework;

    [TestFixture]
    public class StringPrototypeToUpperCaseTests : SputnikTestFixture
    {
        public StringPrototypeToUpperCaseTests()
            : base(@"Conformance\15_Native_ECMA_Script_Objects\15.5_String_Objects\15.5.4_Properties_of_the_String_Prototype_Object\15.5.4.18_String.prototype.toUpperCase")
        {
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A1_T1.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T10.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T11.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T12.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T13.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T14.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T2.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T3.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T4.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T5.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T6.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T7.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T8.js", Description = "String.prototype.toUpperCase()")]
        [TestCase("S15.5.4.18_A1_T9.js", Description = "String.prototype.toUpperCase()")]
        public void StringPrototypeToUpperCase(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A10.js", Description = "The String.prototype.toUpperCase.length property has the attribute ReadOnly")]
        public void TheStringPrototypeToUpperCaseLengthPropertyHasTheAttributeReadOnly(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A11.js", Description = "The length property of the toUpperCase method is 0")]
        public void TheLengthPropertyOfTheToUpperCaseMethodIs0(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A2_T1.js", Description = "String.prototype.toUpperCase() return a string, but not a String object")]
        public void StringPrototypeToUpperCaseReturnAStringButNotAStringObject(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 13.2")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A6.js", Description = "String.prototype.toUpperCase has not prototype property")]
        public void StringPrototypeToUpperCaseHasNotPrototypeProperty(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 13.2")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A7.js", Description = "String.prototype.toUpperCase can\'t be used as constructor")]
        public void StringPrototypeToUpperCaseCanTBeUsedAsConstructor(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A8.js", Description = "The String.prototype.toUpperCase.length property has the attribute DontEnum")]
        public void TheStringPrototypeToUpperCaseLengthPropertyHasTheAttributeDontEnum(string file)
        {
            RunFile(file);
        }

        [Test]
        [Category("Sputnik Conformance")]
        [Category("ECMA 15.5.4.18")]
        [TestCase("S15.5.4.18_A9.js", Description = "The String.prototype.toUpperCase.length property has the attribute DontDelete")]
        public void TheStringPrototypeToUpperCaseLengthPropertyHasTheAttributeDontDelete(string file)
        {
            RunFile(file);
        }
    }
}


text:
.ag-common {
  line-height: 1.4;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #ccc;
/* this is for the rowGroupPanel, that appears along the top of the grid */
/* this is for the column drops that appear in the toolPanel */
}
.ag-common img {
  vertical-align: middle;
  border: 0;
}
.ag-common .ag-root {
  border: 1px solid #808080;
}
.ag-common .ag-cell-not-inline-editing {
  padding: 2px;
}
.ag-common .ag-cell-range-selected-1:not(.ag-cell-focus) {
  background-color: rgba(100,160,160,0.4);
}
.ag-common .ag-cell-range-selected-2:not(.ag-cell-focus) {
  background-color: rgba(100,190,190,0.4);
}
.ag-common .ag-cell-range-selected-3:not(.ag-cell-focus) {
  background-color: rgba(100,220,220,0.4);
}
.ag-common .ag-cell-range-selected-4:not(.ag-cell-focus) {
  background-color: rgba(100,250,250,0.4);
}
.ag-common .ag-column-moving .ag-cell {
  -webkit-transition: left 0.2s;
  -moz-transition: left 0.2s;
  -o-transition: left 0.2s;
  -ms-transition: left 0.2s;
  transition: left 0.2s;
}
.ag-common .ag-cell-focus {
  border: 1px solid #a9a9a9;
}
.ag-common .ag-cell-no-focus {
  border-right: 1px dotted #808080;
  border-top: 1px solid transparent;
  border-left: 1px solid transparent;
  border-bottom: 1px solid transparent;
}
.ag-common .ag-cell-first-right-pinned {
  border-left: 1px solid #808080;
}
.ag-common .ag-cell-last-left-pinned {
  border-right: 1px solid #808080;
}
.ag-common .ag-cell-highlight {
  border: 1px solid #90ee90;
}
.ag-common .ag-cell-highlight-animation {
  -webkit-transition: border 1s;
  -moz-transition: border 1s;
  -o-transition: border 1s;
  -ms-transition: border 1s;
  transition: border 1s;
}
.ag-common .ag-value-change-delta {
  padding-right: 2px;
}
.ag-common .ag-value-change-delta-up {
  color: #adff2f;
}
.ag-common .ag-value-change-delta-down {
  color: #f00;
}
.ag-common .ag-value-change-value {
  background-color: transparent;
  -webkit-border-radius: 1px;
  border-radius: 1px;
  padding-left: 1px;
  padding-right: 1px;
  -webkit-transition: background-color 1s;
  -moz-transition: background-color 1s;
  -o-transition: background-color 1s;
  -ms-transition: background-color 1s;
  transition: background-color 1s;
}
.ag-common .ag-value-change-value-highlight {
  background-color: #d2691e;
  -webkit-transition: background-color 0.1s;
  -moz-transition: background-color 0.1s;
  -o-transition: background-color 0.1s;
  -ms-transition: background-color 0.1s;
  transition: background-color 0.1s;
}
.ag-common .ag-rich-select {
  font-size: 14px;
  border: 1px solid #808080;
  background-color: #302e2e;
}
.ag-common .ag-rich-select-value {
  padding: 2px;
}
.ag-common .ag-rich-select-list {
  border-top: 1px solid #555;
}
.ag-common .ag-rich-select-row {
  padding: 2px;
}
.ag-common .ag-rich-select-row-selected {
  background-color: #4a708b;
}
.ag-common .ag-header {
  color: #e0e0e0;
  background: #626262;
  border-bottom: 1px solid #808080;
  font-weight: normal;
}
.ag-common .ag-header-icon {
  color: #e0e0e0;
  stroke: none;
  fill: #e0e0e0;
}
.ag-common .ag-no-scrolls .ag-header-container {
  background: #626262;
  border-bottom: 1px solid #808080;
}
.ag-common .ag-header-cell {
  border-right: 1px solid #808080;
}
.ag-common .ag-header-cell-moving .ag-header-cell-label {
  opacity: 0.5;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
  filter: alpha(opacity=50);
}
.ag-common .ag-header-cell-moving {
  background-color: #bebebe;
}
.ag-common .ag-header-group-cell {
  border-right: 1px solid #808080;
}
.ag-common .ag-header-group-cell-with-group {
  border-bottom: 1px solid #808080;
}
.ag-common .ag-header-cell-label {
  padding: 4px 2px 4px 2px;
}
.ag-common .ag-header-cell-text {
  padding-left: 2px;
}
.ag-common .ag-header-group-cell-label {
  padding: 4px;
  padding-left: 10px;
}
.ag-common .ag-header-group-text {
  margin-right: 2px;
}
.ag-common .ag-header-cell-menu-button {
  padding: 2px;
  margin-top: 4px;
  border: 1px solid transparent;
  -webkit-border-radius: 3px;
  border-radius: 3px;
  -webkit-box-sizing: content-box /* When using bootstrap, box-sizing was set to 'border-box' */;
  -moz-box-sizing: content-box /* When using bootstrap, box-sizing was set to 'border-box' */;
  box-sizing: content-box /* When using bootstrap, box-sizing was set to 'border-box' */;
  line-height: 0px /* normal line height, a space was appearing below the menu button */;
}
.ag-common .ag-pinned-right-header {
  border-left: 1px solid #808080;
}
.ag-common .ag-header-cell-menu-button:hover {
  border: 1px solid #808080;
}
.ag-common .ag-body {
  background-color: #302e2e;
}
.ag-common .ag-body .ag-row {
  -webkit-transition: background-color 0.1s;
  -moz-transition: background-color 0.1s;
  -o-transition: background-color 0.1s;
  -ms-transition: background-color 0.1s;
  transition: background-color 0.1s;
}
.ag-common .ag-body .ag-row-odd {
  background-color: #302e2e;
}
.ag-common .ag-body .ag-row-even {
  background-color: #403e3e;
}
.ag-common .ag-body .ag-row-selected {
  background-color: #4a708b;
}
.ag-common .ag-floating-top .ag-row {
  background-color: #333;
}
.ag-common .ag-floating-bottom .ag-row {
  background-color: #333;
}
.ag-common .ag-overlay-loading-wrapper {
  background-color: rgba(255,255,255,0.5);
}
.ag-common .ag-overlay-loading-center {
  background-color: #fff;
  border: 1px solid #808080;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  padding: 10px;
  color: #000;
}
.ag-common .ag-overlay-no-rows-center {
  background-color: #fff;
  border: 1px solid #808080;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  padding: 10px;
}
.ag-common .ag-group-cell-entire-row {
  background-color: #302e2e;
  padding: 2px;
}
.ag-common .ag-footer-cell-entire-row {
  background-color: #302e2e;
  padding: 2px;
}
.ag-common .ag-group-cell {
  font-style: italic;
}
.ag-common .ag-group-expanded {
  padding-right: 4px;
}
.ag-common .ag-group-contracted {
  padding-right: 4px;
}
.ag-common .ag-group-value {
  padding-right: 2px;
}
.ag-common .ag-group-checkbox {
  padding-right: 2px;
}
.ag-common .ag-footer-cell {
  font-style: italic;
}
.ag-common .ag-menu {
  border: 1px solid #555;
  background-color: #302e2e;
  cursor: default;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
}
.ag-common .ag-menu .ag-tab-header {
  background-color: #626262;
}
.ag-common .ag-menu .ag-tab {
  padding: 6px 8px 6px 8px;
  margin: 2px 2px 0px 2px;
  display: inline-block;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
  border-top: 1px solid transparent;
  border-top-right-radius: 2px;
  border-top-left-radius: 2px;
}
.ag-common .ag-menu .ag-tab-selected {
  background-color: #302e2e;
  border-right: 1px solid #555;
  border-left: 1px solid #555;
  border-top: 1px solid #555;
}
.ag-common .ag-menu-separator {
  border-top: 1px solid #555;
}
.ag-common .ag-menu-option-active {
  background-color: #4a708b;
}
.ag-common .ag-menu-option-icon {
  padding: 2px 4px 2px 4px;
  vertical-align: middle;
}
.ag-common .ag-menu-option-text {
  padding: 2px 4px 2px 4px;
  vertical-align: middle;
}
.ag-common .ag-menu-option-shortcut {
  padding: 2px 2px 2px 20px;
  vertical-align: middle;
}
.ag-common .ag-menu-option-popup-pointer {
  padding: 2px 4px 2px 4px;
  vertical-align: middle;
}
.ag-common .ag-menu-option-disabled {
  opacity: 0.5;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
  filter: alpha(opacity=50);
}
.ag-common .ag-menu-column-select-wrapper {
  margin: 2px;
}
.ag-common .ag-filter-checkbox {
  position: relative;
  top: 2px;
  left: 2px;
}
.ag-common .ag-filter-header-container {
  border-bottom: 1px solid #555;
}
.ag-common .ag-filter-apply-panel {
  border-top: 1px solid ag-separatorcolor;
  padding: 2px;
}
.ag-common .ag-filter-value {
  margin-left: 4px;
}
.ag-common .ag-selection-checkbox {
  padding-right: 4px;
}
.ag-common .ag-paging-panel {
  padding: 4px;
}
.ag-common .ag-paging-button {
  margin-left: 4px;
  margin-right: 4px;
}
.ag-common .ag-paging-row-summary-panel {
  display: inline-block;
  width: 300px;
}
.ag-common .ag-tool-panel {
  background-color: #302e2e;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  border-top: 1px solid #808080;
  color: #ccc;
}
.ag-common .ag-status-bar {
  color: #ccc;
  background-color: #302e2e;
  font-size: 14px;
  height: 22px;
  border-bottom: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #808080;
  padding: 2px;
}
.ag-common .ag-status-bar-aggregations {
  float: right;
}
.ag-common .ag-status-bar-item {
  padding-left: 10px;
}
.ag-common .ag-column-drop-cell {
  background: #403e3e;
  color: #e0e0e0;
  border: 1px solid #666;
  padding: 2px;
}
.ag-common .ag-column-drop-cell-ghost {
  opacity: 0.5;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
  filter: alpha(opacity=50);
}
.ag-common .ag-column-drop-cell-text {
  padding-left: 2px;
  padding-right: 2px;
}
.ag-common .ag-column-drop-cell-button {
  border: 1px solid transparent;
  padding-left: 2px;
  padding-right: 2px;
  -webkit-border-radius: 3px;
  border-radius: 3px;
}
.ag-common .ag-column-drop-cell-button:hover {
  border: 1px solid #808080;
}
.ag-common .ag-column-drop-empty-message {
  padding-left: 2px;
  padding-right: 2px;
  color: #808080;
}
.ag-common .ag-column-drop-icon {
  padding-right: 4px;
}
.ag-common .ag-column-drop {
  padding: 4px;
  background-color: #302e2e;
}
.ag-common .ag-column-drop-horizontal {
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #808080;
}
.ag-common .ag-column-drop-vertical {
  border-top: 1px solid #808080;
}
.ag-common .ag-column-drop-vertical .ag-column-drop-cell {
  margin-top: 2px;
}
.ag-common .ag-column-drop-vertical .ag-column-drop-empty-message {
  padding: 20px;
}
.ag-common ::-webkit-scrollbar {
  width: 12px;
  height: 12px;
  background: #302e2e;
}
.ag-common ::-webkit-scrollbar-thumb {
  background-color: #626262;
}
.ag-common ::-webkit-scrollbar-corner {
  background: #302e2e;
}
.ag-common select {
  background-color: #302e2e;
  color: #ccc;
}
.ag-common input {
  background-color: #302e2e;
  color: #ccc;
}


text:
require 'test_helper'

class HerdLegacyJsTest < ActiveSupport::TestCase
  test "truth" do
    assert_kind_of Module, HerdLegacyJs
  end
end


text:
package test;

import java.io.IOException;

import org.restlet.Client;
import org.restlet.data.Method;
import org.restlet.data.Protocol;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.Representation;

public class TestHttpGet {

	//CIR metadata services call
	//static String requestUrl = "http://qa.cir.lifetouch.net/CIR-MetadataServices/srv/amrs?sourceLocation=Lab+-+Minneapolis&ssid=36487672&orgUnit=LNSS";
	//static String requestUrl = "http://cir.lifetouch.net/CIR-MetadataServices/srv/amrs?sourceLocation=Lab+-+Minneapolis&ssid=LN51M562Y001001214&orgUnit=LNSS";
	static String requestUrl ="http://cir.lifetouch.net/Ingestion/rest/assetData?AssetId=686C22B4-0CFA-4038-A5C4-44B97DF7AF97";
	//CIR calling cache
	//static String requestUrl = "http://cir.lifetouch.net/cache/aggressivecache?url=http://esb-ws.lifetouch.net/layout/v1.0/layoutsInTheme/11009";

	public static void main(String[] args) throws IOException {
		TestHttpGet testHttpGet = new TestHttpGet();
		testHttpGet.something();
	}

	public void something() throws IOException {
		Request request = new Request(Method.GET, requestUrl);
		Client client = new Client(Protocol.HTTP);

		Response response = client.handle(request);
		Representation representation = response.getEntity();
		System.out.println("http response: " +response.getStatus().getCode()+" "+response.getStatus().getDescription());
		System.out.println("text: \n"+representation.getText());

	}

	/*
	public void something() throws IOException {
		new ClientResource(requestUrl).get().write(System.out);
	}*/
}


text:
/***************
 * NAME:				transdlg.h
 * PROJECT:			Scenario
 * VERSION:			0.1 30.08.1996
 * DESCRIPTION:	transformation dialog
 * AUTHORS:			Mike Hesser
 * HISTORY:			DATE			NAME	COMMENT
 *						07.09.1996	mh		comment
 ***************/

#ifndef TRANSDLG_H
#define TRANSDLG_H

#include "CameraDlg.h"
#include "LightDlg.h"
#include "MeshDlg.h"
#include "bsebutt.h"
#include "flares.h"
#include "CSGDlg.h"
#include "PrimDlg.h"

class CTransformPage : public CPropertyPage
{
public:
	CTransformPage();
	enum { IDD = IDD_TRANSFORM };

	VECTOR m_Pos, m_Align, m_Size;
	OBJECT *m_pObject, *m_pTrack;
	CBrowseButton m_bbtnTrack;
	CString m_sObjectname, m_sTrackname;
	BOOL m_bInverted;

protected:
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange*);

	DECLARE_MESSAGE_MAP()
};

// settings sheet
class CSettingsSheet : public CPropertySheet
{
public:
	DECLARE_DYNAMIC(CSettingsSheet)
	CSettingsSheet(CWnd *);

	OBJECT *m_pObject;
	STAR *m_pStar;
	CTransformPage m_pgTransform;
	CCameraSetPage m_pgCameraSet;
	CLightSetPage  m_pgLightSet;
	CMeshSetPage	m_pgMeshSet;
	CFlareSetPage	m_pgFlareSet;
	CStarSetPage	m_pgStarSet;
	CCSGSetPage		m_pgCSGSet;
	CPrimSetPage	m_pgPrimSet;
	BOOL m_bFlares, m_bStar;

	void ExtraPagesOnOff();

protected:
	DECLARE_MESSAGE_MAP()
};

#endif


text:
package cz.metacentrum.perun.webgui.json;

import com.google.gwt.core.client.JavaScriptObject;
import cz.metacentrum.perun.webgui.client.PerunWebSession;
import cz.metacentrum.perun.webgui.client.resources.PerunEntity;
import cz.metacentrum.perun.webgui.model.PerunError;

import java.util.ArrayList;

/**
 * Unified callback class to get any PerunEntity by it's ID with optional cache support
 *
 * @author Pavel Zlamal <256627@mail.muni.cz>
 */
public class GetEntityById implements JsonCallback, JsonCallbackWithCache {

	// SESSION
	private PerunWebSession session = PerunWebSession.getInstance();

	// PARAMS
	private JsonCallbackEvents events = new JsonCallbackEvents();
	private int entityId;
	private PerunEntity entity;
	private boolean cached = false;

	// URLs
	static private final String URL_MEMBER = "membersManager/getMemberById";
	static private final String URL_RICH_MEMBER = "membersManager/getRichMember";
	static private final String URL_RICH_MEMBER_WITH_ATTRS = "membersManager/getRichMemberWithAttributes";

	static private final String URL_VO = "vosManager/getVoById";
	static private final String URL_FACILITY = "facilitiesManager/getFacilityById";
	static private final String URL_GROUP = "groupsManager/getGroupById";
	static private final String URL_GROUP_PARENT = "groupsManager/getParentGroup";
	static private final String URL_RICH_GROUP = "groupsManager/getRichGroupByIdWithAttributesByNames";

	static private final String URL_RESOURCE = "resourcesManager/getResourceById";
	static private final String URL_RICH_RESOURCE = "resourcesManager/getRichResourceById";
	static private final String URL_PUBLICATION = "cabinetManager/findPublicationById";
	static private final String URL_SERVICE = "servicesManager/getServiceById";

	static private final String URL_USER = "usersManager/getUserById";
	static private final String URL_RICH_USER = "usersManager/getRichUser";
	static private final String URL_RICH_USER_WITH_ATTRS = "usersManager/getRichUserWithAttributes";

	static private final String URL_TASK = "propagationStatsReader/getTaskById";
	static private final String URL_APP_MAIL = "registrarManager/getApplicationMailById";
	static private final String URL_APP = "registrarManager/getApplicationById";

	static private final String URL_SECURITY_TEAM = "securityTeamsManager/getSecurityTeamById";
	static private final String URL_USER_EXT_SRC = "usersManager/getUserExtSourceById";

	static private final String URL_DESTINATION = "servicesManager/getDestinationById";

	/**
	 * New callback instance
	 *
	 * @param entity Perun entity to get
	 * @param entityId entity's ID
	 */
	public GetEntityById(PerunEntity entity, int entityId) {
		this.entity = entity;
		this.entityId = entityId;
	}

	/**
	 * New callback instance
	 *
	 * @param entity Perun entity to get
	 * @param entityId entity's ID
	 * @param events custom events for callback
	 */
	public GetEntityById(PerunEntity entity, int entityId, JsonCallbackEvents events) {
		this.entity = entity;
		this.entityId = entityId;
		this.events = events;
	}

	@Override
	public void retrieveData() {

		String param = "id=" + this.entityId;
		JsonClient js = new JsonClient();
		js.setCacheEnabled(cached);

		if (PerunEntity.MEMBER.equals(entity)) {
			js.retrieveData(URL_MEMBER, param, this);
		} else if (PerunEntity.RICH_MEMBER.equals(entity)) {
			js.retrieveData(URL_RICH_MEMBER, param, this);
		} else if (PerunEntity.RICH_MEMBER_WITH_ATTRS.equals(entity)) {
			js.retrieveData(URL_RICH_MEMBER_WITH_ATTRS, param, this);
		} else if (PerunEntity.VIRTUAL_ORGANIZATION.equals(entity)) {
			js.retrieveData(URL_VO, param, this);
		} else if (PerunEntity.FACILITY.equals(entity)) {
			js.retrieveData(URL_FACILITY, param, this);
		} else if (PerunEntity.GROUP.equals(entity)) {
			js.retrieveData(URL_GROUP, param, this);
		} else if (PerunEntity.GROUP_PARENT.equals(entity)) {
			param = "group="+entityId;
			js.retrieveData(URL_GROUP_PARENT, param, this);
		} else if (PerunEntity.RICH_GROUP.equals(entity)) {
			param = "groupId="+entityId;
			ArrayList<String> attrNames = new ArrayList<>();
			attrNames.add("urn:perun:group:attribute-def:def:synchronizationEnabled");
			attrNames.add("urn:perun:group:attribute-def:def:synchronizationInterval");
			attrNames.add("urn:perun:group:attribute-def:def:lastSynchronizationState");
			attrNames.add("urn:perun:group:attribute-def:def:lastSynchronizationTimestamp");
			attrNames.add("urn:perun:group:attribute-def:def:lastSuccessSynchronizationTimestamp");
			attrNames.add("urn:perun:group:attribute-def:def:authoritativeGroup");
			attrNames.add("urn:perun:group:attribute-def:def:groupSynchronizationTimes");
			attrNames.add("urn:perun:group:attribute-def:def:startOfLastSuccessfulSynchronization");
			for (String value : attrNames) {
				param += "&attrNames[]="+value;
			}
			js.retrieveData(URL_RICH_GROUP, param, this);
		} else if (PerunEntity.PUBLICATION.equals(entity)) {
			js.retrieveData(URL_PUBLICATION, param, this);
		} else if (PerunEntity.RESOURCE.equals(entity)) {
			js.retrieveData(URL_RESOURCE, param, this);
		} else if (PerunEntity.RICH_RESOURCE.equals(entity)) {
			js.retrieveData(URL_RICH_RESOURCE, param, this);
		} else if (PerunEntity.USER.equals(entity)) {
			js.retrieveData(URL_USER, param, this);
		} else if (PerunEntity.RICH_USER.equals(entity)) {
			param = "user="+entityId;
			js.retrieveData(URL_RICH_USER, param, this);
		} else if (PerunEntity.RICH_USER_WITH_ATTRS.equals(entity)) {
			param = "user="+entityId;
			js.retrieveData(URL_RICH_USER_WITH_ATTRS, param, this);
		} else if (PerunEntity.SERVICE.equals(entity)) {
			js.retrieveData(URL_SERVICE, param, this);
		} else if (PerunEntity.TASK.equals(entity)) {
			js.retrieveData(URL_TASK, param, this);
		} else if (PerunEntity.APPLICATION_MAIL.equals(entity)) {
			js.retrieveData(URL_APP_MAIL, param, this);
		} else if (PerunEntity.APPLICATION.equals(entity)) {
			js.retrieveData(URL_APP, param, this);
		} else if (PerunEntity.SECURITY_TEAM.equals(entity)) {
			js.retrieveData(URL_SECURITY_TEAM, param, this);
		} else if (PerunEntity.USER_EXT_SOURCE.equals(entity)) {
			param = "userExtSource="+entityId;
			js.retrieveData(URL_USER_EXT_SRC, param, this);
		} else if (PerunEntity.DESTINATION.equals(entity)) {
			js.retrieveData(URL_DESTINATION, param, this);
		} else {
			// UNSUPPORTED COMBINATION
		}

	}

	@Override
	public void onFinished(JavaScriptObject jso) {
		session.getUiElements().setLogText("Loading "+entity+": " + this.entityId+" finished.");
		events.onFinished(jso);
	}

	@Override
	public void onError(PerunError error) {
		session.getUiElements().setLogErrorText("Error while loading "+entity+": " + this.entityId);
		events.onError(error);
	}

	@Override
	public void onLoadingStart() {
		events.onLoadingStart();
	}

	@Override
	public boolean isCacheEnabled() {
		return cached;
	}

	@Override
	public void setCacheEnabled(boolean cache) {
		this.cached = cache;
	}

}


text:
import keycode from 'keycode';

const initialize = ctx => {
  const { canvas } = ctx;

  //MouseData
  canvas[Symbol.for('mouseData')] = {
    x: 0,
    y: 0,
    dx: 0,
    dy: 0,
    previousX: 0,
    previousY: 0,
    state: false,
    clicked: 0,
  };

  const keys = (canvas[Symbol.for('keyData')] = {});

  for (const name in keycode.code) {
    if (keycode.code.hasOwnProperty(name)) {
      keys[name] = false;
    }
  }

  //Mouse regions
  canvas[Symbol.for('regions')] = {};
  canvas[Symbol.for('mousePoints')] = [];

  //Make the canvas receive touch and mouse events
  canvas.tabIndex = 1;

  const mouseMove = evt => {
    const { clientX, clientY } = evt;

    //Get left and top coordinates
    const { left, top } = canvas.getBoundingClientRect();

    const mouseData = canvas[Symbol.for('mouseData')];

    const point = [clientX - left, clientY - top, mouseData.state];

    mouseData.x = point[0];
    mouseData.y = point[1];

    const points = canvas[Symbol.for('mousePoints')];

    points.push(point);

    //Store the last 100 stored positions for hover detection
    if (points.length > 100) {
      points.splice(0, points.length - 100);
    }

    evt.preventDefault();
    return false;
  };

  //Up target needs to detect mouse up and keyup events if the mouse leaves the canvas
  const upTarget = typeof window !== 'undefined' ? window : canvas;

  canvas.addEventListener('mousemove', mouseMove);
  canvas.addEventListener('mousedown', evt => {
    const { target } = evt;
    if (target === canvas) {
      const mouseData = canvas[Symbol.for('mouseData')];

      if (!mouseData.state) {
        mouseData.clicked += 1;
      }

      mouseData.state = true;
      return mouseMove(evt);
    }
  });

  canvas.addEventListener('keydown', evt => {
    canvas[Symbol.for('keyData')][keycode(evt.keyCode)] = true;
    evt.preventDefault();
    return false;
  });

  upTarget.addEventListener('mouseup', evt => {
    const mouseData = canvas[Symbol.for('mouseData')];
    mouseData.state = false;
    mouseMove(evt);
  });

  upTarget.addEventListener('keyup', evt => {
    canvas[Symbol.for('keyData')][keycode(evt.keyCode)] = false;
    evt.preventDefault();
  });
};

export default initialize;


text:
<localize key="merchelloProductOptions_addProductOption" />

                    <merchello-tabs tabs="tabs" data-ng-if="dialogData.showTabs"></merchello-tabs>

                    <product-options-add-edit option="dialogData.option"></product-options-add-edit>

                    <product-options-associate-shared option="dialogData.option" exclude="dialogData.exclude"></product-options-associate-shared>

                            <localize key="general_cancel"></localize>

                        <button class="btn btn-success" data-ng-click="validate()">
                            <localize key="buttons_save"></localize>
                        </button>


text:
//    #[license]
//    SmartsheetClient SDK for C#
//    %%
//    Copyright (C) 2014 SmartsheetClient
//    %%
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//            http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//    %[license]

namespace Smartsheet.Api
{
    using NLog;
    using System;
    using SmartsheetImpl = Api.Internal.SmartsheetImpl;
    using DefaultHttpClient = Api.Internal.Http.DefaultHttpClient;
    using HttpClient = Api.Internal.Http.HttpClient;
    using JsonNetSerializer = Api.Internal.Json.JsonNetSerializer;
    using JsonSerializer = Api.Internal.Json.JsonSerializer;

    /// <summary>
    /// <para>A convenience class to help create a <seealso cref="SmartsheetClient"/> instance with the appropriate fields.</para>
    ///
    /// <para>Thread Safety: This class is not thread safe since it's mutable, one builder instance is NOT expected to be used in
    /// multiple threads.</para>
    /// </summary>
    public class SmartsheetBuilder
    {
        /// <summary>
        /// <para>Represents the HttpClient.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private HttpClient httpClient;

        /// <summary>
        /// <para>Represents the JsonSerializer.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private JsonSerializer jsonSerializer;

        /// <summary>
        /// <para>Represents the base URI.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private string baseURI;

        /// <summary>
        /// <para>Represents the access token.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private string accessToken;

        /// <summary>
        /// <para>Represents the max retry timeout period.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private long? maxRetryTimeout;

        /// <summary>
        /// <para>Represents the assumed user.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private string assumedUser;

        /// <summary>
        /// <para>Represents the Smartsheet change agent.</para>
        ///
        /// <para>It can be set using corresponding setter.</para>
        /// </summary>
        private string changeAgent;

        /// <summary>
        /// Optional setting to re-enable the JSON serializers string to C# DateTime conversion
        /// </summary>
        private bool dateTimeFixOptOut = false;

        /// <summary>
        /// <para>Represents the default base URI of the Smartsheet REST API.</para>
        ///
        /// <para>It is a constant with Value "https://api.smartsheet.com/2.0".</para>
        /// </summary>
        public const string DEFAULT_BASE_URI = "https://api.smartsheet.com/2.0/";

        /// <summary>
        /// <para>Represents the base URI of the Smartsheetgov REST API.</para>
        ///
        /// <para>It is a constant with Value "https://api.smartsheetgov.com/2.0".</para>
        /// </summary>
        public const string GOV_BASE_URI = "https://api.smartsheetgov.com/2.0/";

        /// <summary>
        /// Constructor.
        /// </summary>
        public SmartsheetBuilder()
        {
        }

        /// <summary>
        /// <para>Set the HttpClient.</para>
        /// </summary>
        /// <param name="httpClient"> the http client </param>
        /// <returns> the SmartsheetClient builder </returns>
        public SmartsheetBuilder SetHttpClient(HttpClient httpClient)
        {
            this.httpClient = httpClient;
            return this;
        }

        /// <summary>
        /// <para>Set the JsonSerializer.</para>
        /// </summary>
        /// <param name="jsonSerializer"> the JsonSerializer </param>
        /// <returns> the SmartsheetBuilder </returns>
        public SmartsheetBuilder SetJsonSerializer(JsonSerializer jsonSerializer)
        {
            this.jsonSerializer = jsonSerializer;
            return this;
        }

        /// <summary>
        /// <para>Set the base URI.</para>
        /// </summary>
        /// <param name="baseURI"> the base uri </param>
        /// <returns> the SmartsheetClient builder </returns>
        public SmartsheetBuilder SetBaseURI(string baseURI)
        {
            this.baseURI = baseURI;
            return this;
        }

        /// <summary>
        /// <para>Set the access token.</para>
        /// </summary>
        /// <param name="accessToken"> the access token </param>
        /// <returns> the SmartsheetClient builder </returns>
        public SmartsheetBuilder SetAccessToken(string accessToken)
        {
            this.accessToken = accessToken;
            return this;
        }

        /// <summary>
        /// <para>Set the assumed user.</para>
        /// </summary>
        /// <param name="assumedUser"> the assumed user </param>
        /// <returns> the SmartsheetClient builder </returns>
        public SmartsheetBuilder SetAssumedUser(string assumedUser)
        {
            this.assumedUser = assumedUser;
            return this;
        }

        /// <summary>
        /// <para>Set the Smartsheet change agent.</para>
        /// </summary>
        /// <param name="changeAgent"> the change agent </param>
        /// <returns> the SmartsheetClient builder </returns>
        public SmartsheetBuilder SetChangeAgent(string changeAgent)
        {
            this.changeAgent = changeAgent;
            return this;
        }

        /// <summary>
        /// Create a DefaultCalcBackoff with a max elapsed timeout specified by the user. This interface
        /// is only valid when the DefaultHttpClient is used.
        /// </summary>
        /// <param name="maxRetryTimeout"></param>
        /// <returns></returns>
        public SmartsheetBuilder SetMaxRetryTimeout(long maxRetryTimeout)
        {
            this.maxRetryTimeout = maxRetryTimeout;
            return this;
        }

        /// <summary>
        /// Set optional flag to re-enable JSON deserializers conversion from string to C# DateTime
        /// </summary>
        /// <param name="dateTimeFixOptOut"></param>
        /// <returns></returns>
        public SmartsheetBuilder SetDateTimeFixOptOut(bool dateTimeFixOptOut)
        {
            this.dateTimeFixOptOut = dateTimeFixOptOut;
            return this;
        }

        /// <summary>
        /// <para>Gets the http client.</para>
        /// </summary>
        /// <returns> the http client </returns>
        public HttpClient HttpClient
        {
            get { return httpClient; }
        }

        /// <summary>
        /// <para>Gets the Json serializer.</para>
        /// </summary>
        /// <returns> the Json serializer </returns>
        public JsonSerializer JsonSerializer
        {
            get { return jsonSerializer; }
        }

        /// <summary>
        /// <para>Gets the base uri.</para>
        /// </summary>
        /// <returns> the base uri </returns>
        public string BaseURI
        {
            get { return baseURI; }
        }

        /// <summary>
        /// <para>Gets the access token.</para>
        /// </summary>
        /// <returns> the access token </returns>
        public string AccessToken
        {
            get { return accessToken; }
        }

        /// <summary>
        /// <para>Gets the assumed user.</para>
        /// </summary>
        /// <returns> the assumed user </returns>
        public string AssumedUser
        {
            get { return assumedUser; }
        }

        /// <summary>
        /// <para>Gets the default base uri.</para>
        /// </summary>
        /// <returns> the default base uri </returns>
        public static string DefaultBaseUri
        {
            get { return DEFAULT_BASE_URI; }
        }

        /// <summary>
        /// <para>Build the SmartsheetClient instance.</para>
        /// </summary>
        /// <returns> the SmartsheetClient instance </returns>
        public SmartsheetClient Build()
        {
            if (baseURI == null)
            {
                baseURI = DEFAULT_BASE_URI;
            }

            if (accessToken == null)
            {
                accessToken = Environment.GetEnvironmentVariable("SMARTSHEET_ACCESS_TOKEN");
            }

            SmartsheetImpl smartsheet = new SmartsheetImpl(baseURI, accessToken, httpClient, jsonSerializer, dateTimeFixOptOut);

            if (changeAgent != null)
            {
                smartsheet.ChangeAgent = changeAgent;
            }

            if (assumedUser != null)
            {
                smartsheet.AssumedUser = assumedUser;
            }

            if (maxRetryTimeout != null)
            {
                smartsheet.MaxRetryTimeout = maxRetryTimeout.Value;
            }

            return smartsheet;
        }
    }

}


text:
import Serializable from './Serializable';
import BaseTypes from './BaseTypes';

/**
 * A TwoVector is a geometric object which is completely described
 * by two values.
 */
class TwoVector extends Serializable {

    static get netScheme() {
        return {
            x: { type: BaseTypes.TYPES.FLOAT32 },
            y: { type: BaseTypes.TYPES.FLOAT32 }
        };
    }

    /**
    * Creates an instance of a TwoVector.
    * @param {Number} x - first value
    * @param {Number} y - second value
    * @return {TwoVector} v - the new TwoVector
    */
    constructor(x, y) {
        super();
        this.x = x;
        this.y = y;

        return this;
    }

    /**
     * Formatted textual description of the TwoVector.
     * @return {String} description
     */
    toString() {
        function round3(x) { return Math.round(x * 1000) / 1000; }
        return `[${round3(this.x)}, ${round3(this.y)}]`;
    }

    /**
     * Set TwoVector values
     *
     * @param {Number} x x-value
     * @param {Number} y y-value
     * @return {TwoVector} returns self
     */
    set(x, y) {
        this.x = x;
        this.y = y;
        return this;
    }

    multiply(other) {
        this.x *= other.x;
        this.y *= other.y;

        return this;
    }

    /**
     * Multiply this TwoVector by a scalar
     *
     * @param {Number} s the scale
     * @return {TwoVector} returns self
     */
    multiplyScalar(s) {
        this.x *= s;
        this.y *= s;

        return this;
    }

    /**
     * Add other vector to this vector
     *
     * @param {TwoVector} other the other vector
     * @return {TwoVector} returns self
     */
    add(other) {
        this.x += other.x;
        this.y += other.y;

        return this;
    }

    /**
     * Subtract other vector to this vector
     *
     * @param {TwoVector} other the other vector
     * @return {TwoVector} returns self
     */
    subtract(other) {
        this.x -= other.x;
        this.y -= other.y;

        return this;
    }

    /**
     * Get vector length
     *
     * @return {Number} length of this vector
     */
    length() {
        return Math.sqrt(this.x * this.x + this.y * this.y);
    }

    /**
     * Normalize this vector, in-place
     *
     * @return {TwoVector} returns self
     */
    normalize() {
        this.multiplyScalar(1 / this.length());
        return this;
    }

    /**
     * Copy values from another TwoVector into this TwoVector
     *
     * @param {TwoVector} sourceObj the other vector
     * @return {TwoVector} returns self
     */
    copy(sourceObj) {
        this.x = sourceObj.x;
        this.y = sourceObj.y;

        return this;
    }

    /**
     * Create a clone of this vector
     *
     * @return {TwoVector} returns clone
     */
    clone() {
        return new TwoVector(this.x, this.y);
    }

    /**
     * Apply in-place lerp (linear interpolation) to this TwoVector
     * towards another TwoVector
     * @param {TwoVector} target the target vector
     * @param {Number} p The percentage to interpolate
     * @return {TwoVector} returns self
     */
    lerp(target, p) {
        this.x += (target.x - this.x) * p;
        this.y += (target.y - this.y) * p;

        return this;
    }

    /**
     * Get bending Delta Vector
     * towards another TwoVector
     * @param {TwoVector} target the target vector
     * @param {Object} options bending options
     * @param {Number} options.increments number of increments
     * @param {Number} options.percent The percentage to bend
     * @param {Number} options.min No less than this value
     * @param {Number} options.max No more than this value
     * @return {TwoVector} returns new Incremental Vector
     */
    getBendingDelta(target, options) {
        let increment = target.clone();
        increment.subtract(this);
        increment.multiplyScalar(options.percent);

        // check for max case
        if (((typeof options.max === 'number') && increment.length() > options.max) ||
            ((typeof options.min === 'number') && increment.length() < options.min)) {
            return new TwoVector(0, 0);
        }

        // divide into increments
        increment.multiplyScalar(1 / options.increments);

        return increment;
    }
}

export default TwoVector;


text:
package org.apache.felix.framework.util;

import java.util.Enumeration;
import java.util.NoSuchElementException;

public class CompoundEnumeration implements Enumeration
{
    private Enumeration[] m_enums = null;
    private int index = 0;

    public CompoundEnumeration(Enumeration[] enums)
    {
        m_enums = enums;
    }

    public boolean hasMoreElements()
    {
        // if the current enum is null that means this enum is finished
        if (currentEnumeration() == null)
        {
            // No next enum
            return false;
        }
        // If the current enum has more elements, lets go
        return currentEnumeration().hasMoreElements();
    }

    private Enumeration findNextEnumeration(boolean moveCursor)
    {
        return findNextEnumeration(index, moveCursor);
    }

    private Enumeration findNextEnumeration(int cursor, boolean moveCursor)
    {
        // next place in the array
        int next = cursor + 1;
        // If the cursor is still in the array
        if (next < m_enums.length)
        {

            // If there is something in that place
            // AND the enum is not empty
            if (m_enums[next] != null &&
                m_enums[next].hasMoreElements())
            {
                // OK
                if (moveCursor)
                {
                    index = next;
                }
                return m_enums[next];
            }
            // Try next element
            return findNextEnumeration(next, moveCursor);
        }
        // No more elements available
        return null;
    }

    public Object nextElement()
    {
        // ask for the next element of the current enum.
        if (currentEnumeration() != null)
        {
            return currentEnumeration().nextElement();
        }

        // no more elements in this Enum
        // We must throw a NoSuchElementException
        throw new NoSuchElementException("No more elements");
    }

    private Enumeration currentEnumeration()
    {
        if (m_enums != null)
        {
            if (index < m_enums.length)
            {
                Enumeration e = m_enums[index];
                if (e == null || !e.hasMoreElements())
                {
                    // the current enum is null or empty
                    // we probably want to switch to the next one
                    e = findNextEnumeration(true);
                }
                return e;
            }
        }
        return null;
    }
}


text:
module CrystalGaze
  class EmailSpirit
    attr_reader :name, :email, :local_part, :domain, :manifestation

    def initialize(name, email)
      @name = name
      @email = email
      @local_part, @domain = email.split("@")
      @manifestation = EmailManifestation.of(local_part)
    end

    def manifest
      manifest_as(name)
    end

    def manifest_as(name, domain = domain)
      manifestation && manifestation.present(name, domain)
    end
  end
end


text:
package org.apache.ignite.internal.processors.cache.persistence.snapshot;

import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;

/**
 * Compound snapshot verification exception from the nodes where the verification process executed.
 */
public class IgniteSnapshotVerifyException extends IgniteException {
    /** Serial version UID. */
    private static final long serialVersionUID = 0L;

    /** Map of received exceptions. */
    private final Map<ClusterNode, Exception> exs = new HashMap<>();

    /**
     * @param map Map of received exceptions.
     */
    public IgniteSnapshotVerifyException(Map<ClusterNode, ? extends Exception> map) {
        exs.putAll(map);
    }

    /**
     * @return Map of received exceptions.
     */
    public Map<ClusterNode, Exception> exceptions() {
        return exs;
    }
}


text:
package com.intellij.coverage;

import com.intellij.execution.configurations.SimpleJavaParameters;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.IOException;

/**
 * @author Roman.Chernyatchik
 */
public abstract class JavaCoverageRunner extends CoverageRunner {
  private static final Logger LOG = Logger.getInstance("#" + JavaCoverageRunner.class.getName());
  private static final String COVERAGE_AGENT_PATH = "coverage.lib.path";

  public boolean isJdk7Compatible() {
    return true;
  }

  @Override
  public boolean acceptsCoverageEngine(@NotNull CoverageEngine engine) {
    return engine instanceof JavaCoverageEngine;
  }

  public abstract void appendCoverageArgument(final String sessionDataFilePath, @Nullable final String[] patterns, final SimpleJavaParameters parameters,
                                              final boolean collectLineInfo, final boolean isSampling);

  public void appendCoverageArgument(final String sessionDataFilePath, @Nullable final String[] patterns, final SimpleJavaParameters parameters,
                                     final boolean collectLineInfo, final boolean isSampling, String sourceMapPath) {
    appendCoverageArgument(sessionDataFilePath, patterns, parameters, collectLineInfo, isSampling);
  }

  protected static String handleSpacesInPath(String agentPath) {
    final String userDefined = System.getProperty(COVERAGE_AGENT_PATH);
    if (userDefined != null && new File(userDefined).exists()) {
      agentPath = userDefined;
    } else {
      agentPath = new File(agentPath).getParent();
    }
    if (!SystemInfo.isWindows && agentPath.contains(" ")) {
      File dir = new File(PathManager.getSystemPath(), "coverageJars");
      if (dir.getAbsolutePath().contains(" ")) {
        try {
          dir = FileUtil.createTempDirectory("coverage", "jars");
          if (dir.getAbsolutePath().contains(" ")) {
            LOG.info("Coverage agent not used since the agent path contains spaces: " + agentPath + "\n" +
                     "One can move the agent libraries to a directory with no spaces in path and specify its path in idea.properties as " + COVERAGE_AGENT_PATH + "=<path>");
            return agentPath;
          }
        }
        catch (IOException e) {
          LOG.info(e);
          return agentPath;
        }
      }

      try {
        LOG.info("Coverage jars were copied to " + dir.getPath());
        FileUtil.copyDir(new File(agentPath), dir);
        return dir.getPath();
      }
      catch (IOException e) {
        LOG.info(e);
      }
    }
    return agentPath;
  }

   protected static void write2file(File tempFile, String arg) throws IOException {
    FileUtil.writeToFile(tempFile, (arg + "\n").getBytes(CharsetToolkit.UTF8_CHARSET), true);
  }

  protected static File createTempFile() throws IOException {
    File tempFile = FileUtil.createTempFile("coverage", "args");
    if (!SystemInfo.isWindows && tempFile.getAbsolutePath().contains(" ")) {
      tempFile = FileUtil.createTempFile(new File(PathManager.getSystemPath(), "coverage"), "coverage", "args", true);
      if (tempFile.getAbsolutePath().contains(" ")) {
        final String userDefined = System.getProperty(COVERAGE_AGENT_PATH);
        if (userDefined != null && new File(userDefined).isDirectory()) {
          tempFile = FileUtil.createTempFile(new File(userDefined), "coverage", "args", true);
        }
      }
    }
    return tempFile;
  }
}


text:
package com.ryandw11.structure.structure;

import com.ryandw11.structure.CustomStructures;
import com.ryandw11.structure.api.CustomStructuresAPI;
import com.ryandw11.structure.exceptions.StructureConfigurationException;
import com.ryandw11.structure.io.StructureFileReader;
import com.ryandw11.structure.threading.CheckStructureList;
import com.ryandw11.structure.utils.Pair;
import org.bukkit.Bukkit;
import org.bukkit.Location;

import java.io.File;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

/**
 * This handler manages the list of active structures.
 *
 *
You can access this handler from {@link CustomStructuresAPI#getStructureHandler()} or {@link CustomStructures#getStructureHandler()}.

 *
 *
Note: Do not store a long term instance of this class as it can be nulled when the /cstruct reload command is done.

 */
public class StructureHandler {

    private final SortedMap<Pair<Location, Long>, Structure> spawnedStructures = new TreeMap<>(
            Comparator.comparingDouble(o -> o.getLeft().distance(new Location(o.getLeft().getWorld(), 0, 0, 0)))
    );

    private final List<Structure> structures;
    private final List<String> names;
    private final CheckStructureList checkStructureList;
    private StructureFileReader structureFileReader;

    /**
     * Constructor for the structure handler.
     *
This is for internal use only. Use {@link CustomStructuresAPI#getStructureHandler()} or {@link CustomStructures#getStructureHandler()} instead.

     *
     * @param stringStructs The list of structures.
     * @param cs            The plugin.
     */
    public StructureHandler(List<String> stringStructs, CustomStructures cs) {
        structures = new ArrayList<>();
        names = new ArrayList<>();
        cs.getLogger().info("Loading structures from files.");
        for (String s : stringStructs) {
            File struct = new File(cs.getDataFolder() + File.separator + "structures" + File.separator + s.replace(".yml", "") + ".yml");
            if (!struct.exists()) {
                cs.getLogger().warning("Structure file: " + s + ".yml does not exist! Did you make a new structure file in the Structure folder?");
                cs.getLogger().warning("For more information please check to wiki.");
                continue;
            }
            try {
                Structure tempStruct = new StructureBuilder(s.replace(".yml", ""), struct).build();
                structures.add(tempStruct);
                names.add(tempStruct.getName());
            } catch (StructureConfigurationException ex) {
                cs.getLogger().warning("The structure '" + s + "' has an invalid configuration file:");
                cs.getLogger().warning(ex.getMessage());
            } catch (Exception ex) {
                cs.getLogger().severe("An unexpected error has occurred when trying to load the structure: " + s + ".");
                cs.getLogger().severe("Please ensure that your configuration file is valid!");
                if (cs.isDebug()) {
                    ex.printStackTrace();
                } else {
                    cs.getLogger().severe("Please enable debug mode to see the full error.");
                }
            }
        }

        checkStructureList = new CheckStructureList(this);
        // Run every 5 minutes.
        checkStructureList.runTaskTimerAsynchronously(cs, 20, 6000);

        if (cs.getConfig().getBoolean("logStructures")) {
            structureFileReader = new StructureFileReader(cs);
            structureFileReader.runTaskTimerAsynchronously(cs, 20, 300);
        }
    }

    /**
     * Get the list of structures.
     *
This list is read only and cannot be modified.

     *
     * @return The list of structures.
     */
    public List<Structure> getStructures() {
        return Collections.unmodifiableList(structures);
    }

    /**
     * Get structure by name
     *
     * @param name The name
     * @return The structure. (Returns null if the structure is not found).
     */
    public Structure getStructure(String name) {
        List<Structure> result = structures.stream().filter(struct -> struct.getName().equals(name)).collect(Collectors.toList());
        if (result.isEmpty())
            return null;
        return result.get(0);
    }

    /**
     * Get the structure by a number.
     *
     * @param i The number
     * @return The structure.
     */
    public Structure getStructure(int i) {
        return structures.get(i);
    }

    /**
     * Get the names of the structures.
     *
     * @return The names of the structures.
     */
    public List<String> getStructureNames() {
        return names;
    }

    /**
     * Get the Map of spawned structures.
     *
Note: This map is not synchronized by default and can be modified on a different thread.

     *
     * @return The list of spawned structures.
     */
    public SortedMap<Pair<Location, Long>, Structure> getSpawnedStructures() {
        return spawnedStructures;
    }

    /**
     * Add a structure to the list of spawned structures.
     *
This feature must be enabled via the config.

     *
Note: This will not spawn in a structure, only add one to the list of spawned structures
     * (seen by /cstruct nearby). Use {@link Structure#spawn(Location)} to spawn a structure in the world.

     *
     * @param loc    The location.
     * @param struct The structure.
     */
    public void putSpawnedStructure(Location loc, Structure struct) {
        synchronized (spawnedStructures) {
            if (structureFileReader != null) {
                structureFileReader.addStructure(loc, struct);
            }
            this.spawnedStructures.put(Pair.of(loc, System.currentTimeMillis()), struct);
        }
    }

    /**
     * Calculate if the structure is far enough away from other structures.
     *
     * @param struct   The structure to calculate that for.
     * @param location The location that the structure is spawning.
     * @return If the distance is valid according to its config.
     */
    public boolean validDistance(Structure struct, Location location) {
        double closest = Double.MAX_VALUE;
        synchronized (spawnedStructures) {
            for (Map.Entry<Pair<Location, Long>, Structure> entry : spawnedStructures.entrySet()) {
                if (entry.getKey().getLeft().getWorld() != location.getWorld()) continue;

                if (entry.getKey().getLeft().distance(location) < closest)
                    closest = entry.getKey().getLeft().distance(location);
            }
        }
        return struct.getStructureLocation().getDistanceFromOthers() < closest;
    }

    public boolean validSameDistance(Structure struct, Location location) {

        synchronized (spawnedStructures) {
            double closest = Double.MAX_VALUE;
            for (Map.Entry<Pair<Location, Long>, Structure> entry : spawnedStructures.entrySet()) {

                if (entry.getKey().getLeft().getWorld() != location.getWorld()) continue;

                if (!Objects.equals(entry.getValue().getName(), struct.getName())) continue;

                if (entry.getKey().getLeft().distance(location) < closest){
                        closest = entry.getKey().getLeft().distance(location);
                }
            }
            return struct.getStructureLocation().getDistanceFromSame() < closest;
        }

    }

    /**
     * Get the structure file reader.
     *
This feature must be enabled via the config.

     *
     * @return An Optional of the StructureFileReader.
     */
    public Optional<StructureFileReader> getStructureFileReader() {
        return Optional.ofNullable(structureFileReader);
    }

    /**
     * Shutdown internal processes.
     */
    public void cleanup() {
        checkStructureList.cancel();
        if (structureFileReader != null)
            structureFileReader.cancel();
        spawnedStructures.clear();
    }
}


text:
package com.github.dynamo.model;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown=true)
public abstract class Downloadable {

	private Long id;
	private String name;
	private DownloadableStatus status = DownloadableStatus.IGNORED;
	private String label;
	private String aka;
	protected int year;
	private Date creationDate;

	private String simpleClassName;

	public Downloadable() {
	}

	public Downloadable(Long id, String name, String label, DownloadableStatus status, String aka, int year, Date creationDate) {
		this.id = id;
		this.name = name;
		this.label = label;
		this.status = status;
		this.aka = aka;
		this.year = year;
		this.creationDate = creationDate;

		this.simpleClassName = getClass().getSimpleName();
	}

	public long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLabel() {
		return label;
	}

	public DownloadableStatus getStatus() {
		return status;
	}

	public void setStatus(DownloadableStatus status) {
		this.status = status;
	}

	public List<String> getAlternateNames() {
		return aka != null  ?Arrays.asList( aka.split(";") ) : new ArrayList<String>();
	}

	public String getType() {
		return simpleClassName;
	}

	public String getAka() {
		return aka;
	}

	@JsonIgnore
	public abstract String getRelativeLink();

	public abstract Path determineDestinationFolder();

	public boolean isDownloaded() {
		return status == DownloadableStatus.DOWNLOADED;
	}

	public void setIgnored() {
		status = DownloadableStatus.IGNORED;
	}

	public void setWanted() {
		status = DownloadableStatus.WANTED;
	}

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

	@Override
	public boolean equals(Object obj) {
		return (obj instanceof Downloadable) && ((Downloadable)obj).getId() == id;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public String getImage() throws ClassNotFoundException {
		return String.format("/data/%s/%d.jpg", simpleClassName, getId());
	}

}