text:
// Karma configuration
// Generated on Fri Aug 01 2014 01:01:26 GMT-0400 (EDT)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'bower_components/angular/angular.js',
      'lib/jquery-1.11.0.min.js',
      'lib/*.js',
      'bower_components/angular-route/angular-route.js',
      'lib/angular-mocks.js',
      'lib/angular-ui-router.js',
      'lib/ui-bootstrap-tpls-0.10.0.min.js',
      'js/*',
      'js/model/*.js',
      'js/services/*.js',
      'js/network/blockchaininfo.js',
      'js/controllers/*.js',
      '**/controllers/*.tests.js'
    ],

    // list of files to exclude
    exclude: [
    'js/model/color*.js',
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false
  });
};


text:
package org.auraframework.util.resource;

import java.io.File;
import java.io.IOException;
import java.util.Set;

import org.auraframework.util.text.Hash;

/**
 * File group to allow hashing  of group contents
 */
public interface FileGroup {

    String getName();

    long getLastMod();

    /**
     * Fetches a hash <i>almost</i> guaranteed to change if anything in the
     * group changes. Note that this should imply that the files must be
     * traversed in some stable order, regardless of whether {@link #getFiles()}
     * returns them in that order.
     *
     * FIXME: This likely needs an SFDC patch, too.
     *
     * @return a hash of all the files in the group.
     * @throws java.io.IOException if a file in the group cannot be read for hashing
     */
    Hash getGroupHash() throws IOException;

    /**
     * Add a file to the group.
     *
     * If the string is an absolute path, it will be added as that absolute file, otherwise, it is
     * resolved from an implementation dependent root directory.
     *
     * @param s the path.
     */
    File addFile(String s) throws IOException;

    File addDirectory(String s) throws IOException;

    Set<File> getFiles();

    /**
     * is this group out of date? It can only check files that were in the group
     * when initially parsed, newly added files won't show up
     */
    boolean isStale();

    /**
     * Reset to get new hash
     */
    void reset() throws IOException;
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#pragma once

#include <bond/core/config.h>

#include "bond_fwd.h"
#include "detail/metadata.h"

#include <bond/core/bond_types.h>

#include <boost/mpl/copy_if.hpp>
#include <boost/mpl/find_if.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/static_assert.hpp>

#include <functional>

namespace bond
{

using boost::mpl::_;

template <typename T> struct
remove_maybe
{
    typedef T type;
};

template <typename T> struct
remove_maybe<maybe<T> >
{
    typedef typename remove_maybe<T>::type type;
};

BOND_STATIC_CONSTEXPR uint16_t invalid_field_id = 0xffff;

/** namespace bond::reflection */
namespace reflection
{
//
// Helper classes/templates
//
typedef std::map<std::string, std::string> Attributes;

// field is required
using required_field_modifier = std::integral_constant<bond::Modifier, bond::Required>;

// field is optional
using optional_field_modifier = std::integral_constant<bond::Modifier, bond::Optional>;

// field is required optional
using required_optional_field_modifier = std::integral_constant<bond::Modifier, bond::RequiredOptional>;

/// @brief Field description in compile-time schema
template <
    uint16_t field_id,
    typename ModifierTag,
    typename Struct,
    typename FieldType,
    FieldType Struct::*field_ptr,
    const bond::Metadata* metadata_ptr>
struct FieldTemplate
{
    // Note: When introducing new names inside this scope, remember to update the
    // fieldTemplateReservedNames list in Reflection_h.hs

    /// @brief Type of the field's parent struct
    typedef Struct struct_type;

    /// @brief Type of the field pointer
    typedef FieldType Struct::*field_pointer;

    /// @brief Type of the field
    typedef typename remove_maybe<FieldType>::type field_type;

    /// @brief Type of the field value
    typedef FieldType value_type;

    /// @brief Modifier tag for the field
    ///
    /// Can be one of:
    /// - bond::reflection::optional_field_modifier
    /// - bond::reflection::required_field_modifier
    /// - bond::reflection::required_optional_field_modifier
    typedef ModifierTag field_modifier;

    /// @brief Static data member describing field metadata
    static const Metadata& metadata;

    /// @brief Static data member representing the field pointer
    static const field_pointer field;

    /// @brief Static data member equal to the field ordinal
    BOND_STATIC_CONSTEXPR uint16_t id = field_id;

    /// @brief Static method returning const reference to the field value for a particular object
    static
    const value_type& GetVariable(const struct_type& object)
    {
        return object.*field_ptr;
    }

    /// @brief Static method returning reference to the field value for a particular object
    static
    value_type& GetVariable(struct_type& object)
    {
        return object.*field_ptr;
    }

    BOOST_STATIC_ASSERT(field_id != invalid_field_id);
};

template <
    uint16_t field_id,
    typename ModifierTag,
    typename Struct,
    typename FieldType,
    FieldType Struct::*field_ptr,
    const Metadata* metadata_ptr>
const bond::Metadata&
    FieldTemplate<field_id, ModifierTag, Struct, FieldType, field_ptr, metadata_ptr>::metadata = *metadata_ptr;

template
<
    uint16_t field_id,
    typename ModifierTag,
    typename Struct,
    typename FieldType,
    FieldType Struct::*field_ptr,
    const Metadata* metadata_ptr
>
const typename FieldTemplate<field_id, ModifierTag, Struct, FieldType, field_ptr, metadata_ptr>::field_pointer
    FieldTemplate<field_id, ModifierTag, Struct, FieldType, field_ptr, metadata_ptr>::field = field_ptr;

template <typename Service, typename Input, typename Result> struct
method_pointer
{
    typedef void (Service::*type)(
        const Input&,
        const std::function<void(const Result&)>&);
};

template <typename Service, typename Input> struct
method_pointer<Service, Input, void>
{
    typedef void (Service::*type)(const Input&);
};

/// @brief Method description in compile-time schema
template <
    typename Service,
    typename Input,
    typename Result,
    typename method_pointer<Service, Input, Result>::type method_ptr,
    const Metadata* metadata_ptr>
struct MethodTemplate
{
    // Note: When introducing new names inside this scope, remember to
    // update the methodTemplateReservedNames list in Grpc_h.hs

    /// @brief Type of the service
    typedef Service service_type;

    /// @brief Type of the request
    typedef Input input_type;

    /// @brief Type of the response
    typedef Result result_type;

    /// @brief Static data member describing method metadata
    static const Metadata& metadata;

    /// @brief Static data member representing the member pointer to the method
    static const typename method_pointer<service_type, input_type, result_type>::type method;
};

template <
    typename Service,
    typename Input,
    typename Result,
    typename method_pointer<Service, Input, Result>::type method_ptr,
    const bond::Metadata* metadata_ptr>
const bond::Metadata&
    MethodTemplate<Service, Input, Result, method_ptr, metadata_ptr>::metadata = *metadata_ptr;

template <
    typename Service,
    typename Input,
    typename Result,
    typename method_pointer<Service, Input, Result>::type method_ptr,
    const bond::Metadata* metadata_ptr>
const typename method_pointer<Service, Input, Result>::type
    MethodTemplate<Service, Input, Result, method_ptr, metadata_ptr>::method = method_ptr;

// Metadata initializer for fields
inline
bond::Metadata MetadataInit(const char* name)
{
    bond::Metadata metadata;

    metadata.name = name;
    return metadata;
}

inline
bond::Metadata MetadataInit(const char* name, bond::Modifier modifier, const Attributes& attributes)
{
    bond::Metadata metadata;

    metadata.name = name;
    metadata.modifier = modifier;
    metadata.attributes = attributes;

    return metadata;
}

inline
bond::Metadata MetadataInit(const char* name, const Attributes& attributes)
{
    bond::Metadata metadata;

    metadata.name = name;
    metadata.attributes = attributes;

    return metadata;
}

template <typename T>
bond::Metadata MetadataInit(const T& default_value, const char* name)
{
    bond::Metadata metadata;

    metadata.name = name;
    detail::VariantSet(metadata.default_value, default_value);
    return metadata;
}

template <typename T>
bond::Metadata MetadataInit(const T& default_value, const char* name, bond::Modifier modifier, const Attributes& attributes)
{
    bond::Metadata metadata = MetadataInit(name, modifier, attributes);

    detail::VariantSet(metadata.default_value, default_value);

    return metadata;
}

struct nothing
{};

inline
bond::Metadata MetadataInit(const nothing&, const char* name)
{
    bond::Metadata metadata;

    metadata.name = name;
    metadata.default_value.nothing = true;
    return metadata;
}

inline
bond::Metadata MetadataInit(const nothing&, const char* name, bond::Modifier modifier, const Attributes& attributes)
{
    bond::Metadata metadata = MetadataInit(name, modifier, attributes);

    metadata.default_value.nothing = true;

    return metadata;
}

// Metadata initializer for structs
inline
bond::Metadata MetadataInit(const char* name, const char* qual_name, const Attributes& attributes)
{
    bond::Metadata metadata;

    metadata.name = name;
    metadata.qualified_name = qual_name;
    metadata.attributes = attributes;

    return metadata;
}

// Metadata initializer for generic structs
template <typename Params>
bond::Metadata MetadataInit(const char* name, const char* qual_name, const Attributes& attributes)
{
    bond::Metadata metadata = MetadataInit(name, qual_name, attributes);

    std::string params;

    // boost::mpl::for_each instantiates object of each type in the sequence.
    // We transform the Params to a sequence of type pointers to avoid creating
    // actual complex types that might not even support default ctor.
    typedef typename boost::mpl::transform<Params, std::add_pointer<_> >::type ParamsPtr;

    boost::mpl::for_each<ParamsPtr>(detail::TypeListBuilder(params));

    metadata.name += "<" + params + ">";
    metadata.qualified_name += "<" + params + ">";

    return metadata;
}

} // namespace reflection

const reflection::nothing nothing = {};

template <typename T, typename Iter> struct
field_id
    : std::integral_constant<uint16_t, boost::mpl::deref<Iter>::type::id> {};

template <typename T> struct
field_id<T, typename boost::mpl::end<T>::type>
    : std::integral_constant<uint16_t, invalid_field_id> {};

template <typename T, uint16_t minId = 0> struct
next_required_field
{
private:
    template <typename Field> struct
    is_next_required
        : std::integral_constant<bool,
            Field::id >= minId
            && std::is_same<typename Field::field_modifier, typename reflection::required_field_modifier>::value> {};

public:
    BOND_STATIC_CONSTEXPR uint16_t value = field_id<T, typename boost::mpl::find_if<T, is_next_required<_> >::type>::value;
};

struct no_base {};

template <typename T, typename Enable = void> struct
is_writer
    : std::false_type {};

template <typename T> struct
is_writer<T,
#ifdef BOND_NO_SFINAE_EXPR
    typename boost::enable_if<check_method<void (T::*)(const Metadata&, bool), &T::WriteStructBegin> >::type>
#else
    detail::mpl::void_t<decltype(std::declval<T>().WriteStructBegin(
        std::declval<Metadata>(),
        std::declval<bool>()))>>
#endif
     : std::true_type {};

template <typename T>
inline typename T::base*
base_class()
{
    return NULL;
}

template <typename T> struct
remove_bonded
{
    typedef T type;
};

template <typename T, typename Reader> struct
remove_bonded<bonded<T, Reader> >
{
    typedef typename remove_bonded<T>::type type;
};

template <typename T> struct
remove_bonded_value
{
    typedef T type;
};

template <typename T, typename Reader> struct
remove_bonded_value<bonded<T, Reader> >
{
    typedef T type;
};

template <typename T, typename Reader> struct
remove_bonded_value<value<T, Reader> >
{
    typedef T type;
};

template <typename T> struct
is_bond_type
    : std::integral_constant<bool,
        is_bonded<typename std::remove_const<T>::type>::value
        || has_schema<typename std::remove_const<T>::type>::value> {};

struct Unknown;

template <typename Unused> struct
schema<Unknown, Unused>
{
    struct type
    {
        typedef no_base base;
        typedef boost::mpl::list<>::type fields;
        static const Metadata metadata;

        type()
        {
            (void)metadata;
        }
    };
};

template <typename Unused>
const Metadata schema<Unknown, Unused>::type::metadata
    = reflection::MetadataInit("Unknown", "Unknown", reflection::Attributes());

template <typename T, typename Enable> struct
schema_for_passthrough
    : schema<typename remove_bonded<T>::type>
{};

template <typename T> struct
schema_for_passthrough<T, typename boost::disable_if<has_schema<typename remove_bonded<T>::type> >::type>
{
    // If type T doesn't have schema we return schema of an empty struct;
    // this allows pass-through of bonded<T> with only forward declaration for T.
    typedef typename schema<Unknown>::type type;
};

template <typename T> struct
is_container
    : std::integral_constant<bool,
        is_list_container<typename std::remove_const<T>::type>::value
        || is_set_container<typename std::remove_const<T>::type>::value
        || is_map_container<typename std::remove_const<T>::type>::value> {};

template <typename Field, typename Transform, typename Enable = void> struct
is_fast_path_field
    : std::false_type {};

template <typename Field, typename Transform> struct
is_fast_path_field<Field, Transform, typename boost::enable_if<std::is_same<typename Field::struct_type,
                                                                            typename Transform::FastPathType> >::type>
     : std::true_type {};

template <typename T> struct
is_nested_field
    : is_bond_type<typename T::field_type> {};

template <typename T> struct
is_struct_field
    : has_schema<typename T::field_type> {};

template <typename T1, typename T2, typename Enable = void> struct
is_matching_container
    : std::false_type {};

template <typename T1, typename T2> struct
is_matching_basic
    : std::integral_constant<bool,
        (is_string<T1>::value && is_string<T2>::value)
        || (is_wstring<T1>::value && is_wstring<T2>::value)
        || ((sizeof(T1) <= sizeof(T2))
            && ((std::is_unsigned<T1>::value && std::is_unsigned<T2>::value)
                || (is_signed_int_or_enum<T1>::value && is_signed_int_or_enum<T2>::value)))> {};

template <typename T> struct
is_matching_basic<typename aliased_type<T>::type, T>
    : std::true_type {};

template <typename T1, typename T2> struct
is_matching
    : std::integral_constant<bool,
        (is_bond_type<T1>::value && is_bond_type<T2>::value)
        || (is_matching_basic<T1, T2>::value)
        || (is_matching_container<T1, T2>::value)> {};

template <typename T> struct
is_matching_basic<T, T>
    : std::true_type {};

template <> struct
is_matching_basic<bool, bool>
    : std::true_type {};

template <typename T> struct
is_matching_basic<bool, T>
    : std::false_type {};

template <> struct
is_matching_basic<uint8_t, bool>
    : std::false_type {};

template <> struct
is_matching_basic<float, double>
    : std::true_type {};

template <typename T, typename Enable> struct
get_type_id;

template <typename T1, typename T2> struct
is_matching_container<T1, T2,
    typename boost::enable_if_c<is_container<T1>::value
                             && get_type_id<T1>::value == get_type_id<T2>::value>::type>
    : is_matching<typename element_type<T1>::type,
                  typename element_type<T2>::type> {};

// tuples match if the elements match
template <typename T1, typename T2, typename U1, typename U2> struct
is_matching<std::pair<T1, T2>, std::pair<U1, U2> >
    : std::integral_constant<bool,
        is_matching<T1, U1>::value
        && is_matching<T2, U2>::value> {};

template <typename T1, typename T2> struct
is_matching<std::pair<T1, T2>, std::pair<T1, T2> >
    : std::true_type {};

// value<T> matches if type matches
template <typename T1, typename Reader, typename T2> struct
is_matching<value<T1, Reader>, T2>
    : is_matching<T1, T2> {};

// value<void> matches every container
template <typename T, typename Reader> struct
is_matching<value<void, Reader>, T>
    : is_container<T> {};

template <typename T, typename X, typename Enable = void> struct
is_element_matching
    : std::false_type {};

template <typename T, typename X> struct
is_element_matching<T, X, typename boost::enable_if<is_container<X> >::type>
    : is_matching<T, typename element_type<X>::type> {};

template <typename X, typename Reader> struct
is_element_matching<value<void, Reader>, X, typename boost::enable_if<is_container<X> >::type>
    : std::integral_constant<bool,
        is_bond_type<typename element_type<X>::type>::value
        || is_container<typename element_type<X>::type>::value> {};

template <typename T, typename X, typename Enable = void> struct
is_map_element_matching
    : std::false_type {};

template <typename X, typename T> struct
is_map_element_matching<T, X, typename boost::enable_if<is_map_container<X> >::type>
    : is_matching<T, typename element_type<X>::type::second_type> {};

template <typename X, typename Reader> struct
is_map_element_matching<value<void, Reader>, X, typename boost::enable_if<is_map_container<X> >::type>
    : std::integral_constant<bool,
        is_bond_type<typename element_type<X>::type::second_type>::value
        || is_container<typename element_type<X>::type::second_type>::value> {};

template <typename T, typename X, typename Enable = void> struct
is_map_key_matching
    : std::false_type {};

template <typename T, typename X> struct
is_map_key_matching<T, X, typename boost::enable_if<is_map_container<X> >::type>
    : is_matching<T, typename element_type<X>::type::first_type> {};

template <typename T> struct
is_basic_type
    : std::integral_constant<bool,
        !(is_container<T>::value || is_bond_type<T>::value)> {};

template <> struct
is_basic_type<void>
    : std::false_type {};

// is_nested_container
template <typename T, typename Enable = void> struct
is_nested_container
    : std::false_type {};

template <typename T> struct
is_nested_container<T, typename boost::enable_if<is_map_container<T> >::type>
    : std::integral_constant<bool,
        !is_basic_type<typename element_type<T>::type::second_type>::value> {};

template <typename T> struct
is_nested_container<T, typename boost::enable_if<is_list_container<T> >::type>
    : std::integral_constant<bool,
        !is_basic_type<typename element_type<T>::type>::value> {};

template <typename T, typename Enable = void> struct
is_struct_container
    : std::false_type {};

template <typename T> struct
is_struct_container<T, typename boost::enable_if<is_map_container<T> >::type>
    : std::integral_constant<bool,
        has_schema<typename element_type<T>::type::second_type>::value
        || is_struct_container<typename element_type<T>::type::second_type>::value> {};

template <typename T> struct
is_struct_container<T, typename boost::enable_if<is_list_container<T> >::type>
    : std::integral_constant<bool,
        has_schema<typename element_type<T>::type>::value
        || is_struct_container<typename element_type<T>::type>::value> {};

// is_struct_container_field
template <typename T> struct
is_struct_container_field
    : is_struct_container<typename T::field_type> {};

// is_basic_container
template <typename T, typename Enable = void> struct
is_basic_container
    : std::false_type {};

template <typename T> struct
is_basic_container<T, typename boost::enable_if<is_map_container<T> >::type>
    : is_basic_type<typename element_type<T>::type::second_type> {};

template <typename T> struct
is_basic_container<T, typename boost::enable_if<is_list_container<T> >::type>
    : is_basic_type<typename element_type<T>::type> {};

template <typename T> struct
is_basic_container<T, typename boost::enable_if<is_set_container<T> >::type>
    : std::true_type {};

template <typename T, typename F> struct
is_matching_container_field
    : is_matching_container<T, typename F::field_type> {};

template <typename T> struct
is_container_field
    : is_container<typename T::field_type> {};

template <typename T, typename F> struct
is_matching_basic_field
    : is_matching_basic<T, typename F::field_type> {};

template <typename T, typename Reader> struct
is_basic_type<value<T, Reader> >
    : std::false_type {};

template <typename T1, typename T2> struct
is_basic_type<std::pair<T1, T2> >
    : std::false_type {};

template <typename T, typename X, typename Enable = void> struct
matching_fields
    : boost::mpl::copy_if<typename schema<T>::type::fields,
                          is_matching_basic_field<X, _>,
                          boost::mpl::front_inserter<boost::mpl::list<> > >
{
    BOOST_STATIC_ASSERT((is_basic_type<X>::value));
};

template <typename T, typename X> struct
matching_fields<T, X, typename boost::enable_if<is_container<X> >::type>
    : boost::mpl::copy_if<typename schema<T>::type::fields,
                          is_matching_container_field<X, _>,
                          boost::mpl::front_inserter<boost::mpl::list<> > > {};

template <typename T> struct
nested_fields
    : boost::mpl::copy_if<typename schema<T>::type::fields,
                          is_nested_field<_>,
                          boost::mpl::front_inserter<boost::mpl::list<> > > {};

template <typename T> struct
struct_fields
    : boost::mpl::copy_if<typename schema<T>::type::fields,
                          is_struct_field<_>,
                          boost::mpl::front_inserter<boost::mpl::list<> > > {};

template <typename T> struct
container_fields
    : boost::mpl::copy_if<typename schema<T>::type::fields,
                          is_container_field<_>,
                          boost::mpl::front_inserter<boost::mpl::list<> > > {};

template <typename T> struct
has_base
    : has_schema<typename schema<T>::type::base> {};

template <typename T>
BondDataType
GetTypeId(const T&)
{
    return get_type_id<T>::value;
}

template <typename Reader>
BondDataType
GetTypeId(const value<void, Reader>& value)
{
    return value.GetTypeId();
}

template <typename T, typename Reader> struct
get_type_id<value<T, Reader> >
    : get_type_id<T> {};

template <typename T1, typename T2> struct
get_type_id<std::pair<T1, T2> >
{
    static const std::pair<BondDataType, BondDataType> value;
};

template <typename T1, typename T2>
const std::pair<BondDataType, BondDataType>
get_type_id<std::pair<T1, T2> >::value = std::make_pair(
    get_type_id<typename std::remove_const<T1>::type>::value,
    get_type_id<T2>::value);

template <> struct
get_type_id<bool>
    : std::integral_constant<BondDataType, BT_BOOL> {};

template <> struct
get_type_id<uint8_t>
    : std::integral_constant<BondDataType, BT_UINT8> {};

template <> struct
get_type_id<uint16_t>
    : std::integral_constant<BondDataType, BT_UINT16> {};

template <> struct
get_type_id<uint32_t>
    : std::integral_constant<BondDataType, BT_UINT32> {};

template <> struct
get_type_id<uint64_t>
    : std::integral_constant<BondDataType, BT_UINT64> {};

template <> struct
get_type_id<int8_t>
    : std::integral_constant<BondDataType, BT_INT8> {};

template <> struct
get_type_id<int16_t>
    : std::integral_constant<BondDataType, BT_INT16> {};

template <> struct
get_type_id<int32_t>
    : std::integral_constant<BondDataType, BT_INT32> {};

template <> struct
get_type_id<int64_t>
    : std::integral_constant<BondDataType, BT_INT64> {};

template <> struct
get_type_id<float>
    : std::integral_constant<BondDataType, BT_FLOAT> {};

template <> struct
get_type_id<double>
    : std::integral_constant<BondDataType, BT_DOUBLE> {};

template <> struct
get_type_id<void>
    : std::integral_constant<BondDataType, BT_UNAVAILABLE> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<std::is_enum<T>>::type>
    : get_type_id<int32_t> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<is_bond_type<T>>::type>
    : std::integral_constant<BondDataType, BT_STRUCT> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<is_set_container<typename std::remove_const<T>::type>>::type>
    : std::integral_constant<BondDataType, BT_SET> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<is_map_container<typename std::remove_const<T>::type>>::type>
    : std::integral_constant<BondDataType, BT_MAP> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<is_list_container<typename std::remove_const<T>::type>>::type>
    : std::integral_constant<BondDataType, BT_LIST> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<is_string<typename std::remove_const<T>::type>>::type>
    : std::integral_constant<BondDataType, BT_STRING> {};

template <typename T> struct
get_type_id<T, typename boost::enable_if<is_wstring<typename std::remove_const<T>::type>>::type>
    : std::integral_constant<BondDataType, BT_WSTRING> {};

template <typename T, typename Enable> struct
get_type_id
    : get_type_id<typename aliased_type<T>::type> {};

template <typename T, typename Enable = void> struct
get_list_sub_type_id
    : std::integral_constant<ListSubType, NO_SUBTYPE> {};

template <typename T> struct
get_list_sub_type_id<nullable<T> >
    : std::integral_constant<ListSubType, NULLABLE_SUBTYPE> {};

template <> struct
get_list_sub_type_id<blob>
    : std::integral_constant<ListSubType, BLOB_SUBTYPE> {};

class PrimitiveTypes
{
    struct Init
    {
        Init(uint32_t* _sizeof)
            : _sizeof(_sizeof)
        {}

        template <typename T>
        void operator()(const T&)
        {
            _sizeof[get_type_id<T>::value] = sizeof(T);
        }

        uint32_t* _sizeof;
    };

public:
    typedef boost::mpl::list
    <
        bool, float, double,
        uint8_t, uint16_t, uint32_t, uint64_t,
        int8_t,  int16_t,  int32_t,  int64_t
    >type;

    PrimitiveTypes(uint32_t* _sizeof)
    {
        boost::mpl::for_each<type>(Init(_sizeof));
    }
};

} // namespace bond


text:
from django.conf.urls import url

from django.contrib import admin

urlpatterns = [
    url(r'^', admin.site.urls),
]


text:
/*
 * Created on 10-May-2006
 */
package recurrence;

public class ArrayAssignmentException extends Exception
{

    public ArrayAssignmentException()
    {
        super();
    }

    public ArrayAssignmentException(String message)
    {
        super(message);
    }

    public ArrayAssignmentException(String message, Throwable cause)
    {
        super(message, cause);
    }

    public ArrayAssignmentException(Throwable cause)
    {
        super(cause);
    }

}


text:
/*
 * Contains modifications by iBuildApp, 2014-2015.
 */

#import "MIRadioButtonGroup.h"
#import "mCFRadioButton.h"
#import "NSString+size.h"

@interface MIRadioButtonGroup()

@property (nonatomic, strong) NSMutableArray *radioButtons;
@property (nonatomic, strong) NSMutableArray *labels;

@end

@implementation MIRadioButtonGroup
@synthesize radioButtons, labels;

#pragma mark -
- (id)initWithFrame:(CGRect)frame andOptions:(NSArray *)options andColumns:(int)columns andTextColor:(UIColor *)textColor
{
  if ((self = [super initWithFrame:frame]))
  {

    self.radioButtons = [NSMutableArray array];
    self.labels = [NSMutableArray array];

    const CGFloat RADIO_BUTTON_SIZE = 34.f;

    CGFloat y = 0;
    for (int i = 0; i < ([options count] / columns); i++)
    {
      mCFRadioButton *rb = [[mCFRadioButton alloc] initWithFrame:CGRectMake(0, y, RADIO_BUTTON_SIZE, RADIO_BUTTON_SIZE)];
      [rb addTarget:self action:@selector(radioButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
      [self addSubview:rb];
      [self.radioButtons addObject:rb];

      CGSize textSize = [[options objectAtIndex:i] sizeForFont:[UIFont systemFontOfSize:17.f]
                                                    limitSize:CGSizeMake(frame.size.width - RADIO_BUTTON_SIZE - 10, CGFLOAT_MAX)
                                              nslineBreakMode:NSLineBreakByWordWrapping];

      UIButton *labelButton = [[UIButton alloc] initWithFrame:CGRectMake(RADIO_BUTTON_SIZE + 10, y + 7,
                                                              frame.size.width - RADIO_BUTTON_SIZE - 10, textSize.height)];
      labelButton.backgroundColor                    = [UIColor clearColor];
      labelButton.titleLabel.adjustsFontSizeToFitWidth = NO;
      labelButton.titleLabel.font                    = [UIFont systemFontOfSize:17.f];
      labelButton.titleLabel.textColor               = textColor;
      //            label.shadowColor               = [UIColor colorWithWhite:0.0 alpha:0.5];
      labelButton.titleLabel.textAlignment           = NSTextAlignmentLeft;
      labelButton.contentHorizontalAlignment         = UIControlContentHorizontalAlignmentLeft;
      labelButton.titleLabel.lineBreakMode           = NSLineBreakByWordWrapping;

      labelButton.titleLabel.numberOfLines           = 0;
      [labelButton setTitle:[options objectAtIndex:i] forState:UIControlStateNormal];
      [labelButton setTitleColor:textColor forState:UIControlStateNormal];
      [labelButton addTarget:self action:@selector(labelButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
      labelButton.tag = i;

      [self addSubview:labelButton];
      [self.labels addObject:labelButton];

      y += MAX(RADIO_BUTTON_SIZE + 15, 7 + labelButton.frame.size.height + 15);
    }

    self.frame = CGRectMake(frame.origin.x, frame.origin.y, self.frame.size.width, y);

  }
  return self;
}

#pragma mark -

- (void)labelButtonClicked:(UIButton *) sender
{
  [self clearAll];
  ((mCFRadioButton *)self.radioButtons[sender.tag]).checked = YES;
}

- (void)radioButtonClicked:(mCFRadioButton *) sender
{
  [self clearAll];
  sender.checked = YES;
}

- (void)removeButtonAtIndex:(int)index
{
  [[self.radioButtons objectAtIndex:index] removeFromSuperview];
}

-(void) setSelected:(int)index
{
  [self clearAll];

  if (index > -1)
    ((mCFRadioButton *)self.radioButtons[index]).checked = YES;
}

- (NSString*)getSelected
{
  for (int i = 0; i < self.radioButtons.count; i++)
  {
    if (((mCFRadioButton *)self.radioButtons[i]).checked)
      return ((UIButton *)self.labels[i]).titleLabel.text;
  }

  return nil;
}

- (void)clearAll
{
  for (int i = 0; i < self.radioButtons.count; i++)
    ((mCFRadioButton *)self.radioButtons[i]).checked = NO;
}

@end


text:
chunkserver
===========

An HTTP Adaptive Streaming Video Server with functionality to dynamically insert chunks depending on the user data.


text:
$packageName = 'crystaldiskmark'
$installerType = 'exe'
$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-'
$url = 'https://en.osdn.jp/frs/redir.php?f=%2Fcrystaldiskmark%2F66553%2FCrystalDiskMark5_2_0-en.exe'
$checksum = '9e3eac56da1b0ab37f8749dbfdf247cfcfda1db8'
$checksumType = 'sha1'
$validExitCodes = @(0)

Install-ChocolateyPackage -PackageName "$packageName" `
                          -FileType "$installerType" `
                          -SilentArgs "$silentArgs" `
                          -Url "$url" `
                          -ValidExitCodes $validExitCodes `
                          -Checksum "$checksum" `
                          -ChecksumType "$checksumType"


text:
<?xml version="1.0" encoding="UTF-8" ?>
<class name="NavigationPolygonInstance" inherits="Node2D" category="Core" version="3.1">
	<brief_description>
	</brief_description>
	<description>
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
	</methods>
	<members>
		<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled">
		</member>
		<member name="navpoly" type="NavigationPolygon" setter="set_navigation_polygon" getter="get_navigation_polygon">
		</member>
	</members>
	<constants>
	</constants>
</class>


text:
The functionality of this project is delivered with JavaScript run within node.

## Code

The main node scripts live in the [bin](../bin) directory. They rely on
JavaScript that resides in the [lib](../lib) directory.

## Development

### Tools

The tools that aid in development are:

* JavaScript Linting
* Unit Tests
* Acceptance Tests
* Continuous Integration

### Environments

The project is principally written in node, and development was initially done
in version `6.9.1`.

Acceptance tests are described in `gherkin`, and the runner of these tests in written in ruby.

### Setup

Given that `node` and `ruby` are involved, you get going locally with the following:

```sh
npm install              # Setup Node
bundle                   # Setup Ruby
```

And you can know that you've got a functional environment with the following:

```sh
npm run lint             # Lint JavaScript
npm run test             # Unit Tests
rake acceptance_tests    # Acceptance Tests
```

## Badges

* [![Code Climate](https://codeclimate.com/github/jedcn/there-and-back-again/badges/gpa.svg)](https://codeclimate.com/github/jedcn/there-and-back-again)
* [![Test Coverage](https://codeclimate.com/github/jedcn/there-and-back-again/badges/coverage.svg)](https://codeclimate.com/github/jedcn/there-and-back-again)
* [![Issue Count](https://codeclimate.com/github/jedcn/there-and-back-again/badges/issue_count.svg)](https://codeclimate.com/github/jedcn/there-and-back-again)


text:
local christmas_tree = "Julgran" -- Name of the christmas tree
local water_sensor = "Vattensensor" -- Name of the water sensor
local delay = 5 -- Flash speed

------ Do not change below ------
local deviceManager = require "telldus.DeviceManager"
local running = false

function onDeviceStateChanged(device, state, stateValue)
	if running == true then
		return
	end
	local sensor = deviceManager:findByName(water_sensor)
	local switch = deviceManager:findByName(christmas_tree)
	if sensor == nil then
		return
	end
	if switch == nil then
		return
	end
	if device:id() ~= sensor:id() then
		return
	end
	running = true
	while (sensor:state() == 2) do -- As long as the sensor is dry
		print("Tick tack")
		switch:command("turnoff", nil, "Christmas tree")
		sleep(delay*1000)
		switch:command("turnon", nil, "Christmas tree")
		sleep(delay*1000)
	end
	running = false
end


text:
package org.springframework.boot.autoconfigure.aop;

import org.aspectj.weaver.Advice;

import org.springframework.aop.config.AopConfigUtils;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
 * Auto-configuration} for Spring's AOP support. Equivalent to enabling
 * {@link EnableAspectJAutoProxy @EnableAspectJAutoProxy} in your configuration.
 * <p>
 * The configuration will not be activated if {@literal spring.aop.auto=false}. The
 * {@literal proxyTargetClass} attribute will be {@literal true}, by default, but can be
 * overridden by specifying {@literal spring.aop.proxy-target-class=false}.
 *
 * @author Dave Syer
 * @author Josh Long
 * @since 1.0.0
 * @see EnableAspectJAutoProxy
 */
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.aop", name = "auto", havingValue = "true", matchIfMissing = true)
public class AopAutoConfiguration {

	@Configuration(proxyBeanMethods = false)
	@ConditionalOnClass(Advice.class)
	static class AspectJAutoProxyingConfiguration {

		@Configuration(proxyBeanMethods = false)
		@EnableAspectJAutoProxy(proxyTargetClass = false)
		@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "false")
		static class JdkDynamicAutoProxyConfiguration {

		}

		@Configuration(proxyBeanMethods = false)
		@EnableAspectJAutoProxy(proxyTargetClass = true)
		@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true",
				matchIfMissing = true)
		static class CglibAutoProxyConfiguration {

		}

	}

	@Configuration(proxyBeanMethods = false)
	@ConditionalOnMissingClass("org.aspectj.weaver.Advice")
	@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true",
			matchIfMissing = true)
	static class ClassProxyingConfiguration {

		@Bean
		static BeanFactoryPostProcessor forceAutoProxyCreatorToUseClassProxying() {
			return (beanFactory) -> {
				if (beanFactory instanceof BeanDefinitionRegistry) {
					BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
					AopConfigUtils.registerAutoProxyCreatorIfNecessary(registry);
					AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry);
				}
			};
		}

	}

}


text:
from google.cloud import dlp_v2

def sample_delete_dlp_job():
    # Create a client
    client = dlp_v2.DlpServiceClient()

    # Initialize request argument(s)
    request = dlp_v2.DeleteDlpJobRequest(
        name="name_value",
    )

    # Make the request
    client.delete_dlp_job(request=request)

# [END dlp_v2_generated_DlpService_DeleteDlpJob_sync]


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

//-----------------------------------------------------------------------------
//
// Description:
//  This is a helper class for pack:// Uris. This is a part of the
//  Metro Packaging Layer
//
//-----------------------------------------------------------------------------

using System.Diagnostics;

namespace System.IO.Packaging
{
    using Properties;

    /// <summary>
    /// This class has the utility methods for composing and parsing an Uri of pack:// scheme
    /// </summary>
    public static class PackUriHelper
    {
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        #region Public Methods

        /// <summary>
        /// This method is used to create a valid part Uri given a relative URI
        /// Makes sure that the URI -
        /// 1. Relative
        /// 2. Begins with '/'
        /// 3. Does not begin with two "//"
        /// 4. Does not end with "/"
        /// 5. Does not have a fragment component
        /// 6. Does the correct escaping
        /// 7. And is refined correctly
        /// </summary>
        /// <param name="partUri">The relative uri that represents the part within a package</param>
        /// <returns>Returns a relative URI with an absolute path that points to a part within a package</returns>
        /// <exception cref="ArgumentNullException">If partUri parameter is null</exception>
        /// <exception cref="ArgumentException">If partUri parameter is an absolute Uri</exception>
        /// <exception cref="ArgumentException">If partUri parameter is empty</exception>
        /// <exception cref="ArgumentException">If partUri parameter ends with "/"</exception>
        /// <exception cref="ArgumentException">If partUri parameter starts with two "/"</exception>
        /// <exception cref="ArgumentException">If partUri parameter has a fragment</exception>
        public static Uri CreatePartUri(Uri partUri)
        {
            if (partUri == null)
                throw new ArgumentNullException("partUri");

            ThrowIfAbsoluteUri(partUri);

            string serializedPartUri = partUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.SafeUnescaped);
            ThrowIfPartNameStartsWithTwoSlashes(serializedPartUri);
            ThrowIfFragmentPresent(serializedPartUri);

            //Create an absolute URI to get the refinement on the relative URI
            Uri resolvedUri = new Uri(s_defaultUri, partUri);

            string partName = GetStringForPartUriFromAnyUri(resolvedUri);

            if (partName == String.Empty)
                throw new ArgumentException(Resources.PartUriIsEmpty);

            ThrowIfPartNameEndsWithSlash(partName);

            return new ValidatedPartUri(partName);
        }

        /// <summary>
        /// This method is used to resolve part Uris
        /// Constructs resolved relative URI from two relative URIs
        /// This method should be used in places where we have a
        /// a target URI in the PackageRelationship and we want to get the
        /// name of the part it targets with respect to the source part
        /// </summary>
        /// <param name="sourcePartUri">This should be a valid partName.
        /// The only exception to this rule is an Uri of the form "/". This uri
        /// will only be used to resolve package level relationships. This Uri
        /// indicates that the relative Uri is being resolved against the root of the
        /// package.</param>
        /// <param name="targetUri">This URI can be any relative URI</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">If either sourcePartUri or targetUri parameter is null</exception>
        /// <exception cref="ArgumentException">If either sourcePartUri or targetUri parameter is an absolute Uri</exception>
        /// <exception cref="ArgumentException">If sourcePartUri parameter does not conform to the valid partUri syntax</exception>
        public static Uri ResolvePartUri(Uri sourcePartUri, Uri targetUri)
        {
            if (sourcePartUri == null)
                throw new ArgumentNullException("sourcePartUri");

            if (targetUri == null)
                throw new ArgumentNullException("targetUri");

            ThrowIfAbsoluteUri(sourcePartUri);

            ThrowIfAbsoluteUri(targetUri);

            Uri resolvedUri;

            if (sourcePartUri == PackageRootUri)
                resolvedUri = new Uri(s_defaultUri, targetUri);
            else
                resolvedUri = new Uri(new Uri(s_defaultUri, ValidatePartUri(sourcePartUri)), targetUri);

            return new Uri(resolvedUri.AbsolutePath, UriKind.Relative);
        }

        /// <summary>
        /// This method returns the relative uri between two given parts
        /// </summary>
        /// <param name="sourcePartUri"></param>
        /// <param name="targetPartUri"></param>
        /// <returns>The relative path between two parts</returns>
        /// <exception cref="ArgumentNullException">If either the sourcePartUri or targetPartUri parameter is null</exception>
        /// <exception cref="ArgumentException">If either sourcePartUri or targetPartUri parameter does not conform to the valid partUri syntax</exception>
        public static Uri GetRelativeUri(Uri sourcePartUri, Uri targetPartUri)
        {
            //although we do expect the subsequent ValidatePartUri call to throw in case of null
            // as well, it dosn't have the right parameter namer for ValidatePartUri function
            if (sourcePartUri == null)
                throw new ArgumentNullException("sourcePartUri");

            if (targetPartUri == null)
                throw new ArgumentNullException("targetPartUri");

            sourcePartUri = new Uri(s_defaultUri, ValidatePartUri(sourcePartUri));
            targetPartUri = new Uri(s_defaultUri, ValidatePartUri(targetPartUri));

            return sourcePartUri.MakeRelativeUri(targetPartUri);
        }

        /// <summary>
        /// Returns the normalized form of the part URI
        /// </summary>
        /// <param name="partUri">Part Uri</param>
        /// <returns>Normalized Part Uri</returns>
        /// <exception cref="ArgumentNullException">If partUri is null</exception>
        /// <exception cref="ArgumentException">If partUri parameter does not conform to the valid partUri syntax</exception>
        public static Uri GetNormalizedPartUri(Uri partUri)
        {
            if (partUri == null)
                throw new ArgumentNullException("partUri");

            if (!(partUri is ValidatedPartUri))
                partUri = ValidatePartUri(partUri);
            return ((ValidatedPartUri)partUri).NormalizedPartUri;
        }

        /// <summary>
        /// This method compares two part uris and returns an int to indicate the equivalence
        /// Null values are allowed
        /// </summary>
        /// <param name="firstPartUri">First part Uri to be compared</param>
        /// <param name="secondPartUri">Second part Uri to be compared</param>
        /// <returns>A 32-bit signed integer indicating the lexical relationship between the compared Uri components.
        /// Value - Less than zero means firstUri is less than secondUri
        /// Value - Equal to zero means both the Uris are equal</returns>
        /// Value - Greater than zero means firstUri is greater than secondUri
        /// <exception cref="ArgumentException">If firstPartUri or secondPartUri parameter does not conform to the valid partUri syntax</exception>
        public static int ComparePartUri(Uri firstPartUri, Uri secondPartUri)
        {
            if (firstPartUri != null)
                firstPartUri = ValidatePartUri(firstPartUri);

            if (secondPartUri != null)
                secondPartUri = ValidatePartUri(secondPartUri);

            //If any of the operands are null then we simply call System.Uri compare to return the correct value
            if (firstPartUri == null || secondPartUri == null)
                return CompareUsingSystemUri(firstPartUri, secondPartUri);

            return ((IComparable<ValidatedPartUri>)firstPartUri).CompareTo((ValidatedPartUri)secondPartUri);
        }

        /// <summary>
        /// IsRelationshipPartUri method returns a boolean indicating whether the
        /// Uri given is a relationship part Uri or not.
        /// </summary>
        /// <param name="partUri">uri of part to evaluate</param>
        /// <returns>true if the given part is a PackageRelationship part</returns>
        /// <remarks>Does not inspect the part contents - this is based solely on the name</remarks>
        /// <exception cref="ArgumentNullException">If partUri parameter is null</exception>
        /// <exception cref="ArgumentException">If partUri parameter is an absolute Uri</exception>
        /// <exception cref="ArgumentException">If partUri parameter does not conform to the valid partUri Syntax</exception>
        public static bool IsRelationshipPartUri(Uri partUri)
        {
            if (partUri == null)
                throw new ArgumentNullException("partUri");

            if (!(partUri is ValidatedPartUri))
                partUri = ValidatePartUri(partUri);

            return ((ValidatedPartUri)partUri).IsRelationshipPartUri;
        }

        /// <summary>
        /// This method returns a relationship part Uri given a part Uri
        /// Example Input - partUri - /files/document.xaml
        /// Return  - Relationship Uri  - /files/_rels/document.xaml.rels
        /// If the input to the method is Uri - "/", then we will return /_rels/.rels as the
        /// relationship part Uri for the Package level relationships
        /// </summary>
        /// <param name="partUri">Part Uri for which the relationship part Uri is wanted</param>
        /// <returns>returns a Uri that conforms to the relationship part Uri syntax</returns>
        /// <exception cref="ArgumentException">If the input Uri is a relationship part Uri itself</exception>
        /// <exception cref="ArgumentNullException">If partUri parameter is null</exception>
        /// <exception cref="ArgumentException">If partUri parameter is an absolute Uri</exception>
        /// <exception cref="ArgumentException">If partUri parameter does not conform to the valid partUri Syntax</exception>
        public static Uri GetRelationshipPartUri(Uri partUri)
        {
            if (partUri == null)
                throw new ArgumentNullException("partUri");

            if (Uri.Compare(partUri, PackageRootUri, UriComponents.SerializationInfoString, UriFormat.UriEscaped, StringComparison.Ordinal) == 0)
                return PackageRelationship.ContainerRelationshipPartName;

            // Verify  -
            // 1. Validates that this part Uri is a valid part Uri

            partUri = ValidatePartUri(partUri);

            // 2. Checks that this part Uri is not a relationshipPart Uri
            if (IsRelationshipPartUri(partUri))
                throw new ArgumentException(Resources.RelationshipPartUriNotExpected);

            //We should have a ValidatedPartUri by this time
            string partName = ((ValidatedPartUri)partUri).PartUriString;

            string file = Path.GetFileName(partName);

            Debug.Assert((partName.Length - file.Length) > 0,
                "The partname may not be wellformed");

            // Get the parname without the last segment
            partName = partName.Substring(0, partName.Length - file.Length);

            partName = Path.Combine(partName, s_relationshipPartSegmentName);         // Adding the "_rels" segment
            partName = Path.Combine(partName, file);                                 // Adding the last segment back
            partName = String.Concat(partName, s_relationshipPartExtensionName);      // Adding the ".rels" extension
            partName = partName.Replace(BackwardSlashChar, ForwardSlashChar);

            // convert to Uri - We could use PackUriHelper.Create, but since we know that this is a
            //valid Part Uri we can just call the Uri constructor.
            return new ValidatedPartUri(partName, true /*IsRelationship*/);
        }

        /// <summary>
        /// Given a valid relationship Part Uri, this method returns the source Part Uri for
        /// this relationship Part Uri.
        /// If the relationship part name is for the Package Level relationships [/_rels/.rels],
        /// we return a relative Uri of the form "/" indicating that it has no part as the parent,
        /// but is at the package level
        /// Example Input - Relationship Uri  - /files/_rels/document.xaml.rels
        /// Returns -Source Part Uri - /files/document.xaml
        /// </summary>
        /// <param name="relationshipPartUri">relationship part Uri</param>
        /// <returns>A uri that is a valid source part Uri for the relationship Uri provided</returns>
        /// <exception cref="ArgumentNullException">If relationshipPartUri parameter is null</exception>
        /// <exception cref="ArgumentException">If relationshipPartUri parameter is an absolute Uri</exception>
        /// <exception cref="ArgumentException">If relationshipPartUri parameter does not conform to the valid partUri Syntax</exception>
        /// <exception cref="ArgumentException">If the relationshipPartUri is not a relationship part Uri itself</exception>
        /// <exception cref="ArgumentException">If the resultant Uri obtained is a relationship part Uri</exception>
        public static Uri GetSourcePartUriFromRelationshipPartUri(Uri relationshipPartUri)
        {
            if (relationshipPartUri == null)
                throw new ArgumentNullException("relationshipPartUri");

            // Verify -
            // 1. Validates that this part Uri is a valid part Uri
            relationshipPartUri = ValidatePartUri(relationshipPartUri);

            // 2. Checks that this part Uri is not a relationshipPart Uri
            if (!IsRelationshipPartUri(relationshipPartUri))
                throw new ArgumentException(Resources.RelationshipPartUriExpected);

            // _rels/.rels has no parent part
            if (ComparePartUri(PackageRelationship.ContainerRelationshipPartName, relationshipPartUri) == 0)
            {
                return PackageRootUri;
            }
            else
            {
                //We should have a ValidatedPartUri by this time
                string path = ((ValidatedPartUri)relationshipPartUri).PartUriString;

                string partNameWithoutExtension = Path.GetFileNameWithoutExtension(path);

                Debug.Assert((path.Length - partNameWithoutExtension.Length - s_relationshipPartExtensionName.Length - 1) > 0,
                    "The partname may not be wellformed");

                //Get the part name without the last segment
                path = path.Substring(0, path.Length - partNameWithoutExtension.Length - s_relationshipPartExtensionName.Length - 1);

                Debug.Assert((path.Length - s_relationshipPartSegmentName.Length) > 0,
                    "The partname may not be wellformed");

                path = path.Substring(0, path.Length - s_relationshipPartSegmentName.Length); // Removing rels segment
                path = Path.Combine(path, partNameWithoutExtension);        // Adding the last segment without ".rels" extension
                path = path.Replace(BackwardSlashChar, ForwardSlashChar);

                // convert to Uri - We could use PackUriHelper.Create, but since we know that this is a
                //valid Part Uri we can just call the Uri constructor.
                return new ValidatedPartUri(path, false /*IsRelationship*/);
            }
        }

        #endregion Public Methods

        //------------------------------------------------------
        //
        //  Internal Properties
        //
        //------------------------------------------------------

        #region Internal Properties

        internal static Uri PackageRootUri
        {
            get
            {
                return s_packageRootUri;
            }
        }

        #endregion Internal Properties

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        internal static bool TryValidatePartUri(Uri partUri, out ValidatedPartUri validatedPartUri)
        {
            if (partUri is ValidatedPartUri)
            {
                validatedPartUri = (ValidatedPartUri)partUri;
                return true;
            }
            else
            {
                string partUriString;
                Exception exception = GetExceptionIfPartUriInvalid(partUri, out partUriString);
                if (exception != null)
                {
                    validatedPartUri = null;
                    return false;
                }
                else
                {
                    validatedPartUri = new ValidatedPartUri(partUriString);
                    return true;
                }
            }
        }

        /// <summary>
        /// This method is used to validate a part Uri
        /// This method does not perform a case sensitive check of the Uri
        /// </summary>
        /// <param name="partUri">The string that represents the part within a package</param>
        /// <returns>Returns the part uri if it is valid</returns>
        /// <exception cref="ArgumentNullException">If partUri parameter is null</exception>
        /// <exception cref="ArgumentException">If partUri parameter is an absolute Uri</exception>
        /// <exception cref="ArgumentException">If partUri parameter is empty</exception>
        /// <exception cref="ArgumentException">If partUri parameter does not start with a "/"</exception>
        /// <exception cref="ArgumentException">If partUri parameter starts with two "/"</exception>
        /// <exception cref="ArgumentException">If partUri parameter ends with a "/"</exception>
        /// <exception cref="ArgumentException">If partUri parameter has a fragment</exception>
        /// <exception cref="ArgumentException">If partUri parameter has some escaped characters that should not be escaped
        /// or some characters that should be escaped are not escaped.</exception>
        internal static ValidatedPartUri ValidatePartUri(Uri partUri)
        {
            if (partUri is ValidatedPartUri)
                return (ValidatedPartUri)partUri;

            string partUriString;
            Exception exception = GetExceptionIfPartUriInvalid(partUri, out partUriString);
            if (exception != null)
            {
                Debug.Assert(partUriString != null && partUriString.Length == 0);
                throw exception;
            }
            else
            {
                Debug.Assert(partUriString != null && partUriString.Length > 0);
                return new ValidatedPartUri(partUriString);
            }
        }

        //Returns the part name in its escaped string form.
        internal static string GetStringForPartUri(Uri partUri)
        {
            Debug.Assert(partUri != null, "Null reference check for this uri parameter should have been made earlier");
            if (!(partUri is ValidatedPartUri))
                partUri = ValidatePartUri(partUri);

            return ((ValidatedPartUri)partUri).PartUriString;
        }

        #endregion Internal Methods

        //------------------------------------------------------
        //
        //  Internal Events
        //
        //------------------------------------------------------
        // None

        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private static readonly char[] HexUpperChars = {
                                   '0', '1', '2', '3', '4', '5', '6', '7',
                                   '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

        private static Exception GetExceptionIfPartUriInvalid(Uri partUri, out string partUriString)
        {
            partUriString = String.Empty;

            if (partUri == null)
                return new ArgumentNullException("partUri");

            Exception argumentException = null;

            argumentException = GetExceptionIfAbsoluteUri(partUri);
            if (argumentException != null)
                return argumentException;

            string partName = GetStringForPartUriFromAnyUri(partUri);

            //We need to make sure that the URI passed to us is not just "/"
            //"/" is a valid relative uri, but is not a valid partname
            if (partName == String.Empty)
                return new ArgumentException(Resources.PartUriIsEmpty);

            if (partName[0] != '/')
                return new ArgumentException(Resources.PartUriShouldStartWithForwardSlash);

            argumentException = GetExceptionIfPartNameStartsWithTwoSlashes(partName);
            if (argumentException != null)
                return argumentException;

            argumentException = GetExceptionIfPartNameEndsWithSlash(partName);
            if (argumentException != null)
                return argumentException;

            argumentException = GetExceptionIfFragmentPresent(partName);
            if (argumentException != null)
                return argumentException;

            //We test if the URI is wellformed and refined.
            //The relative URI that was passed to us may not be correctly escaped and so we test that.
            //Also there might be navigation "/../" present in the URI which we need to detect.
            string wellFormedPartName =
                new Uri(s_defaultUri, partName).GetComponents(UriComponents.Path |
                                                             UriComponents.KeepDelimiter, UriFormat.UriEscaped);

            //Note - For Relative Uris the output of ToString() and OriginalString property
            //are the same as per the current implementation of System.Uri
            //Need to use OriginalString property or ToString() here as we are want to
            //validate that the input uri given to us was valid in the first place.
            //We do not want to use GetComponents in this case as it might lead to
            //performing escaping or unescaping as per the UriFormat enum value and that
            //may alter the string that the user created the Uri with and we may not be able
            //to verify the uri correctly.
            //We perform the comparison in a case-insensitive manner, as at this point,
            //only escaped hex digits (A-F) might vary in casing.
            if (String.CompareOrdinal(partUri.OriginalString.ToUpperInvariant(), wellFormedPartName.ToUpperInvariant()) != 0)
                return new ArgumentException(Resources.InvalidPartUri);

            //if we get here, the partUri is valid and so we return null, as there is no exception.
            partUriString = partName;
            return null;
        }

        private static void ThrowIfAbsoluteUri(Uri uri)
        {
            Exception exception = GetExceptionIfAbsoluteUri(uri);
            if (exception != null)
                throw exception;
        }

        private static ArgumentException GetExceptionIfAbsoluteUri(Uri uri)
        {
            if (uri.IsAbsoluteUri)
                return new ArgumentException(Resources.URIShouldNotBeAbsolute);
            else
                return null;
        }

        private static void ThrowIfFragmentPresent(string partName)
        {
            Exception exception = GetExceptionIfFragmentPresent(partName);
            if (exception != null)
                throw exception;
        }

        private static ArgumentException GetExceptionIfFragmentPresent(string partName)
        {
            if (partName.Contains("#"))
                return new ArgumentException(Resources.PartUriCannotHaveAFragment);
            else
                return null;
        }

        private static void ThrowIfPartNameEndsWithSlash(string partName)
        {
            Exception exception = GetExceptionIfPartNameEndsWithSlash(partName);
            if (exception != null)
                throw exception;
        }

        private static ArgumentException GetExceptionIfPartNameEndsWithSlash(string partName)
        {
            if (partName.Length > 0)
            {
                if (partName[partName.Length - 1] == '/')
                    return new ArgumentException(Resources.PartUriShouldNotEndWithForwardSlash);
            }
            return null;
        }

        private static void ThrowIfPartNameStartsWithTwoSlashes(string partName)
        {
            Exception exception = GetExceptionIfPartNameStartsWithTwoSlashes(partName);
            if (exception != null)
                throw exception;
        }

        // A relative reference that begins with two slash characters is termed
        // a network-path reference; such references are rarely used.
        // However, when they are resolved they represent the authority part of the URI
        // Absolute URI - `http://a/b/c/d;p?q
        // Relative URI - //m
        // Resolved URI - `http://m
        private static ArgumentException GetExceptionIfPartNameStartsWithTwoSlashes(string partName)
        {
            if (partName.Length > 1)
            {
                if (partName[0] == '/' && partName[1] == '/')
                    return new ArgumentException(Resources.PartUriShouldNotStartWithTwoForwardSlashes);
            }
            return null;
        }

        //Calling System.Uri.Compare method
        //This method minimizes the false positives that we might get as a result
        //of comparing two URIs.
        //Also, we exclude the Fragment component while comparing.
        private static int CompareUsingSystemUri(Uri firstUri, Uri secondUri)
        {
            return Uri.Compare(
                    firstUri,
                    secondUri,
                    UriComponents.AbsoluteUri & ~UriComponents.Fragment,
                    UriFormat.UriEscaped,
                    StringComparison.Ordinal);
        }

        //Returns the part name in its escaped string form from an Absolute [must be pack://] or a Relative URI
        private static string GetStringForPartUriFromAnyUri(Uri partUri)
        {
            Debug.Assert(partUri != null, "Null reference check for this uri parameter should have been made earlier");
            Debug.Assert(!(partUri is ValidatedPartUri), "This method should only be called when we have not already validated the part uri");

            Uri safeUnescapedUri;

            // Step 1: Get the safe-unescaped form of the URI first. This will unescape all the characters
            // that can be safely un-escaped, unreserved characters, unicode characters, etc.
            if (!partUri.IsAbsoluteUri)
            {
                //We assume a well formed part uri has been passed to this method
                safeUnescapedUri = new Uri(partUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.SafeUnescaped), UriKind.Relative);
            }
            else
            {
                safeUnescapedUri =
                    new Uri(partUri.GetComponents(UriComponents.Path |
                                                  UriComponents.KeepDelimiter, UriFormat.SafeUnescaped), UriKind.Relative);
            }

            // Step 2: Get the canonically escaped Path with only ascii characters
            //Get the escaped string for the part name as part names should have only ascii characters
            String partName = safeUnescapedUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped);

            //The part name can be empty in cases where we were passed a pack URI that has no part component
            if (IsPartNameEmpty(partName))
                return String.Empty;
            else
                return partName;
        }

        //Verifies whether the part name is empty. PartName can be empty in two cases :
        //1. Empty String
        //2. String with just the begining "/"
        private static bool IsPartNameEmpty(string partName)
        {
            Debug.Assert(partName != null, "Null reference check for this partName parameter should have been made earlier");

            // Uri.GetComponents may return a single forward slash when there is no absolute path.
            // This is Whidbey PS399695.  Until that is changed, we check for both cases - either an entirely empty string,
            // or a single forward slash character.  Either case means there is no part name.
            if (partName.Length == 0 || ((partName.Length == 1) && (partName[0] == '/')))
                return true;
            else
                return false;
        }

        #endregion Private Methods

        //------------------------------------------------------
        //
        //  Private Fields
        //
        //------------------------------------------------------

        #region Private Members

        //we use this dummy URI to resolve relative URIs treating the container as the authority.
        private static readonly Uri s_defaultUri = new Uri("http://defaultcontainer/");

        //we use this dummy Uri to represent the root of the container.
        private static readonly Uri s_packageRootUri = new Uri("/", UriKind.Relative);

        // We need to perform Escaping for the following - '%'; '@'; ',' and '?'
        // !!Important!! - The order is important - The '%' sign should be escaped first.
        // If any more characters need to be added to the array below they should be added at the end.
        private static readonly char[] s_specialCharacters = { '%', '@', ',', '?' };

        //Rels segment and extension
        private static readonly string s_relationshipPartSegmentName = "_rels";
        private static readonly string s_relationshipPartExtensionName = ".rels";

        // Forward Slash
        internal static readonly char ForwardSlashChar = '/';

        // Backward Slash
        internal static readonly char BackwardSlashChar = '\\';

        /// <summary>
        /// pack scheme name
        /// </summary>
        public static readonly string UriSchemePack = "pack";

        #endregion Private Members

        #region Private Class

        /// <summary>
        /// ValidatedPartUri class
        /// Once the partUri has been validated as per the syntax in the OPC spec
        /// we create a ValidatedPartUri, this way we do not have to re-validate
        /// this.
        /// This class is heavily used throughout the Packaging APIs and in order
        /// to reduce the parsing and number of allocations for Strings and Uris
        /// we cache the results after parsing.
        /// </summary>
        internal sealed class ValidatedPartUri : Uri, IComparable<ValidatedPartUri>, IEquatable<ValidatedPartUri>
        {
            //------------------------------------------------------
            //
            //  Internal Constructors
            //
            //------------------------------------------------------

            #region Internal Constructors

            internal ValidatedPartUri(string partUriString)
                : this(partUriString, false /*isNormalized*/, true /*computeIsRelationship*/, false /*dummy value as we will compute it later*/)
            {
            }

            //Use this constructor when you already know if a given string is a relationship
            //or no. One place this is used is while creating a normalized uri for a part Uri
            //This will optimize the code and we will not have to parse the Uri to find out
            //if it is a relationship part uri
            internal ValidatedPartUri(string partUriString, bool isRelationshipUri)
                : this(partUriString, false /*isNormalized*/, false /*computeIsRelationship*/, isRelationshipUri)
            {
            }

            #endregion Internal Constructors

            //------------------------------------------------------
            //
            //  Internal Methods
            //
            //------------------------------------------------------

            #region IComparable Methods

            int IComparable<ValidatedPartUri>.CompareTo(ValidatedPartUri otherPartUri)
            {
                return Compare(otherPartUri);
            }

            #endregion IComparable Methods

            #region IEqualityComparer Methods

            bool IEquatable<ValidatedPartUri>.Equals(ValidatedPartUri otherPartUri)
            {
                return Compare(otherPartUri) == 0;
            }

            #endregion IEqualityComparer Methods

            #region Internal Properties

            //------------------------------------------------------
            //
            //  Internal Properties
            //
            //------------------------------------------------------

            //Returns the PartUri string
            internal string PartUriString
            {
                get
                {
                    return _partUriString;
                }
            }

            internal string PartUriExtension
            {
                get
                {
                    if (_partUriExtension == null)
                    {
                        _partUriExtension = Path.GetExtension(_partUriString);

                        //If extension is absent just return the empty string
                        //else remove the leading "." from the returned extension
                        //string
                        if (_partUriExtension.Length > 0)
                            _partUriExtension = _partUriExtension.Substring(1);
                    }
                    return _partUriExtension;
                }
            }

            //Returns the normalized string for the part uri.
            internal string NormalizedPartUriString
            {
                get
                {
                    if (_normalizedPartUriString == null)
                        _normalizedPartUriString = GetNormalizedPartUriString();

                    return _normalizedPartUriString;
                }
            }

            //Returns the normalized part uri
            internal ValidatedPartUri NormalizedPartUri
            {
                get
                {
                    if (_normalizedPartUri == null)
                        _normalizedPartUri = GetNormalizedPartUri();

                    return _normalizedPartUri;
                }
            }

            //Returns true, if the original string passed to create
            //this object was normalized
            internal bool IsNormalized
            {
                get
                {
                    return _isNormalized;
                }
            }

            //Returns, true is the partUri is a relationship part uri
            internal bool IsRelationshipPartUri
            {
                get
                {
                    return _isRelationshipPartUri;
                }
            }

            #endregion Internal Properties

            //------------------------------------------------------
            //
            //  Private Methods
            //
            //------------------------------------------------------

            #region Private Constructor

            //Note - isRelationshipPartUri parameter is only meaningful if computeIsRelationship
            //bool is false, in which case, it means that we already know whether the partUriString
            //represents a relationship or no, and as such there is no need to compute/parse to
            //find out if its a relationship.
            private ValidatedPartUri(string partUriString, bool isNormalized, bool computeIsRelationship, bool isRelationshipPartUri)
                : base(partUriString, UriKind.Relative)
            {
                Debug.Assert(partUriString != null && partUriString.Length > 0);

                _partUriString = partUriString;
                _isNormalized = isNormalized;
                if (computeIsRelationship)
                    _isRelationshipPartUri = IsRelationshipUri();
                else
                    _isRelationshipPartUri = isRelationshipPartUri;
            }

            #endregion PrivateConstuctor

            //------------------------------------------------------
            //
            //  Private Methods
            //
            //------------------------------------------------------

            #region Private Methods

            // IsRelationshipPartUri method returns a boolean indicating whether the
            // Uri given is a relationship part Uri or no.
            private bool IsRelationshipUri()
            {
                bool result = false;

                //exit early if the partUri does not end with the relationship extention
                if (!NormalizedPartUriString.EndsWith(s_relationshipPartUpperCaseExtension, StringComparison.Ordinal))
                    return false;

                // if uri is /_rels/.rels then we return true
                if (ComparePartUri(s_containerRelationshipNormalizedPartUri, this) == 0)
                    return true;

                // Look for pattern that matches: "XXX/_rels/YYY.rels" where XXX is zero or more part name characters and
                // YYY is any legal part name characters.
                // We can assume that the string is a valid URI because it would have been rejected by the Uri parsing
                // code in the Uri constructor if it wasn't.
                // Uri's are case insensitive so we can compare them by upper-casing them
                // Essentially, we will just look for the existence of a "folder" called _rels and the trailing extension
                // of .rels.  The folder must also be the last "folder".
                // Comparing using the normalized string to reduce the number of ToUpperInvariant operations
                // required for case-insensitive comparison
                string[] segments = NormalizedPartUriString.Split(s_forwardSlashSeparator); //new Uri(_defaultUri, this).Segments; //partUri.Segments cannot be called on a relative Uri;

                // String.Split, will always return an empty string as the
                // first member in the array as the string starts with a "/"

                Debug.Assert(segments.Length > 0 && segments[0] == String.Empty);

                //If the extension was not equal to .rels, we would have exited early.
                Debug.Assert(String.CompareOrdinal((Path.GetExtension(segments[segments.Length - 1])), s_relationshipPartUpperCaseExtension) == 0);

                // must be at least two segments and the last one must end with .RELs
                // and the length of the segment should be greater than just the extension.
                if ((segments.Length >= 3) &&
                    (segments[segments.Length - 1].Length > s_relationshipPartExtensionName.Length))
                {
                    // look for "_RELS" segment which must be second last segment
                    result = (String.CompareOrdinal(segments[segments.Length - 2], s_relationshipPartUpperCaseSegmentName) == 0);
                }

                // In addition we need to make sure that the relationship is not created by taking another relationship
                // as the source of this uri. So XXX/_rels/_rels/YYY.rels.rels would be invalid.
                if (segments.Length > 3 && result == true)
                {
                    if ((segments[segments.Length - 1]).EndsWith(s_relsrelsUpperCaseExtension, StringComparison.Ordinal))
                    {
                        // look for "_rels" segment in the third last segment
                        if (String.CompareOrdinal(segments[segments.Length - 3], s_relationshipPartUpperCaseSegmentName) == 0)
                            throw new ArgumentException(Resources.NotAValidRelationshipPartUri);
                    }
                }

                return result;
            }

            //Returns the normalized string for the part uri.
            //Currently normalizing the PartUriString consists of only one step -
            //1. Take the wellformed and escaped partUri string and case fold to UpperInvariant
            private string GetNormalizedPartUriString()
            {
                //Case Fold the partUri string to Invariant Upper case (this helps us perform case insensitive comparison)
                //We follow the Simple case folding specified in the Unicode standard

                if (_isNormalized)
                    return _partUriString;
                else
                    return _partUriString.ToUpperInvariant();
            }

            private ValidatedPartUri GetNormalizedPartUri()
            {
                if (IsNormalized)
                    return this;
                else
                    return new ValidatedPartUri(_normalizedPartUriString,
                                                true /*isNormalized*/,
                                                false /*computeIsRelationship*/,
                                                IsRelationshipPartUri);
            }

            private int Compare(ValidatedPartUri otherPartUri)
            {
                //If otherPartUri is null then we return 1
                if (otherPartUri == null)
                    return 1;

                //Compare the normalized uri strings for the two part uris.
                return String.CompareOrdinal(NormalizedPartUriString, otherPartUri.NormalizedPartUriString);
            }

            //------------------------------------------------------
            //
            //  Private Members
            //
            //------------------------------------------------------

            private ValidatedPartUri _normalizedPartUri;
            private string _partUriString;
            private string _normalizedPartUriString;
            private string _partUriExtension;
            private bool _isNormalized;
            private bool _isRelationshipPartUri;

            //String Uppercase variants

            private static readonly string s_relationshipPartUpperCaseExtension = ".RELS";
            private static readonly string s_relationshipPartUpperCaseSegmentName = "_RELS";
            private static readonly string s_relsrelsUpperCaseExtension = String.Concat(s_relationshipPartUpperCaseExtension, s_relationshipPartUpperCaseExtension);

            //need to use the private constructor to initialize this particular partUri as we need this in the
            //IsRelationshipPartUri, that is called from the constructor.
            private static readonly Uri s_containerRelationshipNormalizedPartUri = new ValidatedPartUri("/_RELS/.RELS",
                                                                                true /*isnormalized*/,
                                                                                false /*computeIsRelationship*/,
                                                                                true /*IsRelationship*/);

            private static readonly char[] s_forwardSlashSeparator = { '/' };

            #endregion Private Methods

            //------------------------------------------------------
        }

        #endregion Private Class
    }
}


text:
package gov.nih.nci.cabig.caaers.web.search;

import gov.nih.nci.cabig.caaers.dao.query.AbstractQuery;
import gov.nih.nci.cabig.caaers.domain.Study;
import gov.nih.nci.cabig.caaers.web.search.ui.AdvancedSearchUi;
import gov.nih.nci.cabig.caaers.web.search.ui.DependentObject;
import gov.nih.nci.cabig.caaers.web.search.ui.SearchTargetObject;
import gov.nih.nci.cabig.caaers.web.search.ui.ViewColumn;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;

/**
 * This class tests Command2SQL convertor.
 *
 * This class tests Command2SQl convertor for 5 different queries listed below
 * Query1 - Show all adverse events with grade >= 2 which occured on all multi-institutional studies.
 * Query2 - Show all adverse events requiring reporting and the report(s) they were included in
 * Query3 - Show all the participants registered on a study
 * Query4 - Show all studies that have sponsor X and/or coordinating center Y and or site Z
 * @author Sameer Sawant
 */
public class CommandToSQLTest extends TestCase {
	List<AdvancedSearchCriteriaParameter> criteriaParameters;
	SearchTargetObject targetObject;
	AdvancedSearchUi advancedSearchUi;

	protected void setUp() throws Exception {
        super.setUp();
        criteriaParameters = new ArrayList<AdvancedSearchCriteriaParameter>();
        advancedSearchUi = AdvancedSearchUiUtil.loadAdvancedSearchUi();
    }

	public void testTest() throws Exception {
		createStudySearchXML();
		AbstractQuery aq = CommandToSQL.transform(targetObject, criteriaParameters,null);
		String expectedHql = "select  distinct s from Study s WHERE lower(s.shortTitle) like :shortTitleText AND terminology.term = :term";
		assertEquals(expectedHql,aq.getQueryString());
		System.out.println(aq.getQueryString());
	}

	public void createStudySearchXML(){
		// Setup searchTargetObject
		targetObject = AdvancedSearchUiUtil.getSearchTargetObjectByName(advancedSearchUi, Study.class.getName());

		// Setup view
		for(DependentObject dObject: targetObject.getDependentObject()){
			if(dObject.getClassName().equals(Study.class.getName())){
				dObject.setInView(true);
			}

			for(ViewColumn vColumn: dObject.getViewColumn()){
				if (vColumn.getColumnAttribute().equals("shortTitle")) {
					vColumn.setSelected(true);
				}
			}
		}

		// Setup parameters
		criteriaParameters.clear();
		AdvancedSearchCriteriaParameter parameter = createStudyCriteria("shortTitle", "like", "test" , "String", "filterByStudyShortTitle");
		criteriaParameters.add(parameter);
		parameter = createStudyCriteria("term.code", "=", "1" , "Integer", "filterByTerminology");
		criteriaParameters.add(parameter);
		//criteriaParameters.add(parameter1);

	}

	private AdvancedSearchCriteriaParameter createParticipantCriteria(String attributeName, String predicate, String value){
		AdvancedSearchCriteriaParameter parameter = new AdvancedSearchCriteriaParameter();
		parameter.setAttributeName(attributeName);
		parameter.setPredicate(predicate);
		parameter.setValue(value);
		parameter.setObjectName("gov.nih.nci.cabig.caaers.domain.Participant");
		return parameter;
	}

	private AdvancedSearchCriteriaParameter createStudyCriteria(String attributeName, String predicate, String value){
		AdvancedSearchCriteriaParameter parameter = new AdvancedSearchCriteriaParameter();
		parameter.setAttributeName(attributeName);
		parameter.setPredicate(predicate);
		parameter.setValue(value);
		parameter.setObjectName("gov.nih.nci.cabig.caaers.domain.Study");

		return parameter;
	}
	private AdvancedSearchCriteriaParameter createStudyCriteria(String attributeName, String predicate, String value, String dataType , String filterByMethodInQueryClass){
		AdvancedSearchCriteriaParameter parameter = new AdvancedSearchCriteriaParameter();
		parameter.setAttributeName(attributeName);
		parameter.setPredicate(predicate);
		parameter.setValue(value);
		parameter.setObjectName("gov.nih.nci.cabig.caaers.domain.Study");
		parameter.setFilterByMethodInQueryClass(filterByMethodInQueryClass);
		parameter.setDataType(dataType);
		return parameter;
	}
	private AdvancedSearchCriteriaParameter createAdverseEventCriteria(String attributeName, String predicate, String value){
		AdvancedSearchCriteriaParameter parameter = new AdvancedSearchCriteriaParameter();
		parameter.setAttributeName(attributeName);
		parameter.setPredicate(predicate);
		parameter.setValue(value);
		parameter.setObjectName("gov.nih.nci.cabig.caaers.domain.AdverseEvent");
		return parameter;
	}

}


text:
package com.mobileman.projecth.persistence.patient;

import java.util.Date;
import java.util.List;

import com.mobileman.projecth.domain.patient.Patient;
import com.mobileman.projecth.persistence.Dao;

/**
 * Represents DAO for the {@link Patient} entity.
 *
 * @author mobileman
 *
 */
public interface PatientDao extends Dao<Patient> {

	/**
	 * @param patientId
	 * @param startDate
	 * @param endDate
	 * @return computed CDAI value
	 */
	double computeCDAI(Long patientId, Date startDate, Date endDate);

	/**
	 * Dynamicaly computes list of patient's CDAI for each day in given time interval.
	 * @param patientId
	 * @param startDate
	 * @param endDate
	 * @return list of patient's CDAI for each day in given time interval.
	 */
	List<Object[]> computeCDAITimeline(Long patientId, Date startDate, Date endDate);

	/**
	 * @return all patients with account (not deleted)
	 */
	List<Patient> findAllPatientsWithAccounts();
}


text:
package makasprzak.idea.plugins;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import makasprzak.idea.plugins.mappers.PsiParameterMapper;
import makasprzak.idea.plugins.model.Property;

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

import static com.google.common.collect.Lists.transform;
import static com.intellij.openapi.application.PathManager.getJarPathForClass;
import static java.util.Arrays.asList;
import static java.util.Arrays.copyOf;
import static makasprzak.idea.plugins.mappers.PsiSetterMapper.toProperty;

public class StepBuilderGeneratorTest extends LightCodeInsightFixtureTestCase{
    @Override
    protected String getTestDataPath() {
        return new File(getJarPathForClass(StepBuilderGeneratorTest.class)).getPath();
    }

    public void test_shouldSupportSetterInjection() throws Exception {
        shouldGenerateBuilderFromFields("setters");
    }

    public void test_shouldSupportConstructorInjection() throws Exception {
        shouldGenerateBuilderFromConstructor("constructor");
    }

    public void test_shouldUseConstructorSignatureWhenChoosingConstructorInjection() throws Exception {
        shouldGenerateBuilderFromConstructor("constructorWithVararg");
    }

    private void shouldGenerateBuilderFromFields(String prefix) {
        shouldGenerateBuilder(prefix, new Function<PsiClass, List<Property>>() {
            @Override
            public List<Property> apply(PsiClass psiClass) {
                return getPropertiesFromSetters(psiClass);
            }
        });    }

    private void shouldGenerateBuilderFromConstructor(String prefix) {
        shouldGenerateBuilder(prefix, new Function<PsiClass, List<Property>>() {
            @Override
            public List<Property> apply(PsiClass psiClass) {
                return getPropertiesFromConstructor(psiClass);
            }
        });
    }

    private List<Property> getPropertiesFromConstructor(PsiClass psiClass) {
        List<PsiParameter> parameterList = asList(psiClass.getConstructors()[0].getParameterList().getParameters());
        return transform(parameterList, PsiParameterMapper.toProperty());
    }

    private List<Property> getPropertiesFromSetters(PsiClass pojoWithSettersPsiClass) {
        List<PsiMethod> allMethods = asList(pojoWithSettersPsiClass.getAllMethods());
        return ImmutableList.copyOf(Iterables.transform(Iterables.filter(allMethods, new Predicate<PsiMethod>() {
            @Override
            public boolean apply(PsiMethod psiMethod) {
                return psiMethod.getName().startsWith("set");
            }
        }), toProperty()));
    }

    private void shouldGenerateBuilder(String prefix, Function<PsiClass, List<Property>> toProperties) {
        myFixture.configureByFile(prefix + "_before.java");
        PsiElement elementAtCaret = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
        PsiClass pojoWithSettersPsiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class);
        new StepBuilderGeneratorImpl().generateBuilderPattern(
                toProperties.apply(pojoWithSettersPsiClass),pojoWithSettersPsiClass, elementAtCaret);
        myFixture.checkResultByFile(prefix + "_after.java");
    }
}


text:
/* Own modules */
import { PriceFormatTransformer } from './price-format.transformer';

xdescribe('PriceFormatTransformer', () => {
    let transformer: PriceFormatTransformer;
    let expectedDefaultOptions: any = {
        minValue          : '',
        maxValue          : '',
        prefix            : 'R$ ',
        suffix            : '',
        centsSeparator    : '.',
        thousandsSeparator: ',',
        limit             : false,
        centsLimit        : 2,
        clearPrefix       : true,
        clearSuffix       : true,
        allowNegative     : false,
        insertPlusSign    : false,
        cssclass          : '',
        placeholder       : ''
    };

    it('should #expectedDefaults be the default value', () => {
        transformer = new PriceFormatTransformer({});
        const defaultOptions = transformer.options;
        expect(defaultOptions).toEqual(expectedDefaultOptions);
    });

    describe('custom full options', () => {
        const expectedValidOptions = {
            minValue          : '1',
            maxValue          : '100000000',
            prefix            : '$ ',
            suffix            : '%',
            centsSeparator    : ',',
            thousandsSeparator: ' ',
            limit             : false,
            centsLimit        : 3,
            clearPrefix       : true,
            clearSuffix       : true,
            allowNegative     : true,
            insertPlusSign    : true,
            cssclass          : '',
            placeholder       : ''
        };

        beforeAll(() => {
            transformer = new PriceFormatTransformer(expectedValidOptions);
        });

        it('should options changing', () => {
            const defaultOptions = transformer.options;
            expect(defaultOptions).toEqual(expectedValidOptions);
        });

        it('should get a clean value', () => {
          // In this case, thousandsSeparator is ' ', and not '.' as default
            const dirtyValue = '$ 1.234 567,890 %';
            const cleanValue = '1.234567890';
            expect(transformer.getCleanValue(dirtyValue)).toEqual(cleanValue);
        });

        it('should get a negative clean value', () => {
            const dirtyValue = '- $ 1.234 567,890 %';
            const cleanValue = '-1.234567890';
            expect(transformer.getCleanValue(dirtyValue)).toEqual(cleanValue);
        });

        it('should prefix being added and cleared as expected', () => {
            let inputValue = '$      1234.56';
            let resultValue = transformer.clearPrefix(inputValue);
            let expectValue = '1234.56';
            expect(resultValue).toEqual(expectValue);

            inputValue = '1234.56';
            resultValue = transformer.addPrefix(inputValue);
            expectValue = '$ 1234.56';
            expect(resultValue).toEqual(expectValue);

            transformer.options['clearPrefix'] = false;
            inputValue = '$ 1234.56';
            resultValue = transformer.clearPrefix(inputValue);
            expectValue = '$ 1234.56';
            expect(resultValue).toEqual(expectValue);
        });

        it('should suffix being added and cleared', () => {
            let inputValue = '1234.56      %';
            let resultValue = transformer.clearPrefix(inputValue);
            let expectValue = '1234.56';
            expect(resultValue).toEqual(expectValue);

            inputValue = '1234.56';
            resultValue = transformer.addSuffix(inputValue);
            expectValue = '1234.56%';
            expect(resultValue).toEqual(expectValue);

            transformer.options['clearSuffix'] = false;
            inputValue = '1234.56%';
            resultValue = transformer.clearPrefix(inputValue);
            expectValue = '1234.56%';
            expect(resultValue).toEqual(expectValue);
        });
    });

    describe('after options check', () => {
        beforeAll(() => {
            transformer = new PriceFormatTransformer({});
        });

        it('should get correct number from string with centsLimit=2', () => {
            let strInt = '123456';
            let numInt = 1234.56;
            expect(transformer.toNumber(strInt)).toEqual(numInt);

            strInt = '1.23456';
            numInt = 1.23;
            expect(transformer.toNumber(strInt)).toEqual(numInt);
        });

        it('should get correct negative number from string with centsLimit=2', () => {
            let strInt = '-123456';
            let numInt = -1234.56;
            expect(transformer.toNumber(strInt)).toEqual(numInt);

            strInt = '-1.23456';
            numInt = -1.23;
            expect(transformer.toNumber(strInt)).toEqual(numInt);
        });

        it('should price being correctly formatted', () => {
            const strPrice = '-R$123456.789%';
            let expFormPrice = 'R$ 123,456.79';
            const strFormPrice = transformer.priceFormat(strPrice);
            expect(strFormPrice).toEqual(expFormPrice);

            const intPrice = -123456789;
            expFormPrice = 'R$ 123,456,789.00';
            const intFormPrice = transformer.priceFormatNumber(intPrice);
            expect(intFormPrice).toEqual(expFormPrice);
        });

        it('should value not being changed', () => {
            const pureValue = 'R$ 12.345.678,90';
            const changedValue = transformer.change(pureValue);
            expect(changedValue).toEqual(pureValue);
        });

        it('should value being correctly changed', () => {
            const pureValue = 'R$ 123.456.789.012.345.678,90';
            const    expectedValue = 'R$ 1.234.567.890.123.456,78';

            const changedValue = transformer.change(pureValue);
            expect(changedValue).toEqual(expectedValue);
        });
    });
});