text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <TITLE>Function Template restrict</TITLE>
    <LINK REL="stylesheet" HREF="../../../../boost.css">
    <LINK REL="stylesheet" HREF="../theme/iostreams.css">

Function Template restrict

Description

Headers

Reference

Description

    Given a Filter or Device that provides access to a single character sequence, we can construct a second Filter or Device which provides access to contiguous subsequence of the the original sequence. This second Filter or Device is called a restriction of the original device. Restrictions are represented by instances of the class template restriction. The function template resrict is an object generator which returns an appropriate instance of resriction when passed a Filter or Device and a pair of values indicating the endpoints of the restricted subsequence.

    The mode of a resriction is the same as that of the underlying component. A resriction is Closable, Flushable, Localizable and OptimallyBuffered.

    The function template slice is available as an alias of restrict, for platforms that treat restrict as a keyword.

Headers

<boost/iostreams/restrict.hpp>

Reference

Synopsis

namespace boost { namespace iostreams {

template<typename Component>
class restriction {
public:
    typedef typename char_type_of<Component>::type  char_type;
    typedef implementation-defined                  mode;

    restriction( [const] Component& component,
                 stream_offset off,
                 stream_offset len = -1 );

    // Filter or Device member functions
};

template<typename Component>
restriction<Component>
restrict( [const] Component& component,
          stream_offset off,
          stream_offset len = -1 );

} } // End namespace boost::io

Class Template restriction

Template parameters

        Component	-
        A model of Filter or Device

restriction::restriction

    restriction( [const] Component& component,
                 stream_offset off,
                 stream_offset len = -1 );

    Constructs an instance of restriction based on the given component and offsets. The parameters have the following interpretation:

        component	-
        The Filter or Device to be restricted. If Component is a stream or stream buffer type, the function parameter is a non-const reference; otherwise it is a const reference.

        off	-
        The offset of the beginning of the restricted character sequence.

        len	-
        The length of the restricted character sequence. A value of -1 indicates that the end of the restricted sequence should be the same as that of the unrestricted sequence.

Function Template restrict

template<typename Component>
restriction<Component>
restrict( [const] Component& component,
          stream_offset off,
          stream_offset len = -1 );

Template parameters

        Component	-
        A model of Filter or Device

    Constructs an instance of an appropriate specialization of restriction based on the given component and offsets. The parameters have the following interpretation:

        component	-
        The Filter or Device to be restricted. If Component is a stream or stream buffer type, the function parameter is a non-const reference; otherwise it is a const reference.

        off	-
        The offset of the beginning of the restricted character sequence.

        len	-
        The length of the restricted character sequence. A value of -1 indicates that the end of the restricted sequence should be the same as that of the unrestricted sequence.

© Copyright 2008 CodeRage, LLC
© Copyright 2004-2007 Jonathan Turkanis

    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
#ifndef soapSearchBindingService_H
#define soapSearchBindingService_H
#include "soapH.h"
class SOAP_CMAC SearchBindingService : public soap
{ public:
	/// Constructor
	SearchBindingService();
	/// Constructor with copy of another engine state
	SearchBindingService(const struct soap&);
	/// Constructor with engine input+output mode control
	SearchBindingService(soap_mode iomode);
	/// Constructor with engine input and output mode control
	SearchBindingService(soap_mode imode, soap_mode omode);
	/// Destructor, also frees all deserialized data
	virtual ~SearchBindingService();
	/// Delete all deserialized data (uses soap_destroy and soap_end)
	virtual	void destroy();
	/// Initializer used by constructor
	virtual	void SearchBindingService_init(soap_mode imode, soap_mode omode);
	/// Create a copy
	virtual	SearchBindingService *copy();
	/// Force close connection (normally automatic)
	virtual	int soap_close_socket();
	/// Return sender-related fault to sender
	virtual	int soap_senderfault(const char *string, const char *detailXML);
	/// Return sender-related fault with SOAP 1.2 subcode to sender
	virtual	int soap_senderfault(const char *subcodeQName, const char *string, const char *detailXML);
	/// Return receiver-related fault to sender
	virtual	int soap_receiverfault(const char *string, const char *detailXML);
	/// Return receiver-related fault with SOAP 1.2 subcode to sender
	virtual	int soap_receiverfault(const char *subcodeQName, const char *string, const char *detailXML);
	/// Print fault
	virtual	void soap_print_fault(FILE*);
#ifndef WITH_LEAN
	/// Print fault to stream
	virtual	void soap_stream_fault(std::ostream&);
	/// Put fault into buffer
	virtual	char *soap_sprint_fault(char *buf, size_t len);
#endif
	/// Disables and removes SOAP Header from message
	virtual	void soap_noheader();
	/// Put SOAP Header in message
	virtual	void soap_header(char *wsa__MessageID, struct wsa__Relationship *wsa__RelatesTo, struct wsa__EndpointReferenceType *wsa__From, struct wsa__EndpointReferenceType *wsa__ReplyTo, struct wsa__EndpointReferenceType *wsa__FaultTo, char *wsa__To, char *wsa__Action, struct _wsse__Security *wsse__Security, char *wsa5__MessageID, struct wsa5__RelatesToType *wsa5__RelatesTo, struct wsa5__EndpointReferenceType *wsa5__From, struct wsa5__EndpointReferenceType *wsa5__ReplyTo, struct wsa5__EndpointReferenceType *wsa5__FaultTo, char *wsa5__To, char *wsa5__Action);
	/// Get SOAP Header structure (NULL when absent)
	virtual	const SOAP_ENV__Header *soap_header();
	/// Run simple single-thread iterative service on port until a connection error occurs (returns error code or SOAP_OK), use this->bind_flag = SO_REUSEADDR to rebind for a rerun
	virtual	int run(int port);
	/// Bind service to port (returns master socket or SOAP_INVALID_SOCKET)
	virtual	SOAP_SOCKET bind(const char *host, int port, int backlog);
	/// Accept next request (returns socket or SOAP_INVALID_SOCKET)
	virtual	SOAP_SOCKET accept();
	/// Serve this request (returns error code or SOAP_OK)
	virtual	int serve();
	/// Used by serve() to dispatch a request (returns error code or SOAP_OK)
	virtual	int dispatch();

	///
	/// Service operations (you should define these):
	///

	/// Web service operation 'GetServiceCapabilities' (returns error code or SOAP_OK)
	virtual	int GetServiceCapabilities(_tse__GetServiceCapabilities *tse__GetServiceCapabilities, _tse__GetServiceCapabilitiesResponse *tse__GetServiceCapabilitiesResponse){return SOAP_OK;};

	/// Web service operation 'GetRecordingSummary' (returns error code or SOAP_OK)
	virtual	int GetRecordingSummary(_tse__GetRecordingSummary *tse__GetRecordingSummary, _tse__GetRecordingSummaryResponse *tse__GetRecordingSummaryResponse){return SOAP_OK;};

	/// Web service operation 'GetRecordingInformation' (returns error code or SOAP_OK)
	virtual	int GetRecordingInformation(_tse__GetRecordingInformation *tse__GetRecordingInformation, _tse__GetRecordingInformationResponse *tse__GetRecordingInformationResponse){return SOAP_OK;};

	/// Web service operation 'GetMediaAttributes' (returns error code or SOAP_OK)
	virtual	int GetMediaAttributes(_tse__GetMediaAttributes *tse__GetMediaAttributes, _tse__GetMediaAttributesResponse *tse__GetMediaAttributesResponse){return SOAP_OK;};

	/// Web service operation 'FindRecordings' (returns error code or SOAP_OK)
	virtual	int FindRecordings(_tse__FindRecordings *tse__FindRecordings, _tse__FindRecordingsResponse *tse__FindRecordingsResponse){return SOAP_OK;};

	/// Web service operation 'GetRecordingSearchResults' (returns error code or SOAP_OK)
	virtual	int GetRecordingSearchResults(_tse__GetRecordingSearchResults *tse__GetRecordingSearchResults, _tse__GetRecordingSearchResultsResponse *tse__GetRecordingSearchResultsResponse){return SOAP_OK;};

	/// Web service operation 'FindEvents' (returns error code or SOAP_OK)
	virtual	int FindEvents(_tse__FindEvents *tse__FindEvents, _tse__FindEventsResponse *tse__FindEventsResponse){return SOAP_OK;};

	/// Web service operation 'GetEventSearchResults' (returns error code or SOAP_OK)
	virtual	int GetEventSearchResults(_tse__GetEventSearchResults *tse__GetEventSearchResults, _tse__GetEventSearchResultsResponse *tse__GetEventSearchResultsResponse){return SOAP_OK;};

	/// Web service operation 'FindPTZPosition' (returns error code or SOAP_OK)
	virtual	int FindPTZPosition(_tse__FindPTZPosition *tse__FindPTZPosition, _tse__FindPTZPositionResponse *tse__FindPTZPositionResponse){return SOAP_OK;};

	/// Web service operation 'GetPTZPositionSearchResults' (returns error code or SOAP_OK)
	virtual	int GetPTZPositionSearchResults(_tse__GetPTZPositionSearchResults *tse__GetPTZPositionSearchResults, _tse__GetPTZPositionSearchResultsResponse *tse__GetPTZPositionSearchResultsResponse){return SOAP_OK;};

	/// Web service operation 'GetSearchState' (returns error code or SOAP_OK)
	virtual	int GetSearchState(_tse__GetSearchState *tse__GetSearchState, _tse__GetSearchStateResponse *tse__GetSearchStateResponse){return SOAP_OK;};

	/// Web service operation 'EndSearch' (returns error code or SOAP_OK)
	virtual	int EndSearch(_tse__EndSearch *tse__EndSearch, _tse__EndSearchResponse *tse__EndSearchResponse){return SOAP_OK;};

	/// Web service operation 'FindMetadata' (returns error code or SOAP_OK)
	virtual	int FindMetadata(_tse__FindMetadata *tse__FindMetadata, _tse__FindMetadataResponse *tse__FindMetadataResponse){return SOAP_OK;};

	/// Web service operation 'GetMetadataSearchResults' (returns error code or SOAP_OK)
	virtual	int GetMetadataSearchResults(_tse__GetMetadataSearchResults *tse__GetMetadataSearchResults, _tse__GetMetadataSearchResultsResponse *tse__GetMetadataSearchResultsResponse){return SOAP_OK;};
};
#endif

redpajama_set_name: RedPajamaGithub


text:
layout: products
title: Brown Cushion
meta: Simple brown cushion to throw onto any couch.
type: cushions
price: $20.00
image: cushions/brown-cushion.svg
---


text:
DESTDIR = /
PREFIX = $(DESTDIR)/usr/local
PACKAGE_NAME = $(shell grep -m 1 name Cargo.toml | cut -d '"' -f 2)
PACKAGE_VERSION = $(shell grep -m 1 version Cargo.toml | cut -d '"' -f 2)
DEB_CONTROL = build/debian/control.in
ARCH = $(shell uname -m)

debug: target/debug/$(PACKAGE_NAME)

release: target/release/$(PACKAGE_NAME)

target/debug/$(PACKAGE_NAME):
	cargo build

target/release/$(PACKAGE_NAME):
	cargo build --release

install: release
	@echo Installing to $(PREFIX)/bin...
	install -m 0755 target/release/$(PACKAGE_NAME) $(PREFIX)/bin

uninstall:
	@echo Uninstalling from $(PREFIX)/bin...
	rm $(PREFIX)/bin/$(PACKAGE_NAME)

clean:
	-rm -rf target

deb: release
	docker build -f build/debian/Dockerfile -t retest/build-debian .
	docker run -it --rm -v $(CURDIR):/source retest/build-debian $(PACKAGE_NAME) $(PACKAGE_VERSION) $(ARCH) $(DEB_CONTROL) $(shell wc -c < target/release/retest) target/release


text:
package griffon.core.injection;

import javax.annotation.Nonnull;
import javax.inject.Provider;

/**
 * @author Andres Almiray
 * @since 2.0.0
 */
public interface ProviderBinding<T> extends Binding<T> {
    @Nonnull
    Provider<? extends T> getProvider();
}


text:
package org.cometd.common;

import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.IntFunction;
import org.cometd.bayeux.Promise;

/**
 *
Processes asynchronously a sequence of elements, producing a result that
 * is the reduction of the results produced by the processing of each element.

 *
This class implements the asynchronous version of the following synchronous
 * {@code for} loop, but where the processing of each element may be asynchronous.

 *
{@code
 * R result;
 * for (T element : list) {
 *     (result, proceed) = operation.apply(result, element);
 *     if (!proceed) {
 *         break;
 *     }
 * }
 * }

 *
Using this class, the loop above becomes:

 *
{@code
 * R zero;
 * AsyncFoldLeft.run(list, zero, (result, element, loop) -> {
 *     CompletableFuture<R> future = processAsync(element);
 *     future.whenComplete((r, x) -> {
 *         if (x == null) {
 *             R reduced = reduce(result, r);
 *             if (shouldIterate(r)) {
 *                 loop.proceed(reduced);
 *             } else {
 *                 loop.leave(reduced);
 *             }
 *         } else {
 *             loop.fail(x);
 *         }
 *     })
 * }, Promise.complete((r, x) -> {
 *     // Process final result or failure.
 * });
 * }

 */
public class AsyncFoldLeft {
    /**
     *
Processes the given array of elements.

     *
     * @param array     the elements to process
     * @param zero      the initial result
     * @param operation the operation to invoke for each element
     * @param promise   the promise to notify of the final result
     * @param <T>       the type of element
     * @param <R>       the type of the result
     * @see #run(Iterable, Object, Operation, Promise)
     */
    public static <T, R> void run(T[] array, R zero, Operation<T, R> operation, Promise<R> promise) {
        int size = array.length;
        if (size == 0) {
            promise.succeed(zero);
        } else {
            IndexedLoop<T, R> loop = new IndexedLoop<>(i -> array[i], size, zero, operation, promise);
            loop.run();
        }
    }

    /**
     *
Processes the given sequence of elements.

     *
The initial result {@code zero} is returned if the sequence is empty.

     *
For each element the {@link Operation#apply(Object, Object, Loop) operation}
     * function is invoked.

     *
The sequence should have a "stable" iterator, i.e. it should not be
     * affected if the sequence is modified  during the iteration, either concurrently
     * by another thread, or by the same thread in the {@code operation} function.

     *
     * @param iterable  the elements to process
     * @param zero      the initial result
     * @param operation the operation to invoke for each element
     * @param promise   the promise to notify of the final result
     * @param <T>       the type of element
     * @param <R>       the type of the result
     */
    public static <T, R> void run(Iterable<T> iterable, R zero, Operation<T, R> operation, Promise<R> promise) {
        Iterator<T> iterator = iterable.iterator();
        if (!iterator.hasNext()) {
            promise.succeed(zero);
        } else {
            IteratorLoop<T, R> loop = new IteratorLoop<>(iterator, zero, operation, promise);
            loop.run();
        }
    }

    /**
     *
Processes, in reverse order, the given sequence of elements.

     *
     * @param list      the elements to process
     * @param zero      the initial result
     * @param operation the operation to invoke for each element
     * @param promise   the promise to notify of the final result
     * @param <T>       the type of element
     * @param <R>       the type of the result
     * @see #run(Iterable, Object, Operation, Promise)
     */
    public static <T, R> void reverseRun(List<T> list, R zero, Operation<T, R> operation, Promise<R> promise) {
        run(new ReverseIterable<>(list), zero, operation, promise);
    }

    /**
     *
The operation to invoke for each element.

     *
     * @param <T> the type of element
     * @param <R> the type of the result
     */
    @FunctionalInterface
    public interface Operation<T, R> {
        /**
         *
Processes the given {@code element}.

         *
The processing of the element must produce a result that is the reduction
         * of the accumulated {@code result} with the result of the processing of the
         * given {@code element}.

         *
After the processing of the given element, the implementation must decide
         * whether to continue with or break out of the iteration (with the reduced
         * result) or to fail the iteration (with an exception).

         *
         * @param result  the accumulated result so far
         * @param element the element to process
         * @param loop    the control object that continues or breaks the iteration
         */
        void apply(R result, T element, Loop<R> loop);
    }

    /**
     *
Controls the iteration over a sequence of elements, allowing to
     * continue the iteration (with a result), break out of the iteration
     * (with a result), or fail the iteration (with an exception).

     *
     * @param <R> the type of the result
     */
    public interface Loop<R> {
        /**
         *
Makes the loop proceed to the next element (or the end of the loop).

         *
         * @param r the result computed in the current iteration
         */
        public default void proceed(R r) {
        }

        /**
         *
Makes the loop exit (similarly to the {@code break} statement).

         *
         * @param r the result computed in the current iteration
         */
        public default void leave(R r) {
        }

        /**
         *
Makes the loop fail (similarly to throwing an exception).

         *
         * @param failure the failure of the current iteration
         */
        public default void fail(Throwable failure) {
        }
    }

    private enum State {
        LOOP, ASYNC, PROCEED, LEAVE, FAIL
    }

    private static abstract class AbstractLoop<T, R> implements Loop<R> {
        private final AtomicReference<State> state = new AtomicReference<>(State.LOOP);
        private final AtomicReference<Throwable> failure = new AtomicReference<>();
        private final AtomicReference<R> result;
        private final Operation<T, R> operation;
        private final Promise<R> promise;

        private AbstractLoop(R zero, Operation<T, R> operation, Promise<R> promise) {
            this.result = new AtomicReference<>(zero);
            this.operation = operation;
            this.promise = promise;
        }

        abstract boolean hasCurrent();

        abstract T current();

        abstract void next();

        void run() {
            while (hasCurrent()) {
                state.set(State.LOOP);
                operation.apply(result.get(), current(), this);
                loop:
                while (true) {
                    State current = state.get();
                    switch (current) {
                        case LOOP:
                            if (state.compareAndSet(current, State.ASYNC)) {
                                return;
                            }
                            break;
                        case PROCEED:
                            next();
                            break loop;
                        case LEAVE:
                            promise.succeed(result.get());
                            return;
                        case FAIL:
                            promise.fail(failure.get());
                            return;
                        default:
                            throw new IllegalStateException("Could not run loop in state " + current);
                    }
                }
            }
            promise.succeed(result.get());
        }

        @Override
        public void proceed(R r) {
            result.set(r);
            while (true) {
                State current = state.get();
                switch (current) {
                    case LOOP:
                        if (state.compareAndSet(current, State.PROCEED)) {
                            return;
                        }
                        break;
                    case ASYNC:
                        if (state.compareAndSet(current, State.PROCEED)) {
                            next();
                            run();
                            return;
                        }
                        break;
                    default:
                        throw new IllegalStateException("Could not proceed loop in state " + current);
                }
            }
        }

        @Override
        public void leave(R r) {
            result.set(r);
            while (true) {
                State current = state.get();
                switch (current) {
                    case LOOP:
                        if (state.compareAndSet(current, State.LEAVE)) {
                            return;
                        }
                        break;
                    case ASYNC:
                        if (state.compareAndSet(current, State.LEAVE)) {
                            promise.succeed(result.get());
                            return;
                        }
                        break;
                    default:
                        throw new IllegalStateException("Could not leave loop in state " + current);
                }
            }
        }

        @Override
        public void fail(Throwable x) {
            failure.compareAndSet(null, x);
            while (true) {
                State current = state.get();
                switch (current) {
                    case LOOP:
                        if (state.compareAndSet(current, State.FAIL)) {
                            return;
                        }
                        break;
                    case ASYNC:
                        if (state.compareAndSet(current, State.FAIL)) {
                            promise.fail(x);
                            return;
                        }
                        break;
                    default:
                        throw new IllegalStateException("Could not fail loop in state " + current);
                }
            }
        }
    }

    private static class IndexedLoop<T, R> extends AbstractLoop<T, R> {
        private final IntFunction<T> element;
        private final int size;
        private int index;

        private IndexedLoop(IntFunction<T> element, int size, R zero, Operation<T, R> operation, Promise<R> promise) {
            super(zero, operation, promise);
            this.element = element;
            this.size = size;
        }

        @Override
        boolean hasCurrent() {
            return index < size;
        }

        @Override
        T current() {
            return element.apply(index);
        }

        @Override
        void next() {
            ++index;
        }
    }

    private static class IteratorLoop<T, R> extends AbstractLoop<T, R> {
        private final Iterator<T> iterator;
        private boolean hasCurrent;
        private T current;

        private IteratorLoop(Iterator<T> iterator, R zero, Operation<T, R> operation, Promise<R> promise) {
            super(zero, operation, promise);
            this.iterator = iterator;
            next();
        }

        @Override
        boolean hasCurrent() {
            return hasCurrent;
        }

        @Override
        T current() {
            if (!hasCurrent) {
                throw new NoSuchElementException();
            }
            return current;
        }

        @Override
        void next() {
            hasCurrent = iterator.hasNext();
            current = hasCurrent ? iterator.next() : null;
        }
    }

    private static class ReverseIterable<T> implements Iterable<T>, Iterator<T> {
        private final ListIterator<T> iterator;

        private ReverseIterable(List<T> list) {
            this.iterator = list.listIterator(list.size());
        }

        @Override
        public Iterator<T> iterator() {
            return this;
        }

        @Override
        public boolean hasNext() {
            return iterator.hasPrevious();
        }

        @Override
        public T next() {
            return iterator.previous();
        }
    }
}


text:
package snsuapi

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// BandStatusQuery invokes the snsuapi.BandStatusQuery API synchronously
// api document: https://help.aliyun.com/api/snsuapi/bandstatusquery.html
func (client *Client) BandStatusQuery(request *BandStatusQueryRequest) (response *BandStatusQueryResponse, err error) {
	response = CreateBandStatusQueryResponse()
	err = client.DoAction(request, response)
	return
}

// BandStatusQueryWithChan invokes the snsuapi.BandStatusQuery API asynchronously
// api document: https://help.aliyun.com/api/snsuapi/bandstatusquery.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) BandStatusQueryWithChan(request *BandStatusQueryRequest) (<-chan *BandStatusQueryResponse, <-chan error) {
	responseChan := make(chan *BandStatusQueryResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.BandStatusQuery(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// BandStatusQueryWithCallback invokes the snsuapi.BandStatusQuery API asynchronously
// api document: https://help.aliyun.com/api/snsuapi/bandstatusquery.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) BandStatusQueryWithCallback(request *BandStatusQueryRequest, callback func(response *BandStatusQueryResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *BandStatusQueryResponse
		var err error
		defer close(result)
		response, err = client.BandStatusQuery(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// BandStatusQueryRequest is the request struct for api BandStatusQuery
type BandStatusQueryRequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	BandId               requests.Integer `position:"Query" name:"BandId"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
}

// BandStatusQueryResponse is the response struct for api BandStatusQuery
type BandStatusQueryResponse struct {
	*responses.BaseResponse
	RequestId     string       `json:"RequestId" xml:"RequestId"`
	ResultCode    string       `json:"ResultCode" xml:"ResultCode"`
	ResultMessage string       `json:"ResultMessage" xml:"ResultMessage"`
	ResultModule  ResultModule `json:"ResultModule" xml:"ResultModule"`
}

// CreateBandStatusQueryRequest creates a request to invoke BandStatusQuery API
func CreateBandStatusQueryRequest() (request *BandStatusQueryRequest) {
	request = &BandStatusQueryRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Snsuapi", "2018-07-09", "BandStatusQuery", "snsuapi", "openAPI")
	return
}

// CreateBandStatusQueryResponse creates a response to parse from BandStatusQuery response
func CreateBandStatusQueryResponse() (response *BandStatusQueryResponse) {
	response = &BandStatusQueryResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
namespace Lib
{
    public class Class1
    {
        public string DoIt(string Source)
        {
            return Source + " done";
        }
    }
}


text:
<?php
App::uses('AppController', 'Controller');
App::uses('Product', 'Model');
App::uses('User', 'Model');
App::uses('Employee', 'Model');
App::uses('Monitor', 'Model');
App::uses('Mouse', 'Model');
App::uses('Keyboard', 'Model');
App::uses('Systemunit', 'Model');
App::uses('Videocard', 'Model');
App::uses('Headset', 'Model');
App::uses('Speaker', 'Model');
App::uses('Up', 'Model');
App::uses('Inventory', 'Model');
App::uses('Alert', 'lib');

class KeyboardsController extends AppController {

  public $uses = array('Product', 'User', 'Employee', 'Monitor', 'Mouse','Keyboard','Systemunit', 'Videocard', 'Inventory');

  public $helpers = array('Html', 'Form');

	public $components = array('Session', 'Paginator');

public function beforeFilter(){

     parent::beforeFilter();
     $this->alert = new Alert();
     }

	public function index() {

        $all = $this->Keyboard->find('all');
        $number= count($all);
        $this->Set('allKeyboards', $number);

         $this->Paginator->settings = array( 'limit' => 10);

    // similar to findAll(), but fetches paged results
    $data = $this->Paginator->paginate('Keyboard');
    $this->set('keyboards', $data);

}

public function add() {

    $this->autoRender = false;

        if ($this->request->is('post')) {
        $accept = $this->request->data;

              pr($accept);
              die();
            if (empty($accept['kbpropertyno']) || empty($accept['kbdescription']) || empty($accept['kbstatus']) || empty($accept['kbtype']) || empty($accept['kbavailability']) ) {
              $this->Session->setFlash($this->alert->danger('All fields must have values.'),'default', array(), 'keyboard_error');

              $this->redirect($this->referer());
        } else {

                $checkExist = $this->Keyboard->find('first',
                    array(
                        'fields' => 'kbpropertyno',
                        'conditions' => array(
                            'kbpropertyno' => $accept['kbpropertyno']
                            )
                        )
                    );

                if($checkExist){
                    $this->Session->setFlash($this->alert->danger('Update failed. Keyboard Property no. already exist.'),'default', array(), 'keyboard_error');
                } else {
                    $data = array(
                    'Keyboard' => array(
                        'kbpropertyno' => $accept['kbpropertyno'],
                        'kbdescription' => $accept['kbdescription'],
                        'kbstatus' => $accept['kbstatus'],
                        'kbtype' => $accept['kbtype'],
                        'kbavailability' => $accept['kbavailability']
                     )
             );
                  $this->Keyboard->create($data);
                  $this->Keyboard->save($data);
                  $this->Session->setFlash($this->alert->success('Sucessfully added.'), 'default', array(), 'added');
                }

                 $this->redirect($this->referer());
                  exit();
              }
     }

}

public function edit() {
  $this->autoRender = false;

        if ($this->request->is('post')) {

            $data = $this->request->data;

            if(empty($data['kbpropertyno']) || empty($data['kbdescription']) || empty($data['kbstatus']) ||
             empty($data['kbtype']) || empty($data['kbavailability']) ) {

                $this->Session->setFlash($this->alert->danger('All fields must have values.'),'default', array(), 'keyboard_error');
            }else{
             $checkExist = $this->Keyboard->find('first',
                   array(
                    'fields' => 'kbpropertyno',
                    'conditions' => array(
                      'kbpropertyno' => $data['kbpropertyno']
                      )
                    )
                  );

              if($checkExist){

                $this->Session->setFlash($this->alert->danger('Update failed. Keyboard Property No. already exist.'),'default', array(), 'keyboard_error');

                 }else{
                    ($data['kbstatus']=='Working') ? $kbstat = 1 : $kbstat =2;
                    ($data['kbtype']=='New') ? $kbtyp = 1 : $kbtyp =2;
                    ($data['kbavailability']=='Available') ? $kbavail = 1 : $kbavail =2;

                      $prepareData = array(
                        'Keyboard' => array(
                            'kbpropertyno' => $data['kbpropertyno'],
                            'kbdescription' => $data['kbdescription'],
                            'kbstatus' => $kbstat,
                            'kbtype' =>$kbtyp,
                            'kbavailability' => $kbavail

                        )
                    );

                    $this->Keyboard->id = $data['id'];
                    $this->Keyboard->save($prepareData);
                    $this->Session->setFlash($this->alert->success('Update Success.'), 'default', array(), 'good');
                   }

               }

            $this->redirect($this->referer());
            exit();

        }
}

public function delete() {
	$this->autoRender = false;
	$id = $this->request->data['id'];

	if ($this->Keyboard->delete($id)) {
	$this->Session->setFlash('
 Successfully deleted.
', 'default', array(), 'good');
		return $this->redirect(array('action' => 'index'));
	}
	$this->redirect($this->referer());
}

  public function searchKeyboard(){

     $searchInput = $this->request->data['input'];

     $match= $this->Keyboard->find('all',
          array(
            'conditions' => array(
              'OR' =>array(
                'Keyboard.kbpropertyno LIKE' => '%'. $searchInput. '%',
                'Keyboard.kbdescription LIKE' => '%'. $searchInput. '%'

                )
              )
            )
          );

     $this->Set('showKeyboard', $match);

  }

  public function viewAjax(){
    $this->autoRender = false;
    $query = $this->request->query;
    $content = "";
    $error = false;
    if (isset($query['keyboardId'])) {
      $kId = $query['keyboardId'];
      $keyboard = $this->Keyboard->findById($kId);
      if ($keyboard) {
        $error = false;
        $content = $keyboard;
      } else {
        $error = true;
        $content = "no_kb";
      }
    } else {
      $error = true;
      $content = "no_id";
    }
    echo json_encode(array('error' => $error, 'content' => $content));
    exit();
  }

}


text:
import { useSelector } from 'react-redux';

export const gameMatchIdSelector = (state) => state.game.matchId;

export const useGameMatchId = () =>
  useSelector(gameMatchIdSelector);


text:
=========
#### Dependencies:
* python
* requests
* pyperclip

#### Description:
tool for paste your snippet to http://tempel.blankon.in as default it will get data from clipboard as text.
clipboard only available for GUI env, for limited env which not support clipboard you may run `tempel` as follows
`$ dmesg | tempel bash -s`
`$ tempel -t 'free text'`
`$ tempel python -s /path/to/file.py`

#### Usage:

usage: `tempel [-h] [-t TEXT | -s STREAM] [-v] language`

tempel your source code to http://tempel.blankon.in

positional arguments:
```
  {language}              language of source code; bash c cpp css diff html
                          html+django ini java lua make perl php python rst ruby
                          sql text xml yaml
```

optional arguments:
```
  -h, --help            				          show this help message and exit
  -t TEXT, --text TEXT                    from text
  -s STREAM, --stream STREAM              from stdin
  -v, --version         				          show program's version number and exit
```

#### TODO:
1. Create pypi package
2. Create GUI app

### License MIT
Project License can be found [here](LICENSE.md).


text:
<?php
/*
Section: about
Language: German
*/

$translations = array(
    'h1' => 'Das Projekt db4free.net',

    'p1' => 'In diesem Bereich können Sie Ihren Datenbank-Account anlegen, die Daten bearbeiten und den Account wieder löschen.',

    'h2' => 'Was ist das Besondere?',

    'p2' => 'Der Zweck unseres Projekts ist, dass wir die Erfordernisse für Entwickler und Tester von aktuellen Versionen von MySQL erfüllen möchten. Durch regelmäßige Updates erhalten Sie zum Beispiel die Möglichkeit, Ihre Website mit einer aktuellen MySQL-Version zu testen.',

    'h3' => 'Registrieren Sie Ihre kostenlose MySQL Datenbank »',
);
?>


text:
layout: post
date: '2016-10-04'
title: "PROM DRESSES La Femme 16541 Short Chiffon Prom Dress"
category: PROM DRESSES
tags: [PROM DRESSES]
---
### PROM DRESSES La Femme 16541 Short Chiffon Prom Dress
Just **$406.99**
###

Buy it: [https://www.eudances.com/en/prom-dresses/1062-la-femme-16541-short-chiffon-prom-dress.html](https://www.eudances.com/en/prom-dresses/1062-la-femme-16541-short-chiffon-prom-dress.html)


text:
<?php
namespace Gumdrop\Tests;

require_once __DIR__ . '/../TestCase.php';
require_once __DIR__ . '/../../Gumdrop/SiteConfiguration.php';

class SiteConfiguration extends \Gumdrop\Tests\TestCase
{
    public function testSiteConfigurationThrowsExceptionOnMissingConfigurationFile()
    {
        $FSTestHelper = new \FSTestHelper\FSTestHelper();
        $FSTestHelper->create(
            array(
                'folders' => array(),
                'files' => array(
                    array(
                        'path' => 'file.md',
                        'content' => ''
                    )
                )
            )
        );
        $this->setExpectedException(
            'Gumdrop\Exception',
            'Could not find the configuration file at ' . $FSTestHelper . '/conf.json'
        );

        new \Gumdrop\SiteConfiguration($FSTestHelper);
    }

    public function testSiteConfigurationThrowsExceptionOnInvalidConfiguration()
    {
        $FSTestHelper = new \FSTestHelper\FSTestHelper();
        $FSTestHelper->create(
            array(
                'folders' => array(),
                'files' => array(
                    array(
                        'path' => 'file.md',
                        'content' => ''
                    ),
                    array(
                        'path' => 'conf.json',
                        'content' => 'invalid_json'
                    )
                )
            )
        );
        $this->setExpectedException(
            'Gumdrop\Exception',
            'Invalid configuration in ' . $FSTestHelper . '/conf.json'
        );

        new \Gumdrop\SiteConfiguration($FSTestHelper);
    }
}


text:
(function () {
    angular.module('gantt').factory('GanttProjectsDictionaryService', GanttProjectsDictionaryService);

    function GanttProjectsDictionaryService() {
        var dictionary = new IDDictionary(ProjectIDProvider);
        return dictionary;

        function ProjectIDProvider(project){
            return project.id;
        }
    }
})();


text:
package com.corosus.game.client.assets;

/**
 * Created by kickban on 7/29/14.
 */
public class JSONBaseRenderable {
}


text:
package org.jetbrains.plugins.scala.codeInspection.syntacticSimplification

import com.intellij.codeInspection.{ProblemHighlightType, ProblemsHolder}
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.ScalaBundle
import org.jetbrains.plugins.scala.codeInspection.AbstractInspection
import org.jetbrains.plugins.scala.extensions.PsiElementExt
import org.jetbrains.plugins.scala.lang.psi.api.base.{ScConstructor, ScPrimaryConstructor}
import org.jetbrains.plugins.scala.lang.psi.api.expr.{ScExpression, ScMethodCall, ScNewTemplateDefinition, ScReferenceExpression}
import org.jetbrains.plugins.scala.lang.psi.api.statements.{ScFunctionDefinition, ScTypeAlias}
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.templates.ScClassParents
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScClass
import org.jetbrains.plugins.scala.lang.psi.impl.ScalaPsiElementFactory
import org.jetbrains.plugins.scala.lang.resolve.ScalaResolveResult

/**
  * mattfowler
  * 5/7/2016
  */
class RedundantNewCaseClassInspection extends AbstractInspection("RedundantNewCaseClass", "Redundant New on Case Class") {

  override def actionFor(holder: ProblemsHolder): PartialFunction[PsiElement, Any] = {
    case newTemplate: ScNewTemplateDefinition if !newTemplate.extendsBlock.isAnonymousClass =>
      if (hasRedundantNew(newTemplate)) {
        holder.registerProblem(newTemplate.getFirstChild, ScalaBundle.message("new.on.case.class.instantiation.redundant"),
          ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new RemoveNewQuickFix(newTemplate))
      }
  }

  private def hasRedundantNew(newTemplate: ScNewTemplateDefinition): Boolean = {
    val constructor = getConstructorFromTemplate(newTemplate)
    val resolvedConstructor = resolveConstructor(constructor)

    isApplyDefinedOnCaseClass(newTemplate) && isCreatingSameType(newTemplate) && constructorCallHasArgumentList(constructor) &&
      isProblemlessPrimaryConstructorOfCaseClass(resolvedConstructor) && !isTypeAlias(resolvedConstructor)
  }

  private def isApplyDefinedOnCaseClass(newTemplate: ScNewTemplateDefinition): Boolean = {
    val extendsText = newTemplate.extendsBlock.getText
    val expression = ScalaPsiElementFactory.createExpressionWithContextFromText(extendsText, newTemplate.getContext, newTemplate)
    val reference = getDeepestInvokedReference(expression)

    val syntheticNavigationElement = reference.flatMap(_.advancedResolve.map(_.element match {
      case a: ScFunctionDefinition => a.getSyntheticNavigationElement
      case _ => None
    }))

    syntheticNavigationElement.flatten.exists {
      case _: ScClass => true
      case _ => false
    }
  }

  private def getDeepestInvokedReference(resolved: ScExpression): Option[ScReferenceExpression] = {
    resolved match {
      case method: ScMethodCall => method.deepestInvokedExpr match {
        case deepestRef: ScReferenceExpression => Some(deepestRef)
        case _ => None
      }
      case _ => None
    }
  }

  /**
    * Determines if the type of the extends block is the same as the type of the new template type.
    * This prevents us from incorrectly displaying a warning when creating anonymous classes or instances with
    * mixin traits.
    */
  private def isCreatingSameType(newTemplate: ScNewTemplateDefinition): Boolean = {
    newTemplate.extendsBlock.templateParents.exists(_.typeElementsWithoutConstructor.isEmpty)
  }

  private def isTypeAlias(maybeResolveResult: Option[ScalaResolveResult]): Boolean = {
    maybeResolveResult.map(_.getActualElement).exists {
      case _: ScTypeAlias => true
      case _ => false
    }
  }

  private def getConstructorFromTemplate(newTemplate: ScNewTemplateDefinition): Option[ScConstructor] = {
    newTemplate.extendsBlock.firstChild.flatMap {
      case parents: ScClassParents => parents.constructor
      case _ => None
    }
  }

  private def constructorCallHasArgumentList(maybeConstructor: Option[ScConstructor]): Boolean = {
    maybeConstructor.flatMap(_.args).isDefined
  }

  private def resolveConstructor(maybeConstructor: Option[ScConstructor]): Option[ScalaResolveResult] = {
    for {
      constructor <- maybeConstructor
      ref <- constructor.reference
      resolved <- ref.advancedResolve
    } yield {
      resolved
    }
  }

  private def isProblemlessPrimaryConstructorOfCaseClass(maybeResolveResult: Option[ScalaResolveResult]): Boolean = {
    maybeResolveResult
      .filter(_.problems.isEmpty)
      .map(_.element)
      .exists {
        case ScPrimaryConstructor.ofClass(clazz) => clazz.isCase
        case _ => false
      }
  }
}


text:
package edu.duke.cabig.catrip.gui.common;

import java.awt.Image;
import java.util.*;

/**
 * ClassBean represents a Class as defined in UMLClass element of Domain Model Metadata.
 *
 * @author Sanjeev Agarwal
 */
public class ClassBean{

    private String id="";
    private String version="";
    private ArrayList<AttributeBean> attributes = new ArrayList(50);
    private HashMap attributesMap = new HashMap(50);
    private ArrayList<String> associatedClasses= new ArrayList(20); // from the domain model..
    private String packageName="";
    private String className="";
    private String description="";

    // set the icon based on the service name.
    private Image icon;// = "edu/duke/cabig/catrip/gui/dnd/resources/caCore.png";
    private String serviceName="";
    private String serviceUrl="";
    private String domainModelId="";
    private String CDEName="";

    // ----- DCQL helper attributes ---- //

    private boolean needImpl=false;

    private int numNotNullAttributes = 0;
    private ArrayList<AttributeBean> notNullAttributes = new ArrayList();

    private boolean hasAssociations = false;
    private ArrayList<ClassBean> associations = new ArrayList(20);
    private HashMap associationRoleNameMap = new HashMap(20);

    private ArrayList<ForeignAssociationBean> foreignAssociations = new ArrayList(10);
    private boolean hasForeignAssociations = false;
    // ----- DCQL helper attributes ---- //

    // ---- UML Generalization Collection attributes ----//
    private String superClassRefId="";
    private String superClassName="";
    private ArrayList<String> superClassAssociatedClassList = new ArrayList(20);
    private ArrayList<String> subClassIds = new ArrayList(100);
    // ---- UML Generalization Collection attributes ----//

    // ------------- AND / OR group attributes --------------- //
    private ArrayList<ClassBeanGroup> groups = new ArrayList(20);
    private HashMap groupIdMap = new HashMap();

    // ------------- AND / OR group attributes --------------- //

    /** Creates a new instance of ClassBean */
    public ClassBean() {
    }

    public String getId() {
        return id;
    }

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

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public ArrayList<AttributeBean> getAttributes() {
        return attributes;
    }

    public void setAttributes(ArrayList<AttributeBean> attributes) {
        this.attributes = attributes;
    }

    /** All associated classes as defined in the domain model */
    public ArrayList<String> getAssociatedClasses() {
        return associatedClasses;
    }

    /** All associated classes as defined in the domain model */
    public void setAssociatedClasses(ArrayList<String> associatedClasses) {
        this.associatedClasses = associatedClasses;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Image getIcon() {
        return icon;
    }

    public void setIcon(Image icon) {
        this.icon = icon;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getCDEName() {
        return CDEName;
    }

    public void setCDEName(String CDEName) {
        this.CDEName = CDEName;
    }

    public String getDomainModelId() {
        return domainModelId;
    }

    public void setDomainModelId(String domainModelId) {
        this.domainModelId = domainModelId;
    }

    /** Add to the attribute list of the class. */
    public void addAttribute(AttributeBean ab){
        getAttributes().add(ab);
        addToAttributesMap(ab);
    }

    /** Add to the attribute list of the class. */
    public void addUniqueAttribute(AttributeBean ab){
        if (!getAttributesMap().containsKey(ab.getAttributeName())){
            addAttribute(ab);
        }
    }

    public HashMap getAttributesMap() {
        return attributesMap;
    }

    public void addToAttributesMap(AttributeBean ab){
        this.attributesMap.put(ab.getAttributeName(), ab);
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    /** add to the list of associated classes. Associations are defined in domain model. */
    public void addAssociatedClass(String refId){
        if (!associatedClasses.contains(refId)){
            associatedClasses.add(refId);
        }
    }

    /** this is to display the tree node name as class name only. */
    public String toString() {
        return getClassName();
    }

    /** used to clone the class object when it is dropped on the graph.
     * The cloned object contains all the property of the original class object except the values of the Attribute.
     */
    public ClassBean clone(){

        ClassBean cBean = new ClassBean();
        cBean.setAssociatedClasses(getAssociatedClasses()); // associated class will be same for all clones.

        // clone attributes also..
        // this is necessary as different graph nodes of the same class may have different attribute value
        ArrayList<AttributeBean> attributeClones = new ArrayList(50);
        ArrayList attributes = getAttributes();
        for (int k = 0; k < attributes.size(); k++) {
            AttributeBean aBean = ((AttributeBean)attributes.get(k)).clone();
            attributeClones.add(aBean);
        }
        cBean.setAttributes(attributeClones);

        cBean.setCDEName(getCDEName());
        cBean.setClassName(getClassName());
        cBean.setDescription(getDescription());
        cBean.setDomainModelId(getDomainModelId());
        cBean.setIcon(getIcon());
        cBean.setId(getId());
        cBean.setPackageName(getPackageName());
        cBean.setServiceName(getServiceName());
        cBean.setServiceUrl(getServiceUrl());
        cBean.setVersion(getVersion());
        cBean.removeAllUniqueAssociations();
        //cBean.setAssociationRoleNameMap(this.getAssociationRoleNameMap()); It was removed to solve bug: 4330. It needs to be enabled to fix bug: 4667
        cBean.needImpl(needImpl());

        return cBean;
    }

    public ClassBean clone2(){
        ClassBean cBean = clone();
        cBean.setAssociationRoleNameMap(this.getAssociationRoleNameMap());  // bug Id : 4667.
        return cBean;
    }

    /** The service URL of the grid service. Required in DCQL generation from the class instance. */
    public String getServiceUrl() {
        return serviceUrl;
    }

    public void setServiceUrl(String serviceUrl) {
        this.serviceUrl = serviceUrl;
    }

    public String getFullyQualifiedName() {
//        return getPackageName()+"."+getClassName();
        // TODO - change this in future.. for the demo only..
        if (needImpl()){
            return getPackageName()+".impl."+getClassName()+"Impl";
        } else {
            return getPackageName()+"."+getClassName();
        }
    }

    /** The map of the associated classes and corresponding roleNames.
     * Built from the Domain model element "exposedUMLAssociationCollection"
     */
    public HashMap getAssociationRoleNameMap() {
        return this.associationRoleNameMap;
    }

    public void setAssociationRoleNameMap(HashMap associationRoleNameMap) {
        this.associationRoleNameMap = associationRoleNameMap;
    }

    /** get the role name for a particular associated class. */
    public String getAssociationRoleName(String classId) {
        String roleName = (String)this.getAssociationRoleNameMap().get(classId);
        return roleName;
    }

    /** set the role name for a particular associated class and add to the map. */
    public void addAssociationRoleName(String classId, String associationRoleName) {
        if (!this.getAssociationRoleNameMap().containsKey(classId)){
            this.getAssociationRoleNameMap().put(classId, associationRoleName) ;
        }
    }

    // --------- helper methods for generating DCQL ------------------ //

    /** return true of the class object contains attributes without null values  */
    public boolean hasNotNullAttributes(){
        boolean result = false;
        ArrayList attributes = getAttributes();
        for (int i = 0; i < attributes.size(); i++) {
            AttributeBean aBean = (AttributeBean)attributes.get(i);
            if (!aBean.isNull()){
                numNotNullAttributes++;
                result = true;
            }
        }
        return result;
    }

    /** Get the list of attributes with values. */
    public ArrayList<AttributeBean> getNonNullAttributes(){
        notNullAttributes = new ArrayList(numNotNullAttributes);
        ArrayList attributes = getAttributes();
        for (int i = 0; i < attributes.size(); i++) {
            AttributeBean aBean = (AttributeBean)attributes.get(i);
            if (!aBean.isNull()){
                notNullAttributes.add(aBean);
            }

        }
        return notNullAttributes;
    }

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

    /** Check for any association created by linking two nodes on the graph via class-link. */
    public boolean hasAssociations(){
        return hasAssociations;
    }
    public void setHasAssociations(boolean has){
        this.hasAssociations = has;
    }
    /** the list that contains the list of associations created on the graph. */
    public void addAssociation(ClassBean ass){
        associations.add(ass);
//        numAssociations++;
    }

    public ArrayList getAssociations(){
        return associations;
    }

    // -----------------------------------
    /** Check for any foreign association created by linking two nodes on the graph via CDE link  */
    public boolean hasForeignAssociations(){
        return hasForeignAssociations;
    }
    public void setHasForeignAssociations(boolean has){
        this.hasForeignAssociations = has;
    }
    /** add to the list that contains the list of foreign associations created on the graph. */
    public void addForeignAssociation(ForeignAssociationBean fass){
        foreignAssociations.add(fass);
    }

    /** the list that contains the list of foreign associations created on the graph. */
    public ArrayList getForeignAssociations(){
        return foreignAssociations;
    }
    // --------- helper methods for generating DCQL ------------------ //

    /** method created for the "impl" problem in the caCORE SDK generated code. */
    public void needImpl(boolean need){
        this.needImpl = need;
    }
    /** method created for the "impl" problem in the caCORE SDK generated code. */
    public boolean needImpl(){
        return needImpl;
    }

    // --------------- methods for simple GUI.. ------------------ //

    /** Filter the attributes based on the  displaybleAttributes element of the xml..*/
    public void filterAttributes(String[] displaybleAttributes){
        ArrayList attributes = getAttributes();
        ArrayList displaybleAttributesList = new ArrayList(15);
        try{
            for (int j = 0; j < displaybleAttributes.length; j++) {
                String attribute = displaybleAttributes[j];
                for (int i = 0; i < attributes.size(); i++) {
                    AttributeBean aBean = (AttributeBean)attributes.get(i);
                    if (aBean.getAttributeName().equalsIgnoreCase(attribute)){
                        displaybleAttributesList.add(aBean);
                    }
                }

            }

        } catch (Exception e){
            e.printStackTrace();
        }
        this.setAttributes(displaybleAttributesList);

    }

    /** to add the associations only once.. used in Simple gui  */
    public void addUniqueForeignAssociation(ForeignAssociationBean fass){
        boolean alreadyAdded = foreignAssociations.contains(fass); // this thing checks the equals() method of this bean..
        if (!alreadyAdded){   // create a Map and than check in that....
            foreignAssociations.add(fass);
        }
    }

    /** to add the associations only once.. used in Simple gui  */
    public void addUniqueAssociation(ClassBean ass){
        // check if associationRoleNameMap already contains the class.. do not add duplicates...
        boolean alreadyAdded = (associationRoleNameMap.containsKey(ass.getId()) );
        if (!alreadyAdded){
            associations.add(ass);
        }
    }

    public void removeAllUniqueAssociations(){
        hasAssociations = false;
        associations = new ArrayList(20);
//        associationRoleNameMap = new HashMap(20);
        foreignAssociations = new ArrayList(10);
        hasForeignAssociations = false;
    }

    public void print(){
        ArrayList attributes = getAttributes();
        for (int i = 0; i < attributes.size(); i++) {
            AttributeBean aBean = (AttributeBean)attributes.get(i);
            System.out.println("Class CDE:"+getCDEName()+":Attribute name:"+aBean.getAttributeName() + ": Attribute CDE name:" + aBean.getCDEName()+":");
        }
    }

    public void printAttributes(){
        ArrayList attributes = getNonNullAttributes();
        for (int i = 0; i < attributes.size(); i++) {
            AttributeBean aBean = (AttributeBean)attributes.get(i);
            System.out.println("Class Name:"+getFullyQualifiedName()+": Attribute CDE name:" + aBean.getCDEName()+":Attribute value:"+aBean.getAttributeValue() );
        }
    }

    public void printAssociations(){

        if (hasAssociations()){
            ArrayList list = getAssociations();
            for (int i = 0; i < list.size(); i++) {
                ClassBean cBean = (ClassBean)list.get(i);
                System.out.println(getClassName() + " --"+getAssociationRoleName(cBean.getId())+"-> " +cBean.getClassName() );
                cBean.printAssociations();
            }
        }

        if (hasForeignAssociations()){
            ArrayList list = getForeignAssociations();
            for (int i = 0; i < list.size(); i++) {
                ForeignAssociationBean fBean = (ForeignAssociationBean)list.get(i);
                System.out.println(getClassName() +"-:-"+ fBean.getLeftObj().getClassName()+":"+fBean.getLeftProperty()+" ---> " +fBean.getRighObj().getClassName()+":"+fBean.getRightProperty());
                fBean.getRighObj().printAssociations();
            }
        }

    }

    /** Methods used in generalization section of the domain model xml. */

    public String getSuperClassRefId() {
        return superClassRefId;
    }

    public void setSuperClassRefId(String superClassRefId) {
        this.superClassRefId = superClassRefId;
    }

    public ArrayList<String> getSuperClassAssociatedClassList() {
        return superClassAssociatedClassList;
    }

    public void setSuperClassAssociatedClassList(ArrayList<String> superClassAssociatedClassList) {
        this.superClassAssociatedClassList = superClassAssociatedClassList;
    }

    public void addSuperClassAssociatedClassList(String superClassAssociatedClass) {

        boolean alreadyAdded = superClassAssociatedClassList.contains(superClassAssociatedClass);
        if (!alreadyAdded){
            this.superClassAssociatedClassList.add(superClassAssociatedClass);
        }
    }

    public String getSuperClassName() {
        return superClassName;
    }

    public void setSuperClassName(String superClassName) {
        this.superClassName = superClassName;
    }

    public ArrayList<String> getSubClassIds() {
        return subClassIds;
    }
    public void setSubClassIds(ArrayList<String> subClassIds) {
        this.subClassIds = subClassIds;
    }
    public void addSubClassId(String subClassId) {
        boolean alreadyAdded = getSubClassIds().contains(subClassId);
        if (!alreadyAdded){
            getSubClassIds().add( subClassId );
        }

    }

    //------------------- methods for AND / OR grouping ----------------------------

    public String getUniqueId(){
        // this returns the instance ref for the object which is unique for that jvm instance..
        return getClass().getName() + "@" + Integer.toHexString(hashCode());
    }

    public boolean equals(Object obj){
        boolean equal = false;
        if (obj instanceof ClassBean){
            ClassBean cBean = (ClassBean) obj;
            String thisRef = getUniqueId();
            String objRef = cBean.getUniqueId();
            equal = thisRef.equals(objRef); // this compares the two references.. and will be true only if that is same object..
        }
        return equal;
    }

    //------------------- methods for AND / OR grouping ----------------------------

    public ArrayList<ClassBeanGroup> getGroups() {
        return groups;
    }

    public void setGroups(ArrayList<ClassBeanGroup> groups) {
        this.groups = groups;
    }

    public boolean hasGroups() {
        return (groups.size()>0)?true:false;
    }

    public void addGroup(ClassBeanGroup group) {
        if (!hasGroup(group)){
            getGroups().add(group);
            groupIdMap.put(group.getGroupId(), group);
        }
    }

    public boolean hasGroup(ClassBeanGroup group) {
        return groupIdMap.containsKey(group.getGroupId());
    }
    public ClassBeanGroup getGroupById(String id) {
        return (ClassBeanGroup)groupIdMap.get(id);
    }

    // merge tow ClassBean instances..  child will be merged in parent.
    public static void mergeClassBeans(ClassBean parent, ClassBean child){
        // child has no not-null attributes and no associations..  don't do anything..
        boolean hasAttributes = child.hasNotNullAttributes();
        boolean hasAssociations = child.hasAssociations();
        boolean hasGroups = child.hasGroups();

        if (hasGroups){
            ArrayList groups = child.getGroups();
            int groupNums = groups.size();

            for (int i = 0; i < groupNums; i++) {
                ClassBeanGroup group = (ClassBeanGroup)groups.get(i);
                boolean parentHasSameGroup = parent.hasGroup(group);
                if (parentHasSameGroup){
                    // set associations and attributes in that.. right now just set attributes..
                    // use group merge stuff here... create a method in group class.
                    ArrayList attList = group.getAttributeList();
                    for (int j = 0; j < attList.size(); j++) {
                        parent.getGroupById(group.getGroupId()).add((AttributeBean)attList.get(j));
                    }

                }else {
                    parent.addGroup(group);
                }

            }

        }

        if (!hasAttributes && !hasAssociations){
            // do nothing..
        }

        // child has  not-null attributes but no associations..
        // TODO - have to watch out for duplicate Attributes here...
        // you have have attributes with same or different values.. so you may have to group them as well...
        if (hasAttributes && !hasAssociations){
            // set the attributes in parent..
            ArrayList attributes = child.getAttributes(); // list of attributes..
            for (int i = 0; i < attributes.size(); i++) {
                parent.addAttribute((AttributeBean)attributes.get(i));
            }
        }

        // child has no not-null attributes and only associations..
        else if (!hasAttributes && hasAssociations){
            // set the same associations in the parent also..
            ArrayList associations = child.getAssociations(); // list of associations..
            for (int i = 0; i < associations.size(); i++) {
                ClassBean cBeanTmp = (ClassBean)associations.get(i);
                parent.addUniqueAssociation(cBeanTmp);
                parent.addAssociationRoleName(cBeanTmp.getId(), child.getAssociationRoleName(cBeanTmp.getId()));
            }

            // check for the foreign associations as well...
            ArrayList foreignAssociations = child.getForeignAssociations(); // list of associations..
            for (int i = 0; i < foreignAssociations.size(); i++) {
                ForeignAssociationBean faBean = (ForeignAssociationBean)foreignAssociations.get(i);
                parent.addUniqueForeignAssociation(faBean);
            }

        }

        // child has not-null attributes and associations..  set both in the parent also..
        // check for the foreign associations as well...
        else if (hasAttributes && hasAssociations){
            // set the attributes in parent..
            ArrayList attributes = child.getAttributes(); // list of attributes..
            for (int i = 0; i < attributes.size(); i++) {
                parent.addAttribute((AttributeBean)attributes.get(i));
            }

            // set the same associations in the parent also..
            ArrayList associations = child.getAssociations(); // list of associations..
            for (int i = 0; i < associations.size(); i++) {
                ClassBean cBeanTmp = (ClassBean)associations.get(i);
                parent.addUniqueAssociation(cBeanTmp);
                parent.addAssociationRoleName(cBeanTmp.getId(), child.getAssociationRoleName(cBeanTmp.getId()));
            }

            // check for the foreign associations as well...
            ArrayList foreignAssociations = child.getForeignAssociations(); // list of associations..
            for (int i = 0; i < foreignAssociations.size(); i++) {
                ForeignAssociationBean faBean = (ForeignAssociationBean)foreignAssociations.get(i);
                parent.addUniqueForeignAssociation(faBean);
            }
        }

    }

    //------------------- methods for AND / OR grouping ----------------------------

    public static HashMap cloneClassBeanMap(HashMap map){
        HashMap clonedMap = new HashMap(map.size());
        Object[] keys = (Object[])map.keySet().toArray();
        for (int i = 0; i < keys.length; i++) {
            ClassBean cBean = (ClassBean)map.get(keys[i]);
            clonedMap.put(keys[i], cBean.clone());
        }
        return clonedMap;
    }

}


text:
package com.tyrfing.games.id17.networking;

import java.util.List;

import com.tyrfing.games.id17.houses.House;
import com.tyrfing.games.id17.world.World;
import com.tyrlib2.networking.Connection;

public class JoinIntrigue extends NetworkMessage {

	/**
	 *
	 */
	private static final long serialVersionUID = 3779588275136139622L;

	public final short supporterID;
	public final short supportedID;

	/**
	 *
	 * @param supporterID
	 * @param supportedID
	 */

	public JoinIntrigue(int supporterID, int supportedID) {
		this.supportedID = (short) supportedID;
		this.supporterID = (short) supporterID;
	}

	@Override
	public void process(Connection c) {
		List<House> houses = World.getInstance().getHouses();

		if (houses.get(supportedID).intrigueProject != null) {
			houses.get(supportedID).intrigueProject.addSupporter(houses.get(supporterID));
		}
	}
}


text:
// LANG: "lv", ENCODING: UTF-8
// Author: Mihai Bazon, http://dynarch.com/mishoo
// Translated by: Janis Klavins, <janis.klavins@devia.lv>

{
  "Bold": "Trekniem burtiem",
  "Italic": "Kursîvâ",
  "Underline": "Pasvîtrots",
  "Strikethrough": "Pârsvîtrots",
  "Subscript": "Novietot zem rindas",
  "Superscript": "Novietot virs rindas",
  "Justify Left": "Izlîdzinât pa kreisi",
  "Justify Center": "Izlîdzinât centrâ",
  "Justify Right": "Izlîdzinât pa labi",
  "Justify Full": "Izlîdzinât pa visu lapu",
  "Ordered List": "Numurçts saraksts",
  "Bulleted List": "Saraksts",
  "Decrease Indent": "Samazinât atkâpi",
  "Increase Indent": "Palielinât atkâpi",
  "Font Color": "Burtu krâsa",
  "Background Color": "Fona krâsa",
  "Horizontal Rule": "Horizontâla atdalîtâjsvîtra",
  "Insert Web Link": "Ievietot hipersaiti",
  "Insert/Modify Image": "Ievietot attçlu",
  "Insert Table": "Ievietot tabulu",
  "Toggle HTML Source": "Skatît HTML kodu",
  "Enlarge Editor": "Palielinât Rediìçtâju",
  "About this editor": "Par ðo rediìçtâju",
  "Help using editor": "Rediìçtâja palîgs",
  "Current style": "Patreizçjais stils",
  "Undoes your last action": "Atcelt pçdçjo darbîbu",
  "Redoes your last action": "Atkârtot pçdçjo darbîbu",
  "Cut selection": "Izgriezt iezîmçto",
  "Copy selection": "Kopçt iezîmçto",
  "Paste from clipboard": "Ievietot iezîmçto",
  "OK": "Labi",
  "Cancel": "Atcelt",
  "Path": "Ceïð",
  "You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG.": "Jûs patlaban darbojaties TEKSTA REÞÎMÂ. Lai pârietu atpakaï uz GRAFISKO REÞÎMU (WYSIWIG), lietojiet [<>] pogu."
}


text:
/* Master.js
KC3改 Master Dataset

Represents master data from api_start2
Indexes significant data for easier access
Saves and loads significant data for future use
*/
(function(){
	"use strict";

	window.KC3Master = {
		available: false,

		_raw: {},

		init: function( raw ){
			this.load();

			if(typeof raw != "undefined"){
				return this.processRaw( raw );
			}

			this.updateRemodelTable();
			return false;
		},

		/* Process raw data, fresh from API
		-------------------------------------*/
		processRaw :function(raw){
			var beforeCounts = false;
			if( Object.size(this._raw) > 0) {
				beforeCounts = [ Object.size(this._raw.ship), Object.size(this._raw.slotitem) ];
			}
			this._raw.newShips = this._raw.newShips || {};
			this._raw.newItems = this._raw.newItems || {};

			var
				self = this,
				diff = {"ship":"newShips", "slotitem":"newItems"},
				oraw = $.extend({}, this._raw),
				newCounts = [0, 0],
				ctime = Date.now();

			// Loops through each api_mst_
			Object.keys(raw).forEach(function(mst_name) {
				var mst_data = raw[mst_name];
				var short_mst_name = mst_name.replace("api_mst_", "");

				// If the current master item is an array
				if (Object.prototype.toString.call(mst_data) === '[object Array]') {
					// Add the master item to local raw, as empty object
					self._raw[short_mst_name] = {};

					// Store the contents into the new local raw object
					mst_data.map(function(elem, i){
						var elem_key = elem.api_id || i;
						// Add elements to local raw, with their IDs as indexes
						// Elements have no IDs, store them with their original indexes
						self._raw[short_mst_name][elem_key] = elem;

						if(!!diff[short_mst_name] && !!oraw[short_mst_name]) {
							if(!oraw[short_mst_name][elem_key]) {
								self._raw[diff[short_mst_name]][elem_key] = ctime;
							} else {
								delete self._raw[diff[short_mst_name]][elem_key];
							}
						}
					});
				}
			});

			this.updateRemodelTable();
			this.save();
			this.available = true;

			// If there was a count before this update, calculate how many new
			if (beforeCounts) {
				return [
					Object.size(this._raw.ship) - beforeCounts[0],
					Object.size(this._raw.slotitem) - beforeCounts[1]
				];
			} else {
				return [0,0];
			}
		},

		/* Data Access
		-------------------------------------*/
		ship :function(id){
			return !this.available ? false : this._raw.ship[id] || false;
		},

		all_ships :function(){
			return this._raw.ship || {};
		},

		new_ships :function(){
			return this._raw.newShips || {};
		},

		remove_new_ship :function(id){
			delete this._raw.newShips[id];
		},

		graph :function(id){
			return !this.available ? false : this._raw.shipgraph[id] || false;
		},

		graph_file :function(filename){
			var self = this;
			return !this.available ? false : Object.keys(this._raw.shipgraph).filter(function(key){
				return self._raw.shipgraph[key].api_filename === filename;
			})[0];
		},

		slotitem :function(id){
			return !this.available ? false : this._raw.slotitem[id] || false;
		},

		all_slotitems :function(){
			return this._raw.slotitem || {};
		},

		new_slotitems :function(){
			return this._raw.newItems || {};
		},

		remove_new_slotitem :function(id){
			delete this._raw.newItems[id];
		},

		stype :function(id){
			return !this.available ? false : this._raw.stype[id] || false;
		},
		/* Save to localStorage
		-------------------------------------*/
		save :function(){
			localStorage.raw = JSON.stringify(this._raw);
		},

		/* Load from localStorage
		-------------------------------------*/
		load :(function(){
			var keyStor = {
				raw: function fnlRaw(data){
					this._raw = data;
					return true;
				},
				master: function fnlMaster(data){
					this._raw.ship = data.ship;
					this._raw.shipgraph = data.graph || {};
					this._raw.slotitem = data.slotitem;
					this._raw.stype = data.stype;
					this._raw.newShips = data.newShips || {};
					this._raw.newItems = data.newItems || {};
					return true;
				},
			};

			function fnLoad(){
				/*jshint validthis:true*/
				this.available = false;
				for(var storType in keyStor) {
					if(this.available) continue;
					if(typeof localStorage[storType] == 'undefined') continue;

					try {
						var tempRaw = JSON.parse(localStorage[storType]);
						if(!tempRaw.ship) throw Error("Non-existing ship");

						this.available |= keyStor[storType].call(this,tempRaw);
						console.info("Loaded master: %c%s%c data","color:darkblue",storType,"color:initial");
					} catch (e) {
						console.error("Failed to process master: %s data",storType,e);/*RemoveLogging:skip*/
					}
				}
				return this.available;
			}

			return fnLoad;
		})(),

		/* Remodel Table Storage
		-------------------------------------*/
		removeRemodelTable :function(){
			var cShip,ship_id;
			for(ship_id in this._raw.ship) {
				cShip = this._raw.ship[ship_id];
				if(!cShip) { /* invalid API */ continue; }
				if(!cShip.api_buildtime) { /* unbuildable by API */ continue; }
				delete cShip.kc3_maxed;
				delete cShip.kc3_model;
				delete cShip.kc3_bship;
			}
		},
		updateRemodelTable :function(){
			var cShip,ccShip,remodList,ship_id,shipAry,modelLv,bship_id;
			this.removeRemodelTable();
			shipAry = Object.keys(this.all_ships());
			remodList = [];
			modelLv = 1;
			while(shipAry.length) {
				ship_id = parseInt(shipAry.shift());
				cShip = this._raw.ship[ship_id];

				// Pre-checks of the remodel table
				if(!cShip)               { /* invalid API */ continue; }
				if(!cShip.api_buildtime) { /* unbuildable by API */ continue; }

				/* proposed variable:
				  kc3 prefix variable -> to prevent overwriting what devs gonna say later on
					maxed flag -> is it the end of the cycle? is it returns to a cyclic model?
					model level -> mark the current model is already marked.
					base id -> base form of the ship
				*/
				cShip.api_aftershipid = Number(cShip.api_aftershipid);
				if(!!cShip.kc3_model)    { /* already checked ship */ modelLv = 1; continue; }
				if(cShip.api_name.indexOf("改") >= 0 && modelLv <= 1) { /* delays enumeration of the remodelled ship in normal state */ continue; }

				// Prepare remodel flag
				cShip.kc3_maxed = false;
				cShip.kc3_model = modelLv++; // 1 stands for base model
				cShip.kc3_bship = cShip.kc3_bship || ship_id;

				// Prepare salt list for every base ship that is not even a remodel
				// Only for enabled salt check
				if(
					(ConfigManager.info_salt) &&
					(ConfigManager.salt_list.indexOf(cShip.kc3_bship) < 0) &&
					(this._raw.newShips[cShip.kc3_bship])
				){
					ConfigManager.salt_list.push(cShip.kc3_bship);
				}

				// Check whether remodel is available and skip further processing
				if(!!cShip.api_afterlv) {
					shipAry.unshift(cShip.api_aftershipid);
					ccShip = this._raw.ship[cShip.api_aftershipid];
					ccShip.kc3_bship = cShip.kc3_bship;
					cShip.kc3_maxed = !!ccShip.kc3_model;
					continue;
				}
				// Finalize model data
				cShip.kc3_maxed = true;
				modelLv = 1;
			}
		}

	};

})();


text:
package com.sun.cdc.io.j2me.btl2cap;

import java.io.IOException;

import javax.microedition.io.Connection;

import com.intel.bluetooth.BluetoothConsts;
import com.intel.bluetooth.MicroeditionConnector;
import com.sun.cdc.io.ConnectionBaseInterface;

/**
 * This class is Proxy for btl2cap (L2CAP) Connection implementations used in WTK and MicroEmulator
 *
 *

 * Your application should not use this class directly.
 */
public class Protocol implements ConnectionBaseInterface {

	public Connection openPrim(String name, int mode, boolean timeouts) throws IOException {
		return MicroeditionConnector.open(BluetoothConsts.PROTOCOL_SCHEME_L2CAP + ":" + name, mode, timeouts);
	}

}


text:
var Errors = require('../../../../errors.js')
  , core = require('../../core.js')
  ;

module.exports = function(config) {
  var errors = [];

  if (!config.inst.match(core.FORMAT_REGEXPS.ipv4)) {
    var desc = 'not a valid dotted-quad IPv4 address';
    errors.push(new Errors.FormatValidationError(config.resolutionScope,
      config.instanceContext, 'format', 'ipv4', config.inst, desc));
  }

  return errors;
};


text:
from ds import *
# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
	def deleteDuplicates(self, head):
		dummy_head = ListNode(0)
		dummy_head.next = head
		if not head:
			return head
		while head.next:
			if head.val == head.next.val:
				tmp = head.next #free unused pointer
				head.next = head.next.next
				tmp = None
			else:
				head = head.next
		return dummy_head.next

#head = createLinkedList([])
head = createLinkedList([1,1,1,2,2,3,4,4])
printList(Solution().deleteDuplicates(head))
a = None


text:
#import "InspectorStartStop.h"
#import <objc/message.h>

@implementation InspectorStartStop

- (id) initWithSelection:(CCNode *)s andPropertyName:(NSString *)pn andDisplayName:(NSString *)dn andExtra:(NSString *)e
{
    self = [super initWithSelection:s andPropertyName:pn andDisplayName:dn andExtra:e];
    if (!self) return NULL;

    NSArray* bntNames = [self.displayName componentsSeparatedByString:@"|"];
    self.startName = [bntNames objectAtIndex:0];
    self.stopName = [bntNames objectAtIndex:1];

    NSArray* methodNames = [self.extra componentsSeparatedByString:@"|"];
    startMethod = [methodNames objectAtIndex:0];
    stopMethod = [methodNames objectAtIndex:1];

    return self;
}

- (IBAction)pressedStart:(id)sender
{
    SEL selector = NSSelectorFromString(startMethod);
    objc_msgSend(selection, selector);
}

- (IBAction)pressedStop:(id)sender
{
    SEL selector = NSSelectorFromString(stopMethod);
    objc_msgSend(selection, selector);
}

@end


text:
package org.apache.lucene.queryparser.flexible.standard.config;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.DateTools.Resolution;
import org.apache.lucene.queryparser.flexible.core.config.ConfigurationKey;
import org.apache.lucene.queryparser.flexible.core.config.FieldConfig;
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
import org.apache.lucene.queryparser.flexible.standard.StandardQueryParser;
import org.apache.lucene.queryparser.flexible.standard.processors.StandardQueryNodeProcessorPipeline;
import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.MultiTermQuery.RewriteMethod;

/**
 * This query configuration handler is used for almost every processor defined
 * in the {@link StandardQueryNodeProcessorPipeline} processor pipeline. It holds
 * configuration methods that reproduce the configuration methods that could be set on the old
 * lucene 2.4 QueryParser class.

 *
 * @see StandardQueryNodeProcessorPipeline
 */
public class StandardQueryConfigHandler extends QueryConfigHandler {

  /**
   * Class holding keys for StandardQueryNodeProcessorPipeline options.
   */
  final public static class ConfigurationKeys  {

    /**
     * Key used to set whether position increments is enabled
     *
     * @see StandardQueryParser#setEnablePositionIncrements(boolean)
     * @see StandardQueryParser#getEnablePositionIncrements()
     */
    final public static ConfigurationKey<Boolean> ENABLE_POSITION_INCREMENTS = ConfigurationKey.newInstance();

    /**
     * Key used to set whether expanded terms should be expanded
     *
     * @see StandardQueryParser#setLowercaseExpandedTerms(boolean)
     * @see StandardQueryParser#getLowercaseExpandedTerms()
     */
    final public static ConfigurationKey<Boolean> LOWERCASE_EXPANDED_TERMS = ConfigurationKey.newInstance();

    /**
     * Key used to set whether leading wildcards are supported
     *
     * @see StandardQueryParser#setAllowLeadingWildcard(boolean)
     * @see StandardQueryParser#getAllowLeadingWildcard()
     */
    final public static ConfigurationKey<Boolean> ALLOW_LEADING_WILDCARD = ConfigurationKey.newInstance();

    /**
     * Key used to set the {@link Analyzer} used for terms found in the query
     *
     * @see StandardQueryParser#setAnalyzer(Analyzer)
     * @see StandardQueryParser#getAnalyzer()
     */
    final public static ConfigurationKey<Analyzer> ANALYZER = ConfigurationKey.newInstance();

    /**
     * Key used to set the default boolean operator
     *
     * @see StandardQueryParser#setDefaultOperator(org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.Operator)
     * @see StandardQueryParser#getDefaultOperator()
     */
    final public static ConfigurationKey<Operator> DEFAULT_OPERATOR = ConfigurationKey.newInstance();

    /**
     * Key used to set the default phrase slop
     *
     * @see StandardQueryParser#setPhraseSlop(int)
     * @see StandardQueryParser#getPhraseSlop()
     */
    final public static ConfigurationKey<Integer> PHRASE_SLOP = ConfigurationKey.newInstance();

    /**
     * Key used to set the {@link Locale} used when parsing the query
     *
     * @see StandardQueryParser#setLocale(Locale)
     * @see StandardQueryParser#getLocale()
     */
    final public static ConfigurationKey<Locale> LOCALE = ConfigurationKey.newInstance();

    final public static ConfigurationKey<TimeZone> TIMEZONE = ConfigurationKey.newInstance();

    /**
     * Key used to set the {@link RewriteMethod} used when creating queries
     *
     * @see StandardQueryParser#setMultiTermRewriteMethod(org.apache.lucene.search.MultiTermQuery.RewriteMethod)
     * @see StandardQueryParser#getMultiTermRewriteMethod()
     */
    final public static ConfigurationKey<MultiTermQuery.RewriteMethod> MULTI_TERM_REWRITE_METHOD = ConfigurationKey.newInstance();

    /**
     * Key used to set the fields a query should be expanded to when the field
     * is null
     *
     * @see StandardQueryParser#setMultiFields(CharSequence[])
     * @see StandardQueryParser#getMultiFields(CharSequence[])
     */
    final public static ConfigurationKey<CharSequence[]> MULTI_FIELDS = ConfigurationKey.newInstance();

    /**
     * Key used to set a field to boost map that is used to set the boost for each field
     *
     * @see StandardQueryParser#setFieldsBoost(Map)
     * @see StandardQueryParser#getFieldsBoost()
     */
    final public static ConfigurationKey<Map<String,Float>> FIELD_BOOST_MAP = ConfigurationKey.newInstance();

    /**
     * Key used to set a field to {@link Resolution} map that is used
     * to normalize each date field value.
     *
     * @see StandardQueryParser#setDateResolutionMap(Map)
     * @see StandardQueryParser#getDateResolutionMap()
     */
    final public static ConfigurationKey<Map<CharSequence, DateTools.Resolution>> FIELD_DATE_RESOLUTION_MAP = ConfigurationKey.newInstance();

    /**
     * Key used to set the {@link FuzzyConfig} used to create fuzzy queries.
     *
     * @see StandardQueryParser#setFuzzyMinSim(float)
     * @see StandardQueryParser#setFuzzyPrefixLength(int)
     * @see StandardQueryParser#getFuzzyMinSim()
     * @see StandardQueryParser#getFuzzyPrefixLength()
     */
    final public static ConfigurationKey<FuzzyConfig> FUZZY_CONFIG = ConfigurationKey.newInstance();

    /**
     * Key used to set default {@link Resolution}.
     *
     * @see StandardQueryParser#setDateResolution(org.apache.lucene.document.DateTools.Resolution)
     * @see StandardQueryParser#getDateResolution()
     */
    final public static ConfigurationKey<DateTools.Resolution> DATE_RESOLUTION = ConfigurationKey.newInstance();

    /**
     * Key used to set the boost value in {@link FieldConfig} objects.
     *
     * @see StandardQueryParser#setFieldsBoost(Map)
     * @see StandardQueryParser#getFieldsBoost()
     */
    final public static ConfigurationKey<Float> BOOST = ConfigurationKey.newInstance();

    /**
     * Key used to set a field to its {@link NumericConfig}.
     *
     * @see StandardQueryParser#setNumericConfigMap(Map)
     * @see StandardQueryParser#getNumericConfigMap()
     */
    final public static ConfigurationKey<NumericConfig> NUMERIC_CONFIG = ConfigurationKey.newInstance();

    /**
     * Key used to set the {@link NumericConfig} in {@link FieldConfig} for numeric fields.
     *
     * @see StandardQueryParser#setNumericConfigMap(Map)
     * @see StandardQueryParser#getNumericConfigMap()
     */
    final public static ConfigurationKey<Map<String,NumericConfig>> NUMERIC_CONFIG_MAP = ConfigurationKey.newInstance();

  }

  /**
   * Boolean Operator: AND or OR
   */
  public static enum Operator {
    AND, OR;
  }

  public StandardQueryConfigHandler() {
    // Add listener that will build the FieldConfig.
    addFieldConfigListener(new FieldBoostMapFCListener(this));
    addFieldConfigListener(new FieldDateResolutionFCListener(this));
    addFieldConfigListener(new NumericFieldConfigListener(this));

    // Default Values
    set(ConfigurationKeys.ALLOW_LEADING_WILDCARD, false); // default in 2.9
    set(ConfigurationKeys.ANALYZER, null); //default value 2.4
    set(ConfigurationKeys.DEFAULT_OPERATOR, Operator.OR);
    set(ConfigurationKeys.PHRASE_SLOP, 0); //default value 2.4
    set(ConfigurationKeys.LOWERCASE_EXPANDED_TERMS, true); //default value 2.4
    set(ConfigurationKeys.ENABLE_POSITION_INCREMENTS, false); //default value 2.4
    set(ConfigurationKeys.FIELD_BOOST_MAP, new LinkedHashMap<String, Float>());
    set(ConfigurationKeys.FUZZY_CONFIG, new FuzzyConfig());
    set(ConfigurationKeys.LOCALE, Locale.getDefault());
    set(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD, MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
    set(ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP, new HashMap<CharSequence, DateTools.Resolution>());

  }

}


text:
<?php

namespace api\controllers\api;

use Yii;
use yii\rest\ActiveController;
use yii\filters\ContentNegotiator;
use api\controllers\TokenController;
use yii\web\UnauthorizedHttpException;
use yii\web\Response;
use common\models\TaskStage;
use common\models\TaskStageStatus;
use common\models\TaskStageVerdict;
use common\models\TaskStageTemplate;
use common\models\TaskStageType;
use common\models\TaskStageList;
use common\models\TaskStageOperationList;

class TaskStageController extends ActiveController
{
    public $modelClass = 'common\models\TaskStage';

    public $enableCsrfValidation = false;

    public function behaviors()
    {
        $behaviors = parent::behaviors();
        $behaviors['contentNegotiator'] = [
            'class' => ContentNegotiator::className(),
            'formats' => [
                'application/json' => Response::FORMAT_JSON
            ]

        ];
        return $behaviors;
    }

    public function init() {
        Yii::$app->response->format = Response::FORMAT_JSON;

        $token = TokenController::getTokenString(Yii::$app->request);
        // проверяем авторизацию пользователя
        if (!TokenController::isTokenValid($token)) {
            throw new UnauthorizedHttpException();
        }
    }

    public function actions() {
        $actions = parent::actions();
        unset($actions['index']);
        return $actions;
    }

    public function actionIndex() {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStage::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }

    public function actionStatus()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStageStatus::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }

    public function actionVerdict()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStageVerdict::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }

    public function actionTemplate()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStageTemplate::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }

    public function actionType()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStageType::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }

    public function actionList()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStageList::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }

    public function actionOperationList()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;

        // проверяем параметры запроса
        $req = Yii::$app->request;
        $query = TaskStageOperationList::find();

        $id = $req->getQueryParam('id');
        if ($id != NULL) {
            $query->andWhere(['_id' => $id]);
        }

        $changedAfter = $req->getQueryParam('changedAfter');
        if ($changedAfter != NULL) {
            $query->andWhere(['>=', 'changedAt', $changedAfter]);
        }

        // выбираем данные из базы
        $result = $query->all();
        return $result;
    }
}


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.college.football.trivia.Game.GameActivity">

    <item android:id="@+id/action_menu" android:title="Menu"
        android:orderInCategory="100" app:showAsAction="always" />

    <item android:id="@+id/action_quit" android:title="Quit"
        android:orderInCategory="100" app:showAsAction="always" />

</menu>