text:
using namespace BloombergLP;
using namespace bsl;

// ============================================================================
//                             TEST PLAN
// ----------------------------------------------------------------------------
//                              Overview
//                              --------
// ----------------------------------------------------------------------------
// [ 1] BREATHING TEST
// [ 2] BEHAVIOR TEST
// [ 3] USAGE EXAMPLE
// ----------------------------------------------------------------------------

// ============================================================================
//                     STANDARD BDE ASSERT TEST FUNCTION
// ----------------------------------------------------------------------------

namespace {

int testStatus = 0;

void aSsErT(bool condition, const char *message, int line)
{
    if (condition) {
        cout << "Error " __FILE__ "(" << line << "): " << message
             << "    (failed)" << endl;

        if (0 <= testStatus && testStatus <= 100) {
            ++testStatus;
        }
    }
}

}  // close unnamed namespace

// ============================================================================
//               STANDARD BDE TEST DRIVER MACRO ABBREVIATIONS
// ----------------------------------------------------------------------------

#define ASSERT       BSLIM_TESTUTIL_ASSERT
#define ASSERTV      BSLIM_TESTUTIL_ASSERTV

#define LOOP_ASSERT  BSLIM_TESTUTIL_LOOP_ASSERT
#define LOOP0_ASSERT BSLIM_TESTUTIL_LOOP0_ASSERT
#define LOOP1_ASSERT BSLIM_TESTUTIL_LOOP1_ASSERT
#define LOOP2_ASSERT BSLIM_TESTUTIL_LOOP2_ASSERT
#define LOOP3_ASSERT BSLIM_TESTUTIL_LOOP3_ASSERT
#define LOOP4_ASSERT BSLIM_TESTUTIL_LOOP4_ASSERT
#define LOOP5_ASSERT BSLIM_TESTUTIL_LOOP5_ASSERT
#define LOOP6_ASSERT BSLIM_TESTUTIL_LOOP6_ASSERT

#define Q            BSLIM_TESTUTIL_Q   // Quote identifier literally.
#define P            BSLIM_TESTUTIL_P   // Print identifier and value.
#define P_           BSLIM_TESTUTIL_P_  // P(X) without '\n'.
#define T_           BSLIM_TESTUTIL_T_  // Print a tab (w/o newline).
#define L_           BSLIM_TESTUTIL_L_  // current Line number

// ============================================================================
//                       GLOBAL TYPEDEFS/CONSTANTS
// ----------------------------------------------------------------------------

struct UserDefined
{
};

// ============================================================================
//                               USAGE EXAMPLE
// ----------------------------------------------------------------------------
namespace BDLB_ARRAYUTIL_USAGE_EXAMPLE {

void usePrimes(bool verbose);
    // Demonstrate accessing a statically defined array using syntax similar to
    // that of standard containers.  If the specified 'verbose' is 'true',
    // write a trace message to standard output.

void query(bsl::string       *result,
           const bsl::string *columns,
           int                numberOfColumns);
    // Load to the specified 'result' the contents of the specified
    // 'numberOfColumns' table 'columns'.

void checkData(const bsl::vector<bsl::string>& data);
    // Assert that the specified 'data' equals the expected values.

void loadData(bsl::vector<bsl::string> *data);
    // Load the specified 'data' the results of querying an unspecified
    // database table for certain columns.

void getAndCheckData(bool verbose);
    // Assert that the values obtained from a certain database equal their
    // expected values.  If the specified 'verbose' is 'true', write a trace
    // message to standard output.

///Usage
///-----
// This section illustrates intended use of this component.
//
///Example 1: Basic Syntax
///- - - - - - - - - - - -
// When creating a sequence of values it is often easy to write the sequence as
// an initialized array and use this array to initialize a container.  Since
// the array's length may be changed as the program is maintained, the code
// using the array should automatically determine the array's length or
// automatically determine iterators to the beginning and the end of the array.
//
// For example, to initialize a 'bsl::vector<int>' with the first few prime
// numbers stored in an array the following code uses the 'begin' and 'end'
// methods of 'bdlb::ArrayUtil':
//..
    void usePrimes(bool verbose)
    {
        if (verbose) cout << "\n" << "'usePrimes'" << "\n"
                                  << "===========" << "\n";

        const int        primes[] = { 2, 3, 5, 7, 11, 13, 17 };
        bsl::vector<int> values(bdlb::ArrayUtil::begin(primes),
                                bdlb::ArrayUtil::end(primes));

        ASSERT(values.size() == bdlb::ArrayUtil::size(primes));
//..
// Notice that, after constructing 'values' with the content of the array
// 'primes' the assertion verifies that the correct number of values is stored
// in 'values'.
//
// When the length is needed as a constant expression, e.g., to use it for the
// length of another array, the macro 'BDLB_ARRAYUTIL_LENGTH(array)' can be
// used:
//..
        int reversePrimes[BDLB_ARRAYUTIL_SIZE(primes)];

        bsl::copy(values.rbegin(),
                  values.rend(),
                  bdlb::ArrayUtil::begin(reversePrimes));

        ASSERT(bsl::mismatch(bdlb::ArrayUtil::rbegin(primes),
                             bdlb::ArrayUtil::rend(primes),
                             bdlb::ArrayUtil::begin(reversePrimes)).second
               == bdlb::ArrayUtil::end(reversePrimes));
    }
//..
// After defining the array 'reversePrimes' with the same length as 'primes'
// the elements of 'values' are copied in reverse order into this array.  The
// assertion verifies that 'reversePrimes' contains the values from 'primes'
// but in reverse order: 'bsl::mismatch' is used with a reverse sequence of
// 'primes' by using the 'rbegin' and 'rend' methods for 'primes' and normal
// sequence using the 'begin' and 'end' methods for 'reversePrimes'.
//
///Example 2: Use with Database Interfaces
///- - - - - - - - - - - - - - - - - - - -
// The functions 'begin', 'end', and 'size' provided by this component are
// similar to functions provided by containers.  The main difference is that
// they reside in a utility component rather than being member functions.
//
// A typical use case for the 'size' function is a function expecting a pointer
// to a sequence of keys (e.g., columns in a database) and the number of the
// keys in the sequence:
//..
    void query(bsl::string       *result,
               const bsl::string *columns,
               int                numberOfColumns)
    {

        // Query the database.

        for (int i = 0; i != numberOfColumns; ++i) {
            result[i] = "queried " + columns[i];
        }
    }

    void loadData(bsl::vector<bsl::string> *data)
    {
        const bsl::string columns[] = { "column1", "column2", "column3" };
        bsl::string       result[BDLB_ARRAYUTIL_SIZE(columns)];

        query(result, columns, bdlb::ArrayUtil::size(columns));
        data->assign(bdlb::ArrayUtil::begin(result),
                     bdlb::ArrayUtil::end(result));
    }
//..
// The 'loadData' function shows how to use the different function templates.
// The array 'columns' doesn't have a length specified.  It is determined from
// the number of elements it is initialized with.  In this case it is easy to
// see that there are three elements but in real situations the number of
// elements can be non-trivial to get right.  Also, changing the number of
// elements would make it necessary to apply the corresponding change in
// multiple places.  Thus, the length is determined using 'bdlb::ArrayUtil':
//
//: o The length of 'result' should match the length of 'columns'.  When
//:   specifying the length of an array a constant expression is necessary.  In
//:   C++ 2011 the function 'bdlb::ArrayUtil::size' could return a constant
//:   expression but compilers not, yet, implementing the standard a trick must
//:   be used (using 'sizeof' with a reference to suitably sized array of
//:   'char').  This trick is packaged into the macro 'BDLB_ARRAYUTIL_SIZE()'.
//:
//: o When the length is needed in a context where a 'const' expression is not
//:   required, e.g., when calling 'query', the `bdlb::ArrayUtil::size'
//:   function can be used with the array.
//:
//: o The 'bdlb::ArrayUtil::begin' and 'bdlb::ArrayUtil::end' functions are
//:   used to obtain 'begin' and 'end' iterators used with the vector's
//:   'assign' function to put the 'result' obtained from the call to 'query'
//:   into the 'vector' pointed to by 'data'.
//
// Similar needs for an array of a sequence of values frequently arise when
// using one of the database interfaces.
//
// Another common use case are test cases where the content of a computed
// sequence must be compared with an expected result:
//..
    void checkData(const bsl::vector<bsl::string>& data)
    {
        const bsl::string expect[] = { "queried column1",
                                       "queried column2",
                                       "queried column3"
                                     };
        ASSERT(data.size() == bdlb::ArrayUtil::size(expect));
        ASSERT(bdlb::ArrayUtil::end(expect)
            == bsl::mismatch(bdlb::ArrayUtil::begin(expect),
                             bdlb::ArrayUtil::end(expect),
                             data.begin()).first);
    }
//..
// In the code below the actual result in 'data' is compared to the values in
// the array 'expect':
//
//: 1 We make sure that the lengths of 'data' and 'expect' are identical using
//:   'bdlb::ArrayUtil::size'.
//:
//: 2 The sequences are compared using the 'mismatch' algorithm: To get the
//:   begin and of the 'expect' array 'bdlb::ArrayUtil::begin' and
//:   'bdlb::ArrayUtil::end', respectively, are used.
//..
    void getAndCheckData(bool verbose)
    {
        if (verbose) cout << "\n" << "'getAndCheckData'" << "\n"
                                  << "=================" << "\n";
        bsl::vector<bsl::string> data;
        loadData(&data);
        checkData(data);
    }
//..
}  // close namespace BDLB_ARRAYUTIL_USAGE_EXAMPLE

// ============================================================================
//                              MAIN PROGRAM
// ----------------------------------------------------------------------------

int main(int argc, char *argv[])
{
    int     test = argc > 1 ? atoi(argv[1]) : 0;
    bool verbose = argc > 2;

    cout << "TEST " << __FILE__ << " CASE " << test << endl;

    switch (test) { case 0:  // Zero is always the leading case.
      case 3: {
        // --------------------------------------------------------------------
        // USAGE EXAMPLE
        //   Extracted from component header file.
        //
        // Concerns:
        //: 1 The usage example provided in the component header file compiles,
        //:   links, and runs as shown.
        //
        // Plan:
        //: 1 Incorporate usage example from header into test driver, remove
        //:   leading comment characters, and replace 'assert' with 'ASSERT'.
        //:   (C-1)
        //
        // Testing:
        //   USAGE EXAMPLE
        // --------------------------------------------------------------------

        if (verbose) cout << "\n" "USAGE EXAMPLE" "\n"
                                  "=============" "\n";

        BDLB_ARRAYUTIL_USAGE_EXAMPLE::usePrimes(verbose);
        BDLB_ARRAYUTIL_USAGE_EXAMPLE::getAndCheckData(verbose);

      } break;
      case 2: {
        // --------------------------------------------------------------------
        // BEHAVIOR TEST
        //   Verify all function templates produce the expected result.
        //
        // Concerns:
        //: 1 Verify all function produce the expected results.
        //: 2 Verify different qualifiers work.
        //: 3 Verify different array sizes
        //
        // Plan:
        //: 1 Try all functions.
        //: 2 Try them with built-in and user-defined types.
        //: 3 Try them with both 'const', 'volatile' and non-'const' versions
        //: 4 Use different array sizes for the various types.
        //
        // Testing:
        //   BEHAVIOR TEST
        // --------------------------------------------------------------------

        if (verbose) cout << "\n" << "BEHAVIOR TEST" << "\n"
                                  << "=============" << "\n";

        const int constIntArray[] = { 1 };
        ASSERT(constIntArray     == bdlb::ArrayUtil::begin(constIntArray));
        ASSERT(constIntArray + 1 == bdlb::ArrayUtil::end(constIntArray));
        ASSERT(bsl::reverse_iterator<const int*>(constIntArray + 1)
               == bdlb::ArrayUtil::rbegin(constIntArray));
        ASSERT(bsl::reverse_iterator<const int*>(constIntArray)
               == bdlb::ArrayUtil::rend(constIntArray));
        ASSERT(1 == bdlb::ArrayUtil::size(constIntArray));
        ASSERT(1 == bdlb::ArrayUtil::length(constIntArray));
        ASSERT(1 == sizeof(bdlb::ArrayUtil::sizer(constIntArray)));
        ASSERT(1 == BDLB_ARRAYUTIL_SIZE(constIntArray));
        ASSERT(1 == BDLB_ARRAYUTIL_LENGTH(constIntArray));

        volatile int volatileIntArray[] = { 1, 2 };
        ASSERT(volatileIntArray == bdlb::ArrayUtil::begin(volatileIntArray));
        ASSERT(volatileIntArray + 2 == bdlb::ArrayUtil::end(volatileIntArray));
        ASSERT(bsl::reverse_iterator<volatile int*>(volatileIntArray + 2)
               == bdlb::ArrayUtil::rbegin(volatileIntArray));
        ASSERT(bsl::reverse_iterator<volatile int*>(volatileIntArray)
               == bdlb::ArrayUtil::rend(volatileIntArray));
        ASSERT(2 == bdlb::ArrayUtil::size(volatileIntArray));
        ASSERT(2 == bdlb::ArrayUtil::length(volatileIntArray));
        ASSERT(2 == sizeof(bdlb::ArrayUtil::sizer(volatileIntArray)));
        ASSERT(2 == BDLB_ARRAYUTIL_SIZE(volatileIntArray));
        ASSERT(2 == BDLB_ARRAYUTIL_LENGTH(volatileIntArray));

        int intArray[] = { 1, 2, 3 };
        ASSERT(intArray     == bdlb::ArrayUtil::begin(intArray));
        ASSERT(intArray + 3 == bdlb::ArrayUtil::end(intArray));
        ASSERT(bsl::reverse_iterator<int*>(intArray + 3)
               == bdlb::ArrayUtil::rbegin(intArray));
        ASSERT(bsl::reverse_iterator<int*>(intArray)
               == bdlb::ArrayUtil::rend(intArray));
        ASSERT(3 == bdlb::ArrayUtil::size(intArray));
        ASSERT(3 == bdlb::ArrayUtil::length(intArray));
        ASSERT(3 == sizeof(bdlb::ArrayUtil::sizer(intArray)));
        ASSERT(3 == BDLB_ARRAYUTIL_SIZE(intArray));
        ASSERT(3 == BDLB_ARRAYUTIL_LENGTH(intArray));

        const UserDefined constUserDefinedArray[] = { UserDefined() };
        ASSERT(constUserDefinedArray
               == bdlb::ArrayUtil::begin(constUserDefinedArray));
        ASSERT(constUserDefinedArray + 1
               == bdlb::ArrayUtil::end(constUserDefinedArray));
        ASSERT(bsl::reverse_iterator<const UserDefined*>(constUserDefinedArray
                                                         + 1)
               == bdlb::ArrayUtil::rbegin(constUserDefinedArray));
        ASSERT(bsl::reverse_iterator<const UserDefined*>(constUserDefinedArray)
               == bdlb::ArrayUtil::rend(constUserDefinedArray));
        ASSERT(1 == bdlb::ArrayUtil::size(constUserDefinedArray));
        ASSERT(1 == bdlb::ArrayUtil::length(constUserDefinedArray));
        ASSERT(1 == sizeof(bdlb::ArrayUtil::sizer(constUserDefinedArray)));
        ASSERT(1 == BDLB_ARRAYUTIL_SIZE(constUserDefinedArray));
        ASSERT(1 == BDLB_ARRAYUTIL_LENGTH(constUserDefinedArray));

        volatile UserDefined volatileUserDefinedArray[5];
        ASSERT(volatileUserDefinedArray
               == bdlb::ArrayUtil::begin(volatileUserDefinedArray));
        ASSERT(volatileUserDefinedArray + 5
               == bdlb::ArrayUtil::end(volatileUserDefinedArray));
        ASSERT(bsl::reverse_iterator<volatile UserDefined*>(
                                                  volatileUserDefinedArray + 5)
               == bdlb::ArrayUtil::rbegin(volatileUserDefinedArray));
        ASSERT(bsl::reverse_iterator<volatile UserDefined*>(
                                                      volatileUserDefinedArray)
               == bdlb::ArrayUtil::rend(volatileUserDefinedArray));
        ASSERT(5 == bdlb::ArrayUtil::size(volatileUserDefinedArray));
        ASSERT(5 == bdlb::ArrayUtil::length(volatileUserDefinedArray));
        ASSERT(5 == sizeof(bdlb::ArrayUtil::sizer(volatileUserDefinedArray)));
        ASSERT(5 == BDLB_ARRAYUTIL_SIZE(volatileUserDefinedArray));
        ASSERT(5 == BDLB_ARRAYUTIL_LENGTH(volatileUserDefinedArray));

        UserDefined userDefinedArray[1234];
        ASSERT(userDefinedArray == bdlb::ArrayUtil::begin(userDefinedArray));
        ASSERT(userDefinedArray + 1234
               == bdlb::ArrayUtil::end(userDefinedArray));
        ASSERT(bsl::reverse_iterator<UserDefined*>(userDefinedArray + 1234)
               == bdlb::ArrayUtil::rbegin(userDefinedArray));
        ASSERT(bsl::reverse_iterator<UserDefined*>(userDefinedArray)
               == bdlb::ArrayUtil::rend(userDefinedArray));
        ASSERT(1234 == bdlb::ArrayUtil::size(userDefinedArray));
        ASSERT(1234 == bdlb::ArrayUtil::length(userDefinedArray));
        ASSERT(1234 == sizeof(bdlb::ArrayUtil::sizer(userDefinedArray)));
        ASSERT(1234 == BDLB_ARRAYUTIL_SIZE(userDefinedArray));
        ASSERT(1234 == BDLB_ARRAYUTIL_LENGTH(userDefinedArray));

      } break;
      case 1: {
        // --------------------------------------------------------------------
        // BREATHING TEST
        //   Verify all function templates are callable.
        //
        // Concerns:
        //: 1 Both const and non-const arrays should work.
        //: 2 The functions should be callable with arbitrary types.
        //: 3 The functions should be applicable to different array sizes.
        //
        // Plan:
        //: 1 Try all functions.
        //: 2 Try them with built-in and user-defined types.
        //: 3 Try them with both const, volatile and non-const versions
        //: 4 Use different array sizes for the various types.
        //
        // Testing:
        //   BREATHING TEST
        // --------------------------------------------------------------------

        if (verbose) cout << "\n" << "BREATHING TEST" << "\n"
                                  << "==============" << "\n";

        const int constIntArray[] = { 1 };
        bdlb::ArrayUtil::begin(constIntArray);
        bdlb::ArrayUtil::end(constIntArray);
        bdlb::ArrayUtil::rbegin(constIntArray);
        bdlb::ArrayUtil::rend(constIntArray);
        bdlb::ArrayUtil::size(constIntArray);
        bdlb::ArrayUtil::length(constIntArray);
        sizeof(bdlb::ArrayUtil::sizer(constIntArray));
        BDLB_ARRAYUTIL_SIZE(constIntArray);
        BDLB_ARRAYUTIL_LENGTH(constIntArray);

        volatile int volatileIntArray[] = { 1, 2 };
        bdlb::ArrayUtil::begin(volatileIntArray);
        bdlb::ArrayUtil::end(volatileIntArray);
        bdlb::ArrayUtil::rbegin(volatileIntArray);
        bdlb::ArrayUtil::rend(volatileIntArray);
        bdlb::ArrayUtil::size(volatileIntArray);
        bdlb::ArrayUtil::length(volatileIntArray);
        sizeof(bdlb::ArrayUtil::sizer(volatileIntArray));
        BDLB_ARRAYUTIL_SIZE(volatileIntArray);
        BDLB_ARRAYUTIL_LENGTH(volatileIntArray);

        int intArray[] = { 1, 2, 3 };
        bdlb::ArrayUtil::begin(intArray);
        bdlb::ArrayUtil::end(intArray);
        bdlb::ArrayUtil::rbegin(intArray);
        bdlb::ArrayUtil::rend(intArray);
        bdlb::ArrayUtil::size(intArray);
        bdlb::ArrayUtil::length(intArray);
        sizeof(bdlb::ArrayUtil::sizer(intArray));
        BDLB_ARRAYUTIL_SIZE(intArray);
        BDLB_ARRAYUTIL_LENGTH(intArray);

        const UserDefined constUserDefinedArray[] = { UserDefined() };
        bdlb::ArrayUtil::begin(constUserDefinedArray);
        bdlb::ArrayUtil::end(constUserDefinedArray);
        bdlb::ArrayUtil::rbegin(constUserDefinedArray);
        bdlb::ArrayUtil::rend(constUserDefinedArray);
        bdlb::ArrayUtil::size(constUserDefinedArray);
        bdlb::ArrayUtil::length(constUserDefinedArray);
        sizeof(bdlb::ArrayUtil::sizer(constUserDefinedArray));
        BDLB_ARRAYUTIL_SIZE(constUserDefinedArray);
        BDLB_ARRAYUTIL_LENGTH(constUserDefinedArray);

        volatile UserDefined volatileUserDefinedArray[5];
        bdlb::ArrayUtil::begin(volatileUserDefinedArray);
        bdlb::ArrayUtil::end(volatileUserDefinedArray);
        bdlb::ArrayUtil::rbegin(volatileUserDefinedArray);
        bdlb::ArrayUtil::rend(volatileUserDefinedArray);
        bdlb::ArrayUtil::size(volatileUserDefinedArray);
        bdlb::ArrayUtil::length(volatileUserDefinedArray);
        sizeof(bdlb::ArrayUtil::sizer(volatileUserDefinedArray));
        BDLB_ARRAYUTIL_SIZE(volatileUserDefinedArray);
        BDLB_ARRAYUTIL_LENGTH(volatileUserDefinedArray);

        UserDefined userDefinedArray[1234];
        bdlb::ArrayUtil::begin(userDefinedArray);
        bdlb::ArrayUtil::end(userDefinedArray);
        bdlb::ArrayUtil::rbegin(userDefinedArray);
        bdlb::ArrayUtil::rend(userDefinedArray);
        bdlb::ArrayUtil::size(userDefinedArray);
        bdlb::ArrayUtil::length(userDefinedArray);
        sizeof(bdlb::ArrayUtil::sizer(userDefinedArray));
        BDLB_ARRAYUTIL_SIZE(userDefinedArray);
        BDLB_ARRAYUTIL_LENGTH(userDefinedArray);

      } break;
      default: {
        cerr << "WARNING: CASE `" << test << "' NOT FOUND." << endl;
        testStatus = -1;
      }
    }

    if (testStatus > 0) {
        cerr << "Error, non-zero test status = " << testStatus << "." << endl;
    }

    return testStatus;
}

// ----------------------------------------------------------------------------
// Copyright 2015 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------


text:
<?php

declare(strict_types=1);

namespace Sonata\AdminBundle\Security\Handler;

use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Symfony\Component\Security\Acl\Model\MutableAclInterface;
use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface;
use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;

/**
 * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
 */
interface AclSecurityHandlerInterface extends SecurityHandlerInterface
{
    /**
     * Set the permissions not related to an object instance and also to be available when objects do not exist.
     *
     * @param string[] $permissions
     */
    public function setAdminPermissions(array $permissions): void;

    /**
     * Return the permissions not related to an object instance and also to be available when objects do not exist.
     *
     * @return string[]
     */
    public function getAdminPermissions(): array;

    /**
     * Set the permissions related to an object instance.
     *
     * @param string[] $permissions
     */
    public function setObjectPermissions(array $permissions): void;

    /**
     * Return the permissions related to an object instance.
     *
     * @return string[]
     */
    public function getObjectPermissions(): array;

    /**
     * Get the ACL for the passed object identity.
     */
    public function getObjectAcl(ObjectIdentityInterface $objectIdentity): ?MutableAclInterface;

    /**
     * Find the ACLs for the passed object identities.
     *
     * @param \Traversable<ObjectIdentityInterface> $oids
     * @param SecurityIdentityInterface[]           $sids
     *
     * @throws \Exception
     *
     * @return \SplObjectStorage<ObjectIdentityInterface, MutableAclInterface> mapping the passed object identities to ACLs
     */
    public function findObjectAcls(\Traversable $oids, array $sids = []): \SplObjectStorage;

    /**
     * Add an object owner ACE to the object ACL.
     */
    public function addObjectOwner(MutableAclInterface $acl, ?UserSecurityIdentity $securityIdentity = null): void;

    /**
     * Add the object class ACE's to the object ACL.
     *
     * @param array<string, string[]> $roleInformation
     */
    public function addObjectClassAces(MutableAclInterface $acl, array $roleInformation = []): void;

    /**
     * Create an object ACL.
     */
    public function createAcl(ObjectIdentityInterface $objectIdentity): MutableAclInterface;

    /**
     * Update the ACL.
     */
    public function updateAcl(MutableAclInterface $acl): void;

    /**
     * Delete the ACL.
     */
    public function deleteAcl(ObjectIdentityInterface $objectIdentity): void;

    /**
     * Helper method to find the index of a class ACE for a role.
     *
     * @return int|false index if found, FALSE if not found
     */
    public function findClassAceIndexByRole(MutableAclInterface $acl, string $role);

    /**
     * Helper method to find the index of a class ACE for a username.
     *
     * @return int|false index if found, FALSE if not found
     */
    public function findClassAceIndexByUsername(MutableAclInterface $acl, string $username);
}

redpajama_set_name: RedPajamaGithub


text:
package uk.ac.kcl.itemWriters;

import org.apache.poi.ss.formula.functions.T;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.xcontent.*;
//import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import uk.ac.kcl.model.Document;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;

/**
 * Created by rich on 20/04/16.
 */

/**
 * This method is deprecated as using Java REST Client is recommended over Native Java API
 */
@Service("esDocumentWriter")
@Profile("elasticsearch")
public class ElasticsearchDocumentWriter implements ItemWriter<Document> {
    private static final Logger LOG = LoggerFactory.getLogger(ElasticsearchDocumentWriter.class);

    private ElasticsearchDocumentWriter() {
    }

    @Value("${elasticsearch.index.name:#{null}}")
    private String indexName;

    @Value("${elasticsearch.type:#{null}}")
    private String typeName;

    @Value("${elasticsearch.xpack.enabled:false}")
    private boolean securityEnabled;

    @Value("${elasticsearch.cluster.name:#{null}}")
    private String clusterName;

    @Value("${elasticsearch.cluster.host:#{null}}")
    private String clusterHost;

    @Value("${elasticsearch.response.timeout:10000}")
    private long timeout;

    @Value("${elasticsearch.cluster.port:#{null}}")
    private int port;

    @Value("${elasticsearch.xpack.user:#{null}}")
    private String user;

    @Value("${elasticsearch.xpack.ssl.keystore.path:#{null}}")
    private String sslKeyStorePath;

    @Value("${elasticsearch.xpack.ssl.keystore.password:#{null}}")
    private String sslKeyStorePassword;

    @Value("${elasticsearch.xpack.ssl.truststore.path:#{null}}")
    private String sslTrustStorePath;

    @Value("${elasticsearch.xpack.ssl.truststore.password:#{null}}")
    private String trustStorePassword;

    @Value("${elasticsearch.xpack.security.transport.ssl.enabled:false}")
    private boolean sslEnabled;

    @Autowired
    Environment env;

    private Client client;

    @PostConstruct
    public void init() throws UnknownHostException {
        Settings settings;

        if (securityEnabled) {
            settings = Settings.builder()
                .put("cluster.name", clusterName)
                .put("xpack.security.transport.ssl.enabled", sslEnabled)
                .put("request.headers.X-Found-Cluster", clusterName)
                .put("xpack.security.user", user)
                .put("xpack.ssl.keystore.path", sslKeyStorePath)
                .put("xpack.ssl.keystore.password", sslKeyStorePassword)
                .put("xpack.ssl.truststore.path", sslTrustStorePath)
                .put("xpack.ssl.truststore.password", trustStorePassword)

                .build();
            client = new PreBuiltXPackTransportClient(settings)
                    .addTransportAddress(new TransportAddress(InetAddress.getByName(
                            clusterHost),
                            port));
        } else {
            settings = Settings.builder()
                    .put("cluster.name", clusterName).build();
            client = new PreBuiltTransportClient(settings)
                    .addTransportAddress(new TransportAddress(InetAddress.getByName(
                            clusterHost),
                            port));
        }
    }

    @PreDestroy
    public void destroy() {
        client.close();
    }

    @Override
    public final void write(List<? extends Document> documents) throws Exception {
        BulkRequestBuilder bulkRequest = client.prepareBulk();

        for (Document doc : documents) {
            XContentParser parser = null;
            parser = XContentFactory.xContent(XContentType.JSON)
                    .createParser(NamedXContentRegistry.EMPTY,
                            DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
                            doc.getOutputData().getBytes());
            parser.close();
            XContentBuilder builder = jsonBuilder().copyCurrentStructure(parser);

            IndexRequestBuilder request = client.prepareIndex(
                    indexName,
                    typeName).setSource(
                    builder);
            request.setId(doc.getPrimaryKeyFieldValue());
            bulkRequest.add(request);
        }
        //check that no nonessential processes failed
        if (documents.size() != 0) {
            BulkResponse response;
            response = bulkRequest.execute().actionGet(timeout);
            getResponses(response);
        }
    }

    private void getResponses(BulkResponse response) {
        if (response.hasFailures()) {

            for (int i = 0; i < response.getItems().length; i++) {
                //in bulk processing, retry all docs one by one. if one fails, log it. If the entire chunk fails,
                // raise an exception towards skip limit
                if (response.getItems().length == 1) {
                    LOG.warn("failed to index document: " + response.getItems()[i].getId() + " failure is: \n"
                            + response.getItems()[i].getFailureMessage());
                } else {
                    LOG.error("failed to index document: " + response.getItems()[i].getFailureMessage());
                    throw new ElasticsearchException("Bulk indexing request failed");
                }
            }
        }
        LOG.info("{} documents indexed into ElasticSearch in {} ms", response.getItems().length,
                response.getIngestTookInMillis());
    }

}


text:
'use strict';
const Util = require('util');

// Convert any value into a limit: a positive number, zero or Infinity.
function actualLimit(limit) {
  return Number.isFinite(limit) ? Math.max(0, limit) : Infinity;
}

// Convert any value into a cost: a positive number or zero.  If no number
// provided (undefined, NaN, etc) return the default cost of one.
function actualCost(cost) {
  return Number.isFinite(cost) ? Math.max(0, cost) : 1;
}

// TTL (milliseconds) to expiration (timestamp)
function ttlToExpires(ttl) {
  return Number.isInteger(ttl) ? Date.now() + ttl : Infinity;
}

// Returns true if the entry has expired already
function hasExpired(link) {
  return (link.expires <= Date.now());
}

// 1. We don't want these properties to show up in console.log(cache)
// 2. Private methods could come here, when io.js supports them
const _cost   = Symbol('cost');
const _head   = Symbol('head');
const _tail   = Symbol('tail');
const _limit  = Symbol('limit');
const _map    = Symbol('map');

class Cache {

  constructor(limit, source) {
    this[_map]  = new Map();
    this[_cost] = 0;

    if (limit && limit[Symbol.iterator]) {
      source = limit;
      limit  = (source instanceof Cache) ? source.limit : undefined;
    }
    this.limit = limit;
    this.materialize = null;

    if (source instanceof Cache)
      this._cloneCache(source);
    else if (source)
      this._cloneIterator(source);
  }

  _cloneIterator(source) {
    for (let entry of source)
      this.set(entry[0], entry[1]);
  }

  _cloneCache(source) {
    let link = source[_tail];
    while (link) {
      this.set(link.key, link.value, link);
      link = link.previous;
    }
    this.materialize = source.materialize;
  }

  // Remove link from linked list.  Used when deleting, and when moving link
  // to head (during get).
  _removeFromList(link) {
    if (this[_head] === link)
      this[_head] = link.next;
    if (this[_tail] === link)
      this[_tail] = link.previous;

    if (link.next)
      link.next.previous = link.previous;
    if (link.previous)
      link.previous.next = link.next;
  }

  // Prepend to linked list.  Used when adding new link (set) or when moving
  // existing link to beginning of linked list (get).
  _prependToList(link) {
    link.previous  = null;
    link.next      = this[_head];
    if (this[_head])
      this[_head].previous = link;
    this[_head]            = link;
    if (!this[_tail])
      this[_tail] = link;
  }

  get limit() {
    // Getter because we use a setter
    return this[_limit];
  }

  // Sets the cache limit
  set limit(value) {
    // You can use whatever value you want, but we need it to be a positive
    // number, possibly Infinity
    this[_limit] = actualLimit(value);
  }

  // Returns the current cost
  get cost() {
    return this[_cost];
  }

  get size() {
    return this[_map].size;
  }

  clear() {
    this[_map].clear();
    this[_cost] = 0;
    this[_head] = null;
    this[_tail] = null;
  }

  delete(key) {
    const link = this[_map].get(key);
    if (!link)
      return false;

    this._removeFromList(link);
    this[_map].delete(key);

    // Discount
    this[_cost] = this[_cost] - link.cost;

    return true;
  }

  // Evicts as many expired entries an least recently used entries to keep
  // cache under limit.  This can be O(N) as it may iterate over the entire
  // cache twice, but in practice we generally evict as many entries as we add,
  // so viewed over long time horizon, this is an O(1) operation.
  _evict(limit) {
    // Only evicts enough expired keys to make room for new key, if you need to
    // evict all expired keys, use the iterator.
    for (let link of this[_map].values()) {
      if (this[_cost] <= limit)
        break;
      if (hasExpired(link))
        this.delete(link.key);
    }

    // Remove from the tail is potentiall O(N), we in practice we usually evict
    // as many entries as we add, so evict is O(1) spread over time
    while (this.size && this[_cost] > limit) {
      const leastRecent = this[_tail];
      this.delete(leastRecent.key);
    }
  }

  // Returns the key value if set and not evicted yet.
  get(key) {
    const link = this[_map].get(key);
    // Although we do have the value, the contract is that we don't return
    // expired values
    if (link && !hasExpired(link)) {
      this._moveLinkToHead(link);
      return link.value;
    } else if (this.materialize)
      return this._materializeAndCache(key);
    else
      return undefined;
  }

  _moveLinkToHead(link) {
    // Link becomes most recently used
    const mostRecent = (this[_head] === link);
    if (!mostRecent) {
      // This is not the most CPU efficient, there's some redundant linked list
      // changes that we can consolidate if we implemented a move; but in real
      // life, you won't be able to measure the difference, so we opt to reuse
      // existing methods, this gives us better test coverage
      this._removeFromList(link);
      this._prependToList(link);
    }
  }

  _materializeAndCache(key) {
    const self    = this;
    const promise = Promise.resolve(key).then(this.materialize);

    function deleteIfRejected() {
      const entry = self[_map].get(key);
      if (entry && entry.value === promise)
        self.delete(key);
    }

    this.set(key, promise);
    promise.catch(deleteIfRejected);
    return promise;
  }

  // Returns true if key has been set and not evicted yet.
  has(key) {
    const link = this[_map].get(key);
    if (!link)
      return false;
    return !hasExpired(link);
  }

  *entries() {
    let link = this[_head];
    while (link) {
      // We take this opportunity to get rid of expired keys
      if (hasExpired(link))
        this.delete(link.key);
      else
        yield [link.key, link.value];
      link = link.next;
    }
  }

  *values() {
    // This could be `let [key] of` in future version
    for (let entry of this.entries())
      yield entry[1];
  }

  *keys() {
    // This could be `let [key, value] of` in future version
    for (let entry of this.entries())
      yield entry[0];
  }

  forEach(callback, thisArg) {
    // This could be `let [key, value] of` in future version
    for (let entry of this.entries())
      callback.call(thisArg, entry[1], entry[0], this);
  }

  // Stores the key and value.
  //
  // Each key is associated with a cost.  The cost is a positive number, and
  // the default value is 1.  When the total cost is higher than the cache
  // limit, it will start evicting least recently used values.  You can use a
  // cost of zero to keep the key indefinitely (or until it expires).
  //
  // Each key has a TTL associated with it.  Expired keys are evicted first to
  // make room for new keys.
  //
  // The following two are equivalent:
  //
  //   set(key, value)
  //   set(key, value, { cost: 1, ttl: Infinity })
  set(key, value, options) {
    const cost      = actualCost(options && options.cost);
    const expires   = ttlToExpires(options && options.ttl);

    this.delete(key);

    // If TTL is zero we're never going to return this key, we don't want to
    // evict older keys either
    if (expires <= Date.now())
      return this;

    // If this key can't fit, we don't want to evict other keys to make room
    const canHoldKey = (cost <= this.limit);
    if (!canHoldKey)
      return this;

    // Evict enough keys to make room for this one
    const leaveRoomForKey = (this.limit - cost);
    this._evict(leaveRoomForKey);

    // Double linked list (previous, next) for O(1) reordering of recently used
    // keys.  Every place you see a link, it refes to an object with these
    // properties.
    //
    // We need the key here as well so we can evict least recently used entries
    const link = {
      key,
      value,
      previous: null,
      next:     null,
      cost,
      expires,

      inspect(depth, inspectOptions) {
        // console.log(cache) calls inspect(cache) on the Map, which ends up
        // calling inspect on each map value (i.e. this link object).  We want
        // to show the stored value (just like a Map).
        return Util.inspect(value, inspectOptions);
      }
    };

    this._prependToList(link);
    this[_map].set(key, link);
    this[_cost] = this[_cost] + cost;

    // Map allows you to chain calls to set()
    return this;
  }

  // Util.inspect(cache) calls this, and Node's console.log uses inspect
  inspect(depth, inspectOptions) {
    return Util.inspect(this[_map], inspectOptions);
  }

}

// Just like Map, the default iterator iterates over all entries (except our order is different)
Cache.prototype[Symbol.iterator] = Cache.prototype.entries;

module.exports = Cache;


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ MIT License
  ~
  ~ Copyright (c) 2016  Altisource
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->
<!-- This is an unmanaged datasource. It should be used for proofs of concept
   or testing only. It uses H2, an in memory database that ships with JBoss
   AS. -->
<datasources xmlns="http://www.jboss.org/ironjacamar/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
   <!-- The datasource is bound into JNDI at this location. We reference
      this in META-INF/persistence.xml -->
   <!--datasource jndi-name="java:jboss/datasources/ecloud-managerDS" pool-name="ecloud-manager"
       enabled="true" use-java-context="true">
       <connection-url>jdbc:h2:mem:ecloud-manager;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1</connection-url>
       <driver>h2</driver>
       <security>
           <user-name>sa</user-name>
           <password>sa</password>
       </security>
   </datasource-->
</datasources>


text:
.. _measurement:

Using Measurements
==================

Measurements are the combination of two quantities: the mean value and the error (or uncertainty). The easiest ways to generate a measurement object is from a quantity using the `plus_minus` operator.

.. doctest::

   >>> import numpy as np
   >>> from pint import UnitRegistry
   >>> ureg = UnitRegistry()
   >>> book_length = (20. * ureg.centimeter).plus_minus(2.)
   >>> print(book_length)
   (20.0 +/- 2.0) centimeter

.. testsetup:: *

   import numpy as np
   from pint import UnitRegistry
   ureg = UnitRegistry()
   Q_ = ureg.Quantity

You can inspect the mean value, the absolute error and the relative error:

.. doctest::

   >>> print(book_length.value)
   20.0 centimeter
   >>> print(book_length.error)
   2.0 centimeter
   >>> print(book_length.rel)
   0.1

You can also create a Measurement object giving the relative error:

.. doctest::

   >>> book_length = (20. * ureg.centimeter).plus_minus(.1, relative=True)
   >>> print(book_length)
   (20.0 +/- 2.0) centimeter

Measurements support the same formatting codes as Quantity. For example, to pretty print a measurement with 2 decimal positions:

.. doctest::

   >>> print('{:.02fP}'.format(book_length))
   (20.00 ± 2.00) centimeter

Mathematical operations with Measurements, return new measurements following the `Propagation of uncertainty`_ rules.

.. doctest::

   >>> print(2 * book_length)
   (40.0 +/- 4.0) centimeter
   >>> width = (10 * ureg.centimeter).plus_minus(1)
   >>> print('{:.02f}'.format(book_length + width))
   (30.00 +/- 2.24) centimeter

.. note:: only linear combinations are currently supported.

.. _`Propagation of uncertainty`: http://en.wikipedia.org/wiki/Propagation_of_uncertainty


text:
package org.jboss.quickstarts.websocket.model;

import java.util.Date;

public class Bid {

    private Date dateTime;

    private Integer value;

    private String id;

    public Bid(String id, Integer value) {
        this.id = id;
        this.dateTime = new Date();
        this.value = value;
    }

    public Date getDateTime() {
        return dateTime;
    }

    public Integer getValue() {
        return value;
    }

    public String getId() {
        return id;
    }

}


text:
"""
.. function:: variables()

Returns the defined variables with their values.

:Returned table schema:
    - *variable* text
        Variable name.
    - *value* text
        Variable value

.. toadd See also variables..

Examples:

    >>> sql("var 'env' 'testing' ")
    var('env','testing')
    --------------------
    testing
    >>> sql("variables")
    variable | value
    -------------------
    flowname |
    execdb   | :memory:
    env      | testing

"""

import vtbase
import functions
registered=True

class Variables(vtbase.VT):
    def VTiter(self, *parsedArgs,**envars):
        yield [('variable', 'text'),('value', 'text')]

        for i in functions.variables.__dict__:
            yield [i,functions.variables.__dict__[i]]

def Source():
    return vtbase.VTGenerator(Variables)

if not ('.' in __name__):
    """
    This is needed to be able to test the function, put it at the end of every
    new function you create
    """
    import sys
    import setpath
    from functions import *
    testfunction()
    if __name__ == "__main__":
        reload(sys)
        sys.setdefaultencoding('utf-8')
        import doctest
        doctest.testmod()


text:
<?php
namespace eMacros\Runtime\Collection;

use eMacros\Applicable;
use eMacros\Scope;
use eMacros\GenericList;
use eMacros\Symbol;

class ArraySort implements Applicable {
	/**
	 * Callback to invoke
	 * @var callable
	 */
	public $callback;

	public function __construct($callback) {
		$this->callback = $callback;
	}

	/**
	 * Array sort wrapper callback
	 * Usage: (Array::sort _array) (Array::arsort _arr)
	 * Returns: boolean
	 * (non-PHPdoc)
	 * @see \eMacros\Applicable::apply()
	 */
	public function apply(Scope $scope, GenericList $arguments) {
		if (count($arguments) == 0) throw new \BadFunctionCallException("ArraySort: No array specified.");
		$target = $arguments[0];
		if (!($target instanceof Symbol))
			throw new \InvalidArgumentException(sprintf("ArraySort: Expected symbol as first argument but %s was found instead.", substr(strtolower(strstr(get_class($arguments[0]), '\\')), 1)));
		$ref = $target->symbol;

		if (is_array($scope->symbols[$ref])) {
			$func = $this->callback;
			if (count($arguments) > 1)
				return $func($scope->symbols[$ref], $arguments[1]->evaluate($scope));
			return $func($scope->symbols[$ref]);
		}

		throw new \InvalidArgumentException(sprintf("ArraySort: Expected array as first argument but %s was found instead.", gettype($scope->symbols[$ref])));
	}
}
?>


text:
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}

$pluginName = 'SearchForm';

// Add allowed records to pages
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_azuresearch_index');

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
    $_EXTKEY,                       // Extension Key
    'Configuration/TypoScript',     // Path to setup.txt and constants.txt
    'Azure Search'                  // Title in the selector box
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    $_EXTKEY,
    $pluginName,
    'Microsoft Azure Search'
);

$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);

$iconRegistry->registerIcon(
    'microsoft-azure-search',
    \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
    ['source' => 'EXT:azuresearch/ext_icon.png']
);

$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginSignature = $extensionName.'_' . strtolower($pluginName);

$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';


text:
'use strict';

const {
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
} = require('ReactNative');

module.exports =
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.createReactNativeComponentClass;


text:
module RiotGamesApi
  module LOL
    module Model
      module StaticData
        class MetaData
          include Virtus.model

          attribute :is_rune, Boolean
          attribute :tier, Integer
          attribute :type, String

          alias_method :rune, :is_rune
          alias_method :rune?, :is_rune?
        end
      end
    end
  end
end


text:
import webpack from "webpack";
import CleanWebpackPlugin from "clean-webpack-plugin";
import CopyWebpackPlugin from "copy-webpack-plugin";
import SitemapPlugin from "sitemap-webpack-plugin";
import WebpackPwaManifest from "webpack-pwa-manifest";
import CspHtmlWebpackPlugin from "csp-html-webpack-plugin";
import ImageminWebpack from "imagemin-webpack";
import ScriptExtHtmlWebpackPlugin from "script-ext-html-webpack-plugin";
import path from "path";
import { distPath } from "./build/paths.config";
import {
    aliases,
    staticViews,
    cleanupConfig,
    copyFilesList,
    extractCSS,
    entrypoints,
    externalLibs,
    webpackProvides,
    manifestConfig,
    scriptLoadConfig,
    cspConfig,
    imageOptimizationConfig,
    webpackRules,
    sitemapPages
} from "./build";

// Getting values from the CLI arguments
const argv = require("yargs").argv;
const isProdModeOn = argv.p || false;
const isDebugModeOn = (argv.env && argv.env.debug) || false;

let webpackBaseConfig = {
    performance: {
        hints: false
    },
    target: "web",
    context: path.resolve(__dirname, "../"),
    resolve: {
        modules: [path.resolve("./"), "node_modules"],
        extensions: ["*", ".js", ".json", ".hbs", "css", "scss"],
        alias: aliases
    },
    entry: entrypoints,
    output: {
        pathinfo: false,
        library: "SkeletonAppLib",
        libraryTarget: "window",
        filename: "[name]/js/bundle.[hash:6].min.js",
        chunkFilename: "[id].js",
        publicPath: "/",
        path: path.join(__dirname, `../${distPath}`)
    },
    module: {
        rules: webpackRules
    },
    externals: externalLibs,
    plugins: [
        new CleanWebpackPlugin(cleanupConfig),
        new CopyWebpackPlugin(copyFilesList),
        new webpack.ProvidePlugin(webpackProvides),
        extractCSS,
        new SitemapPlugin("http://www.domain.com", sitemapPages, { fileName: "sitemap.xml" }),
        new CspHtmlWebpackPlugin(cspConfig.policy, cspConfig.optional),
        new WebpackPwaManifest(manifestConfig),
        new ImageminWebpack(imageOptimizationConfig)
    ]
};

staticViews.forEach(staticViewJHtmlPlugin => {
    webpackBaseConfig.plugins.unshift(staticViewJHtmlPlugin);
});

webpackBaseConfig.plugins.push(new ScriptExtHtmlWebpackPlugin(scriptLoadConfig));

export default webpackBaseConfig;


text:
/*
 * Copyright (C) 2018 ScyllaDB
 */

#pragma once

#include <optional>
#include <string_view>
#include <variant>

#include <filesystem>

#if __has_include(<memory_resource>)
#include <memory_resource>
#else
#include <experimental/memory_resource>
namespace std::pmr {
    using namespace std::experimental::pmr;
}
#endif

#if defined(__cpp_impl_coroutine) || defined(__cpp_coroutines)
#define SEASTAR_COROUTINES_ENABLED
#endif

// Defining SEASTAR_ASAN_ENABLED in here is a bit of a hack, but
// convenient since it is build system independent and in practice
// everything includes this header.

#ifndef __has_feature
#define __has_feature(x) 0
#endif

// clang uses __has_feature, gcc defines __SANITIZE_ADDRESS__
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
#define SEASTAR_ASAN_ENABLED
#endif

#if __has_include(<source_location>)
#include <source_location>
#endif

#if defined(__cpp_lib_source_location) && !defined(SEASTAR_BROKEN_SOURCE_LOCATION)
namespace seastar::compat {
using source_location = std::source_location;
}
#elif __has_include(<experimental/source_location>) && !defined(SEASTAR_BROKEN_SOURCE_LOCATION)
#include <experimental/source_location>
namespace seastar::compat {
using source_location = std::experimental::source_location;
}
#else
#include <seastar/util/source_location-compat.hh>
namespace seastar::compat {
using source_location = seastar::internal::source_location;
}
#endif


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

/*=============================================================================
	FoliageComponent.cpp: Foliage rendering implementation.
=============================================================================*/

#include "FoliagePrivate.h"
#include "InteractiveFoliageActor.h"
#include "InteractiveFoliageComponent.h"
#include "Components/CapsuleComponent.h"

/** Scene proxy class for UInteractiveFoliageComponent. */
class FInteractiveFoliageSceneProxy : public FStaticMeshSceneProxy
{
public:

	FInteractiveFoliageSceneProxy(UInteractiveFoliageComponent* InComponent) :
		FStaticMeshSceneProxy(InComponent),
		FoliageImpluseDirection(0,0,0),
		FoliageNormalizedRotationAxisAndAngle(0,0,1,0)
	{}

	/** Accessor used by the rendering thread when setting foliage parameters for rendering. */
	virtual void GetFoliageParameters(FVector& OutFoliageImpluseDirection, FVector4& OutFoliageNormalizedRotationAxisAndAngle) const
	{
		OutFoliageImpluseDirection = FoliageImpluseDirection;
		OutFoliageNormalizedRotationAxisAndAngle = FoliageNormalizedRotationAxisAndAngle;
	}

	/** Updates the scene proxy with new foliage parameters from the game thread. */
	void UpdateParameters_GameThread(const FVector& NewFoliageImpluseDirection, const FVector4& NewFoliageNormalizedRotationAxisAndAngle)
	{
		checkSlow(IsInGameThread());
		ENQUEUE_UNIQUE_RENDER_COMMAND_THREEPARAMETER(
			UpdateFoliageParameters,
			FInteractiveFoliageSceneProxy*,FoliageProxy,this,
			FVector,NewFoliageImpluseDirection,NewFoliageImpluseDirection,
			FVector4,NewFoliageNormalizedRotationAxisAndAngle,NewFoliageNormalizedRotationAxisAndAngle,
			{
				FoliageProxy->FoliageImpluseDirection = NewFoliageImpluseDirection;
				FoliageProxy->FoliageNormalizedRotationAxisAndAngle = NewFoliageNormalizedRotationAxisAndAngle;
			});
	}

protected:

	FVector FoliageImpluseDirection;
	FVector4 FoliageNormalizedRotationAxisAndAngle;
};

UInteractiveFoliageComponent::UInteractiveFoliageComponent(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

FPrimitiveSceneProxy* UInteractiveFoliageComponent::CreateSceneProxy()
{
	// If a static mesh does not exist then this component cannot be added to the scene.
	if(StaticMesh == NULL
		|| StaticMesh->RenderData == NULL
		|| StaticMesh->RenderData->LODResources.Num() == 0
		|| StaticMesh->RenderData->LODResources[0].VertexBuffer.GetNumVertices() == 0)
	{
		return NULL;
	}

	// Store the foliage proxy so we can push updates to it during Tick
	FoliageSceneProxy = new FInteractiveFoliageSceneProxy(this);
	return FoliageSceneProxy;
}

void UInteractiveFoliageComponent::DestroyRenderState_Concurrent()
{
	Super::DestroyRenderState_Concurrent();
	FoliageSceneProxy = NULL;
}

float AInteractiveFoliageActor::TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
{
	FHitResult Hit;
	FVector ImpulseDir;
	DamageEvent.GetBestHitInfo(this, (EventInstigator ? EventInstigator->GetPawn() : NULL), Hit, ImpulseDir);

	// Discard the magnitude of the momentum and use Damage as the length instead
	FVector DamageImpulse = ImpulseDir.GetSafeNormal() * DamageAmount * FoliageDamageImpulseScale;

	// Apply force magnitude clamps
	DamageImpulse.X = FMath::Clamp(DamageImpulse.X, -MaxDamageImpulse, MaxDamageImpulse);
	DamageImpulse.Y = FMath::Clamp(DamageImpulse.Y, -MaxDamageImpulse, MaxDamageImpulse);
	DamageImpulse.Z = FMath::Clamp(DamageImpulse.Z, -MaxDamageImpulse, MaxDamageImpulse);

	FoliageForce += DamageImpulse;

	// Bring this actor out of stasis so that it gets ticked now that a force has been applied
	SetActorTickEnabled(true);

	return 0.f;
}

void AInteractiveFoliageActor::CapsuleTouched(AActor* Other, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	if (Other != NULL && OtherComp != NULL)
	{
		UCapsuleComponent* const TouchingActorCapsule = Cast<UCapsuleComponent>(OtherComp);
		if (TouchingActorCapsule && CapsuleComponent)
		{
			const FVector CenterToTouching = FVector(TouchingActorCapsule->Bounds.Origin.X, TouchingActorCapsule->Bounds.Origin.Y, CapsuleComponent->Bounds.Origin.Z) - CapsuleComponent->Bounds.Origin;
			// Keep track of the first position on the collision cylinder that the touching actor intersected
			//@todo - need to handle multiple touching actors
			TouchingActorEntryPosition = GetRootComponent()->Bounds.Origin + CenterToTouching.GetSafeNormal() * CapsuleComponent->GetScaledCapsuleRadius();
		}
		// Bring this actor out of stasis so that it gets ticked now that a force has been applied
		SetActorTickEnabled(true);
	}
}

void AInteractiveFoliageActor::SetupCollisionCylinder()
{
	if (GetStaticMeshComponent()->StaticMesh)
	{
		const FBoxSphereBounds MeshBounds = GetStaticMeshComponent()->StaticMesh->GetBounds();
		const FVector Scale3D = GetStaticMeshComponent()->RelativeScale3D;
		// Set the cylinder's radius based off of the static mesh's bounds radius
		// CollisionRadius is in world space so apply the actor's scale
		CapsuleComponent->SetCapsuleSize(MeshBounds.SphereRadius * .7f * FMath::Max(Scale3D.X, Scale3D.Y), MeshBounds.BoxExtent.Z * Scale3D.Z);

		// Ensure delegate is bound (just once)
		CapsuleComponent->OnComponentBeginOverlap.RemoveDynamic(this, &AInteractiveFoliageActor::CapsuleTouched);
		CapsuleComponent->OnComponentBeginOverlap.AddDynamic(this, &AInteractiveFoliageActor::CapsuleTouched);
	}
}

void AInteractiveFoliageActor::Tick(float DeltaSeconds)
{
	UInteractiveFoliageComponent* const FoliageComponent = CastChecked<UInteractiveFoliageComponent>(GetStaticMeshComponent());
	// Can only push updates to the scene proxy if we are being ticked while registered
	// The proxy will be NULL on dedicated server
	if (FoliageComponent->IsRegistered() && FoliageComponent->FoliageSceneProxy)
	{
		TArray<AActor*> Touching;
		GetOverlappingActors(Touching);

		for (int32 TouchingIndex = 0; TouchingIndex < Touching.Num(); TouchingIndex++)
		{
			AActor* TouchingActor = Touching[TouchingIndex];
			if (TouchingActor != NULL && TouchingActor->GetRootComponent() != NULL)
			{
				const FVector TouchingActorPosition(TouchingActor->GetRootComponent()->Bounds.Origin.X, TouchingActor->GetRootComponent()->Bounds.Origin.Y, GetRootComponent()->Bounds.Origin.Z);
				//DrawDebugLine(GetWorld(), TouchingActorPosition, GetRootComponent()->Bounds.Origin, 255, 255, 255, false);
				// Operate on the touching actor's collision cylinder
				//@todo - handle touching actors without collision cylinders
				UCapsuleComponent* TouchingActorCapsule = Cast<UCapsuleComponent>(TouchingActor->GetRootComponent());
				if (TouchingActorCapsule && CapsuleComponent)
				{
					FVector TouchingToCenter = GetRootComponent()->Bounds.Origin - TouchingActorPosition;
					// Force the simulated position to be in the XY plane for simplicity
					TouchingToCenter.Z = 0;
					// Position on the collision cylinder mirrored across the cylinder's center from the position that the touching actor entered
					const FVector OppositeTouchingEntryPosition = GetRootComponent()->Bounds.Origin + GetRootComponent()->Bounds.Origin - TouchingActorEntryPosition;

					// Project the touching actor's center onto the vector from where it first entered to OppositeTouchingEntryPosition
					// This results in the same directional force being applied for the duration of the other actor touching this foliage actor,
					// Which prevents strange movement that results from just comparing cylinder centers.
					const FVector ProjectedTouchingActorPosition = (TouchingActorPosition - OppositeTouchingEntryPosition).ProjectOnTo(TouchingActorEntryPosition - OppositeTouchingEntryPosition) + OppositeTouchingEntryPosition;
					// Find the furthest position on the cylinder of the touching actor from OppositeTouchingEntryPosition
					const FVector TouchingActorFurthestPosition = ProjectedTouchingActorPosition + (TouchingActorEntryPosition - OppositeTouchingEntryPosition).GetSafeNormal() * TouchingActorCapsule->GetScaledCapsuleRadius();
					// Construct the impulse as the distance between the furthest cylinder positions minus the two cylinder's diameters
					const FVector ImpulseDirection =
						- (OppositeTouchingEntryPosition - TouchingActorFurthestPosition
						- (OppositeTouchingEntryPosition - TouchingActorFurthestPosition).GetSafeNormal() * 2.0f * (TouchingActorCapsule->GetScaledCapsuleRadius() + CapsuleComponent->GetScaledCapsuleRadius()));

					//DrawDebugLine(GetWorld(), GetRootComponent()->Bounds.Origin + FVector(0,0,100), GetRootComponent()->Bounds.Origin + ImpulseDirection + FVector(0,0,100), 100, 255, 100, false);

					// Scale and clamp the touch force
					FVector Impulse = ImpulseDirection * FoliageTouchImpulseScale;
					Impulse.X = FMath::Clamp(Impulse.X, -MaxTouchImpulse, MaxTouchImpulse);
					Impulse.Y = FMath::Clamp(Impulse.Y, -MaxTouchImpulse, MaxTouchImpulse);
					Impulse.Z = FMath::Clamp(Impulse.Z, -MaxTouchImpulse, MaxTouchImpulse);
					FoliageForce += Impulse;
				}
			}
		}

		// Apply spring stiffness, which is the force that pushes the simulated particle back to the origin
		FoliageForce += -FoliageStiffness * FoliagePosition;
		// Apply spring quadratic stiffness, which increases in magnitude with the square of the distance to the origin
		// This prevents the spring from being displaced too much by touch and damage forces
		FoliageForce += -FoliageStiffnessQuadratic * FoliagePosition.SizeSquared() * FoliagePosition.GetSafeNormal();
		// Apply spring damping, which is like air resistance and causes the spring to lose energy over time
		FoliageForce += -FoliageDamping * FoliageVelocity;

		FoliageForce.X = FMath::Clamp(FoliageForce.X, -MaxForce, MaxForce);
		FoliageForce.Y = FMath::Clamp(FoliageForce.Y, -MaxForce, MaxForce);
		FoliageForce.Z = FMath::Clamp(FoliageForce.Z, -MaxForce, MaxForce);

		FoliageVelocity += FoliageForce * DeltaSeconds;
		FoliageForce = FVector::ZeroVector;

		const float MaxVelocity = 1000.0f;
		FoliageVelocity.X = FMath::Clamp(FoliageVelocity.X, -MaxVelocity, MaxVelocity);
		FoliageVelocity.Y = FMath::Clamp(FoliageVelocity.Y, -MaxVelocity, MaxVelocity);
		FoliageVelocity.Z = FMath::Clamp(FoliageVelocity.Z, -MaxVelocity, MaxVelocity);

		FoliagePosition += FoliageVelocity * DeltaSeconds;

		//DrawDebugLine(GetWorld(), GetRootComponent()->Bounds.Origin + FVector(0,0,100), GetRootComponent()->Bounds.Origin + FVector(0,0,100) + FoliagePosition, 255, 100, 100, false);

		//@todo - derive this height from the static mesh
		const float IntersectionHeight = 100.0f;
		// Calculate the rotation angle using Sin(Angle) = Opposite / Hypotenuse
		const float RotationAngle = -FMath::Asin(FoliagePosition.Size() / IntersectionHeight);
		// Use a rotation angle perpendicular to the impulse direction and the z axis
		const FVector NormalizedRotationAxis = FoliagePosition.SizeSquared() > KINDA_SMALL_NUMBER ?
			(FoliagePosition ^ FVector(0,0,1)).GetSafeNormal() :
			FVector(0,0,1);

		// Propagate the new rotation axis and angle to the rendering thread
		FoliageComponent->FoliageSceneProxy->UpdateParameters_GameThread(FoliagePosition, FVector4(NormalizedRotationAxis, RotationAngle));

		if (FoliagePosition.SizeSquared() < FMath::Square(KINDA_SMALL_NUMBER * 10.0f)
			&& FoliageVelocity.SizeSquared() < FMath::Square(KINDA_SMALL_NUMBER * 10.0f))
		{
			// Go into stasis (will no longer be ticked) if this actor's spring simulation has stabilized
			SetActorTickEnabled(false);
		}
	}
	Super::Tick(DeltaSeconds);
}

void AInteractiveFoliageActor::PostActorCreated()
{
	Super::PostActorCreated();
	SetupCollisionCylinder();
}

void AInteractiveFoliageActor::PostLoad()
{
	Super::PostLoad();
	SetupCollisionCylinder();
}


text:
<html>
	<head>
		<meta name="viewport" content="width=320,user-scalable=yes" />
	</head>
	<body style="background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#5D5D5D), color-stop(100%,#000000));">
			<img src="../../data/seating-chart.png" />
	</body>
</html>


text:
/*globals Foo:true $foo:true */

import { get } from 'ember-metal/property_get';

var obj;
var moduleOpts = {
  setup: function() {
    obj = {
      foo: {
        bar: {
          baz: { biff: 'BIFF' }
        }
      },
      falseValue: false
    };

    window.Foo = {
      bar: {
        baz: { biff: 'FooBiff' }
      }
    };

    window.$foo = {
      bar: {
        baz: { biff: '$FOOBIFF' }
      }
    };

    window.localPathGlobal = 5;
  },

  teardown: function() {
    obj = undefined;
    window.Foo = undefined;
    window.$foo = undefined;
    window.localPathGlobal = undefined;
  }
};

QUnit.module('Ember.get with path', moduleOpts);

// ..........................................................
// LOCAL PATHS
//

test('[obj, foo] -> obj.foo', function() {
  deepEqual(get(obj, 'foo'), obj.foo);
});

test('[obj, foo.bar] -> obj.foo.bar', function() {
  deepEqual(get(obj, 'foo.bar'), obj.foo.bar);
});

test('[obj, this.foo] -> obj.foo', function() {
  deepEqual(get(obj, 'this.foo'), obj.foo);
});

test('[obj, this.foo.bar] -> obj.foo.bar', function() {
  deepEqual(get(obj, 'this.foo.bar'), obj.foo.bar);
});

test('[obj, this.Foo.bar] -> (null)', function() {
  deepEqual(get(obj, 'this.Foo.bar'), undefined);
});

test('[obj, falseValue.notDefined] -> (null)', function() {
  deepEqual(get(obj, 'falseValue.notDefined'), undefined);
});

// ..........................................................
// LOCAL PATHS WITH NO TARGET DEPRECATION
//

test('[null, length] returning data is deprecated', function() {
  expectDeprecation(function(){
    equal(5, Ember.get(null, 'localPathGlobal'));
  }, "Ember.get fetched 'localPathGlobal' from the global context. This behavior will change in the future (issue #3852)");
});

test('[length] returning data is deprecated', function() {
  expectDeprecation(function(){
    equal(5, Ember.get('localPathGlobal'));
  }, "Ember.get fetched 'localPathGlobal' from the global context. This behavior will change in the future (issue #3852)");
});

// ..........................................................
// NO TARGET
//

test('[null, Foo] -> Foo', function() {
  deepEqual(get('Foo'), Foo);
});

test('[null, Foo.bar] -> Foo.bar', function() {
  deepEqual(get('Foo.bar'), Foo.bar);
});


text:
package city.tests.roles;

import junit.framework.TestCase;
import utilities.RestaurantZhangMenu;
import city.roles.RestaurantZhangCustomerRole;
import city.roles.interfaces.RestaurantZhangCustomer;
import city.tests.agents.mocks.MockPerson;
import city.tests.animations.mocks.MockRestaurantZhangAnimatedCustomer;
import city.tests.roles.mocks.MockRestaurantZhangCashier;
import city.tests.roles.mocks.MockRestaurantZhangHost;
import city.tests.roles.mocks.MockRestaurantZhangWaiterRegular;

/**
 * Restaurant customer Agent
 */

public class RestaurantZhangCustomerTest extends TestCase {
	RestaurantZhangCustomerRole customer;
	MockRestaurantZhangAnimatedCustomer anim;
	MockRestaurantZhangHost host;
	MockRestaurantZhangWaiterRegular waiter;
	MockRestaurantZhangCashier cashier;
	RestaurantZhangMenu menu;

	public void setUp() throws Exception {
		super.setUp();
		customer = new RestaurantZhangCustomerRole();
		anim = new MockRestaurantZhangAnimatedCustomer(customer);
		host = new MockRestaurantZhangHost();
		waiter = new MockRestaurantZhangWaiterRegular();
		cashier = new MockRestaurantZhangCashier();
		menu = new RestaurantZhangMenu();

		customer.setPerson(new MockPerson("Person"));
		customer.setHost(host);
		customer.setCashier(cashier);
		customer.setAnimation(anim);
		customer.setMoney(30);
	}

	public void testOneNormalCustomerScenario() { // Tests when customer has more than enough money to pay
		// Check to make sure customer's initial state is okay
		assertEquals("customer should have no table. It doesn't.", customer.getTable(), null);
		assertEquals("customer should have no check. It doesn't.", customer.getCheck(), null);
		assertTrue("customer should have money. It doesn't.", customer.getMoney() > 0);
		assertTrue("customer should have no tab. It doesn't.", customer.getTab() <= 0);
		assertEquals("customer should have a host. It doesn't", customer.getHost(), host);
		assertEquals("customer should have a cashier. It doesn't", customer.getCashier(), cashier);
		assertEquals("customer should have no waiter. It doesn't", customer.getWaiter(), null);
		assertEquals("customer's state should be doing nothing. Instead it's " + customer.getState().name(), customer.getState(), RestaurantZhangCustomer.AGENTSTATE.DoingNothing);
		assertEquals("customer's event should be none. Instead it's " + customer.getState().name(), customer.getEvent(), RestaurantZhangCustomer.AGENTEVENT.none);

		// Step 1: Set active
		customer.setActive();
		assertEquals("customer should have no table. It doesn't.", customer.getTable(), null);
		assertEquals("customer should have no check. It doesn't.", customer.getCheck(), null);
		assertTrue("customer should have money. It doesn't.", customer.getMoney() > 0);
		assertTrue("customer should have no tab. It doesn't.", customer.getTab() <= 0);
		assertEquals("customer should have a host. It doesn't", customer.getHost(), host);
		assertEquals("customer should have a cashier. It doesn't", customer.getCashier(), cashier);
		assertEquals("customer should have no waiter. It doesn't", customer.getWaiter(), null);
		assertEquals("customer's state should be doing nothing. Instead it's " + customer.getState().name(), customer.getState(), RestaurantZhangCustomer.AGENTSTATE.DoingNothing);
		assertEquals("customer's event should be gotHungry. Instead it's " + customer.getState().name(), customer.getEvent(), RestaurantZhangCustomer.AGENTEVENT.gotHungry);

		// Step 2: Run the scheduler
		assertTrue("Customer's scheduler didn't run", customer.runScheduler());
		assertEquals("customer should have no table. It doesn't.", customer.getTable(), null);
		assertEquals("customer should have no check. It doesn't.", customer.getCheck(), null);
		assertTrue("customer should have money. It doesn't.", customer.getMoney() > 0);
		assertTrue("customer should have no tab. It doesn't.", customer.getTab() <= 0);
		assertEquals("customer should have a host. It doesn't", customer.getHost(), host);
		assertEquals("customer should have a cashier. It doesn't", customer.getCashier(), cashier);
		assertEquals("customer should have no waiter. It doesn't", customer.getWaiter(), null);
		assertEquals("customer's state should be doing nothing. Instead it's " + customer.getState().name(), customer.getState(), RestaurantZhangCustomer.AGENTSTATE.AtEntrance);
		assertEquals("customer's event should be gotHungry. Instead it's " + customer.getState().name(), customer.getEvent(), RestaurantZhangCustomer.AGENTEVENT.gotHungry);

		// Step 3: Message the customer to wait
		customer.msgHereIsYourWaitingPosition(0);
		assertEquals("customer should have waiting position of 0. It doesn't.", customer.getWaitingPosition(), 0);
		assertEquals("customer should have no table. It doesn't.", customer.getTable(), null);
		assertEquals("customer should have no check. It doesn't.", customer.getCheck(), null);
		assertTrue("customer should have money. It doesn't.", customer.getMoney() > 0);
		assertTrue("customer should have no tab. It doesn't.", customer.getTab() <= 0);
		assertEquals("customer should have a host. It doesn't", customer.getHost(), host);
		assertEquals("customer should have a cashier. It doesn't", customer.getCashier(), cashier);
		assertEquals("customer should have no waiter. It doesn't", customer.getWaiter(), null);
		assertEquals("customer's state should be doing nothing. Instead it's " + customer.getState().name(), customer.getState(), RestaurantZhangCustomer.AGENTSTATE.AtEntrance);
		assertEquals("customer's event should be gotWaitingPosition. Instead it's " + customer.getState().name(), customer.getEvent(), RestaurantZhangCustomer.AGENTEVENT.gotWaitingPosition);

		// Step 4: Run the scheduler
		assertTrue("Customer's scheduler didn't run", customer.runScheduler());
		assertEquals("customer should have no table. It doesn't.", customer.getTable(), null);
		assertEquals("customer should have no check. It doesn't.", customer.getCheck(), null);
		assertTrue("customer should have money. It doesn't.", customer.getMoney() > 0);
		assertTrue("customer should have no tab. It doesn't.", customer.getTab() <= 0);
		assertEquals("customer should have a host. It doesn't", customer.getHost(), host);
		assertEquals("customer should have a cashier. It doesn't", customer.getCashier(), cashier);
		assertEquals("customer should have no waiter. It doesn't", customer.getWaiter(), null);
		assertEquals("customer's state should be GoingToWaitingPosition. Instead it's " + customer.getState().name(), customer.getState(), RestaurantZhangCustomer.AGENTSTATE.GoingToWaitingPosition);
		assertEquals("customer's event should be atWaitingPosition. Instead it's " + customer.getState().name(), customer.getEvent(), RestaurantZhangCustomer.AGENTEVENT.atWaitingPosition);
	}
}


text:
package io.lucci.bookshop.controller.resolver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;

import io.lucci.bookshop.model.SimplePaginator;

public class PaginatorArgumentResolver implements HandlerMethodArgumentResolver {

    private static Logger LOGGER = LoggerFactory.getLogger( PaginatorArgumentResolver.class );

    @Override
    public boolean supportsParameter( MethodParameter methodParameter ) {
        return methodParameter.getParameterAnnotation( Paginator.class ) != null;
    }

    @Override
    public Object resolveArgument( MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory ) throws Exception {
        LOGGER.debug( "resolving argument of methodParameter: {}", methodParameter );

        Integer page = null;
        if ( nativeWebRequest.getParameter( "page" ) != null ) {
            page = Integer.valueOf( nativeWebRequest.getParameter( "page" ) );
        }
        Integer size = null;
        if ( nativeWebRequest.getParameter( "size" ) != null ) {
            size = Integer.valueOf( nativeWebRequest.getParameter( "size" ) );
        }
        SimplePaginator pageRequest = null;
        if (size != null && page != null) {
        	pageRequest = new SimplePaginator( page, size );
        }
        LOGGER.debug( "argument resolved as {}", pageRequest );
        return pageRequest;
    }

}


text:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name:  Ion Auth Lang - Dutch
*
* Author: Jeroen van der Gulik
*         jeroen@isset.nl
*
* Adjustments by Dieter
*
* Location: http://github.com/benedmunds/CodeIgniter-Ion-Auth
*
* Created:  05.01.2010
*
* Description:  Dutch language file for Ion Auth messages and errors
*
*/

// Account Creation
$lang['account_creation_successful'] 	  	 = 'Account is aangemaakt';
$lang['account_creation_unsuccessful'] 	 	 = 'Account aanmaken is mislukt';
$lang['account_creation_duplicate_email'] 	 = 'E-mail is al in gebruik of ongeldig';
$lang['account_creation_duplicate_username'] 	 = 'Gebruikersnaam is al in gebruik of ongeldig';

// TODO Please Translate
$lang['account_creation_missing_default_group'] = 'Standaard groep is niet ingesteld';
$lang['account_creation_invalid_default_group'] = 'Standaard groepsnaam is ongeldig';

// Password
$lang['password_change_successful'] 	 	 = 'Wachtwoord succesvol gewijzigd';
$lang['password_change_unsuccessful'] 	  	 = 'Wachtwoord wijzigen is mislukt';
$lang['forgot_password_successful'] 	 	 = 'E-mail om het wachtwoord te Resetten is verzonden';
$lang['forgot_password_unsuccessful'] 	 	 = 'Wachtwoord resetten is mislukt';

// Activation
$lang['activate_successful'] 		  	 = 'Account is geactiveerd';
$lang['activate_unsuccessful'] 		 	 = 'Account activeren is mislukt';
$lang['deactivate_successful'] 		  	 = 'Account is gedeactiveerd';
$lang['deactivate_unsuccessful'] 	  	 = 'Accound deactiveren is mislukt';
$lang['activation_email_successful'] 	  	 = 'Activatie e-mail is verzonden';
$lang['activation_email_unsuccessful']   	 = 'Activatie e-mail verzenden is mislukt';

// Login / Logout
$lang['login_successful'] 		  	 = 'U bent ingelogd';
$lang['login_unsuccessful'] 		  	 = 'Login is incorrect';
$lang['login_unsuccessful_not_active'] 		 = 'Account is inactive';
$lang['login_timeout']                       = 'Temporarily Locked Out.  Try again later.';
$lang['logout_successful'] 		 	 = 'U bent uitgelogd';

// Account Changes
$lang['update_successful'] 		 	 = 'Account is bijgewerkt';
$lang['update_unsuccessful'] 		 	 = 'Account bijwerken is mislukt';
$lang['delete_successful'] 		 	 = 'Gebruiker is verwijderd';
$lang['delete_unsuccessful'] 		 	 = 'Gebruiker verwijderen is mislukt';

// Groups
$lang['group_creation_successful']  = 'Group created Successfully';
$lang['group_already_exists']       = 'Group name already taken';
$lang['group_update_successful']    = 'Group details updated';
$lang['group_delete_successful']    = 'Group deleted';
$lang['group_delete_unsuccessful'] 	= 'Unable to delete group';
$lang['group_delete_notallowed']    = 'Can\'t delete the administrators\' group';
$lang['group_name_required'] 		= 'Group name is a required field';
$lang['group_name_admin_not_alter'] = 'Admin group name can not be changed';

// Activation Email
$lang['email_activation_subject']            = 'Account Activering';
$lang['email_activate_heading']    = 'Activate account for %s';
$lang['email_activate_subheading'] = 'Please click this link to %s.';
$lang['email_activate_link']       = 'Activate Your Account';

// Forgot Password Email
$lang['email_forgotten_password_subject']    = 'Verificatie Verloren Wachtwoord';
$lang['email_forgot_password_heading']    = 'Reset Password for %s';
$lang['email_forgot_password_subheading'] = 'Please click this link to %s.';
$lang['email_forgot_password_link']       = 'Reset Your Password';
// New Password Email
$lang['email_new_password_subject']          = 'Nieuw wachtwoord';
$lang['email_new_password_heading']    = 'New Password for %s';
$lang['email_new_password_subheading'] = 'Your password has been reset to: %s';

/* End of file ion_auth_lang.php */
/* Location: ./system/application/language/dutch/ion_auth_lang.php */


text:
package org.mini2Dx.core.assets;

public interface AssetProperties<T> {

}


text:
storge-js
=========

local and session storage with namespacing, versioning, expiring keys and migration support

`npm install storge-js`

##Examples
localStorage
```js
var store = require('storge-js');

// can use set or setItem, get or getItem
store.set('foo', 1);
store.get('foo'); // 1
store.clear();
store.get('foo'); // undefined
```

sessionStorage
```js
var session = require('storge-js').session;

session.set('foo', 1);
session.get('foo'); // 1
```

##Expiration
Keys can expire by setting a time-to-live (in ms):
```js
store.set('foo', 1, 60 * 1000);
// or
store.set('foo', 1, { ttl: 60 * 1000 });
```
The next time the key is accessed, if it has expired it
will be removed and `undefined` will be returned. This works
across page loads.

##Namespacing and Versioning
The store can be namespaced and versioned by passing the name and semver
to storge-js. A namespaced store will not clash with other
stores (even non-namespaced and unversioned stores!).
```js
var testStore = require('storge-js')('TEST');
// shows up in localStorage as 'TEST_0.0.0_foo'
testStore.set('foo', 1);
    .get('foo'); // 1

var testStore2 = require('storge-js')('TEST', '1.1.2');
// shows up in localStorage as 'TEST_1.1.2_foo'
testStore2.set('foo', 2);
    .get('foo'); // 2

testStore2.keys(); ['foo']
// TEST_0.0.0_foo will still be in storage
testStore2.clear();
```

##Migration
Setup a migration by passing a migration config to the store. Each
migration config handles a single migration step and key:
```js
store.migration({
    from: '0.0.0',
    to:   '0.0.1',
    key:  'foo',
    process: function(oldData) {
        return newData;
    }
});
```
To migrate, simply call `.migrate()` on the store.

To delete deprecated versions, call `.deprecate()`. This is recommended to
prevent hitting the storage cap of ~5MB.

##Nice Toys
No need to `JSON.stringify` or `JSON.parse` your values, storge-js does it for you
```js
store.set('foo', { bar: 1 });
store.get('foo'); // { bar: 1 }
```

Set multiple keys and values.
```js
store.set({ foo: 1, bar: 2 });
```

Get or remove multiple values.
```js
store.get(['foo', 'bar']); // [1, 2]
store.remove(['foo', 'bar']);
```

Async methods: `getAsync`, `setAsync`, `removeAsync`, `clearAsync`, `keyAsync`, `keysAsync`
using native `Promise`.

##Danger Zone
`.flush()` will wipe the entire store, regardless of namespace and versioning.
`.backup()` will create an object of all key-value pairs in the store without
escaping store-specific keys.

#Tests
`npm install && npm test` for unit tests
`npm run browser` for in-browser testing

#License
The MIT License (MIT)

Copyright (c) 2014 Joseph Clay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.