text:
#ifndef BOOST_INTRUSIVE_UNORDERED_SET_HOOK_HPP
#define BOOST_INTRUSIVE_UNORDERED_SET_HOOK_HPP

#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/slist_hook.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/detail/generic_hook.hpp>

namespace boost {
namespace intrusive {

/// @cond

template<class VoidPointer>
struct slist_node_plus_hash
{
   typedef typename boost::pointer_to_other
      <VoidPointer, slist_node_plus_hash>::type   node_ptr;
   node_ptr    next_;
   std::size_t hash_;
};

// slist_node_traits can be used with circular_slist_algorithms and supplies
// a slist_node holding the pointers needed for a singly-linked list
// it is used by slist_base_hook and slist_member_hook
template<class VoidPointer>
struct slist_node_traits_plus_hash
{
   typedef slist_node_plus_hash<VoidPointer> node;
   typedef typename boost::pointer_to_other
      <VoidPointer, node>::type          node_ptr;
   typedef typename boost::pointer_to_other
      <VoidPointer, const node>::type    const_node_ptr;

   static const bool store_hash = true;

   static node_ptr get_next(const_node_ptr n)
   {  return n->next_;  }

   static void set_next(node_ptr n, node_ptr next)
   {  n->next_ = next;  }

   static std::size_t get_hash(const_node_ptr n)
   {  return n->hash_;  }

   static void set_hash(node_ptr n, std::size_t h)
   {  n->hash_ = h;  }
};

template<class VoidPointer, bool StoreHash>
struct get_uset_node_algo
{
   typedef typename detail::if_c
      < StoreHash
      , slist_node_traits_plus_hash<VoidPointer>
      , slist_node_traits<VoidPointer>
      >::type node_traits_type;
   typedef circular_slist_algorithms<node_traits_type> type;
};
/// @endcond

//! Helper metafunction to define a \c unordered_set_base_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
#endif
struct make_unordered_set_base_hook
{
   /// @cond
   typedef typename pack_options
      < hook_defaults, O1, O2, O3, O4>::type packed_options;

   typedef detail::generic_hook
   < get_uset_node_algo<typename packed_options::void_pointer
                       , packed_options::store_hash
                       >
   , typename packed_options::tag
   , packed_options::link_mode
   , detail::UsetBaseHook
   > implementation_defined;
   /// @endcond
   typedef implementation_defined type;
};

//! Derive a class from unordered_set_base_hook in order to store objects in
//! in an unordered_set/unordered_multi_set. unordered_set_base_hook holds the data necessary to maintain
//! the unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set.
//!
//! The hook admits the following options: \c tag<>, \c void_pointer<>,
//! \c link_mode<> and \c store_hash<>.
//!
//! \c tag<> defines a tag to identify the node.
//! The same tag value can be used in different classes, but if a class is
//! derived from more than one \c list_base_hook, then each \c list_base_hook needs its
//! unique tag.
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
//!
//! \c store_hash<> will tell the hook to store the hash of the value
//! to speed up rehashings.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class unordered_set_base_hook
   :  public make_unordered_set_base_hook<O1, O2, O3, O4>::type
{
   #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
   //! Effects: If link_mode is \c auto_unlink or \c safe_link
   //!   initializes the node to an unlinked state.
   //!
   //! Throws: Nothing.
   unordered_set_base_hook();

   //! Effects: If link_mode is \c auto_unlink or \c safe_link
   //!   initializes the node to an unlinked state. The argument is ignored.
   //!
   //! Throws: Nothing.
   //!
   //! Rationale: Providing a copy-constructor
   //!   makes classes using the hook STL-compliant without forcing the
   //!   user to do some additional work. \c swap can be used to emulate
   //!   move-semantics.
   unordered_set_base_hook(const unordered_set_base_hook& );

   //! Effects: Empty function. The argument is ignored.
   //!
   //! Throws: Nothing.
   //!
   //! Rationale: Providing an assignment operator
   //!   makes classes using the hook STL-compliant without forcing the
   //!   user to do some additional work. \c swap can be used to emulate
   //!   move-semantics.
   unordered_set_base_hook& operator=(const unordered_set_base_hook& );

   //! Effects: If link_mode is \c normal_link, the destructor does
   //!   nothing (ie. no code is generated). If link_mode is \c safe_link and the
   //!   object is stored in an unordered_set an assertion is raised. If link_mode is
   //!   \c auto_unlink and \c is_linked() is true, the node is unlinked.
   //!
   //! Throws: Nothing.
   ~unordered_set_base_hook();

   //! Effects: Swapping two nodes swaps the position of the elements
   //!   related to those nodes in one or two containers. That is, if the node
   //!   this is part of the element e1, the node x is part of the element e2
   //!   and both elements are included in the containers s1 and s2, then after
   //!   the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
   //!   at the position of e1. If one element is not in a container, then
   //!   after the swap-operation the other element is not in a container.
   //!   Iterators to e1 and e2 related to those nodes are invalidated.
   //!
   //! Complexity: Constant
   //!
   //! Throws: Nothing.
   void swap_nodes(unordered_set_base_hook &other);

   //! Precondition: link_mode must be \c safe_link or \c auto_unlink.
   //!
   //! Returns: true, if the node belongs to a container, false
   //!   otherwise. This function can be used to test whether \c unordered_set::iterator_to
   //!   will return a valid iterator.
   //!
   //! Complexity: Constant
   bool is_linked() const;

   //! Effects: Removes the node if it's inserted in a container.
   //!   This function is only allowed if link_mode is \c auto_unlink.
   //!
   //! Throws: Nothing.
   void unlink();
   #endif
};

//! Helper metafunction to define a \c unordered_set_member_hook that yields to the same
//! type when the same options (either explicitly or implicitly) are used.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
template<class ...Options>
#else
template<class O1 = none, class O2 = none, class O3 = none, class O4 = none>
#endif
struct make_unordered_set_member_hook
{
   /// @cond
   typedef typename pack_options
      < hook_defaults, O1, O2, O3, O4>::type packed_options;

   typedef detail::generic_hook
   < get_uset_node_algo< typename packed_options::void_pointer
                       , packed_options::store_hash
                       >
   , member_tag
   , packed_options::link_mode
   , detail::NoBaseHook
   > implementation_defined;
   /// @endcond
   typedef implementation_defined type;
};

//! Put a public data member unordered_set_member_hook in order to store objects of this class in
//! an unordered_set/unordered_multi_set. unordered_set_member_hook holds the data necessary for maintaining the
//! unordered_set/unordered_multi_set and provides an appropriate value_traits class for unordered_set/unordered_multi_set.
//!
//! The hook admits the following options: \c void_pointer<>,
//! \c link_mode<> and \c store_hash<>.
//!
//! \c void_pointer<> is the pointer type that will be used internally in the hook
//! and the the container configured to use this hook.
//!
//! \c link_mode<> will specify the linking mode of the hook (\c normal_link,
//! \c auto_unlink or \c safe_link).
//!
//! \c store_hash<> will tell the hook to store the hash of the value
//! to speed up rehashings.
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
template<class ...Options>
#else
template<class O1, class O2, class O3, class O4>
#endif
class unordered_set_member_hook
   :  public make_unordered_set_member_hook<O1, O2, O3, O4>::type
{
   #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
   //! Effects: If link_mode is \c auto_unlink or \c safe_link
   //!   initializes the node to an unlinked state.
   //!
   //! Throws: Nothing.
   unordered_set_member_hook();

   //! Effects: If link_mode is \c auto_unlink or \c safe_link
   //!   initializes the node to an unlinked state. The argument is ignored.
   //!
   //! Throws: Nothing.
   //!
   //! Rationale: Providing a copy-constructor
   //!   makes classes using the hook STL-compliant without forcing the
   //!   user to do some additional work. \c swap can be used to emulate
   //!   move-semantics.
   unordered_set_member_hook(const unordered_set_member_hook& );

   //! Effects: Empty function. The argument is ignored.
   //!
   //! Throws: Nothing.
   //!
   //! Rationale: Providing an assignment operator
   //!   makes classes using the hook STL-compliant without forcing the
   //!   user to do some additional work. \c swap can be used to emulate
   //!   move-semantics.
   unordered_set_member_hook& operator=(const unordered_set_member_hook& );

   //! Effects: If link_mode is \c normal_link, the destructor does
   //!   nothing (ie. no code is generated). If link_mode is \c safe_link and the
   //!   object is stored in an unordered_set an assertion is raised. If link_mode is
   //!   \c auto_unlink and \c is_linked() is true, the node is unlinked.
   //!
   //! Throws: Nothing.
   ~unordered_set_member_hook();

   //! Effects: Swapping two nodes swaps the position of the elements
   //!   related to those nodes in one or two containers. That is, if the node
   //!   this is part of the element e1, the node x is part of the element e2
   //!   and both elements are included in the containers s1 and s2, then after
   //!   the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
   //!   at the position of e1. If one element is not in a container, then
   //!   after the swap-operation the other element is not in a container.
   //!   Iterators to e1 and e2 related to those nodes are invalidated.
   //!
   //! Complexity: Constant
   //!
   //! Throws: Nothing.
   void swap_nodes(unordered_set_member_hook &other);

   //! Precondition: link_mode must be \c safe_link or \c auto_unlink.
   //!
   //! Returns: true, if the node belongs to a container, false
   //!   otherwise. This function can be used to test whether \c unordered_set::iterator_to
   //!   will return a valid iterator.
   //!
   //! Complexity: Constant
   bool is_linked() const;

   //! Effects: Removes the node if it's inserted in a container.
   //!   This function is only allowed if link_mode is \c auto_unlink.
   //!
   //! Throws: Nothing.
   void unlink();
   #endif
};

} //namespace intrusive
} //namespace boost

#include <boost/intrusive/detail/config_end.hpp>

#endif //BOOST_INTRUSIVE_UNORDERED_SET_HOOK_HPP


text:
package laurenyew.weatherapp.network;

import android.content.Context;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

/**
 * Created by laurenyew on 4/19/16.
 * <p>
 * Singleton Volley Request Queue (Suggested best practice by Volley)
 */
public class WeatherServiceRequestQueue {
    private static WeatherServiceRequestQueue mInstance;
    private RequestQueue mRequestQueue;

    private static Context mContext;

    private WeatherServiceRequestQueue(Context context) {
        mContext = context;
        mRequestQueue = getRequestQueue();
    }

    public static synchronized WeatherServiceRequestQueue getInstance(Context context) {
        if (mInstance == null) {
            mInstance = new WeatherServiceRequestQueue(context);
        }
        return mInstance;
    }

    public RequestQueue getRequestQueue() {
        if (mRequestQueue == null) {
            // getApplicationContext() is key, it keeps you from leaking the
            // Activity or BroadcastReceiver if someone passes one in.
            mRequestQueue = Volley.newRequestQueue(mContext.getApplicationContext());
        }
        return mRequestQueue;
    }

    public <T> void addToRequestQueue(Request<T> req) {
        getRequestQueue().add(req);
    }

    public void cancelRequestsWithTag(Object tag) {
        getRequestQueue().cancelAll(tag);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Brasa\TurnoBundle\Repository;

use Doctrine\ORM\EntityRepository;

class TurServicioInconsistenciaRepository extends EntityRepository {
    public function listaDql() {
        $em = $this->getEntityManager();
        $dql   = "SELECT si FROM BrasaTurnoBundle:TurServicioInconsistencia si WHERE si.codigoServicioInconsistenciaPk <> 0";
        return $dql;
    }
}


text:
#include "util.hpp"
#include "io_realm_internal_TableQuery.h"
#include "tablequery.hpp"

using namespace realm;

#if 1
#define COL_TYPE_VALID(env,ptr,col, type)           TBL_AND_COL_INDEX_AND_TYPE_VALID(env,ptr,col, type)
#define COL_TYPE_LINK_OR_LINKLIST(env,ptr,col)      TBL_AND_COL_INDEX_AND_LINK_OR_LINKLIST(env,ptr,col)
#define QUERY_COL_TYPE_VALID(env, jPtr, col, type)  query_col_type_valid(env, jPtr, col, type)
#define QUERY_VALID(env, pQuery)                    query_valid(env, pQuery)
#else
#define COL_TYPE_VALID(env,ptr,col, type)           (true)
#define COL_TYPE_LINK_OR_LINKLIST(env,ptr,col)      (true)
#define QUERY_COL_TYPE_VALID(env, jPtr, col, type)  (true)
#define QUERY_VALID(env, pQuery)                    (true)
#endif

inline bool query_valid(JNIEnv* env, Query* pQuery)
{
    return TABLE_VALID(env, pQuery->get_table().get());
}

inline bool query_col_type_valid(JNIEnv* env, jlong nativeQueryPtr, jlong colIndex, DataType type)
{
    return COL_TYPE_VALID(env, TQ(nativeQueryPtr)->get_current_table().get(), colIndex, type);
}

//-------------------------------------------------------

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeClose(JNIEnv *, jclass, jlong nativeQueryPtr) {
    TR_ENTER_PTR(nativeQueryPtr)
    delete Q(nativeQueryPtr);
}

JNIEXPORT jstring JNICALL Java_io_realm_internal_TableQuery_nativeValidateQuery
(JNIEnv *env, jobject, jlong nativeQueryPtr)
{
    try {
        return to_jstring(env, Q(nativeQueryPtr)->validate());
    } CATCH_STD();
    return NULL;
}

// helper functions and macros
#define GET_ARRAY() \
    jsize arr_len = env->GetArrayLength(columnIndexes); \
    jlong *arr = env->GetLongArrayElements(columnIndexes, NULL);

#define RELEASE_ARRAY() \
    env->ReleaseLongArrayElements(columnIndexes, arr, 0);

Table* getTableLink(jlong nativeQueryPtr, jlong *arr, jsize arr_len) {
    Table* tbl = Q(nativeQueryPtr)->get_table().get();
    for (int i=0; i<arr_len-1; i++) {
        tbl->link(size_t(arr[i]));
    }
    return tbl;
}

template <typename coretype, typename cpptype, typename javatype>
Query numeric_link_equal(Table* tbl, jlong columnIndex, javatype value) {
    return tbl->column<coretype>(size_t(columnIndex)) == cpptype(value);
}

template <typename coretype, typename cpptype, typename javatype>
Query numeric_link_notequal(Table* tbl, jlong columnIndex, javatype value) {
    return tbl->column<coretype>(size_t(columnIndex)) != cpptype(value);
}

template <typename coretype, typename cpptype, typename javatype>
Query numeric_link_greater(Table* tbl, jlong columnIndex, javatype value) {
    return tbl->column<coretype>(size_t(columnIndex)) > cpptype(value);
}

template <typename coretype, typename cpptype, typename javatype>
Query numeric_link_greaterequal(Table* tbl, jlong columnIndex, javatype value) {
    return tbl->column<coretype>(size_t(columnIndex)) >= cpptype(value);
}

template <typename coretype, typename cpptype, typename javatype>
Query numeric_link_less(Table* tbl, jlong columnIndex, javatype value) {
    return tbl->column<coretype>(size_t(columnIndex)) < cpptype(value);
}

template <typename coretype, typename cpptype, typename javatype>
Query numeric_link_lessequal(Table* tbl, jlong columnIndex, javatype value) {
    return tbl->column<coretype>(size_t(columnIndex)) <= cpptype(value);
}

// Integer

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEqual__J_3JJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
                return;
            Q(nativeQueryPtr)->equal(S(arr[0]), static_cast<int64_t>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_equal<Int, int64_t, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL JNICALL Java_io_realm_internal_TableQuery_nativeNotEqual__J_3JJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
                return;
            Q(nativeQueryPtr)->not_equal(S(arr[0]), static_cast<int64_t>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_notequal<Int, int64_t, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreater__J_3JJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
                return;
            Q(nativeQueryPtr)->greater(S(arr[0]), static_cast<int64_t>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greater<Int, int64_t, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreaterEqual__J_3JJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
                return;
            Q(nativeQueryPtr)->greater_equal(S(arr[0]), static_cast<int64_t>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greaterequal<Int, int64_t, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLess__J_3JJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
                return;
            Q(nativeQueryPtr)->less(S(arr[0]), static_cast<int64_t>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_less<Int, int64_t, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLessEqual__J_3JJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
                return;
            Q(nativeQueryPtr)->less_equal(S(arr[0]), static_cast<int64_t>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_lessequal<Int, int64_t, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeBetween__J_3JJJ(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value1, jlong value2)
{
    GET_ARRAY()
    if (arr_len == 1) {
        if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Int))
            return;
        try {
            Q(nativeQueryPtr)->between(S(arr[0]), static_cast<int64_t>(value1), static_cast<int64_t>(value2));
        } CATCH_STD()
    }
    else {
        ThrowException(env, IllegalArgument, "between does not support link queries.");
    }
    RELEASE_ARRAY();
}

// Float

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEqual__J_3JF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->equal(S(arr[0]), static_cast<float>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_equal<Float, float, jfloat>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL JNICALL Java_io_realm_internal_TableQuery_nativeNotEqual__J_3JF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->not_equal(S(arr[0]), static_cast<float>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_notequal<Float, float, jfloat>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreater__J_3JF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->greater(S(arr[0]), static_cast<float>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greater<Float, float, jfloat>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreaterEqual__J_3JF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->greater_equal(S(arr[0]), static_cast<float>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greaterequal<Float, float, jfloat>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLess__J_3JF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->less(S(arr[0]), static_cast<float>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_less<Float, float, jfloat>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLessEqual__J_3JF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->less_equal(S(arr[0]), static_cast<float>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_lessequal<Float, float, jfloat>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeBetween__J_3JFF(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jfloat value1, jfloat value2)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Float))
                return;
            Q(nativeQueryPtr)->between(S(arr[0]), static_cast<float>(value1), static_cast<float>(value2));
        }
        else {
            Q(nativeQueryPtr)->group();
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greaterequal<Float, float, jfloat>(tbl, arr[arr_len-1], value1));
            tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_lessequal<Float, float, jfloat>(tbl, arr[arr_len-1], value2));
            Q(nativeQueryPtr)->end_group();
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

// Double

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEqual__J_3JD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->equal(S(arr[0]), static_cast<double>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_equal<Double, double, jdouble>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL JNICALL Java_io_realm_internal_TableQuery_nativeNotEqual__J_3JD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->not_equal(S(arr[0]), static_cast<double>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_notequal<Double, double, jdouble>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreater__J_3JD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->greater(S(arr[0]), static_cast<double>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greater<Double, double, jdouble>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreaterEqual__J_3JD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->greater_equal(S(arr[0]), static_cast<double>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greaterequal<Double, double, jdouble>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLess__J_3JD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->less(S(arr[0]), static_cast<double>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_less<Double, double, jdouble>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLessEqual__J_3JD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->less_equal(S(arr[0]), static_cast<double>(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_lessequal<Double, double, jdouble>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeBetween__J_3JDD(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jdouble value1, jdouble value2)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Double))
                return;
            Q(nativeQueryPtr)->between(S(arr[0]), static_cast<double>(value1), static_cast<double>(value2));
        }
        else {
            Q(nativeQueryPtr)->group();
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greaterequal<Double, double, jdouble>(tbl, arr[arr_len-1], value1));
            tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_lessequal<Double, double, jdouble>(tbl, arr[arr_len-1], value2));
            Q(nativeQueryPtr)->end_group();
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

// DateTime

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEqualDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->equal_datetime(S(arr[0]), DateTime(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_equal<DateTime, DateTime, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL JNICALL Java_io_realm_internal_TableQuery_nativeNotEqualDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->not_equal_datetime(S(arr[0]), DateTime(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_notequal<DateTime, DateTime, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreaterDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->greater_datetime(S(arr[0]), DateTime(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greater<DateTime, DateTime, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGreaterEqualDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->greater_equal_datetime(S(arr[0]), DateTime(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_greaterequal<DateTime, DateTime, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLessDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->less_datetime(S(arr[0]), DateTime(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_less<DateTime, DateTime, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY();
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeLessEqualDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->less_equal_datetime(S(arr[0]), DateTime(value));
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_lessequal<DateTime, DateTime, jlong>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeBetweenDateTime(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jlong value1, jlong value2)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_DateTime))
                return;
            Q(nativeQueryPtr)->between_datetime(S(arr[0]), DateTime(value1), DateTime(value2));
        }
        else {
            ThrowException(env, IllegalArgument, "between does not support link queries.");
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

// Bool

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEqual__J_3JZ(
  JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jboolean value)
{
    GET_ARRAY()
    try {
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_Bool))
                return;
            Q(nativeQueryPtr)->equal(S(arr[0]), value != 0 ? true : false);
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            Q(nativeQueryPtr)->and_query(numeric_link_equal<Bool, bool, jboolean>(tbl, arr[arr_len-1], value));
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

// String

enum StringPredicate {
    StringEqual,
    StringNotEqual,
    StringContains,
    StringBeginsWith,
    StringEndsWith
};

void TableQuery_StringPredicate(JNIEnv *env, jlong nativeQueryPtr, jlongArray columnIndexes, jstring value, jboolean caseSensitive, StringPredicate predicate) {
    GET_ARRAY()
    try {
        bool isCaseSensitive = caseSensitive ? true : false;
        JStringAccessor value2(env, value); // throws
        if (arr_len == 1) {
            if (!QUERY_COL_TYPE_VALID(env, nativeQueryPtr, arr[0], type_String))
                return;
            switch (predicate) {
            case StringEqual:
                Q(nativeQueryPtr)->equal(S(arr[0]), value2, isCaseSensitive);
                break;
            case StringNotEqual:
                Q(nativeQueryPtr)->not_equal(S(arr[0]), value2, isCaseSensitive);
                break;
            case StringContains:
                Q(nativeQueryPtr)->contains(S(arr[0]), value2, isCaseSensitive);
                break;
            case StringBeginsWith:
                Q(nativeQueryPtr)->begins_with(S(arr[0]), value2, isCaseSensitive);
                break;
            case StringEndsWith:
                Q(nativeQueryPtr)->ends_with(S(arr[0]), value2, isCaseSensitive);
                break;
            }
        }
        else {
            Table* tbl = getTableLink(nativeQueryPtr, arr, arr_len);
            switch (predicate) {
            case StringEqual:
                Q(nativeQueryPtr)->and_query(tbl->column<String>(size_t(arr[arr_len-1])).equal(StringData(value2), isCaseSensitive));
                break;
            case StringNotEqual:
                Q(nativeQueryPtr)->and_query(tbl->column<String>(size_t(arr[arr_len-1])).not_equal(StringData(value2), isCaseSensitive));
                break;
            case StringContains:
                Q(nativeQueryPtr)->and_query(tbl->column<String>(size_t(arr[arr_len-1])).contains(StringData(value2), isCaseSensitive));
                break;
            case StringBeginsWith:
                Q(nativeQueryPtr)->and_query(tbl->column<String>(size_t(arr[arr_len-1])).begins_with(StringData(value2), isCaseSensitive));
                break;
            case StringEndsWith:
                Q(nativeQueryPtr)->and_query(tbl->column<String>(size_t(arr[arr_len-1])).ends_with(StringData(value2), isCaseSensitive));
                break;
            }
        }
    } CATCH_STD()
    RELEASE_ARRAY()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEqual__J_3JLjava_lang_String_2Z(
    JNIEnv *env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jstring value, jboolean caseSensitive)
{
    TableQuery_StringPredicate(env, nativeQueryPtr, columnIndexes, value, caseSensitive, StringEqual);
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeNotEqual__J_3JLjava_lang_String_2Z(
    JNIEnv *env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jstring value, jboolean caseSensitive)
{
    TableQuery_StringPredicate(env, nativeQueryPtr, columnIndexes, value, caseSensitive, StringNotEqual);
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeBeginsWith(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jstring value, jboolean caseSensitive)
{
    TableQuery_StringPredicate(env, nativeQueryPtr, columnIndexes, value, caseSensitive, StringBeginsWith);
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEndsWith(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jstring value, jboolean caseSensitive)
{
    TableQuery_StringPredicate(env, nativeQueryPtr, columnIndexes, value, caseSensitive, StringEndsWith);
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeContains(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlongArray columnIndexes, jstring value, jboolean caseSensitive)
{
    TableQuery_StringPredicate(env, nativeQueryPtr, columnIndexes, value, caseSensitive, StringContains);
}

// General ----------------------------------------------------
// TODO:
// Some of these methods may not need the check for Table/Query validity,
// as they are called for each method when building up the query.
// Consider to reduce to just the "action" methods on Query

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeTableview(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlong nativeTableViewPtr)
{
    Query* pQuery = Q(nativeQueryPtr);
    if (!QUERY_VALID(env, pQuery))
        return;
    try {
        pQuery->get_table()->where(TV(nativeTableViewPtr));
    } CATCH_STD()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeGroup(
    JNIEnv* env, jobject, jlong nativeQueryPtr)
{
    Query* pQuery = Q(nativeQueryPtr);
    if (!QUERY_VALID(env, pQuery))
        return;
    try {
        pQuery->group();
    } CATCH_STD()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeEndGroup(
    JNIEnv* env, jobject, jlong nativeQueryPtr)
{
    Query* pQuery = Q(nativeQueryPtr);
    if (!QUERY_VALID(env, pQuery))
        return;
    try {
        pQuery->end_group();
    } CATCH_STD()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeOr(
    JNIEnv* env, jobject, jlong nativeQueryPtr)
{
    // No verification of parameters needed?
    Query* pQuery = Q(nativeQueryPtr);
    if (!QUERY_VALID(env, pQuery))
        return;
    try {
        pQuery->Or();
    } CATCH_STD()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeNot(
    JNIEnv* env, jobject, jlong nativeQueryPtr)
{
    Query* pQuery = Q(nativeQueryPtr);
    if (!QUERY_VALID(env, pQuery))
        return;
    try {
        pQuery->Not();
    } CATCH_STD()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeSubtable(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlong columnIndex)
{
    TableQuery* pTQuery = TQ(nativeQueryPtr);
    if (!QUERY_VALID(env, pTQuery))
        return;

    try {
        Table* pTable = pTQuery->get_current_table().get();
        pTQuery->push_subtable(S(columnIndex));
        if (!COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Table))
            return;

        pTQuery->subtable(S(columnIndex));
    } CATCH_STD()
}

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeParent(
    JNIEnv* env, jobject, jlong nativeQueryPtr)
{
    TableQuery* pTQuery = TQ(nativeQueryPtr);
    if (!QUERY_VALID(env, pTQuery))
        return;
    try {
        if (pTQuery->pop_subtable()) {
            pTQuery->end_subtable();
        }
        else {
            ThrowException(env, UnsupportedOperation, "No matching subtable().");
        }
    } CATCH_STD()
}

// Find --------------------------------------

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeFind(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlong fromTableRow)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery))
        return -1;
    // It's valid to go 1 past the end index
    if ((fromTableRow < 0) || (S(fromTableRow) > pTable->size())) {
        // below check will fail with appropriate exception
        (void) ROW_INDEX_VALID(env, pTable, fromTableRow);
        return -1;
    }

    try {
        size_t r = pQuery->find( S(fromTableRow) );
        return (r == not_found) ? jlong(-1) : jlong(r);
    } CATCH_STD()
    return -1;
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeFindAll(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return -1;
    try {
        TableView* pResultView = new TableView( pQuery->find_all(S(start), S(end), S(limit)) );
        return reinterpret_cast<jlong>(pResultView);
    } CATCH_STD()
    return -1;
}

// Integer Aggregates

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeSumInt(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Int) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->sum_int(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeMaximumInt(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Int) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->maximum_int(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeMinimumInt(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Int) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->minimum_int(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeAverageInt(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Int) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        size_t resultcount;
        //TODO: return resultcount?
        double avg = pQuery->average_int(S(columnIndex), &resultcount, S(start), S(end), S(limit));
        //fprintf(stderr, "!!!Average(%d, %d) = %f (%d results)\n", start, end, avg, resultcount); fflush(stderr);
        return avg;
    } CATCH_STD()
    return 0;
}

// float Aggregates

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeSumFloat(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Float) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->sum_float(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jfloat JNICALL Java_io_realm_internal_TableQuery_nativeMaximumFloat(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Float) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->maximum_float(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jfloat JNICALL Java_io_realm_internal_TableQuery_nativeMinimumFloat(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Float) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->minimum_float(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeAverageFloat(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Float) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        size_t resultcount;
        double avg = pQuery->average_float(S(columnIndex), &resultcount, S(start), S(end), S(limit));
        return avg;
    } CATCH_STD()
    return 0;
}

// double Aggregates

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeSumDouble(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Double) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->sum_double(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeMaximumDouble(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Double) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->maximum_double(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeMinimumDouble(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Double) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->minimum_double(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jdouble JNICALL Java_io_realm_internal_TableQuery_nativeAverageDouble(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_Double) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        //TODO: Return resultcount
        size_t resultcount;
        double avg = pQuery->average_double(S(columnIndex), &resultcount, S(start), S(end), S(limit));
        return avg;
    } CATCH_STD()
    return 0;
}

// date aggregates

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeMaximumDate(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_DateTime) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        // This exploits the fact that dates are stored as int in core
        return pQuery->maximum_int(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeMinimumDate(
    JNIEnv* env, jobject, jlong nativeQueryPtr,
    jlong columnIndex, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !COL_INDEX_AND_TYPE_VALID(env, pTable, columnIndex, type_DateTime) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        // This exploits the fact that dates are stored as int in core
        return pQuery->minimum_int(S(columnIndex), NULL, S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

// Count, Remove

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeCount(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->count(S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeRemove(
    JNIEnv* env, jobject, jlong nativeQueryPtr, jlong start, jlong end, jlong limit)
{
    Query* pQuery = Q(nativeQueryPtr);
    Table* pTable = pQuery->get_table().get();
    if (!QUERY_VALID(env, pQuery) ||
        !ROW_INDEXES_VALID(env, pTable, start, end, limit))
        return 0;
    try {
        return pQuery->remove(S(start), S(end), S(limit));
    } CATCH_STD()
    return 0;
}

// isNull and isNotNull

JNIEXPORT void JNICALL Java_io_realm_internal_TableQuery_nativeIsNull(
    JNIEnv *env, jobject, jlong nativeQueryPtr, jlong columnIndex)
{
    Query* pQuery = Q(nativeQueryPtr);
    try {
        Table* pTable = pQuery->get_table().get();
        if (!COL_TYPE_LINK_OR_LINKLIST(env, pTable, columnIndex))
            return;
        Query query = pTable->column<Link>(S(columnIndex)).is_null();
        pQuery->and_query(query);
    } CATCH_STD()
}


text:
<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude" xml:lang="en">

120 Mz is adequate for an average home user.

  <test xml:lang='fr' xml:base="french.xml">Zut Alors!</test>
</document>


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="elmdroid.elmdroid">
    <!--
           The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
           Google Maps Android API v2, but you must specify either coarse or fine
           location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".example.ShowCase"
            android:label="@string/title_activity_show_case"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="github.com"
                    android:path="/saffih/ElmDroid"
                    android:scheme="https" />
            </intent-filter>
        </activity>
        <activity
            android:name=".example2orig.Example2OrigDrawer"
            android:label="@string/title_activity_main_example2_orig"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example2.DrawerExample" />
        </activity>
        <activity
            android:name=".example2.DrawerExample"
            android:label="@string/title_activity_example2"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example.ShowCase" />
        </activity>
        <activity android:name=".example1.ExampleHelloWorldActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example.ShowCase" />
        </activity>

        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".example3.MapsActivity"
            android:label="@string/title_activity_maps">

            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example.ShowCase" />
        </activity>
        <activity
            android:name=".example3orig.MapsActivityOrig"
            android:label="@string/title_activity_maps_orig">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example.ShowCase" />
        </activity>
        <activity
            android:name=".example5.ItemListActivity"
            android:label="@string/title_item_list"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example.ShowCase" />
        </activity>
        <activity
            android:name=".example5.ItemDetailActivity"
            android:label="@string/title_item_detail"
            android:parentActivityName=".example5.ItemListActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example5.ItemListActivity" />
        </activity>
        <activity
            android:name=".example5orig.ItemListActivity"
            android:label="@string/title_item_list"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example5.ItemListActivity" />
        </activity>
        <activity
            android:name=".example5orig.ItemDetailActivity"
            android:label="@string/title_item_detail"
            android:parentActivityName=".example5orig.ItemListActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example5orig.ItemListActivity" />
        </activity>
        <activity
            android:name=".example4.TabbedActivity"
            android:label="@string/title_activity_main_example4"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example.ShowCase" />
        </activity>
        <activity
            android:name=".example4.TabbedActivityOrig"
            android:label="@string/title_activity_tabbed"
            android:parentActivityName=".example4.TabbedActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="elmdroid.elmdroid.example4.TabbedActivity" />
        </activity>

        <!-- example of map with real service -->
        <service
            android:name="saffih.elmdroid.gps.GpsService"
            android:enabled="true"
            android:exported="true"></service>

        <!-- example of map local service -->
        <service
            android:name="saffih.elmdroid.gps.GpsLocalService"
            android:enabled="true"
            android:exported="false"></service>
    </application>

</manifest>


text:
package org.simplity.kernel.data;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.simplity.kernel.ApplicationError;
import org.simplity.kernel.value.BooleanValue;
import org.simplity.kernel.value.DateValue;
import org.simplity.kernel.value.DecimalValue;
import org.simplity.kernel.value.IntegerValue;
import org.simplity.kernel.value.Value;
import org.simplity.kernel.value.ValueType;

/**
 * Default generic data structure that is created for implementing a service. We
 * would encourage sub-classing this rather than having this as an attribute.
 *
 * @author simplity.org
 *
 */
public class CommonData implements CommonDataInterface {
	protected static final int NOT_APPLICABLE = -1;

	/**
	 * generally temp and work related fields that are created during an
	 * algorithm, and are not part of any record. These fields are addressed
	 * with just field name with no qualifier
	 */
	protected final Map<String, Value> allFields = new HashMap<String, Value>();

	/**
	 * data sheets. a given data sheet may be either a SingleRowSheet or
	 * DataSheet
	 */
	protected final Map<String, DataSheet> allSheets = new HashMap<String, DataSheet>();

	/**
	 * sheets that are currently being iterated. Iteration over single-row sheet
	 * is dummy, and is simulated, and hence is never put into this list
	 */
	protected final Map<String, SheetIterator> iteratedSheets = new HashMap<String, CommonData.SheetIterator>();

	/**
	 * in java-class intensive projects, objects like DAO, DTO are used for data
	 * So, let us carry them as well.
	 */
	protected final Map<String, Object> allObjects = new HashMap<String, Object>();

	@Override
	public final Value getValue(String fieldName) {
		if (fieldName == null) {
			return null;
		}
		NameParts nameParts = new NameParts(fieldName);
		/*
		 * it is from a data sheet
		 */
		if (nameParts.sheet == null) {
			return this.allFields.get(fieldName);
		}
		if (nameParts.rowIdx == CommonData.NOT_APPLICABLE) {
			return nameParts.sheet.getValue(nameParts.fieldName);
		}
		return nameParts.sheet.getColumnValue(nameParts.fieldName,
				nameParts.rowIdx);
	}

	@Override
	public final void setValue(String fieldName, Value value) {
		if (fieldName == null) {
			return;
		}
		NameParts nameParts = new NameParts(fieldName);

		if (nameParts.sheet == null) {
			if (value == null) {
				this.allFields.remove(fieldName);
			} else {
				this.allFields.put(fieldName, value);
			}
			return;
		}

		if (nameParts.rowIdx != CommonData.NOT_APPLICABLE) {
			nameParts.sheet.setColumnValue(nameParts.fieldName,
					nameParts.rowIdx, value);
			return;
		}

		if (value == null) {
			nameParts.sheet.removeValue(fieldName);
		} else {
			nameParts.sheet.setValue(fieldName, value);
		}
	}

	@Override
	public final Value removeValue(String fieldName) {
		if (fieldName == null) {
			return null;
		}
		NameParts nameParts = new NameParts(fieldName);
		/*
		 * it is from a data sheet
		 */
		if (nameParts.sheet == null) {
			return this.allFields.remove(fieldName);
		}

		if (nameParts.rowIdx == CommonData.NOT_APPLICABLE) {
			return nameParts.sheet.removeValue(fieldName);
		}

		Value value = nameParts.sheet.getColumnValue(nameParts.fieldName,
				nameParts.rowIdx);
		nameParts.sheet.setColumnValue(nameParts.fieldName, nameParts.rowIdx,
				null);
		return value;
	}

	@Override
	public final boolean hasValue(String fieldName) {
		if (fieldName == null) {
			return false;
		}
		NameParts nameParts = new NameParts(fieldName);
		/*
		 * it is from a data sheet
		 */
		if (nameParts.sheet == null) {
			return this.allFields.containsKey(fieldName);
		}

		if (nameParts.rowIdx == CommonData.NOT_APPLICABLE) {
			return nameParts.sheet.hasValue(fieldName);
		}
		return nameParts.sheet.getColumnValue(nameParts.fieldName,
				nameParts.rowIdx) != null;
	}

	@Override
	public final DataSheet getDataSheet(String sheetName) {
		return this.allSheets.get(sheetName);
	}

	@Override
	public final void putDataSheet(String sheetName, DataSheet sheet) {
		this.allSheets.put(sheetName, sheet);
	}

	@Override
	public final boolean hasDataSheet(String sheetName) {
		return this.allSheets.containsKey(sheetName);
	}

	@Override
	public final DataSheet removeDataSheet(String sheetName) {
		return this.allSheets.remove(sheetName);
	}

	@Override
	public final DataSheetIterator startIteration(String sheetName)
			throws AlreadyIteratingException {
		DataSheet sheet = this.getDataSheet(sheetName);

		if (sheet == null || this.iteratedSheets.containsKey(sheetName)) {
			throw new AlreadyIteratingException();
		}
		int nbrRows = sheet.length();
		SheetIterator iter;
		if (nbrRows > 0 && sheet instanceof MultiRowsSheet) {
			iter = new SheetIterator(sheetName, nbrRows);
			this.iteratedSheets.put(sheetName, iter);
		} else {
			iter = new SheetIterator(null, nbrRows);
		}
		return iter;
	}

	void endIteration(String sheetName) {
		if (sheetName != null) {
			this.iteratedSheets.remove(sheetName);
		}
	}

	protected class SheetIterator implements DataSheetIterator {

		/**
		 * last index - zero based, that this sheet can go up to.
		 *
		 */
		private int lastIdx;
		/**
		 * bit tricky, because we want to accommodate the state
		 * started-but-before -first-get-next. -1 is that state, but we return 0
		 * as current index
		 */
		private int currentIdx = -1;

		/**
		 * null means need not worry about. non-null means we have to inform
		 * parent when this iteration completes
		 */
		private final String sheetName;

		/**
		 *
		 * @param sheetName
		 * @param nbrRows
		 */
		SheetIterator(String sheetName, int nbrRows) {
			this.lastIdx = nbrRows - 1;
			this.sheetName = sheetName;
		}

		/**
		 * get current index. default is zero
		 *
		 * @return
		 */
		int getIdx() {
			if (this.currentIdx < 0) {
				return 0;
			}
			return this.currentIdx;
		}

		@Override
		public boolean hasNext() {
			return this.currentIdx < this.lastIdx;
		}

		@Override
		public boolean moveToNextRow() {
			if (this.currentIdx < this.lastIdx) {
				this.currentIdx++;
				return true;
			}
			if (this.currentIdx == this.lastIdx) {
				this.cancelIteration();
			}
			return false;
		}

		@Override
		public void cancelIteration() {
			this.lastIdx = -1;
			CommonData.this.endIteration(this.sheetName);
		}
	}

	SheetIterator getIterator(String sheetName) {
		return this.iteratedSheets.get(sheetName);
	}

	/**
	 * simple data structure to split qualified name into sheet name and field
	 * name
	 */
	private class NameParts {
		String fieldName = null;
		DataSheet sheet = null;
		int rowIdx = CommonData.NOT_APPLICABLE;

		NameParts(String fullName) {
			if (fullName == null) {
				return;
			}
			int idx = fullName.indexOf('.');
			if (idx == -1) {
				this.fieldName = fullName;
				return;
			}

			this.fieldName = fullName.substring(idx + 1);
			String sheetName = fullName.substring(0, idx).trim();
			this.sheet = CommonData.this.getDataSheet(sheetName);
			if (this.sheet == null) {
				throw new ApplicationError(
						"Data sheet "
								+ sheetName
								+ " is not available in context for a put/get/remove operation for field "
								+ fullName);
			}
			if (this.sheet instanceof MultiRowsSheet) {
				SheetIterator iter = CommonData.this.getIterator(sheetName);
				if (iter == null) {
					this.rowIdx = 0;
				} else {
					this.rowIdx = iter.getIdx();
				}
			}
		}
	}

	@Override
	public Set<Entry<String, Value>> getAllFields() {
		return this.allFields.entrySet();
	}

	/**
	 * Way to pass an object to subsequent action
	 *
	 * @param dataName
	 *            name by which this is referred
	 * @param object
	 *            object being set to this name
	 */
	public void setObject(String dataName, Object object) {
		this.allObjects.put(dataName, object);
	}

	/**
	 * @param dataName
	 *            name by which this is referred
	 * @return get the named object, or null if the object does not exists
	 */
	public Object getObject(String dataName) {
		return this.allObjects.get(dataName);
	}

	/**
	 * @param dataName
	 *            name of the object to be removed
	 * @return object being removed, null if object was not found
	 */
	public Object removeObject(String dataName) {
		return this.allObjects.remove(dataName);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#getTextValue(java.lang.String
	 * )
	 */
	@Override
	public String getTextValue(String fieldName) {
		Value val = this.getValue(fieldName);
		if (Value.isNull(val)) {
			return null;
		}
		return val.toString();
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#getLongValue(java.lang.String
	 * )
	 */
	@Override
	public long getLongValue(String fieldName) {
		Value val = this.getValue(fieldName);
		if (Value.isNull(val)) {
			return 0;
		}
		ValueType vt = val.getValueType();
		if (vt == ValueType.INTEGER) {
			return ((IntegerValue) val).getLong();
		}
		if (vt == ValueType.DECIMAL) {
			return ((DecimalValue) val).getLong();
		}
		return 0;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#getDateValue(java.lang.String
	 * )
	 */
	@Override
	public Date getDateValue(String fieldName) {
		Value val = this.getValue(fieldName);
		if (Value.isNull(val)) {
			return null;
		}

		if (val.getValueType() == ValueType.DECIMAL) {
			return new Date(((DateValue) val).getDate());
		}
		return null;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#getBooleanValue(java.lang
	 * .String)
	 */
	@Override
	public boolean getBooleanValue(String fieldName) {
		Value val = this.getValue(fieldName);
		if (Value.isNull(val)) {
			return false;
		}
		if (val.getValueType() == ValueType.BOOLEAN) {
			return ((BooleanValue) val).getBoolean();
		}
		return false;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#getDoubleValue(java.lang
	 * .String)
	 */
	@Override
	public double getDoubleValue(String fieldName) {
		Value val = this.getValue(fieldName);
		if (Value.isNull(val)) {
			return 0;
		}
		ValueType vt = val.getValueType();
		if (vt == ValueType.DECIMAL) {
			return ((DecimalValue) val).getDouble();
		}
		if (vt == ValueType.INTEGER) {
			return ((IntegerValue) val).getDouble();
		}
		return 0;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#setTextValue(java.lang.String
	 * , java.lang.String)
	 */
	@Override
	public void setTextValue(String fieldName, String value) {
		this.setValue(fieldName, Value.newTextValue(value));
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#setLongValue(java.lang.String
	 * , long)
	 */
	@Override
	public void setLongValue(String fieldName, long value) {
		this.setValue(fieldName, Value.newIntegerValue(value));
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#setDoubleValue(java.lang
	 * .String, java.lang.Double)
	 */
	@Override
	public void setDoubleValue(String fieldName, double value) {
		this.setValue(fieldName, Value.newDecimalValue(value));
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#setDateValue(java.lang.String
	 * , java.util.Date)
	 */
	@Override
	public void setDateValue(String fieldName, Date value) {
		this.setValue(fieldName, Value.newDateValue(value));
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.simplity.kernel.data.CommonDataInterface#setBooleanValue(java.lang
	 * .String, boolean)
	 */
	@Override
	public void setBooleanValue(String fieldName, boolean value) {
		this.setValue(fieldName, Value.newBooleanValue(value));
	}
}


text:
#ifndef __GLUES_REGISTRY_H__
#define __GLUES_REGISTRY_H__

#if defined(__USE_SDL_GLES__)
   #include <SDL/SDL_opengles.h>
   #define GLAPI GL_API
#elif defined (__QNXNTO__)
   #include <GLES/gl.h>
   #define GLAPI extern
   #define GLAPIENTRY
#else
   #error "Platform is unsupported"
#endif

#ifndef APIENTRY
	#define APIENTRY
#endif

#ifdef __cplusplus
   extern "C" {
#endif

/* Version */
#define GLU_VERSION_1_1 0x00000001
#define GLU_VERSION_1_2 0x00000001
#define GLU_VERSION_1_3 0x00000001

/* StringName */
#define GLU_VERSION     100800
#define GLU_EXTENSIONS  100801

GLAPI const GLubyte* APIENTRY gluGetString(GLenum name);
GLAPI GLboolean APIENTRY gluCheckExtension(const GLubyte* extName, const GLubyte* extString);

#ifdef __cplusplus
}
#endif

#endif /* __GLUES_REGISTRY_H__ */


text:
using BookFast.Booking.Data.Mappers;
using BookFast.ReliableEvents;
using Microsoft.ServiceFabric.Data;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace BookFast.Booking.Data
{
    internal class ReliableEventsDataSource : IReliableEventsDataSource
    {
        private readonly IReliableStateManager stateManager;

        public ReliableEventsDataSource(IReliableStateManager stateManager)
        {
            this.stateManager = stateManager;
        }

        public async Task ClearEventAsync(string eventId, CancellationToken cancellationToken)
        {
            var eventsDictionary = await stateManager.GetAllReliableEventsAsync();

            using (var transaction = stateManager.CreateTransaction())
            {
                await eventsDictionary.TryRemoveAsync(transaction, eventId);

                await transaction.CommitAsync();
            }
        }

        public async Task<IEnumerable<ReliableEvent>> GetPendingEventsAsync(CancellationToken cancellationToken)
        {
            var eventsDictionary = await stateManager.GetAllReliableEventsAsync();
            var result = new List<ReliableEvent>();

            using (var transaction = stateManager.CreateTransaction())
            {
                var enumerator = (await eventsDictionary.CreateEnumerableAsync(transaction)).GetAsyncEnumerator();
                while (await enumerator.MoveNextAsync(cancellationToken))
                {
                    result.Add(enumerator.Current.Value.ToContractModel());
                }

                await transaction.CommitAsync();
            }

            return result;
        }
    }
}


text:
package com.acme;

import java.util.List;
import java.util.ArrayList;
import org.apache.commons.text.WordUtils;
import org.apache.commons.lang3.tuple.Pair;

// tag::sample[]
public class Simpsons {
    private static final Person HOMER = new Person("Homer", "Simpson");
    private static final Person MARGE = new Person("Majorie", "Simpson");
    private static final Person BART = new Person("Bartholomew", "Simpson");
    private static final Person LISA = new Person("Elisabeth Marie", "Simpson");
    private static final Person MAGGIE = new Person("Margaret Eve", "Simpson");
    private static final List<Person> FAMILY = new ArrayList<Person>() {{
        add(HOMER);
        add(MARGE);
        add(BART);
        add(LISA);
        add(MAGGIE);
    }};

    public static Person homer() { return HOMER; }

    public static Person marge() { return MARGE; }

    public static Person bart() { return BART; }

    public static Person lisa() { return LISA; }

    public static Person maggie() { return MAGGIE; }

    // ...
//end::sample[]
    public static Person named(String firstName) {
        String capitalized = WordUtils.capitalizeFully(firstName);
        for (Person person : FAMILY) {
            if (capitalized.equals(person.getFirstName())) {
                return person;
            }
        }
        return null;
    }

    public static Person of(Pair<String, String> pair) {
        return new Person(pair.getLeft(), pair.getRight());
    }
}


text:
package org.sudoku.game.conf;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import static java.lang.Math.sqrt;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class ConfigurationTest {

    private final int numberOfElements;
    private GameFieldConfiguration configuration;

    public ConfigurationTest(int numberOfElements) {
        this.numberOfElements = numberOfElements;
    }

    @Parameters
    public static Collection<Integer> conf() {
        return Arrays.asList(9 * 9, 16 * 16, 25 * 25, 36 * 36, 49 * 49, 64 * 64, 81 * 81);
    }

    @Before
    public void setUp()
            throws Exception {
        configuration = new GameFieldConfiguration.Builder(numberOfElements).build();
    }

    @Test
    public void testNumbersOfSquares()
            throws Exception {
        assertThat(configuration.getNumberOfSquares(), is(calculateNumberOfSquares()));
    }

    private int calculateNumberOfSquares() {
        return (int) sqrt(numberOfElements);
    }

    @Test
    public void testNumbersOfElements()
            throws Exception {
        assertThat(configuration.getNumberOfElements(), is(numberOfElements));
    }

    @Test
    public void testNumberOfElementsOnSide()
            throws Exception {
        assertThat(configuration.getNumberOfElementsOnSide(), is(calculateNumberOfElementsOnSide()));
    }

    private int calculateNumberOfElementsOnSide() {
        return (int) sqrt(numberOfElements);
    }

    @Test
    public void testNumberOfElementsOnSquareSide()
            throws Exception {
        assertThat(configuration.getNumberOfElementsOnSquareSide(), is(calculateNumberOfElementsOnSquareSide()));
    }

    private int calculateNumberOfElementsOnSquareSide() {
        return (int) sqrt(sqrt(numberOfElements));
    }

    @Test
    public void testNumberOfSquaresOnSide()
            throws Exception {
        assertThat(configuration.getNumberOfSquaresOnSide(), is(calculateNumberOfSquaresOnSide()));
    }

    private int calculateNumberOfSquaresOnSide() {
        return (int) sqrt(sqrt(numberOfElements));
    }
}


text: Perl Yara::Scanner library.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>MD5</title>
<meta name="date" content="2015-01-09">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.share.mod.pay.ali.direct.sign

Class MD5

java.lang.Object

com.share.mod.pay.ali.direct.sign.MD5

public class MD5
extends java.lang.Object

功能:支付宝MD5签名处理核心文件,不需要修改
 版本:3.3
 修改日期:2012-08-17
 说明:
 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
 该代码仅供学习和研究支付宝接口使用,只是提供一个

Constructor Summary

Constructors

Constructor and Description

MD5()

Method Summary

Methods

Modifier and Type
Method and Description

static java.lang.String
sign(java.lang.String text,
    java.lang.String key,
    java.lang.String input_charset)

签名字符串

static boolean
verify(java.lang.String text,
      java.lang.String sign,
      java.lang.String key,
      java.lang.String input_charset)

签名字符串

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

MD5

public MD5()

Method Detail

sign

public static java.lang.String sign(java.lang.String text,
                    java.lang.String key,
                    java.lang.String input_charset)

签名字符串

Parameters:

text - 需要签名的字符串

key - 密钥

input_charset - 编码格式

Returns:

签名结果

verify

public static boolean verify(java.lang.String text,
             java.lang.String sign,
             java.lang.String key,
             java.lang.String input_charset)

签名字符串

Parameters:

text - 需要签名的字符串

sign - 签名结果

key - 密钥

input_charset - 编码格式

Returns:

签名结果

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
Le paiement de votre adhésion à !!sitename!! a échoué. Veuillez cliquer sur le lien suivant pour vous connecter et mettre à jour vos informations de paiement afin de renouveler votre adhésion. !!login_link!!

Compte : !!display_name!! (!!user_email!!)

Les dernières infos que nous ayons :

!!billing_address!!

	!!cardtype!!: !!accountnumber!!

	Expiration : !!expirationmonth!!/!!expirationyear!!


text:
<?xml version="1.0" encoding="UTF-8"?>

<rootTag>
  <Award>
    <AwardTitle>PostDoctoral Research Fellowship</AwardTitle>
    <AwardEffectiveDate>07/01/2013</AwardEffectiveDate>
    <AwardExpirationDate>06/30/2017</AwardExpirationDate>
    <AwardAmount>150000</AwardAmount>
    <AwardInstrument>
      <Value>Fellowship</Value>
    </AwardInstrument>
    <Organization>
      03040000
      <Directorate>
        <LongName>Direct For Mathematical & Physical Scien</LongName>
      </Directorate>
      <Division>
        <LongName>Division Of Mathematical Sciences</LongName>
      </Division>
    </Organization>
    <ProgramOfficer>
      <SignBlockName>Bruce P. Palka</SignBlockName>
    </ProgramOfficer>
    <AbstractNarration>This award is made as part of the FY 2013 Mathematical Sciences Postdoctoral Research Fellowships Program. Each of the fellowships supports a research and training project at a host institution in the mathematical sciences, including applications to other disciplines, under the mentorship of a sponsoring scientist. The title of the project for this fellowship to Dani Neftin is "Embedding Problems and Their Applications." The host institution for the fellowship is the University of Michigan, and the sponsoring scientist is Dr. Michael Zieve.</AbstractNarration>
    <MinAmdLetterDate>03/19/2013</MinAmdLetterDate>
    <MaxAmdLetterDate>03/19/2013</MaxAmdLetterDate>
    <ARRAAmount/>
    <AwardID>1303990</AwardID>
    <Investigator>
      <FirstName>Dani</FirstName>
      <LastName>Neftin</LastName>
      <EmailAddress/>
      <StartDate>03/19/2013</StartDate>
      <EndDate/>
      <RoleCode>Principal Investigator</RoleCode>
    </Investigator>
    <Institution>
      <Name>Neftin Dani</Name>
      <CityName>Ann Arbor</CityName>
      <ZipCode>481052541</ZipCode>
      <PhoneNumber/>
      <StreetAddress/>
      <CountryName>United States</CountryName>
      <StateName>Michigan</StateName>
      <StateCode>MI</StateCode>
    </Institution>
    <ProgramElement>
      7335
      <Text>WORKFORCE IN THE MATHEMAT SCI</Text>
    </ProgramElement>
    <ProgramReference>
      9219
      <Text>POSTDOCTORAL FELLOWSHIPS IN MATH SCIENCE</Text>
    </ProgramReference>
  </Award>
</rootTag>


text:
<?php

namespace Api\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Tblprocess
 *
 * @ORM\Table(name="tblProcess", indexes={@ORM\Index(name="fk_tblProcess_tblModules1_idx", columns={"intModuleID"})})
 * @ORM\Entity
 */
class Tblprocess
{
    /**
     * @var integer
     *
     * @ORM\Column(name="intProcessID", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     */
    private $intprocessid;

    /**
     * @var string
     *
     * @ORM\Column(name="intProcessName", type="string", length=45, nullable=false)
     */
    private $intprocessname;

    /**
     * @var integer
     *
     * @ORM\Column(name="intStatus", type="integer", nullable=true)
     */
    private $intstatus;

    /**
     * @var \Api\Entity\Tblmodules
     *
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     * @ORM\OneToOne(targetEntity="Api\Entity\Tblmodules")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="intModuleID", referencedColumnName="intModuleID")
     * })
     */
    private $intmoduleid;

    /**
     * Set intprocessid
     *
     * @param integer $intprocessid
     * @return Tblprocess
     */
    public function setIntprocessid($intprocessid)
    {
        $this->intprocessid = $intprocessid;

        return $this;
    }

    /**
     * Get intprocessid
     *
     * @return integer
     */
    public function getIntprocessid()
    {
        return $this->intprocessid;
    }

    /**
     * Set intprocessname
     *
     * @param string $intprocessname
     * @return Tblprocess
     */
    public function setIntprocessname($intprocessname)
    {
        $this->intprocessname = $intprocessname;

        return $this;
    }

    /**
     * Get intprocessname
     *
     * @return string
     */
    public function getIntprocessname()
    {
        return $this->intprocessname;
    }

    /**
     * Set intstatus
     *
     * @param integer $intstatus
     * @return Tblprocess
     */
    public function setIntstatus($intstatus)
    {
        $this->intstatus = $intstatus;

        return $this;
    }

    /**
     * Get intstatus
     *
     * @return integer
     */
    public function getIntstatus()
    {
        return $this->intstatus;
    }

    /**
     * Set intmoduleid
     *
     * @param \Api\Entity\Tblmodules $intmoduleid
     * @return Tblprocess
     */
    public function setIntmoduleid(\Api\Entity\Tblmodules $intmoduleid)
    {
        $this->intmoduleid = $intmoduleid;

        return $this;
    }

    /**
     * Get intmoduleid
     *
     * @return \Api\Entity\Tblmodules
     */
    public function getIntmoduleid()
    {
        return $this->intmoduleid;
    }
}


text:
import org.junit.Test;

import static org.junit.Assert.*;

public class StoneTest {

    @Test
    public void testRepresentation() throws Exception {
        Board board = new Board();
        Stone stone = new Stone(board, new Position(1,1));

        org.junit.Assert.assertEquals("failure stone not s",
                                      stone.representation(),"s");
    }
}


text:
'use strict';

var mapProjectAppControllers = angular.module('mapProjectAppControllers', [ 'ui.bootstrap',
  'mapProjectAppDirectives', 'mapProjectAppDashboards' ]);

var root_url = '/mapping-rest/';
var root_mapping = root_url + 'mapping/';
var root_content = root_url + 'content/';
var root_metadata = root_url + 'metadata/';
var root_workflow = root_url + 'workflow/';
var root_security = root_url + 'security/';
var root_reporting = root_url + 'reporting/';

mapProjectAppControllers.config(function(localStorageServiceProvider) {

  localStorageServiceProvider.setPrefix('mapping').setStorageType('sessionStorage').setNotify(true,
    true)
});

mapProjectAppControllers
  .run(function($rootScope, $window, $http, $location, utilService) {

    // global function to handle any type of error. Currently only
    // specifically implemented for authorization failures.
    $rootScope.handleHttpError = function(data, status, headers, config) {
      // $rootScope.globalError = data.replace(/"/g, '');
      utilService.handleError(data.replace(/"/g, ''));
      if (status == '401') {
        $location.path('/');
      }
      $window.scrollTo(0, 0);
    };

    // global function to handle an error that returns user to dashboard
    // currently used for improper viewing of records in editing
    $rootScope.handleReturnToDashboardError = function(errorString, currentRole) {
      $rootScope.globalError = errorString;
      $location.path('/' + currentRole.toLowerCase() + '/dash');
      $window.scrollTo(0, 0);

    };

    // global function to reset the global error
    $rootScope.resetGlobalError = function() {
      $rootScope.globalError = '';
      $rootScope.globalLongError = '';
    };

    // global variable to display a glass pane (if non-zero) preventing user
    // interaction
    $rootScope.glassPane = 0;

    // global variable, contains user-viewable error text displayed one very
    // page if not empty
    $rootScope.resetGlobalError();

    // variable to indicate whether the current page is 'dirty'
    // i.e. leaving this page might cause data to be lost
    // at writing, only two pages with this status are:
    // - mapRecord.html
    // - compareRecords.html
    $rootScope.currentPageDirty = false;

    $rootScope.title = 'IHTSDO Mapping';

    // root watcher to check for page changes, reload events, window closes,
    // etc
    // if on a 'dirty' page, prompt for confirmation from user

    // TODO RIGHT HERE IS THE THING OMG THE THING
    $rootScope
      .$on(
        '$locationChangeStart',
        function(event) {
          if ($rootScope.currentPageDirty == true) {
            if (!confirm('Are you sure you want to leave this page? Any data you have entered will be lost.')) {
              event.preventDefault();
            } else {
              // always set this to false
              // it is the responsibility of a 'dirty' page controller to
              // set
              // this to true
              $rootScope.currentPageDirty = false;
            }
          }

          // request to prevent reload (currently indexViewer.js)
          else if ($rootScope.preventSingleReload == true) {

            // prevent the default and set the flag to false
            event.preventDefault();
            $rootScope.preventSingleReload = false;
          }
        }

      );

  });


text:
Companion.PageSession = function(windowSession) {
    this.windowSession = windowSession;

    this._pageHasFocus = false;
    this._stageCode = Companion.PageSession.STAGE_START;
    this._stage = null;
};

Companion.PageSession.STAGE_START = 0;
Companion.PageSession.STAGE_ACTIVATING = 1;
Companion.PageSession.STAGE_ACTIVE_AUGMENTING = 2;

Companion.PageSession.prototype.dispose = function() {
    this._stage = null;

    this.detectionEntries = null;
};

Companion.PageSession.prototype.installUserInterface = function() {
    this._pageHasFocus = true;
    this._internalInstallUserInterface();
};

Companion.PageSession.prototype.uninstallUserInterface = function() {
    this._pageHasFocus = false;
    this._internalUninstallUserInterface();
};

Companion.PageSession.prototype._internalInstallUserInterface = function() {
    if (this._stage == null) {
        switch (this._stageCode) {
        case Companion.PageSession.STAGE_START:
            this._stage = new Companion.PageSession.StartStage(this);
            break;

        case Companion.PageSession.STAGE_ACTIVATING:
            this._stage = new Companion.PageSession.ActivatingStage(this);
            break;

        case Companion.PageSession.STAGE_ACTIVE_AUGMENTING:
            this._stage = new Companion.PageSession.ActiveAugmentingStage(this);
            break;
        }
    }
    this._stage.installUserInterface();
};

Companion.PageSession.prototype._internalUninstallUserInterface = function() {
    if (this._stage != null) {
        this._stage.uninstallUserInterface();
    }
};

Companion.PageSession.prototype._switchStage = function(newStageCode) {
    if (this._stage != null) {
        try {
            if (this._pageHasFocus) {
                this._stage.uninstallUserInterface();
            }
            this._stage.dispose();
        } catch (e) {
            Companion.exception(e);
        }
        this._stage = null;
    }

    this._stageCode = newStageCode;
    this._internalInstallUserInterface();
};

Companion.PageSession.prototype.reset = function() {
    this._switchStage(Companion.PageSession.STAGE_START);
};

Companion.PageSession.prototype.activate = function() {
    if (this._stageCode == Companion.PageSession.STAGE_ACTIVE_AUGMENTING) {
        this.reset();
    }
    if (this._stageCode == Companion.PageSession.STAGE_START) {
        this._switchStage(Companion.PageSession.STAGE_ACTIVATING);
        this._stage.kickstart();
    }
};

Companion.PageSession.prototype.augment = function(identityModel) {
    this.identityModel = identityModel;
    this._switchStage(Companion.PageSession.STAGE_ACTIVE_AUGMENTING);
};


text:
using System;

namespace EventChangeProperty
{
    class Program
    {
        static void Main(string[] args)
        {
            var student = new Student("Lena", 22);

            student.onStudentPropertyChange += (Student sender, StudentPropChangeEventArgs eventArgs) =>
            {
                Console.WriteLine($"{sender.Name}'s {eventArgs.propName} has changed from {eventArgs.OldProp} to {eventArgs.NewProp}");
            };

            student.Age = 33;
            student.Age = 23;
            student.Name = "Alla";
        }
    }
}


text:
<?php

namespace TypiCMS\Modules\Translations\Providers;

use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use TypiCMS\Modules\Core\Services\Cache\LaravelCache;
use TypiCMS\Modules\Translations\Models\Translation;
use TypiCMS\Modules\Translations\Repositories\CacheDecorator;
use TypiCMS\Modules\Translations\Repositories\EloquentTranslation;

class ModuleProvider extends ServiceProvider
{
    public function boot()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/config.php', 'typicms.translations'
        );

        $modules = $this->app['config']['typicms']['modules'];
        $this->app['config']->set('typicms.modules', array_merge(['translations' => []], $modules));

        $this->loadViewsFrom(__DIR__.'/../resources/views/', 'translations');
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'translations');

        $this->publishes([
            __DIR__.'/../resources/views' => base_path('resources/views/vendor/translations'),
        ], 'views');
        $this->publishes([
            __DIR__.'/../database' => base_path('database'),
        ], 'migrations');
    }

    public function register()
    {
        $app = $this->app;

        /*
         * Register route service provider
         */
        $app->register('TypiCMS\Modules\Translations\Providers\RouteServiceProvider');

        /*
         * Sidebar view composer
         */
        $app->view->composer('core::admin._sidebar', 'TypiCMS\Modules\Translations\Composers\SidebarViewComposer');

        $app->bind('TypiCMS\Modules\Translations\Repositories\TranslationInterface', function (Application $app) {
            $repository = new EloquentTranslation(
                new Translation()
            );
            if (!config('typicms.cache')) {
                return $repository;
            }
            $laravelCache = new LaravelCache($app['cache'], 'translations', 10);

            return new CacheDecorator($repository, $laravelCache);
        });
    }
}


text:
_Applies to: Excel 2016, Office 2016_

Encapsulates the format properties for chart gridlines.

## Properties

None

## Relationships
| Relationship | Type	|Description|
|:---------------|:--------|:----------|
|line|[ChartLineFormat](chartlineformat.md)|Represents chart line formatting. Read-only.|

## Methods

| Method		   | Return Type	|Description|
|:---------------|:--------|:----------|
|[load(param: object)](#loadparam-object)|void|Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.|

## Method Details

### load(param: object)
Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

#### Syntax
```js
object.load(param);
```

#### Parameters
| Parameter	   | Type	|Description|
|:---------------|:--------|:----------|
|param|object|Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide [loadOption](loadoption.md) object.|

#### Returns
void


text:
using System;
using Sonneville.Investing.Accounting.Cash;
using Sonneville.Investing.Accounting.Cash.Transactions;

namespace Sonneville.Investing.Accounting.CashStrategies
{
    public class OnlyAcceptPositiveOrZeroAmountDepositsStrategy : ICashTransactionStrategy<IDeposit>
    {
        public void ThrowIfInvalid(IDeposit deposit, ICashAccount cashAccount)
        {
            if (deposit == null)
            {
                throw new ArgumentNullException(nameof(deposit), "Cannot validate null Deposit!");
            }
            if (deposit.Amount < 0)
            {
                throw new InvalidOperationException("Cannot deposit a negative amount of funds!");
            }
        }
    }
}